Re: cpow
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 11 Sep 2025 01:17:27 UTC
On 9/10/25 10:07, Steve Kargl wrote: > On Wed, Sep 10, 2025 at 03:16:51PM +0000, Vincenzo Innocente wrote: >> >>> On Sep 10, 2025, at 5:13 PM, Steve Kargl <kargls@comcast.net> wrote: >>> >>> On 9/9/25 23:45, Paul Zimmermann wrote: >>>> Hi, >>>> we noticed that in FreeBSD 14.3, cpow(x,y) for x = y = (+0,+0) yields (+0,+0), >>>> whereas GNU MPC yields (1,+0), which matches the real case, where IEEE 754 >>>> requires x^+0 = 1 when x is not a signaling NaN. >>>> Is there any reason for the choice (+0,+0)? >>> >>> It seems that FreeBSD's cpow was imported from OpenBSD. >>> Looking at the Copyright, it was written by Stephen L. >>> Moshier, which means the code ultimately comes from >>> CEPHES. >> WOW! >> suspect last update was in the `90s >> > > If one looks at FreeBSD's pow(3) manual page, there > is a rather long NOTES section about x**0 = 1 forall > x. It would seem logical to update cpow() to have > the same semantics. I won't do the change as I try > to avoid looking at CEPHES derived codes in FreeBSD > libm. > Well, I couldn't help myself. There's a patch attached to https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=289447 -- steve