this repo has no description
at fixPythonPipStalling 73 lines 1.0 kB view raw
1 2// 3// atanh 4// 5// by Ian Ollmann 6// 7// based on MathLib v3 8// 9// Copyright � 2005, Apple Computer, Inc. All Rights Reserved. 10// 11 12#include "math.h" 13 14double atanh( double x ) 15{ 16 if( x != x ) return x + x; 17 18 double fabsx = __builtin_fabs( x ); 19 20 if( fabsx > 1.0) 21 return sqrt( -fabsx ); 22 23 if( fabsx >= 0x1.0p-27 ) //sqrt( negative epsilon ) 24 { 25 fabsx = 0.5 * log1p( (fabsx + fabsx) / (1.0 - fabsx) ); 26 27 } 28 else 29 { 30 if( x == 0.0 ) 31 return x; 32 33 fabsx *= 0x1.0p55; 34 fabsx += 0x1.0p-1022; 35 fabsx *= 0x1.0p-55; 36 } 37 38 if( x < 0 ) 39 fabsx = -fabsx; 40 41 return fabsx; 42} 43 44long double atanhl( long double x ) 45{ 46 if( x != x ) return x + x; 47 48 long double fabsx = __builtin_fabsl( x ); 49 50 if( fabsx > 1.0L) 51 return sqrtl( -fabsx ); 52 53 if( fabsx >= 0x1.0p-32 ) //sqrt( negative epsilon ) 54 { 55 fabsx = 0.5 * log1pl( (fabsx + fabsx) / (1.0L - fabsx) ); 56 57 } 58 else 59 { 60 if( x == 0.0 ) 61 return x; 62 63 fabsx *= 0x1.0p65; 64 fabsx += 0x1.0p-16382L; 65 fabsx *= 0x1.0p-65; 66 } 67 68 if( x < 0 ) 69 fabsx = -fabsx; 70 71 return fabsx; 72} 73