The nearest 64-bit IEEE 754 floating-point binary number to 0.555 is 0.55500000000000004884981308350688777863979339599609375. This is very slightly closer to 0.56 than to 0.55.
The nearest 64-bit IEEE 754 floating-point binary number to 5.555 is 5.55499999999999971578290569595992565155029296875. This is very slightly closer to 5.55 than to 5.56.
In each case, the output is the nearest decimal number with 2 decimal places to the actual value of the extension number.
As Pascal Quoc says in a comment, 0.555 is located in binade [0.5 ... 1), in which representable floating-point numbers are separated by 2 -53 . On the contrary, 5.555 is in binad [4 ... 8), in which representable floating-point numbers are divided by 2 -50 . That is why the fractional parts differ for 0.555 and 5.555.
source share