s_asinhf.c revision 176451
190075Sobrien/* s_asinhf.c -- float version of s_asinh.c. 290075Sobrien * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. 3169689Skan */ 490075Sobrien 590075Sobrien/* 690075Sobrien * ==================================================== 790075Sobrien * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 890075Sobrien * 990075Sobrien * Developed at SunPro, a Sun Microsystems, Inc. business. 1090075Sobrien * Permission to use, copy, modify, and distribute this 1190075Sobrien * software is freely granted, provided that this notice 1290075Sobrien * is preserved. 1390075Sobrien * ==================================================== 1490075Sobrien */ 1590075Sobrien 1690075Sobrien#include <sys/cdefs.h> 1790075Sobrien__FBSDID("$FreeBSD: head/lib/msun/src/s_asinhf.c 176451 2008-02-22 02:30:36Z das $"); 1890075Sobrien 19169689Skan#include "math.h" 20169689Skan#include "math_private.h" 2190075Sobrien 22169689Skanstatic const float 2390075Sobrienone = 1.0000000000e+00, /* 0x3F800000 */ 2490075Sobrienln2 = 6.9314718246e-01, /* 0x3f317218 */ 2590075Sobrienhuge= 1.0000000000e+30; 26169689Skan 2790075Sobrienfloat 2890075Sobrienasinhf(float x) 2990075Sobrien{ 3090075Sobrien float t,w; 3190075Sobrien int32_t hx,ix; 3290075Sobrien GET_FLOAT_WORD(hx,x); 3390075Sobrien ix = hx&0x7fffffff; 3490075Sobrien if(ix>=0x7f800000) return x+x; /* x is inf or NaN */ 3590075Sobrien if(ix< 0x31800000) { /* |x|<2**-28 */ 36132718Skan if(huge+x>one) return x; /* return x inexact except 0 */ 37132718Skan } 3890075Sobrien if(ix>0x4d800000) { /* |x| > 2**28 */ 3990075Sobrien w = __ieee754_logf(fabsf(x))+ln2; 40169689Skan } else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */ 4190075Sobrien t = fabsf(x); 4290075Sobrien w = __ieee754_logf((float)2.0*t+one/(__ieee754_sqrtf(x*x+one)+t)); 4390075Sobrien } else { /* 2.0 > |x| > 2**-28 */ 4490075Sobrien t = x*x; 4590075Sobrien w =log1pf(fabsf(x)+t/(one+__ieee754_sqrtf(one+t))); 4690075Sobrien } 4790075Sobrien if(hx>0) return w; else return -w; 48117395Skan} 4990075Sobrien