Back to index

glibc  2.9
s_asinhf.c
Go to the documentation of this file.
00001 /* s_asinhf.c -- float version of s_asinh.c.
00002  * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
00003  */
00004 
00005 /*
00006  * ====================================================
00007  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
00008  *
00009  * Developed at SunPro, a Sun Microsystems, Inc. business.
00010  * Permission to use, copy, modify, and distribute this
00011  * software is freely granted, provided that this notice
00012  * is preserved.
00013  * ====================================================
00014  */
00015 
00016 #if defined(LIBM_SCCS) && !defined(lint)
00017 static char rcsid[] = "$NetBSD: s_asinhf.c,v 1.5 1995/05/12 04:57:39 jtc Exp $";
00018 #endif
00019 
00020 #include "math.h"
00021 #include "math_private.h"
00022 
00023 #ifdef __STDC__
00024 static const float
00025 #else
00026 static float
00027 #endif
00028 one =  1.0000000000e+00, /* 0x3F800000 */
00029 ln2 =  6.9314718246e-01, /* 0x3f317218 */
00030 huge=  1.0000000000e+30;
00031 
00032 #ifdef __STDC__
00033        float __asinhf(float x)
00034 #else
00035        float __asinhf(x)
00036        float x;
00037 #endif
00038 {
00039        float t,w;
00040        int32_t hx,ix;
00041        GET_FLOAT_WORD(hx,x);
00042        ix = hx&0x7fffffff;
00043        if(ix>=0x7f800000) return x+x;     /* x is inf or NaN */
00044        if(ix< 0x38000000) { /* |x|<2**-14 */
00045            if(huge+x>one) return x;       /* return x inexact except 0 */
00046        }
00047        if(ix>0x47000000) {  /* |x| > 2**14 */
00048            w = __ieee754_logf(fabsf(x))+ln2;
00049        } else if (ix>0x40000000) { /* 2**14 > |x| > 2.0 */
00050            t = fabsf(x);
00051            w = __ieee754_logf((float)2.0*t+one/(__ieee754_sqrtf(x*x+one)+t));
00052        } else {             /* 2.0 > |x| > 2**-14 */
00053            t = x*x;
00054            w =__log1pf(fabsf(x)+t/(one+__ieee754_sqrtf(one+t)));
00055        }
00056        if(hx>0) return w; else return -w;
00057 }
00058 weak_alias (__asinhf, asinhf)