octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

test failure for mappers.cc


From: John W. Eaton
Subject: test failure for mappers.cc
Date: Tue, 9 Nov 2010 12:42:42 -0500

On  9-Nov-2010, Ben Abbott wrote:

| I'm seeing the failure below with tip 11212
| 
|       octave:2> test mappers.cc
|         ***** assert(arg (single(-1)), single(pi));
|       !!!!! test failed
|       assert (arg (single (-1)),single (pi)) expected
|        3.1416
|       but got
|        3.1416
|       values do not match
| 
| The difference between the actual and expected is ...
| 
|       arg (single (-1)) - single (pi)
|       ans = -2.3842e-07
| 
| I consistently get the *exactly* same difference.
| 
|       for n = 1:10
|         d(n) = arg (single (-1)) - single (pi);
|       endfor
|       std (d)
|       ans = 0
| 
| I assume this came about after your mapper changesets. Do you
| (anyone?) see this as well?

I'm not seeing the difference, but it is probably happening because I
changed the float version of arg from

  float arg (float x) { return atan2 (0.0, x); }

to

  float arg (float x) { return atan2f (0.0f, x); }

It looks like your result is now off by about "2*eps ('single')".
Does adding that as a tolerance avoid the warning?  Even if it does,
should we make the change?  Shouldn't the atan2f function in your math
library recognize -1 as a special case and return precisely the single
precision value for pi?  Should we be tweaking test tolerances to hide
what might be considered bugs in system libraries?

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]