Re: complex.h functions and errno

2017-11-08 Thread Geoff Clare
Hal Finkel wrote, on 07 Nov 2017: > > [...] However, because setting > errno is not required by C for functions in complex.h, when POSIX says "No > errors are defined." that constrains the choice (POSIX is constraining the > implementation choice allowed by C as it does in many other cases). As a

Re: complex.h functions and errno

2017-11-08 Thread Bruce Evans
On Tue, 7 Nov 2017, Hal Finkel wrote: My reading of the combined C and POSIX specifications leads me to believe that functions in complex.h don't set errno on POSIX systems. This came up recently during a code review for the Clang compiler [1]. It has been pointed out that, under glibc, cabs()

Re: complex.h functions and errno

2017-11-08 Thread Shware Systems
  When POSIX says "No errors are defined" for a C standard header, that defers to the C standard doesn't require errno be set to specific values, but a POSIX implementation can still elect to set errno due to the 7.3.2 clause. Places where POSIX overrides the C standard get the CX or XSI shading, u

Re: complex.h functions and errno

2017-11-08 Thread Joseph Myers
On Wed, 8 Nov 2017, Bruce Evans wrote: > This is without Annex F (IEEE754/IOCmumble bindings). With Annex F, > cabs() is specified in terms of hypot() and atan2(), so math_errhandling > accidentally applies to it (via the hypot() part). However, overflow is I think that specification is only fo

Re: complex.h functions and errno

2017-11-08 Thread Don Cragun
Hi Hal, I agree with what others have already said in this thread, but I think there is a more basic issue at play here. In the example you provided: cabs(1.7e308+I*1.7e308); the multiplication is not being performed by the function. It is performed by the compiler evaluating arguments