real128 cmplx ATAN, ATANH - quality of implementation?

Steve Kargl sgk@troutmask.apl.washington.edu
Fri Feb 3 15:35:00 GMT 2017


On Fri, Feb 03, 2017 at 03:44:14PM +0100, FX wrote:
> > Behaviour of complex intrinsics such as ATAN or ATANH
> > at branch points is not defined by the standard (I think).
> > However, for complex of kind real32 and real64
> > gfortran 6 and 7 give very helpful values at branch points.
> > Not so for real128.
> 
> The relevant source file is from libquadmath, online at
> https://github.com/gcc-mirror/gcc/blob/master/libquadmath/math/catanhq.c
> Suggestions to improve it are very welcome!
> 

No, it is not.  Anton uses x86_64-*-free.  REAL128 maps to REAL(10)
aka long double complex.  Note, that the standard says that REAL128
corresponds with a type that occupies 128 bits, which REAL(10) does
on FreeBSD (long double is padded for 16-byte alignment).

% cat a.f90
program foo
   use iso_fortran_env
   print '(3(I0,1x))', kind(1._REAL32), kind(1._REAL64), kind(1._REAL128)
end program foo
% gfc7 -o z a.f90
% ./z
4 8 10

Maybe this should be considered a bug in gfortran as the above program
shows that REAL128 mapped to REAL(16) (aka libquadmath) on i686-*-freebsd.

-- 
Steve
20161221 https://www.youtube.com/watch?v=IbCHE-hONow



More information about the Fortran mailing list