LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

rounding off to nearest decimal point

Solved!
Go to solution

@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
CLD
(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.
0 Kudos
Message 11 of 18
(1,701 Views)

Jeff,

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

X would be number i want to round off to?

 

0 Kudos
Message 12 of 18
(1,689 Views)

@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,679 Views)

Untitled.png

 

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?

 

0 Kudos
Message 14 of 18
(1,678 Views)

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.

0 Kudos
Message 15 of 18
(1,675 Views)

nevermind..its my fault

the rounding methods are good!!!!!

 

0 Kudos
Message 16 of 18
(1,657 Views)

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
CLD
(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.
0 Kudos
Message 17 of 18
(1,638 Views)

smart. Thanks

0 Kudos
Message 18 of 18
(1,140 Views)