git: dc6149102509 - stable/14 - fmax.3: Add caveat for going beyond C std requirements
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 13 Apr 2026 17:43:20 UTC
The branch stable/14 has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=dc61491025091d9e61048cc3cfb18d25ed354a8b
commit dc61491025091d9e61048cc3cfb18d25ed354a8b
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:43:05 +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)
(cherry picked from commit 855507463e0d3903d31aa7c084efbf4f819b5d63)
---
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 .