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
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 :-)
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.