# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Re: rounding off to nearest decimal point

@RavensFan wrote:

One other comment about rounding.  LabVIEW uses banker's rounding which takes any value that is dead on 0.5 and will round it to the nearest even integer.  Generally in school we would have learned that 0.5 would be rounded up.

So nearest even integer may or may not be what you are looking for.

Don't forget to mention that banker's rounding is the industry standard and not just some arbitrary NI decision.  😉

Bill

(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 11 of 18
(1,745 Views)

## Re: rounding off to nearest decimal point

Jeff,

what is the X value and what is the d value?

X would be number i want to round off to?

Message 12 of 18
(1,733 Views)

## Re: rounding off to nearest decimal point

@super_saiyans wrote:

Jeff,

what is the X value and what is the d value?

X would be number i want to round off to?

It you read the thread I linked you would see it is a LabVIEW implementation to duplicate the ROUND(X,d) function in Excel

# ROUND function

This article describes the formula syntax and usage of the ROUND function in Microsoft Excel.

## Description

The ROUND function rounds a number to a specified number of digits. For example, if cell A1 contains 23.7825, and you want to round that value to two decimal places, you can use the following formula:

`=ROUND(A1, 2)`

The result of this function is 23.78.

## Syntax

`ROUND(number, num_digits)`

The ROUND function syntax has the following arguments:

• number    Required. The number that you want to round.
• num_digits    Required. The number of digits to which you want to round the number argument.

"Should be" isn't "Is" -Jay
Message 13 of 18
(1,723 Views)

## Re: rounding off to nearest decimal point

i am having problem with this rounding off thing because i only want to look at certain points in my array

in this roundoff method..i have to select the whole array?

can you guys look at my code and sugguest a cleaner methold?

Message 14 of 18
(1,722 Views)

## Re: rounding off to nearest decimal point

X is the number you want to round.

d is the power of 10 you want to round to.  So to round to the nearest 0.1, but in -1.  Round to the nearest 10, but in +1.

Message 15 of 18
(1,719 Views)

## Re: rounding off to nearest decimal point

nevermind..its my fault

the rounding methods are good!!!!!

Message 16 of 18
(1,701 Views)

## Re: rounding off to nearest decimal point

I think you still should use Lynn's method that relies on the smallest difference of absolute values.  This way is TOTALLY unambiguous and doesn't rely on someone's "best guess" which is what rounding really is.

Bill

(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 17 of 18
(1,682 Views)

smart. Thanks

Message 18 of 18
(1,184 Views)