I have an attribute rounder which is rounding a figure to 2 decimal places with Round-off Direction set to nearest but when using 0.145 as an input is returning 0.14
1.145 as an input returns 1.15
Any ideas why, am I missing something?
FME 2014 SP2 (20140623 - Build 14339 - WIN32)
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.
0.145 (decimal, what you see) = 00111110 00010100 01111010 11100001 (binary, what the computer stores)
When you convert the binary representation back to decimal, however, you will see that the conversion introduced a slight "rounding error", since not all decimal numbers can be accurately represented in binary. In this case, we get 0.14499999582767487
Now, if you round 0.14499999582767487 to the nearest two decimals you will get 0.14.
So 0.14 is the correct answer to the computer, although maybe not the one the user expected :-)