clog.c revision 25c28e83beb90e7c80452a7c818c5e6f73a07dc8
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* 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.
*/
/* INDENT OFF */
/*
* dcomplex clog(dcomplex z);
*
* _________
* / 2 2 -1 y
* log(x+iy) = log(\/ x + y ) + i tan (---)
* x
*
* 1 2 2 -1 y
* = --- log(x + y ) + i tan (---)
* 2 x
*
* Note that the arctangent ranges from -PI to +PI, thus the imaginary
* part of clog is atan2(y,x).
*
* clog(-0 + i 0 ) = -inf + i pi
* clog( 0 + i 0 ) = -inf + i 0
* clog( x + i inf ) = -inf + i pi/2, for finite x
* clog( x + i NaN ) = NaN + i NaN with invalid for finite x
* clog(-inf + iy )= +inf + i pi, for finite positive-signed y
* clog(+inf + iy )= +inf + i 0 , for finite positive-signed y
* clog(-inf + i inf)= inf + i 3pi/4
* clog(+inf + i inf)= inf + i pi/4
* 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 "libm_synonyms.h"
#include "complex_wrapper.h"
#include "libm_protos.h" /* __k_clog_r */
x = D_RE(z);
y = D_IM(z);
/* swap x and y to force ax >= ay */
t = ax;
ay = t;
iy = n;
ly = n;
}
else
/* 0.5 <= x < 2 */
if (ix >= 0x3ff00000) {
else if (n >= 60)
else
} else if (n >= 60) {
} else {
}
} else if (n >= 30) {
/* 2**-500< y < x < 2**500 */
} else {
}
return (ans);
}