Bug 289447 - [libm] Fix cpow[fl]() to be consistent with pow[fl]() and glibc
Summary: [libm] Fix cpow[fl]() to be consistent with pow[fl]() and glibc
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-numerics (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-09-10 21:24 UTC by Steve Kargl
Modified: 2025-09-19 01:01 UTC (History)
3 users (show)

See Also:


Attachments
path to libm sources (5.62 KB, patch)
2025-09-10 21:24 UTC, Steve Kargl
no flags Details | Diff
Corrected patch (1.33 KB, patch)
2025-09-11 15:55 UTC, Steve Kargl
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Kargl freebsd_committer freebsd_triage 2025-09-10 21:24:58 UTC
Created attachment 263688 [details]
path to libm sources

The attached patch addresses an issue raised in

https://lists.freebsd.org/archives/freebsd-hackers/2025-September/005052.html

For pow(0.,0.), the returned value is 1.  For cpow(z,z) with z = CMPLX(0,0),
the returned value is 0.   See the note in pow(3) man page.

The patch brings FreeBSD's libm into agreement with glibc.
Comment 1 Konstantin Belousov freebsd_committer freebsd_triage 2025-09-11 09:41:57 UTC
The patch removes s_remquof.S from sources on amd64 (it seems).  Was it
intended?  If yes, does the file itself should be kept in sources?
Comment 2 Steve Kargl freebsd_committer freebsd_triage 2025-09-11 15:47:44 UTC
(In reply to Konstantin Belousov from comment #1)
No.  It was no intended.  I attached the wrong
patch.  I attached the correct one shortly.
Comment 3 Steve Kargl freebsd_committer freebsd_triage 2025-09-11 15:55:12 UTC
Created attachment 263718 [details]
Corrected patch

Here's the patch that only touches s_cpow[fl].c
Comment 4 commit-hook freebsd_committer freebsd_triage 2025-09-12 02:37:40 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=8b41ba845c7e10b5f241a1f944fe9a8e19ad75a9

commit 8b41ba845c7e10b5f241a1f944fe9a8e19ad75a9
Author:     Steve Kargl <kargl@FreeBSD.org>
AuthorDate: 2025-09-11 16:38:17 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-09-12 02:36:27 +0000

    lib/msun: cpow{,f,l}(CMLX(0.0, 0.0)) should return 1.0

    PR:     289447
    MFC after:      1 week

 lib/msun/src/s_cpow.c  | 5 ++++-
 lib/msun/src/s_cpowf.c | 5 ++++-
 lib/msun/src/s_cpowl.c | 5 ++++-
 3 files changed, 12 insertions(+), 3 deletions(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2025-09-19 01:00:26 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=92801ed02423bd8f7237223168eaa194b28d147f

commit 92801ed02423bd8f7237223168eaa194b28d147f
Author:     Steve Kargl <kargl@FreeBSD.org>
AuthorDate: 2025-09-11 16:38:17 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-09-19 00:58:53 +0000

    lib/msun: cpow{,f,l}(CMLX(0.0, 0.0)) should return 1.0

    PR:     289447

    (cherry picked from commit 8b41ba845c7e10b5f241a1f944fe9a8e19ad75a9)

 lib/msun/src/s_cpow.c  | 5 ++++-
 lib/msun/src/s_cpowf.c | 5 ++++-
 lib/msun/src/s_cpowl.c | 5 ++++-
 3 files changed, 12 insertions(+), 3 deletions(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2025-09-19 01:01:28 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=6f59cb79e84a86d7b864d709652ec57b6928a6cf

commit 6f59cb79e84a86d7b864d709652ec57b6928a6cf
Author:     Steve Kargl <kargl@FreeBSD.org>
AuthorDate: 2025-09-11 16:38:17 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-09-19 00:59:55 +0000

    lib/msun: cpow{,f,l}(CMLX(0.0, 0.0)) should return 1.0

    PR:     289447

    (cherry picked from commit 8b41ba845c7e10b5f241a1f944fe9a8e19ad75a9)

 lib/msun/src/s_cpow.c  | 5 ++++-
 lib/msun/src/s_cpowf.c | 5 ++++-
 lib/msun/src/s_cpowl.c | 5 ++++-
 3 files changed, 12 insertions(+), 3 deletions(-)