C# - Inconsistent math operation result on 32-bit and 64-bit
Posted
by david.healed
on Stack Overflow
See other posts from Stack Overflow
or by david.healed
Published on 2010-03-17T10:09:19Z
Indexed on
2010/03/17
10:11 UTC
Read the original article
Hit count: 288
c#
Consider the following code:
double v1 = double.MaxValue;
double r = Math.Sqrt(v1 * v1);
r = double.MaxValue on 32-bit machine r = Infinity on 64-bit machine
We develop on 32-bit machine and thus unaware of the problem until notified by customer. Why such inconsistency happens? How to prevent this from happening?
© Stack Overflow or respective owner