[Bug 294692] lib/msun: Replaced manual checks with isnan()

[email protected] Wed, 22 Apr 2026 18:12:12 +0000
Newsgroups gmane.os.freebsd.devel.standards
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D294692

--- Comment #12 from Robert Clausecker <[email protected]> ---
(In reply to Steve Kargl from comment #11)

-ffast-math is documented as (by gcc13):

     -ffast-math
         Sets the options -fno-math-errno, -funsafe-math-optimizations,
         -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans,
         -fcx-limited-range and -fexcess-precision=3Dfast.

         This option causes the preprocessor macro "__FAST_MATH__" to be
         defined.

         This option is not turned on by any -O option besides -Ofast since=
 it
         can result in incorrect output for programs that depend on an exact
         implementation of IEEE or ISO rules/specifications for math
         functions. It may, however, yield faster code for programs that do
         not require the guarantees of these specifications.

In particular, -ffinite-math-only is documented as:

     -ffinite-math-only
         Allow optimizations for floating-point arithmetic that assume that
         arguments and results are not NaNs or +-Infs.

         This option is not turned on by any -O option since it can result =
in
         incorrect output for programs that depend on an exact implementati=
on
         of IEEE or ISO rules/specifications for math functions. It may,
         however, yield faster code for programs that do not require the
         guarantees of these specifications.

         The default is -fno-finite-math-only.

So anybody who expects correct outcomes with respect to NaN values in the f=
ace
of -ffast-math is a fool.  I don't think we need to add documentation to po=
int
out explicitly that you'll shoot yourself in the foot if you compile with
foot-shooting turned on and aim the compiler at your foot.

--=20
You are receiving this mail because:
You are the assignee for the bug.=