Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • 7
    That's not the question. Commented Aug 9, 2012 at 8:13
  • 20
    Accidentally, in all those langauges 1/6 results in .166666667, or 0.16666666666667 or something similar. I chose the ((1/6)*6)==1 variant to get rid of those little differences, but it looks like I overestimated the math skills of some people. Commented Aug 9, 2012 at 8:49
  • 1
    @RocMartí yes, it really is... Commented Aug 9, 2012 at 15:11
  • 1
    I would be surprised to see (1.0/6.0)*6 being exactly equal to 1! The rounding of the result of (1.0/6.0) will lead to a small difference. (Although there will be a few languages that default to infinite precision) Commented Aug 9, 2012 at 17:49
  • 2
    @Sjoerd: It's not too surprosing that it's exact, actually. Consider in decimal the scenario of 1/11 * 11 with all values accurate to five significant figures. The value of 1/11 is 9.0909 * 10^-2. Multiply by 11 and one would get 99.9999 * 10/-2 before rounding. Round to five significant figures and the result will be 1.0000 * 10^0. Note that the key is that the mantissa of 1/6 is "...0101010101...". If the last bit of a representation is a "1", multiplying it by six and rounding will yield 1. If the last bit were zero, it would not. Commented Aug 9, 2012 at 18:46