s_asinhf.c revision 23579
12116Sjkh/* s_asinhf.c -- float version of s_asinh.c. 22116Sjkh * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. 32116Sjkh */ 42116Sjkh 52116Sjkh/* 62116Sjkh * ==================================================== 72116Sjkh * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 82116Sjkh * 92116Sjkh * Developed at SunPro, a Sun Microsystems, Inc. business. 102116Sjkh * Permission to use, copy, modify, and distribute this 118870Srgrimes * software is freely granted, provided that this notice 122116Sjkh * is preserved. 132116Sjkh * ==================================================== 142116Sjkh */ 152116Sjkh 162116Sjkh#ifndef lint 1723579Sbdestatic char rcsid[] = "$Id: s_asinhf.c,v 1.4 1997/02/22 15:10:57 peter Exp $"; 182116Sjkh#endif 192116Sjkh 202116Sjkh#include "math.h" 212116Sjkh#include "math_private.h" 222116Sjkh 232116Sjkh#ifdef __STDC__ 248870Srgrimesstatic const float 252116Sjkh#else 268870Srgrimesstatic float 272116Sjkh#endif 282116Sjkhone = 1.0000000000e+00, /* 0x3F800000 */ 292116Sjkhln2 = 6.9314718246e-01, /* 0x3f317218 */ 308870Srgrimeshuge= 1.0000000000e+30; 312116Sjkh 322116Sjkh#ifdef __STDC__ 332116Sjkh float asinhf(float x) 342116Sjkh#else 352116Sjkh float asinhf(x) 362116Sjkh float x; 372116Sjkh#endif 388870Srgrimes{ 392116Sjkh float t,w; 402116Sjkh int32_t hx,ix; 412116Sjkh GET_FLOAT_WORD(hx,x); 422116Sjkh ix = hx&0x7fffffff; 432116Sjkh if(ix>=0x7f800000) return x+x; /* x is inf or NaN */ 442116Sjkh if(ix< 0x31800000) { /* |x|<2**-28 */ 452116Sjkh if(huge+x>one) return x; /* return x inexact except 0 */ 468870Srgrimes } 472116Sjkh if(ix>0x4d800000) { /* |x| > 2**28 */ 482116Sjkh w = __ieee754_logf(fabsf(x))+ln2; 492116Sjkh } else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */ 502116Sjkh t = fabsf(x); 5123579Sbde w = __ieee754_logf((float)2.0*t+one/(__ieee754_sqrtf(x*x+one)+t)); 522116Sjkh } else { /* 2.0 > |x| > 2**-28 */ 532116Sjkh t = x*x; 5423579Sbde w =log1pf(fabsf(x)+t/(one+__ieee754_sqrtf(one+t))); 552116Sjkh } 562116Sjkh if(hx>0) return w; else return -w; 572116Sjkh} 58