Re: [eigen] Precision difference on 32-bit and 64-bit linux using float? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
The size of the rounding error is not well defined since it
depends on so many details.
- the internal floating point unit (FPU) uses 80 bits (instead of 64).
If the compiler loads a temporary result off the FPU to store it
in memory, one looses precision (even if stored in a 64 bit word)
- a 64 bit CPU has much more 64 bit registers, so the compiler
can hold more temporary results in 64 bit precision
while on a 32 bit CPU it might have to push those intermediate
results to memory (only 32 bit in your case)
- the optimization part of the compiler schedules the instructions
to keep as many units on the CPU busy as possible.
Any change in the sequence of floating point operations
might change the result.
So, in general it is very hard to find reasonable 'robust' bounds.
Helmut.
On 26 Feb, Atle Rudshaug wrote:
> Hi!
>
> I have a unit-test where I check a function, using a lot of Eigen math,
> against some hard coded results for equality. However, the precision on
> 32-bit and 64-bit platforms differ, which causes the test to fail on our
> 32-bit nightly test. I am using floats, not doubles. Is this a known
> "problem"?
>
> Here are the results from the 32-bit run (the 64-bit run gets the
> correct answers):
> Expected: -8.333e-12 Actual: -8.34754e-12
> Expected: -1.111e-06 Actual: -1.11111e-06
> Expected: -1.389e-12 Actual: -1.39126e-12
> Expected: -1.389e-12 Actual: -1.39126e-12
> Expected: -5.556e-07 Actual: -5.55554e-07
> Expected: -5.556e-07 Actual: -5.55554e-07
> Expected: -5.556e-07 Actual: -5.55554e-07
> Expected: -5.556e-07 Actual: -5.55554e-07
> Expected: -6.944e-13 Actual: -6.95629e-13
> Expected: -6.944e-13 Actual: -6.95629e-13
> Expected: 1.111e-06 Actual: 1.11111e-06
> Expected: -1.389e-12 Actual: -1.39126e-12
> Expected: -1.389e-12 Actual: -1.39126e-12
> Expected: -1.389e-12 Actual: -1.39126e-12
> Expected: 5.556e-07 Actual: 5.55557e-07
> Expected: 5.556e-07 Actual: 5.55557e-07
> Expected: 5.556e-07 Actual: 5.55557e-07
> Expected: 5.556e-07 Actual: 5.55557e-07
> Expected: -6.944e-13 Actual: -6.95629e-13
> Expected: -6.944e-13 Actual: -6.95629e-13
>
> - Atle
>
--
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany