My algorithm computes epsilon for single precision floating point arithmetic . It is estimated that it will be around 1.1921e-007. Here is the code:
static void Main(string[] args) {
float a = 0.000000000000000013877787807814457f;
for (; ; ) {
float temp = 1f + a;
if (temp - 1f != 0f) break;
a *= 2f;
Console.Out.WriteLine("current increment: " + a);
}
Console.Out.WriteLine("Found epsilon: " + a);
Console.ReadKey();
}
In debug mode, it gives the following reasonable conclusion (in abbreviated form):
current increment: 2,775558E-17
current increment: 5,551115E-17
...
current increment: 2,980232E-08
current increment: 5,960464E-08
current increment: 1,192093E-07
Found epsilon: 1,192093E-07
However, when switching to release mode (regardless of / Without optimization!), The code gives the following result:
current increment: 2,775558E-17
current increment: 5,551115E-17
current increment: 1,110223E-16
current increment: 2,220446E-16
Found epsilon: 2,220446E-16
which matches the value for double precision . Therefore, I suppose that some optimizations cause the calculations to be performed on double values. Of course, in this case the result is incorrect!
: X86 Release . : / . 64- WIN7, VS 2010 Ultimate, .NET 4.0.
? WOW? ? CLR , ?
: " CPU" "X64" - . , 32/64 . , .