Re: [eigen] Failing basicstuff_3 test |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] Failing basicstuff_3 test*From*: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>*Date*: Wed, 9 Jun 2010 08:18:14 -0400*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=clrlQPRJvrFyNwsUBKJD0Vn+xijMhwr8ozQl3YLICf4=; b=NHCJ4sJJ50/M7htRW4nlgZAViiyxTq8SxVkDSSNU7gmYp2M9azRXzHlhs208jFNryY 41hXLC4De7WBCuwn2rTn+esrh6MplIGBbldo1Xm00h4giQXtqT2rCEuSWRwU8sC0734R ISxRawr9Vu0cuNiMDtCvF07VwwilyHqKv0R54=*Domainkey-signature*: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=AohKugy7BU5s8FY06XQOM56oLJDFYa6rjcKCoSzL0qI5NyXe3188IShtCMognkFKkX BsZYGeogUBc7meS1HV33U3OMKepKw3CmIJdZljL/Wi1AQqUH7JVEgEead3YhXNMTSxlu sf4ig5Irczw8Z6+3TAqHlw8iQlZXR+gU+NslY=

2010/6/9 Jitse Niesen <jitse@xxxxxxxxxxxxxxxxx>: > Hello, > > The basicstuff_3 test is failing on my computer (32-bits, gcc 4.1 and 4.3, > both with and without SSE). However, it works fine on Gael's computer. > > The offending code is (with Scalar = complex<float> ): > > Scalar s1 = ei_random<Scalar>(), > s2 = ei_random<Scalar>(); > > VERIFY(ei_real(s1)==ei_real_ref(s1)); > VERIFY(ei_imag(s1)==ei_imag_ref(s1)); > ei_real_ref(s1) = ei_real(s2); > ei_imag_ref(s1) = ei_imag(s2); > VERIFY(s1==s2); > > The last VERIFY fails. The bug is very finicky; changing almost anything and > it goes fine. This is the best I could simplify it too: > > complex<float> s1 = complex<float>(1.5,1.5); > complex<float> s2 = ei_random<complex<float> >(); > > VERIFY(jn_imag(s1)==jn_imag_ref(s1)); > jn_real_ref(s1) = jn_real(s2); > jn_imag_ref(s1) = jn_imag(s2); > if (s1!=s2) { > std::cerr << s1-s2 << std::endl; > std::cerr << "Test failed!" << std::endl; > } > > Leaving out either the call to ei_random or the VERIFY and the bug goes > away. When compiled with -O1 or higher, the test fails with s1-s2 = > (-5.587935448e-09,2.328306437e-08); This is with float? So the relative error is less than machine epsilon? Then we shouldn't care about it, just do VERIFY_IS_APPROX here. It's fine to try checking == in operations such as this one that seem to be plausibly exact, but when in practice they aren't, there's no point insisting :) Benoit when compiled without optimization the > test passes. What's interesting is that s1-s2 is so small. In fact, if I > print s2, I find that s2 = (-0.2112341523,0.6803754568), which means that > the difference is smaller than the distance between two single-precision > floating point numbers. > > I guess that means that the bug has to do with the extended precision of the > FPU. So, what to do now? > > Is there any way to check my guess? I guess definite proof comes from the > generated assemble. I looked at the assembly (not something I know well), > and it is full of Fxxx instructions, so it does use the FPU. However, it is > rather more complicated that I'd have expected (there are FMUL in there), so > it would take a lot of time for me to understand it. Any shortcuts I could > take? Is it possible to force the FPU not to use extended precision? > > If the failing test is indeed caused by the extended precision, then it's > not a bug and we should rewrite the test. Correct? > > > Jitse > > >

**References**:**[eigen] Failing basicstuff_3 test***From:*Jitse Niesen

**Messages sorted by:**[ date | thread ]- Prev by Date:
**[eigen] Failing basicstuff_3 test** - Next by Date:
**[eigen] AnyMatrixBase** - Previous by thread:
**[eigen] Failing basicstuff_3 test** - Next by thread:
**[eigen] AnyMatrixBase**

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