Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Rounding value
ROUND(0.225,0.01)=0.23
If i'am going to use
Round (0.045*5,0.01)= 0.22
Why are the results different?
Hi
Read Henric's post as suggested by Ashfaq.
0.045 * 5 is calculated internally as two binary numbers, so is almost, but not quite, equal to 0.225. In this case, it appears as if, internally, its something like 0.224999999999999999..., which is being rounded down (correctly), to 0.22.
HTH
Jonathan
Did you check this
http://community.qlik.com/blogs/qlikviewdesignblog/2013/12/17/rounding-errors
=Ceil (0.045*5,0.01) will return you 0.23
Regards
ASHFAQ
Hi
Read Henric's post as suggested by Ashfaq.
0.045 * 5 is calculated internally as two binary numbers, so is almost, but not quite, equal to 0.225. In this case, it appears as if, internally, its something like 0.224999999999999999..., which is being rounded down (correctly), to 0.22.
HTH
Jonathan
Further to other answers, have you tried double-rounding ...
=round(round(0.045*5,'0.001'),'0.01')
... it works on that example, and a quick check for 1000 numbers in a table chart all worked correctly, however I would fully test it and following Henric's advice is probably the best advice.
flipside