Print this page
11210 libm should be cstyle(1ONBLD) clean
*** 16,28 ****
--- 16,30 ----
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
+
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
+
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
*** 40,111 ****
#include "longdouble.h"
extern enum fp_direction_type __swapRD(enum fp_direction_type);
static const long double qone = 1.0L, qhalf = 0.5L, qmhalf = -0.5L;
-
long double
! aintl(long double x) {
long double t, w;
if (!finitel(x))
return (x + x);
w = fabsl(x);
t = rintl(w);
if (t <= w)
return (copysignl(t, x)); /* NaN or already aint(|x|) */
else /* |t|>|x| case */
return (copysignl(t - qone, x)); /* |t-1|*sign(x) */
}
long double
! anintl(long double x) {
long double t, w, z;
if (!finitel(x))
return (x + x);
w = fabsl(x);
t = rintl(w);
if (t == w)
return (copysignl(t, x));
z = t - w;
if (z > qhalf)
t = t - qone;
else if (z <= qmhalf)
t = t + qone;
return (copysignl(t, x));
}
int
! irintl(long double x) {
enum fp_direction_type rd;
rd = __swapRD(fp_nearest);
(void) __swapRD(rd); /* restore Rounding Direction */
switch (rd) {
case fp_nearest:
if (x < 2147483647.5L && x >= -2147483648.5L)
return ((int)rintl(x));
break;
case fp_tozero:
if (x < 2147483648.0L && x > -2147483649.0L)
return ((int)rintl(x));
break;
case fp_positive:
if (x <= 2147483647.0L && x > -2147483649.0L)
return ((int)rintl(x));
break;
case fp_negative:
if (x < 2147483648.0L && x >= -2147483648.0L)
return ((int)rintl(x));
break;
}
return ((int)copysignl(1.0e100L, x));
}
int
! nintl(long double x) {
if ((x < 2147483647.5L) && (x > -2147483648.5L))
return ((int)anintl(x));
else
return ((int)copysignl(1.0e100L, x));
}
--- 42,133 ----
#include "longdouble.h"
extern enum fp_direction_type __swapRD(enum fp_direction_type);
static const long double qone = 1.0L, qhalf = 0.5L, qmhalf = -0.5L;
long double
! aintl(long double x)
! {
long double t, w;
if (!finitel(x))
return (x + x);
+
w = fabsl(x);
t = rintl(w);
+
if (t <= w)
return (copysignl(t, x)); /* NaN or already aint(|x|) */
else /* |t|>|x| case */
return (copysignl(t - qone, x)); /* |t-1|*sign(x) */
}
long double
! anintl(long double x)
! {
long double t, w, z;
if (!finitel(x))
return (x + x);
+
w = fabsl(x);
t = rintl(w);
+
if (t == w)
return (copysignl(t, x));
+
z = t - w;
+
if (z > qhalf)
t = t - qone;
else if (z <= qmhalf)
t = t + qone;
+
return (copysignl(t, x));
}
int
! irintl(long double x)
! {
enum fp_direction_type rd;
rd = __swapRD(fp_nearest);
(void) __swapRD(rd); /* restore Rounding Direction */
+
switch (rd) {
case fp_nearest:
+
if (x < 2147483647.5L && x >= -2147483648.5L)
return ((int)rintl(x));
+
break;
case fp_tozero:
+
if (x < 2147483648.0L && x > -2147483649.0L)
return ((int)rintl(x));
+
break;
case fp_positive:
+
if (x <= 2147483647.0L && x > -2147483649.0L)
return ((int)rintl(x));
+
break;
case fp_negative:
+
if (x < 2147483648.0L && x >= -2147483648.0L)
return ((int)rintl(x));
+
break;
}
+
return ((int)copysignl(1.0e100L, x));
}
int
! nintl(long double x)
! {
if ((x < 2147483647.5L) && (x > -2147483648.5L))
return ((int)anintl(x));
else
return ((int)copysignl(1.0e100L, x));
}