[bb82c03] | 1 | // |
---|
[6e991d6] | 2 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
| 6 | // |
---|
[bb82c03] | 7 | // math -- |
---|
| 8 | // |
---|
[6e991d6] | 9 | // Author : Peter A. Buhr |
---|
| 10 | // Created On : Mon Apr 18 23:37:04 2016 |
---|
| 11 | // Last Modified By : Peter A. Buhr |
---|
[dc5376a] | 12 | // Last Modified On : Sun Apr 24 12:45:02 2016 |
---|
| 13 | // Update Count : 59 |
---|
[bb82c03] | 14 | // |
---|
[17e5e2b] | 15 | |
---|
| 16 | #ifndef MATH_H |
---|
| 17 | #define MATH_H |
---|
| 18 | |
---|
[dc5376a] | 19 | extern "C" { |
---|
| 20 | #include <math.h> // fpclassify, isfinite, isnormal, isnan, isinf |
---|
| 21 | } // extern "C" |
---|
[6e991d6] | 22 | |
---|
[dc5376a] | 23 | float fabs( float ); |
---|
| 24 | // extern "C" { double fabs( double ); } |
---|
| 25 | long double fabs( long double ); |
---|
| 26 | float cabs( float _Complex ); |
---|
| 27 | // extern "C" { double cabs( double _Complex ); } |
---|
| 28 | long double cabs( long double _Complex ); |
---|
[6e991d6] | 29 | |
---|
[dc5376a] | 30 | float ?%?( float, float ); |
---|
| 31 | float fmod( float, float ); |
---|
| 32 | double ?%?( double, double ); |
---|
| 33 | // extern "C" { double fmod( double, double ); } |
---|
| 34 | long double ?%?( long double, long double ); |
---|
| 35 | long double fmod( long double, long double ); |
---|
[6e991d6] | 36 | |
---|
[dc5376a] | 37 | float remainder( float, float ); |
---|
| 38 | // extern "C" { double remainder( double, double ); } |
---|
| 39 | long double remainder( long double, long double ); |
---|
[6e991d6] | 40 | |
---|
[dc5376a] | 41 | [ int, float ] remquo( float, float ); |
---|
| 42 | float remquo( float, float, int * ); |
---|
| 43 | [ int, double ] remquo( double, double ); |
---|
| 44 | // extern "C" { double remquo( double, double, int * ); } |
---|
| 45 | [ int, long double ] remquo( long double, long double ); |
---|
| 46 | long double remquo( long double, long double, int * ); |
---|
[6e991d6] | 47 | |
---|
[dc5376a] | 48 | [ int, float ] div( float, float ); // alternative name for remquo |
---|
| 49 | float div( float, float, int * ); |
---|
| 50 | [ int, double ] div( double, double ); |
---|
| 51 | // extern "C" { double div( double, double, int * ); } |
---|
| 52 | [ int, long double ] div( long double, long double ); |
---|
| 53 | long double div( long double, long double, int * ); |
---|
[6e991d6] | 54 | |
---|
[dc5376a] | 55 | float fma( float, float, float ); |
---|
| 56 | // extern "C" { double fma( double, double, double ); } |
---|
| 57 | long double fma( long double, long double, long double ); |
---|
[6e991d6] | 58 | |
---|
[dc5376a] | 59 | float fdim( float, float ); |
---|
| 60 | // extern "C" { double fdim( double, double ); } |
---|
| 61 | long double fdim( long double, long double ); |
---|
[6e991d6] | 62 | |
---|
[dc5376a] | 63 | float nan( const char * ); |
---|
| 64 | // extern "C" { double nan( const char * ); } |
---|
| 65 | long double nan( const char * ); |
---|
[6e991d6] | 66 | |
---|
[dc5376a] | 67 | //---------------------- Exponential ---------------------- |
---|
[6e991d6] | 68 | |
---|
| 69 | float exp( float ); |
---|
[dc5376a] | 70 | // extern "C" { double exp( double ); } |
---|
[6e991d6] | 71 | long double exp( long double ); |
---|
| 72 | float _Complex exp( float _Complex ); |
---|
| 73 | double _Complex exp( double _Complex ); |
---|
| 74 | long double _Complex exp( long double _Complex ); |
---|
| 75 | |
---|
[dc5376a] | 76 | float exp2( float ); |
---|
| 77 | // extern "C" { double exp2( double ); } |
---|
| 78 | long double exp2( long double ); |
---|
| 79 | // float _Complex exp2( float _Complex ); |
---|
| 80 | // double _Complex exp2( double _Complex ); |
---|
| 81 | // long double _Complex exp2( long double _Complex ); |
---|
| 82 | |
---|
| 83 | float expm1( float ); |
---|
| 84 | // extern "C" { double expm1( double ); } |
---|
| 85 | long double expm1( long double ); |
---|
| 86 | |
---|
[6e991d6] | 87 | float log( float ); |
---|
[dc5376a] | 88 | // extern "C" { double log( double ); } |
---|
[6e991d6] | 89 | long double log( long double ); |
---|
| 90 | float _Complex log( float _Complex ); |
---|
| 91 | double _Complex log( double _Complex ); |
---|
| 92 | long double _Complex log( long double _Complex ); |
---|
| 93 | |
---|
[dc5376a] | 94 | float log2( float ); |
---|
| 95 | // extern "C" { double log2( double ); } |
---|
| 96 | long double log2( long double ); |
---|
| 97 | // float _Complex log2( float _Complex ); |
---|
| 98 | // double _Complex log2( double _Complex ); |
---|
| 99 | // long double _Complex log2( long double _Complex ); |
---|
| 100 | |
---|
| 101 | float log10( float ); |
---|
| 102 | // extern "C" { double log10( double ); } |
---|
| 103 | long double log10( long double ); |
---|
| 104 | // float _Complex log10( float _Complex ); |
---|
| 105 | // double _Complex log10( double _Complex ); |
---|
| 106 | // long double _Complex log10( long double _Complex ); |
---|
| 107 | |
---|
| 108 | float log1p( float ); |
---|
| 109 | // extern "C" { double log1p( double ); } |
---|
| 110 | long double log1p( long double ); |
---|
| 111 | |
---|
| 112 | int ilogb( float ); |
---|
| 113 | // extern "C" { int ilogb( double ); } |
---|
| 114 | int ilogb( long double ); |
---|
| 115 | |
---|
| 116 | float logb( float ); |
---|
| 117 | // extern "C" { double logb( double ); } |
---|
| 118 | long double logb( long double ); |
---|
| 119 | |
---|
| 120 | //---------------------- Power ---------------------- |
---|
[6e991d6] | 121 | |
---|
| 122 | float sqrt( float ); |
---|
[dc5376a] | 123 | // extern "C" { double sqrt( double ); } |
---|
[6e991d6] | 124 | long double sqrt( long double ); |
---|
| 125 | float _Complex sqrt( float _Complex ); |
---|
| 126 | double _Complex sqrt( double _Complex ); |
---|
| 127 | long double _Complex sqrt( long double _Complex ); |
---|
| 128 | |
---|
[dc5376a] | 129 | float cbrt( float ); |
---|
| 130 | // extern "C" { double cbrt( double ); } |
---|
| 131 | long double cbrt( long double ); |
---|
[6e991d6] | 132 | |
---|
[dc5376a] | 133 | float hypot( float, float ); |
---|
| 134 | // extern "C" { double hypot( double, double ); } |
---|
| 135 | long double hypot( long double, long double ); |
---|
[6e991d6] | 136 | |
---|
[dc5376a] | 137 | float pow( float, float ); |
---|
| 138 | // extern "C" { double pow( double, double ); } |
---|
| 139 | long double pow( long double, long double ); |
---|
| 140 | float _Complex pow( float _Complex, float _Complex ); |
---|
| 141 | double _Complex pow( double _Complex, double _Complex ); |
---|
| 142 | long double _Complex pow( long double _Complex, long double _Complex ); |
---|
[6e991d6] | 143 | |
---|
[dc5376a] | 144 | //---------------------- Trigonometric ---------------------- |
---|
[6e991d6] | 145 | |
---|
[dc5376a] | 146 | float sin( float ); |
---|
| 147 | // extern "C" { double sin( double ); } |
---|
| 148 | long double sin( long double ); |
---|
| 149 | float _Complex sin( float _Complex ); |
---|
| 150 | double _Complex sin( double _Complex ); |
---|
| 151 | long double _Complex sin( long double _Complex ); |
---|
[6e991d6] | 152 | |
---|
[dc5376a] | 153 | float cos( float ); |
---|
| 154 | // extern "C" { double cos( double ); } |
---|
| 155 | long double cos( long double ); |
---|
| 156 | float _Complex cos( float _Complex ); |
---|
| 157 | double _Complex cos( double _Complex ); |
---|
| 158 | long double _Complex cos( long double _Complex ); |
---|
[6e991d6] | 159 | |
---|
[dc5376a] | 160 | float tan( float ); |
---|
| 161 | // extern "C" { double tan( double ); } |
---|
| 162 | long double tan( long double ); |
---|
| 163 | float _Complex tan( float _Complex ); |
---|
| 164 | double _Complex tan( double _Complex ); |
---|
| 165 | long double _Complex tan( long double _Complex ); |
---|
[6e991d6] | 166 | |
---|
[dc5376a] | 167 | float asin( float ); |
---|
| 168 | // extern "C" { double asin( double ); } |
---|
| 169 | long double asin( long double ); |
---|
| 170 | float _Complex asin( float _Complex ); |
---|
| 171 | double _Complex asin( double _Complex ); |
---|
| 172 | long double _Complex asin( long double _Complex ); |
---|
[6e991d6] | 173 | |
---|
[dc5376a] | 174 | float acos( float ); |
---|
| 175 | // extern "C" { double acos( double ); } |
---|
| 176 | long double acos( long double ); |
---|
| 177 | float _Complex acos( float _Complex ); |
---|
| 178 | double _Complex acos( double _Complex ); |
---|
| 179 | long double _Complex acos( long double _Complex ); |
---|
[6e991d6] | 180 | |
---|
[dc5376a] | 181 | float atan( float ); |
---|
| 182 | // extern "C" { double atan( double ); } |
---|
| 183 | long double atan( long double ); |
---|
| 184 | float _Complex atan( float _Complex ); |
---|
| 185 | double _Complex atan( double _Complex ); |
---|
| 186 | long double _Complex atan( long double _Complex ); |
---|
[6e991d6] | 187 | |
---|
[dc5376a] | 188 | float atan2( float, float ); |
---|
[8884112] | 189 | // extern "C" { double atan2( double, double ); } |
---|
[dc5376a] | 190 | long double atan2( long double, long double ); |
---|
[6e991d6] | 191 | |
---|
[dc5376a] | 192 | float atan( float, float ); // alternative name for atan2 |
---|
| 193 | double atan( double, double ); |
---|
| 194 | long double atan( long double, long double ); |
---|
[6e991d6] | 195 | |
---|
[dc5376a] | 196 | //---------------------- Hyperbolic ---------------------- |
---|
[6e991d6] | 197 | |
---|
[dc5376a] | 198 | float sinh( float ); |
---|
| 199 | // extern "C" { double sinh( double ); } |
---|
| 200 | long double sinh( long double ); |
---|
| 201 | float _Complex sinh( float _Complex ); |
---|
| 202 | double _Complex sinh( double _Complex ); |
---|
| 203 | long double _Complex sinh( long double _Complex ); |
---|
[6e991d6] | 204 | |
---|
[dc5376a] | 205 | float cosh( float ); |
---|
| 206 | // extern "C" { double cosh( double ); } |
---|
| 207 | long double cosh( long double ); |
---|
| 208 | float _Complex cosh( float _Complex ); |
---|
| 209 | double _Complex cosh( double _Complex ); |
---|
| 210 | long double _Complex cosh( long double _Complex ); |
---|
[6e991d6] | 211 | |
---|
[dc5376a] | 212 | float tanh( float ); |
---|
| 213 | // extern "C" { double tanh( double ); } |
---|
| 214 | long double tanh( long double ); |
---|
| 215 | float _Complex tanh( float _Complex ); |
---|
| 216 | double _Complex tanh( double _Complex ); |
---|
| 217 | long double _Complex tanh( long double _Complex ); |
---|
[6e991d6] | 218 | |
---|
[dc5376a] | 219 | float asinh( float ); |
---|
| 220 | // extern "C" { double asinh( double ); } |
---|
| 221 | long double asinh( long double ); |
---|
| 222 | float _Complex asinh( float _Complex ); |
---|
| 223 | double _Complex asinh( double _Complex ); |
---|
| 224 | long double _Complex asinh( long double _Complex ); |
---|
| 225 | |
---|
| 226 | float acosh( float ); |
---|
| 227 | // extern "C" { double acosh( double ); } |
---|
| 228 | long double acosh( long double ); |
---|
| 229 | float _Complex acosh( float _Complex ); |
---|
| 230 | double _Complex acosh( double _Complex ); |
---|
| 231 | long double _Complex acosh( long double _Complex ); |
---|
| 232 | |
---|
| 233 | float atanh( float ); |
---|
| 234 | // extern "C" { double atanh( double ); } |
---|
| 235 | long double atanh( long double ); |
---|
| 236 | float _Complex atanh( float _Complex ); |
---|
| 237 | double _Complex atanh( double _Complex ); |
---|
| 238 | long double _Complex atanh( long double _Complex ); |
---|
| 239 | |
---|
| 240 | //---------------------- Error / Gamma ---------------------- |
---|
| 241 | |
---|
| 242 | float erf( float ); |
---|
| 243 | // extern "C" { double erf( double ); } |
---|
| 244 | long double erf( long double ); |
---|
| 245 | // float _Complex erf( float _Complex ); |
---|
| 246 | // double _Complex erf( double _Complex ); |
---|
| 247 | // long double _Complex erf( long double _Complex ); |
---|
| 248 | |
---|
| 249 | float erfc( float ); |
---|
| 250 | // extern "C" { double erfc( double ); } |
---|
| 251 | long double erfc( long double ); |
---|
| 252 | // float _Complex erfc( float _Complex ); |
---|
| 253 | // double _Complex erfc( double _Complex ); |
---|
| 254 | // long double _Complex erfc( long double _Complex ); |
---|
[6e991d6] | 255 | |
---|
| 256 | float lgamma( float ); |
---|
[dc5376a] | 257 | // extern "C" { double lgamma( double ); } |
---|
[6e991d6] | 258 | long double lgamma( long double ); |
---|
[dc5376a] | 259 | float lgamma( float, int * ); |
---|
| 260 | double lgamma( double, int * ); |
---|
| 261 | long double lgamma( long double, int * ); |
---|
| 262 | |
---|
| 263 | float tgamma( float ); |
---|
| 264 | // extern "C" { double tgamma( double ); } |
---|
| 265 | long double tgamma( long double ); |
---|
[6e991d6] | 266 | |
---|
[dc5376a] | 267 | //---------------------- Nearest Integer ---------------------- |
---|
| 268 | |
---|
| 269 | float floor( float ); |
---|
| 270 | // extern "C" { double floor( double ); } |
---|
| 271 | long double floor( long double ); |
---|
| 272 | |
---|
| 273 | float ceil( float ); |
---|
| 274 | // extern "C" { double ceil( double ); } |
---|
| 275 | long double ceil( long double ); |
---|
| 276 | |
---|
| 277 | float trunc( float ); |
---|
| 278 | // extern "C" { double trunc( double ); } |
---|
| 279 | long double trunc( long double ); |
---|
| 280 | |
---|
| 281 | float rint( float ); |
---|
| 282 | long double rint( long double ); |
---|
| 283 | long int rint( float ); |
---|
| 284 | long int rint( double ); |
---|
| 285 | long int rint( long double ); |
---|
| 286 | long long int rint( float ); |
---|
| 287 | long long int rint( double ); |
---|
| 288 | long long int rint( long double ); |
---|
[6e991d6] | 289 | |
---|
| 290 | long int lrint( float ); |
---|
[dc5376a] | 291 | // extern "C" { long int lrint( double ); } |
---|
[6e991d6] | 292 | long int lrint( long double ); |
---|
| 293 | long long int llrint( float ); |
---|
[dc5376a] | 294 | // extern "C" { long long int llrint( double ); } |
---|
[6e991d6] | 295 | long long int llrint( long double ); |
---|
| 296 | |
---|
[dc5376a] | 297 | float nearbyint( float ); |
---|
| 298 | // extern "C" { double nearbyint( double ); } |
---|
| 299 | long double nearbyint( long double ); |
---|
| 300 | |
---|
| 301 | float round( float ); |
---|
| 302 | long double round( long double ); |
---|
| 303 | long int round( float ); |
---|
| 304 | long int round( double ); |
---|
| 305 | long int round( long double ); |
---|
| 306 | long long int round( float ); |
---|
| 307 | long long int round( double ); |
---|
| 308 | long long int round( long double ); |
---|
[6e991d6] | 309 | |
---|
| 310 | long int lround( float ); |
---|
[dc5376a] | 311 | // extern "C" { long int lround( double ); } |
---|
[6e991d6] | 312 | long int lround( long double ); |
---|
| 313 | long long int llround( float ); |
---|
[dc5376a] | 314 | // extern "C" { long long int llround( double ); } |
---|
[6e991d6] | 315 | long long int llround( long double ); |
---|
| 316 | |
---|
[dc5376a] | 317 | //---------------------- Manipulation ---------------------- |
---|
[6e991d6] | 318 | |
---|
[dc5376a] | 319 | float copysign( float, float ); |
---|
| 320 | // extern "C" { double copysign( double, double ); } |
---|
| 321 | long double copysign( long double, long double ); |
---|
[6e991d6] | 322 | |
---|
[dc5376a] | 323 | float frexp( float, int * ); |
---|
| 324 | // extern "C" { double frexp( double, int * ); } |
---|
| 325 | long double frexp( long double, int * ); |
---|
[6e991d6] | 326 | |
---|
[dc5376a] | 327 | float ldexp( float, int ); |
---|
| 328 | // extern "C" { double ldexp( double, int ); } |
---|
| 329 | long double ldexp( long double, int ); |
---|
[6e991d6] | 330 | |
---|
[dc5376a] | 331 | [ float, float ] modf( float ); |
---|
| 332 | float modf( float, float * ); |
---|
| 333 | [ double, double ] modf( double ); |
---|
| 334 | // extern "C" { double modf( double, double * ); } |
---|
| 335 | [ long double, long double ] modf( long double ); |
---|
| 336 | long double modf( long double, long double * ); |
---|
[6e991d6] | 337 | |
---|
| 338 | float nextafter( float, float ); |
---|
[dc5376a] | 339 | // extern "C" { double nextafter( double, double ); } |
---|
[6e991d6] | 340 | long double nextafter( long double, long double ); |
---|
| 341 | |
---|
| 342 | float nexttoward( float, long double ); |
---|
[dc5376a] | 343 | // extern "C" { double nexttoward( double, long double ); } |
---|
[6e991d6] | 344 | long double nexttoward( long double, long double ); |
---|
| 345 | |
---|
| 346 | float scalbn( float, int ); |
---|
[dc5376a] | 347 | // extern "C" { double scalbn( double, int ); } |
---|
[6e991d6] | 348 | long double scalbn( long double, int ); |
---|
| 349 | |
---|
| 350 | float scalbln( float, long int ); |
---|
[dc5376a] | 351 | // extern "C" { double scalbln( double, long int ); } |
---|
[6e991d6] | 352 | long double scalbln( long double, long int ); |
---|
| 353 | |
---|
[17e5e2b] | 354 | #endif // MATH_H |
---|
| 355 | |
---|
[6e991d6] | 356 | // Local Variables: // |
---|
| 357 | // mode: c // |
---|
| 358 | // tab-width: 4 // |
---|
| 359 | // End: // |
---|