summaryrefslogtreecommitdiffstats
path: root/lib/libm/src/s_lroundf.c
diff options
context:
space:
mode:
authormartynas <martynas@openbsd.org>2011-04-17 13:59:54 +0000
committermartynas <martynas@openbsd.org>2011-04-17 13:59:54 +0000
commitd37b90348eaddca97fc8cbeb99fcf38a0727c60a (patch)
tree46bff012b635aea2c10dce1803dcf072b9566452 /lib/libm/src/s_lroundf.c
parentcleanups, cosmethic changes, functions that should be static are now static (diff)
downloadwireguard-openbsd-d37b90348eaddca97fc8cbeb99fcf38a0727c60a.tar.xz
wireguard-openbsd-d37b90348eaddca97fc8cbeb99fcf38a0727c60a.zip
The {,l}lround{,f} implementations are based on {,l}lrint{,f},
therefore affected by the same bugs I've fixed a week ago. The high part was being clipped for all exponents greater or equal to 52. Fix this to use RESTYPE_BITS instead; also make the code consistent.
Diffstat (limited to 'lib/libm/src/s_lroundf.c')
-rw-r--r--lib/libm/src/s_lroundf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libm/src/s_lroundf.c b/lib/libm/src/s_lroundf.c
index aee5ca0cd9b..7858008cab9 100644
--- a/lib/libm/src/s_lroundf.c
+++ b/lib/libm/src/s_lroundf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: s_lroundf.c,v 1.1 2008/07/21 20:29:14 martynas Exp $ */
+/* $OpenBSD: s_lroundf.c,v 1.2 2011/04/17 13:59:54 martynas Exp $ */
/* $NetBSD: lroundf.c,v 1.2 2004/10/13 15:18:32 drochner Exp $ */
/*-
@@ -75,9 +75,9 @@ LROUNDNAME(float x)
shift = e - SNG_FRACBITS;
if (shift >=0)
- res = (shift < 32 ? (RESTYPE)i0 << shift : 0);
+ res = (shift < RESTYPE_BITS ? (RESTYPE)i0 << shift : 0);
else
- res = (shift > -32 ? i0 >> -shift : 0);
+ res = (shift > -RESTYPE_BITS ? (RESTYPE)i0 >> -shift : 0);
return (s ? -res : res);
}