Last time I challenged you to find a value which does not round correctly using the algorithm
Math.Floor(value + 0.5)
The value which does not round correctly is the double 0.49999999999999994
, which is the largest double that is smaller than 0.5
. With the given algorithm this rounds up to 1.0
, even though clearly 0.49999999999999994
is less than one half, and therefore should round down.
What the heck is going on here?