Floating points are usually stored as x*(2^y). Many numbers that are finitely expressible in decimal, lie exactly between two binary numbers, such that adding more binary digits will not reach their exact value. Hence any one of the values which d was set to, may not have been represented exactly, but with a small error. This means that the value was probably just below 13.5 but when printing, the number of decimal places expected was too small for it to show this so it rounded. I think.