Implement C23 pown [committed]

Joseph Myers josmyers@redhat.com
Wed Jun 4 20:19:48 GMT 2025


On Wed, 4 Jun 2025, Segher Boessenkool wrote:

> On Wed, Jun 04, 2025 at 03:50:53PM +0000, Joseph Myers wrote:
> > On Tue, 3 Jun 2025, Segher Boessenkool wrote:
> > 
> > > The commit message clearly says this implementation isd correct for
> > > IEEE float only.  And indeed it is not for double-double, which is very
> > > much not IEEE.
> > > 
> > > Maybe these tests should require IEEE float?  The implementation does,
> > > after all!
> > 
> > I don't know how you're reading the commit message as saying this is only 
> > correct for IEEE formats.
> 
> "The underlying implementation uses __ieee754_pow functions".  Yeah that
> does not literallky say that it only works correctly for IEEE float, but
> it does suggest that, and all evidence we have point in the same
> direction.

__ieee754_* are simply the internal functions, typically not setting 
errno, wrapped by errno-setting wrappers.  This has nothing to do with 
whether the floating-point format in question has IEEE arithmetic 
semantics.

> > and if there's a problem, either it's a bug in powl, or a bug in libgcc 
> > converting y from long long to long double (which should be exact) outside 
> > round-to-nearest mode, but not a bug in this implementation.
> 
> pown (-inf, MAXINT) returns +inf, and some things that should be finite
> return a NaN, and probably some other interesting infelicities as well.
> If such things do work correctly for IEEE float, that makes it seem this
> code is really only written to be correct for IEEEE (which is hard
> enough of course!)

The thing that is incorrect (in non-default rounding modes) is either 
libgcc (conversions from long long to long double) or the powl 
implementation, not pown.

-- 
Joseph S. Myers
josmyers@redhat.com



More information about the Libc-alpha mailing list