Print this page
11210 libm should be cstyle(1ONBLD) clean
*** 20,29 ****
--- 20,30 ----
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
+
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
*** 40,81 ****
#define TINY 1.0e-20L /* single: 1e-5, double: 1e-10, quad: 1e-20 */
#define OVFLEXP 16400 /* single: 130, double 1030, quad: 16400 */
#define UNFLEXP -16520 /* single:-155, double -1080, quad:-16520 */
! static const long double
! zero = 0.0L,
tiny = TINY * TINY,
half = 0.5L,
ln2 = 6.931471805599453094172321214581765680755e-0001L,
one = 1.0L;
! static const int
! ovflexp = OVFLEXP,
! unflexp = UNFLEXP;
long double
! exp2l(long double x) {
long double t;
if (!finitel(x)) {
if (isnanl(x) || x > zero)
return (x + x);
else
return (zero);
}
t = fabsl(x);
if (t < half) {
if (t < tiny)
return (one + x);
else
return (expl(ln2 * x));
}
t = anintl(x);
if (t < ovflexp) {
if (t >= unflexp)
! return (scalbnl(expl(ln2 * (x - t)), (int) t));
else
return (scalbnl(one, unflexp)); /* underflow */
! } else
return (scalbnl(one, ovflexp)); /* overflow */
}
--- 41,85 ----
#define TINY 1.0e-20L /* single: 1e-5, double: 1e-10, quad: 1e-20 */
#define OVFLEXP 16400 /* single: 130, double 1030, quad: 16400 */
#define UNFLEXP -16520 /* single:-155, double -1080, quad:-16520 */
! static const long double zero = 0.0L,
tiny = TINY * TINY,
half = 0.5L,
ln2 = 6.931471805599453094172321214581765680755e-0001L,
one = 1.0L;
! static const int ovflexp = OVFLEXP, unflexp = UNFLEXP;
long double
! exp2l(long double x)
! {
long double t;
if (!finitel(x)) {
if (isnanl(x) || x > zero)
return (x + x);
else
return (zero);
}
+
t = fabsl(x);
+
if (t < half) {
if (t < tiny)
return (one + x);
else
return (expl(ln2 * x));
}
+
t = anintl(x);
+
if (t < ovflexp) {
if (t >= unflexp)
! return (scalbnl(expl(ln2 * (x - t)), (int)t));
else
return (scalbnl(one, unflexp)); /* underflow */
! } else {
return (scalbnl(one, ovflexp)); /* overflow */
+ }
}