math - Strange subtraction in c# -


i doing c# program.. must simple mathematical operation.

72057594037927936.0 - 255.0 = ..... 

both numbers double... obtain

72057594037927680.0  

instead of

72057594037927681.0  

can explain me please how possible?

thanx

the exact result of subtraction,

72057594037927681 = 0xffffffffffff01 

needs 56 bits of precision, double has 53, hence result rounded nearest representable number.


Comments

Popular posts from this blog

javascript - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -