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