Print this page
11210 libm should be cstyle(1ONBLD) clean
*** 16,36 ****
* 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.
*/
#pragma weak clog = __clog
! /* INDENT OFF */
/*
* dcomplex clog(dcomplex z);
*
* _________
* / 2 2 -1 y
--- 16,38 ----
* 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.
*/
#pragma weak clog = __clog
!
/*
* dcomplex clog(dcomplex z);
*
* _________
* / 2 2 -1 y
*** 56,76 ****
* clog(+-inf+ i NaN)= inf + i NaN
* clog(NaN + i y )= NaN + i NaN for finite y
* clog(NaN + i inf)= inf + i NaN
* clog(NaN + i NaN)= NaN + i NaN
*/
- /* INDENT ON */
#include <math.h> /* atan2/fabs/log/log1p */
#include "complex_wrapper.h"
#include "libm_protos.h" /* __k_clog_r */
-
static const double half = 0.5, one = 1.0;
dcomplex
! __clog(dcomplex z) {
dcomplex ans;
double x, y, t, ax, ay, w;
int n, ix, iy, hx, hy;
unsigned lx, ly;
--- 58,77 ----
* clog(+-inf+ i NaN)= inf + i NaN
* clog(NaN + i y )= NaN + i NaN for finite y
* clog(NaN + i inf)= inf + i NaN
* clog(NaN + i NaN)= NaN + i NaN
*/
#include <math.h> /* atan2/fabs/log/log1p */
#include "complex_wrapper.h"
#include "libm_protos.h" /* __k_clog_r */
static const double half = 0.5, one = 1.0;
dcomplex
! __clog(dcomplex z)
! {
dcomplex ans;
double x, y, t, ax, ay, w;
int n, ix, iy, hx, hy;
unsigned lx, ly;
*** 83,122 ****
ix = hx & 0x7fffffff;
iy = hy & 0x7fffffff;
ay = fabs(y);
ax = fabs(x);
D_IM(ans) = carg(z);
if (ix < iy || (ix == iy && lx < ly)) {
/* swap x and y to force ax >= ay */
t = ax;
ax = ay;
ay = t;
n = ix, ix = iy;
iy = n;
n = lx, lx = ly;
ly = n;
}
n = (ix - iy) >> 20;
if (ix >= 0x7ff00000) { /* x or y is Inf or NaN */
if (ISINF(ix, lx))
D_RE(ans) = ax;
else if (ISINF(iy, ly))
D_RE(ans) = ay;
else
D_RE(ans) = ax * ay;
} else if ((iy | ly) == 0) {
! D_RE(ans) = ((ix | lx) == 0)? -one / ax : log(ax);
} else if (((0x3fffffff - ix) ^ (ix - 0x3fe00000)) >= 0) {
/* 0.5 <= x < 2 */
if (ix >= 0x3ff00000) {
if (((ix - 0x3ff00000) | lx) == 0)
D_RE(ans) = half * log1p(ay * ay);
else if (n >= 60)
D_RE(ans) = log(ax);
else
! D_RE(ans) = half * (log1p(ay * ay + (ax -
! one) * (ax + one)));
} else if (n >= 60) {
D_RE(ans) = log(ax);
} else {
D_RE(ans) = __k_clog_r(ax, ay, &w);
}
--- 84,126 ----
ix = hx & 0x7fffffff;
iy = hy & 0x7fffffff;
ay = fabs(y);
ax = fabs(x);
D_IM(ans) = carg(z);
+
if (ix < iy || (ix == iy && lx < ly)) {
/* swap x and y to force ax >= ay */
t = ax;
ax = ay;
ay = t;
n = ix, ix = iy;
iy = n;
n = lx, lx = ly;
ly = n;
}
+
n = (ix - iy) >> 20;
+
if (ix >= 0x7ff00000) { /* x or y is Inf or NaN */
if (ISINF(ix, lx))
D_RE(ans) = ax;
else if (ISINF(iy, ly))
D_RE(ans) = ay;
else
D_RE(ans) = ax * ay;
} else if ((iy | ly) == 0) {
! D_RE(ans) = ((ix | lx) == 0) ? -one / ax : log(ax);
} else if (((0x3fffffff - ix) ^ (ix - 0x3fe00000)) >= 0) {
/* 0.5 <= x < 2 */
if (ix >= 0x3ff00000) {
if (((ix - 0x3ff00000) | lx) == 0)
D_RE(ans) = half * log1p(ay * ay);
else if (n >= 60)
D_RE(ans) = log(ax);
else
! D_RE(ans) = half * (log1p(ay * ay + (ax - one) *
! (ax + one)));
} else if (n >= 60) {
D_RE(ans) = log(ax);
} else {
D_RE(ans) = __k_clog_r(ax, ay, &w);
}
*** 127,133 ****
--- 131,138 ----
D_RE(ans) = half * log(ax * ax + ay * ay);
} else {
t = ay / ax;
D_RE(ans) = log(ax) + half * log1p(t * t);
}
+
return (ans);
}