08-03-2015 05:38 PM
I really have lost my brain cells to work out suitable formula to achieve this!
I need at all cost be able to round down on the result of an equation. Obviously Labview compliant with IEEE would always round up at/above .5. Is there a way to achieve what I am after?
Many thanks
K Waris
Solved! Go to Solution.
08-03-2015 05:46 PM
Does Round Toward -Infinity do the job?
08-03-2015 06:57 PM
08-03-2015 08:53 PM
mikeporter wrote:
There is no such thing as exactly .5.
Sorry, but that's not correct. Dividing any integer by 2 gives a floating representation of that integer times 2^(-1).. To see the "exact" representation of, say, 9/2, typecast it to an array of U8 (bytes), and you'll see 64 18 0 0, exponent and mantissa.
BS
08-03-2015 11:36 PM
@k-waris wrote:
I really have lost my brain cells to work out suitable formula to achieve this!
I need at all cost be able to round down on the result of an equation. Obviously Labview compliant with IEEE would always round up at/above .5. Is there a way to achieve what I am after?
Many thanks
K Waris
Actually, the statement in bold is untrue. IEEE standard for "round to nearest" is "round to even integer", which is the rule that LabVIEW follows.
http://zone.ni.com/reference/en-XX/help/371361H-01/glang/round_to_nearest/
08-03-2015 11:48 PM
That solved my problem. Thank you
08-04-2015 12:18 AM
Note that this method might not work like you want for negative numbers. If you want -3.2 to round to -3, you will need to check the sign and if negative round to +inf.