Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Apr 2026 17:36:01 +0000
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 855507463e0d - stable/15 - fmax.3: Add caveat for going beyond C std requirements
Message-ID:  <69dd2981.33c20.18a98019@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=855507463e0d3903d31aa7c084efbf4f819b5d63

commit 855507463e0d3903d31aa7c084efbf4f819b5d63
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2026-04-02 21:59:42 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-04-13 17:35:35 +0000

    fmax.3: Add caveat for going beyond C std requirements
    
    libm's fmax and fmin family of functions treat +0.0 as greater than
    -0.0.  This is not required by the C standard, so the user may not see
    this behaviour due to compiler optimization.
    
    PR:             294214
    Reviewed by:    fuz
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D56230
    
    (cherry picked from commit 7764e9ca28a9702aed4ba7391e055ec2fcf35c41)
---
 lib/msun/man/fmax.3 | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lib/msun/man/fmax.3 b/lib/msun/man/fmax.3
index 25fc9b6d518a..873a19375ce5 100644
--- a/lib/msun/man/fmax.3
+++ b/lib/msun/man/fmax.3
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd June 29, 2004
+.Dd April 6, 2026
 .Dt FMAX 3
 .Os
 .Sh NAME
@@ -68,10 +68,6 @@ functions return the smaller of
 .Fa x
 and
 .Fa y .
-They treat
-.Li +0.0
-as being larger than
-.Li -0.0 .
 If one argument is an \*(Na, then the other argument is returned.
 If both arguments are \*(Nas, then the result is an \*(Na.
 These routines do not raise any floating-point exceptions.
@@ -90,6 +86,13 @@ and
 .Fn fminl
 functions conform to
 .St -isoC-99 .
+.Sh CAVEATS
+The library implementations of these functions treat
+.Li +0.0
+as being larger than
+.Li -0.0 .
+This behavior is not specified by the C standard, is not portable,
+and may not occur in light of compiler optimizations.
 .Sh HISTORY
 These routines first appeared in
 .Fx 5.3 .


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69dd2981.33c20.18a98019>