https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126305

--- Comment #12 from Steve Kargl <kargl at gcc dot gnu.org> ---
(In reply to dave.anglin from comment #11)
> On 2026-07-17 5:21 p.m., kargl at gcc dot gnu.org wrote:
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126305
> > 
> > --- Comment #10 from Steve Kargl <kargl at gcc dot gnu.org> ---
> > (In reply to dave.anglin from comment #9)
> >> On 2026-07-17 3:14 p.m., kargl at gcc dot gnu.org wrote:
> > 
> >>> Can gfortran be configured on HPUX without REAL(16)
> >>> (or REAL(17)) support.  Perhaps, that should be the
> >>> default?
> >>
> >> I don't think that's currently possible.
> > 
> > That's unfortunate.  Fortran only requires REAL
> > and DOUBLE PRECISION.  REAL(16) is not necessary
> > for a conforming compiler.
> > 
> > Seems HPUX is a mess with its long double support.
> > 
> > The easiest way forward is to punt with gross hacks
> > to c99_functions.c such as
> > 
> > #if defined(HAVE_ATAN) && !defined(HAVE_ATANL)
> > #define HAVE_ATANL 1
> > long double atanl(long double);
> > 
> > long double
> > atanl(long double x)
> > {
> >    return((long double)atan((double)x));
> > }
> > #endif
> > 
> > To do this right, you'll need to consider minimax polynomials
> > and/or rational approximations and whether the domain needs 
> > to be split into subdomains.
> 
> That's certainly doable.  But the default is to build and link with
> libquadmath.
> strtof128 isn't found but it's in libquadmath.  Think there's some config
> issues
> __float128 support that needs investigation.

1. The patch is comment #5 is wrong.  sind(0, cosd(), ... are
functions where the argument has an unit of degree.  These functions
are part of Fortran 2023, and have nothing to do with decimal
arithmetic.

2. Your comment #3 shows a program from Harald that uses atand().

   program test
     real(16) :: x = 1
     print *, atand(x)
   end

and your reply shows

   test.f90.006t.original:      D.1079 = __builtin_atanl (x)*
   5.72957795130823208767981548141051722660080813268252612005e+1;

which is the correct result in that atanl() has units of radian
and the constant multiplier converts that to degree.  So, you're
chasing how does gcc translate __builtin_atanl().  On HPUX,
are long double math functions magically translated into libquadmath
references?  That is, __builtin_atanl(x) somehow ends up as
atanq((__float128)x)?  

Does

  #include <math.h>

  long double
  foo(long double x)
  {
     long double y;
     y = atanl(x);
     return (y);
  }

generate __builtin_atanl(x)  and if you compile to assembly
is there a reference to atanl or atanq?

Reply via email to