Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libm/src Use FP_ILOGB0 and FP_ILOGBNAN
details: https://anonhg.NetBSD.org/src/rev/11c2c310c6e2
branches: trunk
changeset: 784798:11c2c310c6e2
user: matt <matt%NetBSD.org@localhost>
date: Sat Feb 09 22:56:00 2013 +0000
description:
Use FP_ILOGB0 and FP_ILOGBNAN
diffstat:
lib/libm/src/s_ilogb.c | 6 +++---
lib/libm/src/s_ilogbf.c | 6 +++---
lib/libm/src/s_ilogbl.c | 8 ++++----
3 files changed, 10 insertions(+), 10 deletions(-)
diffs (87 lines):
diff -r 7430eeab7d20 -r 11c2c310c6e2 lib/libm/src/s_ilogb.c
--- a/lib/libm/src/s_ilogb.c Sat Feb 09 22:33:13 2013 +0000
+++ b/lib/libm/src/s_ilogb.c Sat Feb 09 22:56:00 2013 +0000
@@ -12,7 +12,7 @@
#include <sys/cdefs.h>
#if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_ilogb.c,v 1.13 2011/07/28 22:32:29 joerg Exp $");
+__RCSID("$NetBSD: s_ilogb.c,v 1.14 2013/02/09 22:56:00 matt Exp $");
#endif
/* ilogb(double x)
@@ -38,7 +38,7 @@
if(hx<0x00100000) {
GET_LOW_WORD(lx,x);
if((hx|lx)==0)
- return 0x80000001; /* ilogb(0) = 0x80000001 */
+ return FP_ILOGB0; /* ilogb(0) = 0x80000001 */
else /* subnormal x */
if(hx==0) {
for (ix = -1043; lx>0; lx<<=1) ix -=1;
@@ -48,5 +48,5 @@
return ix;
}
else if (hx<0x7ff00000) return (hx>>20)-1023;
- else return 0x7fffffff;
+ else return FP_ILOGBNAN; /* inf too */
}
diff -r 7430eeab7d20 -r 11c2c310c6e2 lib/libm/src/s_ilogbf.c
--- a/lib/libm/src/s_ilogbf.c Sat Feb 09 22:33:13 2013 +0000
+++ b/lib/libm/src/s_ilogbf.c Sat Feb 09 22:56:00 2013 +0000
@@ -15,7 +15,7 @@
#include <sys/cdefs.h>
#if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_ilogbf.c,v 1.7 2002/05/26 22:01:56 wiz Exp $");
+__RCSID("$NetBSD: s_ilogbf.c,v 1.8 2013/02/09 22:56:00 matt Exp $");
#endif
#include "math.h"
@@ -30,11 +30,11 @@
hx &= 0x7fffffff;
if(hx<0x00800000) {
if(hx==0)
- return 0x80000001; /* ilogb(0) = 0x80000001 */
+ return FP_ILOGB0; /* ilogb(0) = 0x80000001 */
else /* subnormal x */
for (ix = -126,hx<<=8; hx>0; hx<<=1) ix -=1;
return ix;
}
else if (hx<0x7f800000) return (hx>>23)-127;
- else return 0x7fffffff;
+ else return FP_ILOGBNAN; /* inf too */
}
diff -r 7430eeab7d20 -r 11c2c310c6e2 lib/libm/src/s_ilogbl.c
--- a/lib/libm/src/s_ilogbl.c Sat Feb 09 22:33:13 2013 +0000
+++ b/lib/libm/src/s_ilogbl.c Sat Feb 09 22:56:00 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: s_ilogbl.c,v 1.1 2011/07/28 22:32:29 joerg Exp $ */
+/* $NetBSD: s_ilogbl.c,v 1.2 2013/02/09 22:56:00 matt Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: s_ilogbl.c,v 1.1 2011/07/28 22:32:29 joerg Exp $");
+__RCSID("$NetBSD: s_ilogbl.c,v 1.2 2013/02/09 22:56:00 matt Exp $");
#include "namespace.h"
@@ -54,12 +54,12 @@
union ieee_ext_u u;
if (x == 0.0L)
- return 0x80000001; /* ilogbl(0) = 0x80000001 */
+ return FP_ILOGB0; /* ilogbl(0) = 0x80000001 */
u.extu_ld = x;
if (u.extu_ext.ext_exp == EXT_EXP_INFNAN)
- return 0x7fffffff;
+ return FP_ILOGBNAN; /* inf too */
if (u.extu_ext.ext_exp == 0) {
/*
Home |
Main Index |
Thread Index |
Old Index