Changes in src/libcfa/stdlib.c [6e991d6:6b6597c]
- File:
-
- 1 edited
-
src/libcfa/stdlib.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/stdlib.c
r6e991d6 r6b6597c 10 10 // Created On : Thu Jan 28 17:10:29 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Apr 21 07:58:29201613 // Update Count : 1 6512 // Last Modified On : Tue Apr 19 21:21:51 2016 13 // Update Count : 159 14 14 // 15 15 … … 24 24 #include <malloc.h> // malloc_usable_size 25 25 #include <math.h> // fabsf, fabs, fabsl 26 #include <complex.h> // _Complex_I 26 #include <complex.h> // _Complex_I, cabsf, cabs, cabsl 27 27 } // extern "C" 28 28 … … 82 82 int ato( const char * ptr ) { 83 83 int i; 84 if ( sscanf( ptr, "%d", &i ) == EOF ) {} 84 if ( sscanf( ptr, "%d", &i ) == EOF ) {} // check return code 85 85 return i; 86 86 } 87 87 unsigned int ato( const char * ptr ) { 88 88 unsigned int ui; 89 if ( sscanf( ptr, "%u", &ui ) == EOF ) {} 89 if ( sscanf( ptr, "%u", &ui ) == EOF ) {} // check return code 90 90 return ui; 91 91 } 92 92 long int ato( const char * ptr ) { 93 93 long int li; 94 if ( sscanf( ptr, "%ld", &li ) == EOF ) {} 94 if ( sscanf( ptr, "%ld", &li ) == EOF ) {} // check return code 95 95 return li; 96 96 } 97 97 unsigned long int ato( const char * ptr ) { 98 98 unsigned long int uli; 99 if ( sscanf( ptr, "%lu", &uli ) == EOF ) {} 99 if ( sscanf( ptr, "%lu", &uli ) == EOF ) {} // check return code 100 100 return uli; 101 101 } 102 102 long long int ato( const char * ptr ) { 103 103 long long int lli; 104 if ( sscanf( ptr, "%lld", &lli ) == EOF ) {} 104 if ( sscanf( ptr, "%lld", &lli ) == EOF ) {} // check return code 105 105 return lli; 106 106 } 107 107 unsigned long long int ato( const char * ptr ) { 108 108 unsigned long long int ulli; 109 if ( sscanf( ptr, "%llu", &ulli ) == EOF ) {} 109 if ( sscanf( ptr, "%llu", &ulli ) == EOF ) {} // check return code 110 110 return ulli; 111 111 } … … 113 113 float ato( const char * ptr ) { 114 114 float f; 115 if ( sscanf( ptr, "%f", &f ) == EOF ) {} 115 if ( sscanf( ptr, "%f", &f ) == EOF ) {} // check return code 116 116 return f; 117 117 } 118 118 double ato( const char * ptr ) { 119 119 double d; 120 if ( sscanf( ptr, "%lf", &d ) == EOF ) {} 120 if ( sscanf( ptr, "%lf", &d ) == EOF ) {} // check return code 121 121 return d; 122 122 } 123 123 long double ato( const char * ptr ) { 124 124 long double ld; 125 if ( sscanf( ptr, "%Lf", &ld ) == EOF ) {} 125 if ( sscanf( ptr, "%Lf", &ld ) == EOF ) {} // check return code 126 126 return ld; 127 127 } … … 129 129 float _Complex ato( const char * ptr ) { 130 130 float re, im; 131 if ( sscanf( ptr, "%g%gi", &re, &im ) == EOF ) {} 131 if ( sscanf( ptr, "%g%gi", &re, &im ) == EOF ) {} // check return code 132 132 return re + im * _Complex_I; 133 133 } 134 134 double _Complex ato( const char * ptr ) { 135 135 double re, im; 136 if ( sscanf( ptr, "%lf%lfi", &re, &im ) == EOF ) {} 136 if ( sscanf( ptr, "%lf%lfi", &re, &im ) == EOF ) {} // check return code 137 137 return re + im * _Complex_I; 138 138 } 139 139 long double _Complex ato( const char * ptr ) { 140 140 long double re, im; 141 if ( sscanf( ptr, "%Lf%Lfi", &re, &im ) == EOF ) {} 141 if ( sscanf( ptr, "%Lf%Lfi", &re, &im ) == EOF ) {} // check return code 142 142 return re + im * _Complex_I; 143 143 } … … 221 221 long int abs( long int v ) { return labs( v ); } 222 222 long long int abs( long long int v ) { return llabs( v ); } 223 float abs( float x ) { return fabsf( x ); } 224 double abs( double x ) { return fabs( x ); } 225 long double abs( long double x ) { return fabsl( x ); } 226 float abs( float _Complex x ) { return cabsf( x ); } 227 double abs( double _Complex x ) { return cabs( x ); } 228 long double abs( long double _Complex x ) { return cabsl( x ); } 223 float abs( float v ) { return fabsf( v ); } 224 double abs( double v ) { return fabs( v ); } 225 long double abs( long double v ) { return fabsl( v ); } 226 float _Complex abs( float _Complex v ) { return cabsf( v ); } 227 double _Complex abs( double _Complex v ) { return cabs( v ); } 228 long double _Complex abs( long double _Complex v ) { return cabsl( v ); } 229 230 //--------------------------------------- 231 232 float floor( float v ) { return floorf( v ); } 233 long double floor( long double v ) { return floorl( v ); } 234 235 float ceil( float v ) { return ceilf( v ); } 236 long double ceil( long double v ) { return ceill( v ); } 229 237 230 238 //---------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.