[Top][All Lists]

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

[Octave-bug-tracker] [bug #44310] log and functions which use log return

From: Michael Godfrey
Subject: [Octave-bug-tracker] [bug #44310] log and functions which use log return incorrect result
Date: Thu, 19 Feb 2015 14:28:13 +0000
User-agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0


                 Summary:  log and functions which use log return incorrect
                 Project: GNU Octave
            Submitted by: godfrey
            Submitted on: Thu 19 Feb 2015 02:28:11 PM GMT
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Regression
                  Status: None
             Assigned to: None
         Originator Name: godfrey
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: GNU/Linux




octave:1> atanh(0 -10i)
ans =  4.6717e-17 - 1.4711e+00i

This occurs on Fedora systems, and maybe others.
The library: /usr/lib64/libm-2.20.so contains the log function. Until fairly
recently this seemed to work correctly. But in  libm-2.20.so the following
happens using:

#include <stdio.h>
#include <complex.h>
#include <math.h>

int main(void)
    float complex z = catanh(0-10i);
    printf("catanh(0-10i) = %e%+ei\n", creal(z), cimag(z));
    double complex x  = (0-10i);
    double complex xm = (1.0 - x);
    double complex xp = (1.0 + x);
    double complex an = clog(xp/xm)/2.0;
    long double complex anl = clogl(xp/xm)/2.0;
    printf("catanh (an)  =  %e%+ei\n", creal(an), cimag(an));
    printf("catanh (anl) =  %e%+ei\n", creal(an), cimag(an));
address@hidden atanh]$ gcc -lm -o testt atanh_t.cc
address@hidden atanh]$ testt
catanh(0-10i) = 0.000000e+00-1.471128e+00i
catanh (an)  =  4.671731e-17-1.471128e+00i
catanh (anl) =  4.671731e-17-1.471128e+00i

Note that both clog and clogl fail.

Under libm-2.13.so the result for clog was:
catanh(0-10i) = 0.000000e+00-1.471128e+00i
catanh =  0.000000e+00-1.471128e+00i

While  4.671731e-17 is a small number (less than a usual eps) it
is not correct. This result causes the current Octave system to produce
incorrect results as it uses clog in its math function library.

This first showed up when using the current Fedora 21 x86_64 system.

I have attempted to report this to 
 sourceware.org/bugzilla but I am not sure that the report
got through. In any case the error causes errors in Octave.


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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