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 16176451Sdas#include <sys/cdefs.h> 17176451Sdas__FBSDID("$FreeBSD$"); 182116Sjkh 192116Sjkh#include "math.h" 202116Sjkh#include "math_private.h" 212116Sjkh 228870Srgrimesstatic const float 232116Sjkhone = 1.0000000000e+00, /* 0x3F800000 */ 242116Sjkhln2 = 6.9314718246e-01, /* 0x3f317218 */ 258870Srgrimeshuge= 1.0000000000e+30; 262116Sjkh 2797413Salfredfloat 2897413Salfredasinhf(float x) 298870Srgrimes{ 302116Sjkh float t,w; 312116Sjkh int32_t hx,ix; 322116Sjkh GET_FLOAT_WORD(hx,x); 332116Sjkh ix = hx&0x7fffffff; 342116Sjkh if(ix>=0x7f800000) return x+x; /* x is inf or NaN */ 352116Sjkh if(ix< 0x31800000) { /* |x|<2**-28 */ 362116Sjkh if(huge+x>one) return x; /* return x inexact except 0 */ 378870Srgrimes } 382116Sjkh if(ix>0x4d800000) { /* |x| > 2**28 */ 392116Sjkh w = __ieee754_logf(fabsf(x))+ln2; 402116Sjkh } else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */ 412116Sjkh t = fabsf(x); 4223579Sbde w = __ieee754_logf((float)2.0*t+one/(__ieee754_sqrtf(x*x+one)+t)); 432116Sjkh } else { /* 2.0 > |x| > 2**-28 */ 442116Sjkh t = x*x; 4523579Sbde w =log1pf(fabsf(x)+t/(one+__ieee754_sqrtf(one+t))); 462116Sjkh } 472116Sjkh if(hx>0) return w; else return -w; 482116Sjkh} 49