e_acoshf.c revision 8870
12116Sjkh/* e_acoshf.c -- float version of e_acosh.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 178870Srgrimesstatic char rcsid[] = "$Id: e_acoshf.c,v 1.1.1.1 1994/08/19 09:39:44 jkh 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.0, 292116Sjkhln2 = 6.9314718246e-01; /* 0x3f317218 */ 302116Sjkh 312116Sjkh#ifdef __STDC__ 322116Sjkh float __ieee754_acoshf(float x) 332116Sjkh#else 342116Sjkh float __ieee754_acoshf(x) 352116Sjkh float x; 362116Sjkh#endif 378870Srgrimes{ 382116Sjkh float t; 392116Sjkh int32_t hx; 402116Sjkh GET_FLOAT_WORD(hx,x); 412116Sjkh if(hx<0x3f800000) { /* x < 1 */ 422116Sjkh return (x-x)/(x-x); 432116Sjkh } else if(hx >=0x4d800000) { /* x > 2**28 */ 442116Sjkh if(hx >=0x7f800000) { /* x is inf of NaN */ 452116Sjkh return x+x; 468870Srgrimes } else 472116Sjkh return __ieee754_logf(x)+ln2; /* acosh(huge)=log(2x) */ 482116Sjkh } else if (hx==0x3f800000) { 492116Sjkh return 0.0; /* acosh(1) = 0 */ 502116Sjkh } else if (hx > 0x40000000) { /* 2**28 > x > 2 */ 512116Sjkh t=x*x; 522116Sjkh return __ieee754_logf((float)2.0*x-one/(x+sqrtf(t-one))); 532116Sjkh } else { /* 1<x<2 */ 542116Sjkh t = x-one; 552116Sjkh return log1pf(t+sqrtf((float)2.0*t+t*t)); 562116Sjkh } 572116Sjkh} 58