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 - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -