octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #45507] acos returns different results on big


From: Lachlan Andrew
Subject: [Octave-bug-tracker] [bug #45507] acos returns different results on big input values on gcc 4.8
Date: Thu, 23 Jun 2016 00:23:28 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

Update of bug #45507 (project octave):

             Open/Closed:                  Closed => Open                   
                 Release:                   4.0.0 => dev                    
                 Summary: acos returns different results on big input values
=> acos returns different results on big input values on gcc 4.8

    _______________________________________________________

Follow-up Comment #33:

Mike, sorry for the slow reply.

Yes, I still get bad results with the patch applied.

Configure says "yes" for std::acos in <complex> (and all the others).

I'm reopening this, because now there are three new failing test on my system
(in addition to the two failures from xpow and realpow).  GCC 4.8 isn't really
old; as Julien Bect pointed out, even gcc 4.7 is used in ubuntu 12.04, which
is not yet end-of-life.

One option would be to have an #if defined () to use std::acos on systems
where it works, and the slow explicit code where it doesn't, with a FIXME
comment to say it should be removed once 4.8 is out of circulation.


 rval = 0;
 ival = 1.31695789692481635;
 obs = acos ([2, 2-i*eps, 2+i*eps]);
 exp = [rval + ival*i, rval + ival*i, rval - ival*i];
 assert (obs, exp, 2*eps);
 rval = pi;
 obs = acos ([-2, -2-i*eps, -2+i*eps]);
 exp = [rval - ival*i, rval + ival*i, rval - ival*i];
 assert (obs, exp, 2*eps);
 assert (acos ([2 0]),  [ival*i, pi/2], 2*eps);
 assert (acos ([2 0i]), [ival*i, pi/2], 2*eps);
 x = [1, -1, i, -i] .* 1e150;
 v = [0, pi, pi/2, pi/2];
 assert (real (acos (x)), v);
!!!!! test failed
ASSERT errors for:  assert (real (acos (x)),v)

  Location  |  Observed  |  Expected  |  Reason
    (1)         1.5708         0         Abs err 1.5708 exceeds tol 0
    (2)         1.5708       3.1416      Abs err 1.5708 exceeds tol 0
shared variables 
  scalar structure containing the fields:

    rt2 =  1.4142
    rt3 =  1.7321
***** test
 rval = pi/2;
 ival = 1.31695789692481635;
 obs = asin ([2, 2-i*eps, 2+i*eps]);
 exp = [rval - ival*i, rval - ival*i, rval + ival*i];
 assert (obs, exp, 2*eps);
 obs = asin ([-2, -2-i*eps, -2+i*eps]);
 exp = [-rval + ival*i, -rval - ival*i, -rval + ival*i];
 assert (obs, exp, 2*eps);
 assert (asin ([2 0]),  [rval - ival*i, 0], 2*eps);
 assert (asin ([2 0i]), [rval - ival*i, 0], 2*eps);
 x = [1, -1, i, -i] .* 1e150;
 v = [pi/2, -pi/2, 0, -0];
 assert (real (asin (x)), v);
!!!!! test failed
ASSERT errors for:  assert (real (asin (x)),v)

  Location  |  Observed  |  Expected  |  Reason
    (1)           0          1.5708      Abs err 1.5708 exceeds tol 0
    (2)           -0        -1.5708      Abs err 1.5708 exceeds tol 0
shared variables 
  scalar structure containing the fields:

    rt2 =  1.4142
    rt3 =  1.7321
***** test
 v = single ([0, pi/2*i, 0, -pi/2*i]);
 x = single ([0, i, 0, -i]);
 assert (asinh (x), v,  sqrt (eps ("single")));
 x = [1, -1, i, -i] .* 1e150;
 v = [0, 0, pi/2, -pi/2];
 assert (imag (asinh (x)), v);
!!!!! test failed
ASSERT errors for:  assert (imag (asinh (x)),v)

  Location  |  Observed  |  Expected  |  Reason
    (4)           -0        -1.5708      Abs err 1.5708 exceeds tol 0
shared variables 
  scalar structure containing the fields:

    rt2 =  1.4142
    rt3 =  1.7321


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?45507>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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