CVS commit: src/tests/lib/libc/gen

"Taylor R Campbell" <[email protected]>
Newsgroups gmane.os.netbsd.devel.cvs
Message-ID <[email protected]>
Module Name:	src
Committed By:	riastradh
Date:		Tue Feb 17 22:32:36 UTC 2026

Modified Files:
	src/tests/lib/libc/gen: t_fpclassify.c

Log Message:
t_fpclassify: Show the floating-point bits more carefully.

Use formatbits(&f) rather than formatbits(f).  This serves two
purposes:

1. Type-checking.

   Can't accidentally pass a double where a float is needed -- a bug
   that previously appeared a few times in this code.

2. Reducing the chance that the data will pass through floating-point
   load/store instructions on x87.

   Floating-point load of binary32 (float) or binary64 (double)
   converts to x87 80-bit extended precision format internally, which
   preserves all floating-point _numbers_ and _infinities_ but has
   the side effect of changing signalling NaN to quiet NaN (and
   raising FE_INVALID).  This means that signalling NaNs were getting
   wrongly printed _as if_ they were quiet NaNs, which is frustrating
   for diagnostics!

   This change doesn't guarantee floating-point load instructions are
   prevented, but for the moment it seems to avoid them.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/tests/lib/libc/gen/t_fpclassify.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.