Re: [eigen] Precision difference on 32-bit and 64-bit linux using float? |

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] Precision difference on 32-bit and 64-bit linux using float?*From*: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>*Date*: Fri, 26 Feb 2010 11:24:42 +0100*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type; bh=qlLRSKCoVwS7nbTbEOg6KEwKu/3HsDacqz5071duXQ0=; b=hVCBABLM7fqUB7ClgYS2vGWZgkRHm7lf7NhPP8XmtNX2v+FVscxhugDbIgWiqjXZWq TTepa49EGQyhALahHaW7wpXqSLO/jUEKXg0qONywAWugy1DEK7owWvspdwgfgcAvL7Im fX56mq966RlSWtb7kMLV47KrbDM0LKCNdvqoY=*Domainkey-signature*: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=oMm2dHrm1RpA9QX2dWtMFPpL3AZB3lfKGkHOBF8FcI8D8h8D1fPHr3KK0Kl57feFXI gm52fnxknFSf1fzet4Uuy0S+egYT/Ufb/jmZ2FSf8BkvW1tYApbQAnTOITwJkegtoGkJ 9GfFXPlCMxdbMFvLYRSoqTkHpYuab+Ew9iVBo=

First you should not test for equality but do some fuzzy comparisons, you know a*b != b*a etc.

Second, are you comparing 64bits against 32bits without SEE ? or 32bits with SSE ? In the former case, it is perfectly normal to get significant differences because the FPU does all the computations using 80bits of precision, even for floats. So if you are not enabling SSE on the 32bits platform, I'd say that the 32bits results are more correct than the 64bits ones (on 64bits SSE is enabled by default).

If you think you still have troubles, please be more specific about the kind of operations your are doing.

gael

On Fri, Feb 26, 2010 at 10:47 AM, Atle Rudshaug <atle@xxxxxxxxxxxxxxxxxx> 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

**Follow-Ups**:**Re: [eigen] Precision difference on 32-bit and 64-bit linux using float?***From:*Benoit Jacob

**References**:**[eigen] Precision difference on 32-bit and 64-bit linux using float?***From:*Atle Rudshaug

**Messages sorted by:**[ date | thread ]- Prev by Date:
**[eigen] Precision difference on 32-bit and 64-bit linux using float?** - Next by Date:
**Re: [eigen] a branch for SMP (openmp) experimentations** - Previous by thread:
**[eigen] Precision difference on 32-bit and 64-bit linux using float?** - Next by thread:
**Re: [eigen] Precision difference on 32-bit and 64-bit linux using float?**

Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |