Print this page
11210 libm should be cstyle(1ONBLD) clean
@@ -20,10 +20,11 @@
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
+
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -44,15 +45,17 @@
*/
#include "libm.h"
double
-__frexp(double x, int *exp) {
+__frexp(double x, int *exp)
+{
union {
unsigned i[2];
double d;
} xx, yy;
+
double t;
unsigned hx;
int e;
xx.d = x;
@@ -62,10 +65,11 @@
*exp = 0;
return (x);
}
e = 0;
+
if (hx < 0x00100000) { /* x is subnormal or zero */
if ((hx | xx.i[LOWORD]) == 0) {
*exp = 0;
return (x);
}
@@ -87,11 +91,11 @@
yy.i[LOWORD] = xx.i[LOWORD];
t = yy.d;
yy.i[HIWORD] = 0x43300000;
yy.i[LOWORD] = 0;
t -= yy.d; /* t = |x| scaled */
- xx.d = ((int)xx.i[HIWORD] < 0)? -t : t;
+ xx.d = ((int)xx.i[HIWORD] < 0) ? -t : t;
hx = xx.i[HIWORD] & ~0x80000000;
e = -1074;
}
/* now xx.d is normal */