artulab
projects
/
openbsd
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f78f1c7
)
Make sure modff() returns correct values for infinities.
author
miod
<miod@openbsd.org>
Sun, 13 Aug 2023 06:56:10 +0000
(06:56 +0000)
committer
miod
<miod@openbsd.org>
Sun, 13 Aug 2023 06:56:10 +0000
(06:56 +0000)
Reported by Willemijn Coene.
lib/libm/src/s_modff.c
patch
|
blob
|
history
diff --git
a/lib/libm/src/s_modff.c
b/lib/libm/src/s_modff.c
index
829bfce
..
2a014de
100644
(file)
--- a/
lib/libm/src/s_modff.c
+++ b/
lib/libm/src/s_modff.c
@@
-45,6
+45,8
@@
modff(float x, float *iptr)
} else { /* no fraction part */
u_int32_t ix;
*iptr = x*one;
+ if (jj0 == 0x80) /* +-inf or NaN */
+ return (0.0 / x); /* +-0 or NaN */
GET_FLOAT_WORD(ix,x);
SET_FLOAT_WORD(x,ix&0x80000000); /* return +-0 */
return x;