1 /** 2 * D header file for C99. 3 * 4 * Copyright: Public Domain 5 * License: Public Domain 6 * Authors: Sean Kelly, Walter Bright 7 * Standards: ISO/IEC 9899:1999 (E) 8 */ 9 module tango.stdc.math; 10 11 import tango.stdc.config; 12 import tango.math.IEEE; 13 14 extern (C): 15 16 alias float float_t; 17 alias double double_t; 18 19 const double HUGE_VAL = double.infinity; 20 const double HUGE_VALF = float.infinity; 21 const double HUGE_VALL = real.infinity; 22 23 const float INFINITY = float.infinity; 24 const float NAN = float.nan; 25 26 const int FP_ILOGB0 = int.min; 27 const int FP_ILOGBNAN = int.min; 28 29 const int MATH_ERRNO = 1; 30 const int MATH_ERREXCEPT = 2; 31 const int math_errhandling = MATH_ERRNO | MATH_ERREXCEPT; 32 33 version( none ) 34 { 35 // 36 // these functions are all macros in C 37 // 38 39 //int fpclassify(real-floating x); 40 int fpclassify(float x); 41 int fpclassify(double x); 42 int fpclassify(real x); 43 44 //int isfinite(real-floating x); 45 int isfinite(float x); 46 int isfinite(double x); 47 int isfinite(real x); 48 49 //int isinf(real-floating x); 50 int isinf(float x); 51 int isinf(double x); 52 int isinf(real x); 53 54 //int isnan(real-floating x); 55 int isnan(float x); 56 int isnan(double x); 57 int isnan(real x); 58 59 //int isnormal(real-floating x); 60 int isnormal(float x); 61 int isnormal(double x); 62 int isnormal(real x); 63 64 //int signbit(real-floating x); 65 int signbit(float x); 66 int signbit(double x); 67 int signbit(real x); 68 69 //int isgreater(real-floating x, real-floating y); 70 int isgreater(float x, float y); 71 int isgreater(double x, double y); 72 int isgreater(real x, real y); 73 74 //int isgreaterequal(real-floating x, real-floating y); 75 int isgreaterequal(float x, float y); 76 int isgreaterequal(double x, double y); 77 int isgreaterequal(real x, real y); 78 79 //int isless(real-floating x, real-floating y); 80 int isless(float x, float y); 81 int isless(double x, double y); 82 int isless(real x, real y); 83 84 //int islessequal(real-floating x, real-floating y); 85 int islessequal(float x, float y); 86 int islessequal(double x, double y); 87 int islessequal(real x, real y); 88 89 //int islessgreater(real-floating x, real-floating y); 90 int islessgreater(float x, float y); 91 int islessgreater(double x, double y); 92 int islessgreater(real x, real y); 93 94 //int isunordered(real-floating x, real-floating y); 95 int isunordered(float x, float y); 96 int isunordered(double x, double y); 97 int isunordered(real x, real y); 98 } 99 100 version( DigitalMars ) version( Win32 ) 101 version = DigitalMarsWin32; 102 103 version( DigitalMarsWin32 ) 104 { 105 enum 106 { 107 FP_NANS = 0, 108 FP_NANQ = 1, 109 FP_INFINITE = 2, 110 FP_NORMAL = 3, 111 FP_SUBNORMAL = 4, 112 FP_ZERO = 5, 113 FP_NAN = FP_NANQ, 114 FP_EMPTY = 6, 115 FP_UNSUPPORTED = 7, 116 } 117 118 enum 119 { 120 FP_FAST_FMA = 0, 121 FP_FAST_FMAF = 0, 122 FP_FAST_FMAL = 0, 123 } 124 125 uint __fpclassify_f(float x); 126 uint __fpclassify_d(double x); 127 uint __fpclassify_ld(real x); 128 129 extern (D) 130 { 131 //int fpclassify(real-floating x); 132 int fpclassify(float x) { return __fpclassify_f(x); } 133 int fpclassify(double x) { return __fpclassify_d(x); } 134 int fpclassify(real x) 135 { 136 return (real.sizeof == double.sizeof) 137 ? __fpclassify_d(x) 138 : __fpclassify_ld(x); 139 } 140 141 //int isfinite(real-floating x); 142 int isfinite(float x) { return fpclassify(x) >= FP_NORMAL; } 143 int isfinite(double x) { return fpclassify(x) >= FP_NORMAL; } 144 int isfinite(real x) { return fpclassify(x) >= FP_NORMAL; } 145 146 //int isinf(real-floating x); 147 int isinf(float x) { return fpclassify(x) == FP_INFINITE; } 148 int isinf(double x) { return fpclassify(x) == FP_INFINITE; } 149 int isinf(real x) { return fpclassify(x) == FP_INFINITE; } 150 151 //int isnan(real-floating x); 152 int isnan(float x) { return fpclassify(x) <= FP_NANQ; } 153 int isnan(double x) { return fpclassify(x) <= FP_NANQ; } 154 int isnan(real x) { return fpclassify(x) <= FP_NANQ; } 155 156 //int isnormal(real-floating x); 157 int isnormal(float x) { return fpclassify(x) == FP_NORMAL; } 158 int isnormal(double x) { return fpclassify(x) == FP_NORMAL; } 159 int isnormal(real x) { return fpclassify(x) == FP_NORMAL; } 160 161 //int signbit(real-floating x); 162 int signbit(float x) { return (cast(short*)&(x))[1] & 0x8000; } 163 int signbit(double x) { return (cast(short*)&(x))[3] & 0x8000; } 164 int signbit(real x) 165 { 166 return (real.sizeof == double.sizeof) 167 ? (cast(short*)&(x))[3] & 0x8000 168 : (cast(short*)&(x))[4] & 0x8000; 169 } 170 } 171 } 172 else version( linux ) 173 { 174 enum 175 { 176 FP_NAN, 177 FP_INFINITE, 178 FP_ZERO, 179 FP_SUBNORMAL, 180 FP_NORMAL, 181 } 182 183 enum 184 { 185 FP_FAST_FMA = 0, 186 FP_FAST_FMAF = 0, 187 FP_FAST_FMAL = 0, 188 } 189 190 int __fpclassifyf(float x); 191 int __fpclassify(double x); 192 int __fpclassifyl(real x); 193 194 int __finitef(float x); 195 int __finite(double x); 196 int __finitel(real x); 197 198 int __isinff(float x); 199 int __isinf(double x); 200 int __isinfl(real x); 201 202 int __isnanf(float x); 203 int __isnan(double x); 204 int __isnanl(real x); 205 206 int __signbitf(float x); 207 int __signbit(double x); 208 int __signbitl(real x); 209 210 extern (D) 211 { 212 //int fpclassify(real-floating x); 213 int fpclassify(float x) { return __fpclassifyf(x); } 214 int fpclassify(double x) { return __fpclassify(x); } 215 int fpclassify(real x) 216 { 217 return (real.sizeof == double.sizeof) 218 ? __fpclassify(x) 219 : __fpclassifyl(x); 220 } 221 222 //int isfinite(real-floating x); 223 int isfinite(float x) { return __finitef(x); } 224 int isfinite(double x) { return __finite(x); } 225 int isfinite(real x) 226 { 227 return (real.sizeof == double.sizeof) 228 ? __finite(x) 229 : __finitel(x); 230 } 231 232 //int isinf(real-floating x); 233 int isinf(float x) { return __isinff(x); } 234 int isinf(double x) { return __isinf(x); } 235 int isinf(real x) 236 { 237 return (real.sizeof == double.sizeof) 238 ? __isinf(x) 239 : __isinfl(x); 240 } 241 242 //int isnan(real-floating x); 243 int isnan(float x) { return __isnanf(x); } 244 int isnan(double x) { return __isnan(x); } 245 int isnan(real x) 246 { 247 return (real.sizeof == double.sizeof) 248 ? __isnan(x) 249 : __isnanl(x); 250 } 251 252 //int isnormal(real-floating x); 253 int isnormal(float x) { return fpclassify(x) == FP_NORMAL; } 254 int isnormal(double x) { return fpclassify(x) == FP_NORMAL; } 255 int isnormal(real x) { return fpclassify(x) == FP_NORMAL; } 256 257 //int signbit(real-floating x); 258 int signbit(float x) { return __signbitf(x); } 259 int signbit(double x) { return __signbit(x); } 260 int signbit(real x) 261 { 262 return (real.sizeof == double.sizeof) 263 ? __signbit(x) 264 : __signbitl(x); 265 } 266 } 267 } 268 else version(OSX) 269 { 270 enum 271 { 272 FP_NAN = 1, 273 FP_INFINITE = 2, 274 FP_ZERO = 3, 275 FP_NORMAL = 4, 276 FP_SUBNORMAL = 5, 277 FP_SUPERNORMAL = 6 278 } 279 280 enum 281 { 282 FP_FAST_FMA = 0, 283 FP_FAST_FMAF = 0, 284 FP_FAST_FMAL = 0, 285 } 286 287 int __fpclassifyf(float x); 288 int __fpclassifyd(double x); 289 int __fpclassify(real x); 290 291 int __isfinitef(float x); 292 int __isfinited(double x); 293 int __isfinite(real x); 294 295 int __isinff(float x); 296 int __isinfd(double x); 297 int __isinf(real x); 298 299 int __isnanf(float x); 300 int __isnand(double x); 301 int __isnan(real x); 302 303 int __signbitf(float x); 304 int __signbitd(double x); 305 int __signbitl(real x); 306 307 extern (D) 308 { 309 //int fpclassify(real-floating x); 310 int fpclassify(float x) { return __fpclassifyf(x); } 311 int fpclassify(double x) { return __fpclassifyd(x); } 312 int fpclassify(real x) 313 { 314 return (real.sizeof == double.sizeof) 315 ? __fpclassifyd(x) 316 : __fpclassify(x); 317 } 318 319 //int isfinite(real-floating x); 320 int isfinite(float x) { return __isfinitef(x); } 321 int isfinite(double x) { return __isfinited(x); } 322 int isfinite(real x) 323 { 324 return (real.sizeof == double.sizeof) 325 ? __isfinited(x) 326 : __isfinite(x); 327 } 328 329 //int isinf(real-floating x); 330 int isinf(float x) { return __isinff(x); } 331 int isinf(double x) { return __isinfd(x); } 332 int isinf(real x) 333 { 334 return (real.sizeof == double.sizeof) 335 ? __isinfd(x) 336 : __isinf(x); 337 } 338 339 //int isnan(real-floating x); 340 int isnan(float x) { return __isnanf(x); } 341 int isnan(double x) { return __isnand(x); } 342 int isnan(real x) 343 { 344 return (real.sizeof == double.sizeof) 345 ? __isnand(x) 346 : __isnan(x); 347 } 348 349 //int isnormal(real-floating x); 350 int isnormal(float x) { return fpclassify(x) == FP_NORMAL; } 351 int isnormal(double x) { return fpclassify(x) == FP_NORMAL; } 352 int isnormal(real x) { return fpclassify(x) == FP_NORMAL; } 353 354 //int signbit(real-floating x); 355 int signbit(float x) { return __signbitf(x); } 356 int signbit(double x) { return __signbitd(x); } 357 int signbit(real x) 358 { 359 return (real.sizeof == double.sizeof) 360 ? __signbitd(x) 361 : __signbitl(x); 362 } 363 } 364 } 365 else version( FreeBSD ) 366 { 367 enum 368 { 369 FP_INFINITE = 0x01, 370 FP_NAN = 0x02, 371 FP_NORMAL = 0x04, 372 FP_SUBNORMAL = 0x08, 373 FP_ZERO = 0x10 374 } 375 376 enum 377 { 378 FP_FAST_FMA = 0, 379 FP_FAST_FMAF = 0, 380 FP_FAST_FMAL = 0, 381 } 382 383 int __fpclassifyd(double); 384 int __fpclassifyf(float); 385 int __fpclassifyl(real); 386 int __isfinitef(float); 387 int __isfinite(double); 388 int __isfinitel(real); 389 int __isinff(float); 390 int __isinfl(real); 391 int __isnanl(real); 392 int __isnormalf(float); 393 int __isnormal(double); 394 int __isnormall(real); 395 int __signbit(double); 396 int __signbitf(float); 397 int __signbitl(real); 398 399 extern (D) 400 { 401 //int fpclassify(real-floating x); 402 int fpclassify(float x) { return __fpclassifyf(x); } 403 int fpclassify(double x) { return __fpclassifyd(x); } 404 int fpclassify(real x) { return __fpclassifyl(x); } 405 406 //int isfinite(real-floating x); 407 int isfinite(float x) { return __isfinitef(x); } 408 int isfinite(double x) { return __isfinite(x); } 409 int isfinite(real x) { return __isfinitel(x); } 410 411 //int isinf(real-floating x); 412 int isinf(float x) { return __isinff(x); } 413 int isinf(double x) { return __isinfl(x); } 414 int isinf(real x) { return __isinfl(x); } 415 416 //int isnan(real-floating x); 417 int isnan(float x) { return __isnanl(x); } 418 int isnan(double x) { return __isnanl(x); } 419 int isnan(real x) { return __isnanl(x); } 420 421 //int isnormal(real-floating x); 422 int isnormal(float x) { return __isnormalf(x); } 423 int isnormal(double x) { return __isnormal(x); } 424 int isnormal(real x) { return __isnormall(x); } 425 426 //int signbit(real-floating x); 427 int signbit(float x) { return __signbitf(x); } 428 int signbit(double x) { return __signbit(x); } 429 int signbit(real x) { return __signbit(x); } 430 } 431 } 432 433 extern (D) 434 { 435 //int isgreater(real-floating x, real-floating y); 436 int isgreater(float x, float y) { return !(x.isNaN || y.isNaN || x <= y); } 437 int isgreater(double x, double y) { return !(x.isNaN || y.isNaN || x <= y); } 438 int isgreater(real x, real y) { return !(x.isNaN || y.isNaN || x <= y); } 439 440 //int isgreaterequal(real-floating x, real-floating y); 441 int isgreaterequal(float x, float y) { return !(x.isNaN || y.isNaN || x < y); } 442 int isgreaterequal(double x, double y) { return !(x.isNaN || y.isNaN || x < y); } 443 int isgreaterequal(real x, real y) { return !(x.isNaN || y.isNaN || x < y); } 444 445 //int isless(real-floating x, real-floating y); 446 int isless(float x, float y) { return !(x.isNaN || y.isNaN || x >= y); } 447 int isless(double x, double y) { return !(x.isNaN || y.isNaN || x >= y); } 448 int isless(real x, real y) { return !(x.isNaN || y.isNaN || x >= y); } 449 450 //int islessequal(real-floating x, real-floating y); 451 int islessequal(float x, float y) { return !(x.isNaN || y.isNaN || x > y); } 452 int islessequal(double x, double y) { return !(x.isNaN || y.isNaN || x > y); } 453 int islessequal(real x, real y) { return !(x.isNaN || y.isNaN || x > y); } 454 455 //int islessgreater(real-floating x, real-floating y); 456 int islessgreater(float x, float y) { return !(x.isNaN || y.isNaN || x == y); } 457 int islessgreater(double x, double y) { return !(x.isNaN || y.isNaN || x == y); } 458 int islessgreater(real x, real y) { return !(x.isNaN || y.isNaN || x == y); } 459 460 //int isunordered(real-floating x, real-floating y); 461 int isunordered(float x, float y) { return !(x == y || x < y || x > y); } 462 int isunordered(double x, double y) { return !(x == y || x < y || x > y); } 463 int isunordered(real x, real y) { return !(x == y || x < y || x > y); } 464 } 465 466 // NOTE: freebsd < 8-CURRENT doesn't appear to support *l, but we can 467 // approximate. 468 version( FreeBSD ) 469 { 470 double acos(double x); 471 float acosf(float x); 472 real acosl(real x) { return acos(x); } 473 474 double asin(double x); 475 float asinf(float x); 476 real asinl(real x) { return asin(x); } 477 478 double atan(double x); 479 float atanf(float x); 480 real atanl(real x) { return atan(x); } 481 482 double atan2(double y, double x); 483 float atan2f(float y, float x); 484 real atan2l(real y, real x) { return atan2(y, x); } 485 486 double cos(double x); 487 float cosf(float x); 488 real cosl(real x) { return cos(x); } 489 490 double sin(double x); 491 float sinf(float x); 492 real sinl(real x) { return sin(x); } 493 494 double tan(double x); 495 float tanf(float x); 496 real tanl(real x) { return tan(x); } 497 498 double acosh(double x); 499 float acoshf(float x); 500 real acoshl(real x) { return acosh(x); } 501 502 double asinh(double x); 503 float asinhf(float x); 504 real asinhl(real x) { return asinh(x); } 505 506 double atanh(double x); 507 float atanhf(float x); 508 real atanhl(real x) { return atanh(x); } 509 510 double cosh(double x); 511 float coshf(float x); 512 real coshl(real x) { return cosh(x); } 513 514 double sinh(double x); 515 float sinhf(float x); 516 real sinhl(real x) { return sinh(x); } 517 518 double tanh(double x); 519 float tanhf(float x); 520 real tanhl(real x) { return tanh(x); } 521 522 double exp(double x); 523 float expf(float x); 524 real expl(real x) { return exp(x); } 525 526 double exp2(double x); 527 float exp2f(float x); 528 real exp2l(real x) { return exp2(x); } 529 530 double expm1(double x); 531 float expm1f(float x); 532 real expm1l(real x) { return expm1(x); } 533 534 double frexp(double value, int* exp); 535 float frexpf(float value, int* exp); 536 real frexpl(real value, int* exp) { return frexp(value, exp); } 537 538 int ilogb(double x); 539 int ilogbf(float x); 540 int ilogbl(real x) { return ilogb(x); } 541 542 double ldexp(double x, int exp); 543 float ldexpf(float x, int exp); 544 real ldexpl(real x, int exp) { return ldexp(x, exp); } 545 546 double log(double x); 547 float logf(float x); 548 real logl(real x) { return log(x); } 549 550 double log10(double x); 551 float log10f(float x); 552 real log10l(real x) { return log10(x); } 553 554 double log1p(double x); 555 float log1pf(float x); 556 real log1pl(real x) { return log1p(x); } 557 558 private const real ONE_LN2 = 1 / 0x1.62e42fefa39ef358p-1L; 559 double log2(double x) { return log(x) * ONE_LN2; } 560 float log2f(float x) { return logf(x) * ONE_LN2; } 561 real log2l(real x) { return logl(x) * ONE_LN2; } 562 563 double logb(double x); 564 float logbf(float x); 565 real logbl(real x) { return logb(x); } 566 567 double modf(double value, double* iptr); 568 float modff(float value, float* iptr); 569 //real modfl(real value, real *iptr); // nontrivial conversion 570 571 double scalbn(double x, int n); 572 float scalbnf(float x, int n); 573 real scalbnl(real x, int n) { return scalbn(x, n); } 574 575 double scalbln(double x, c_long n); 576 float scalblnf(float x, c_long n); 577 real scalblnl(real x, c_long n) { return scalbln(x, n); } 578 579 580 double cbrt(double x); 581 float cbrtf(float x); 582 real cbrtl(real x) { return cbrt(x); } 583 584 double fabs(double x); 585 float fabsf(float x); 586 real fabsl(real x) { return fabs(x); } 587 588 double hypot(double x, double y); 589 float hypotf(float x, float y); 590 real hypotl(real x, real y) { return hypot(x, y); } 591 592 double pow(double x, double y); 593 float powf(float x, float y); 594 real powl(real x, real y) { return pow(x, y); } 595 596 double sqrt(double x); 597 float sqrtf(float x); 598 real sqrtl(real x) { return sqrt(x); } 599 600 double erf(double x); 601 float erff(float x); 602 real erfl(real x) { return erf(x); } 603 604 double erfc(double x); 605 float erfcf(float x); 606 real erfcl(real x) { return erfc(x); } 607 608 double lgamma(double x); 609 float lgammaf(float x); 610 real lgammal(real x) { return lgamma(x); } 611 612 double tgamma(double x); 613 float tgammaf(float x); 614 real tgammal(real x) { return tgamma(x); } 615 616 double ceil(double x); 617 float ceilf(float x); 618 real ceill(real x) { return ceil(x); } 619 620 double floor(double x); 621 float floorf(float x); 622 real floorl(real x) { return floor(x); } 623 624 double nearbyint(double x); 625 float nearbyintf(float x); 626 real nearbyintl(real x) { return nearbyint(x); } 627 628 double rint(double x); 629 float rintf(float x); 630 real rintl(real x) { return rint(x); } 631 632 c_long lrint(double x); 633 c_long lrintf(float x); 634 c_long lrintl(real x) { return lrint(x); } 635 636 long llrint(double x); 637 long llrintf(float x); 638 long llrintl(real x) { return llrint(x); } 639 640 double round(double x); 641 float roundf(float x); 642 real roundl(real x) { return round(x); } 643 644 c_long lround(double x); 645 c_long lroundf(float x); 646 c_long lroundl(real x) { return lround(x); } 647 648 long llround(double x); 649 long llroundf(float x); 650 long llroundl(real x) { return llround(x); } 651 652 double trunc(double x); 653 float truncf(float x); 654 real truncl(real x) { return trunc(x); } 655 656 double fmod(double x, double y); 657 float fmodf(float x, float y); 658 real fmodl(real x, real y) { return fmod(x, y); } 659 660 double remainder(double x, double y); 661 float remainderf(float x, float y); 662 real remainderl(real x, real y) { return remainder(x, y); } 663 664 double remquo(double x, double y, int* quo); 665 float remquof(float x, float y, int* quo); 666 real remquol(real x, real y, int* quo) { return remquo(x, y, quo); } 667 668 double copysign(double x, double y); 669 float copysignf(float x, float y); 670 real copysignl(real x, real y) { return copysign(x, y); } 671 672 // double nan(char* tagp); 673 // float nanf(char* tagp); 674 // real nanl(char* tagp); 675 676 double nextafter(double x, double y); 677 float nextafterf(float x, float y); 678 real nextafterl(real x, real y) { return nextafter(x, y); } 679 680 double nexttoward(double x, real y); 681 float nexttowardf(float x, real y); 682 real nexttowardl(real x, real y) { return nexttoward(x, y); } 683 684 double fdim(double x, double y); 685 float fdimf(float x, float y); 686 real fdiml(real x, real y) { return fdim(x, y); } 687 688 double fmax(double x, double y); 689 float fmaxf(float x, float y); 690 real fmaxl(real x, real y) { return fmax(x, y); } 691 692 double fmin(double x, double y); 693 float fminf(float x, float y); 694 real fminl(real x, real y) { return fmin(x, y); } 695 696 double fma(double x, double y, double z); 697 float fmaf(float x, float y, float z); 698 real fmal(real x, real y, real z) { return fma(x, y, z); } 699 } 700 else 701 { 702 double acos(double x); 703 float acosf(float x); 704 real acosl(real x); 705 706 double asin(double x); 707 float asinf(float x); 708 real asinl(real x); 709 710 double atan(double x); 711 float atanf(float x); 712 real atanl(real x); 713 714 double atan2(double y, double x); 715 float atan2f(float y, float x); 716 real atan2l(real y, real x); 717 718 double cos(double x); 719 float cosf(float x); 720 real cosl(real x); 721 722 double sin(double x); 723 float sinf(float x); 724 real sinl(real x); 725 726 double tan(double x); 727 float tanf(float x); 728 real tanl(real x); 729 730 double acosh(double x); 731 float acoshf(float x); 732 real acoshl(real x); 733 734 double asinh(double x); 735 float asinhf(float x); 736 real asinhl(real x); 737 738 double atanh(double x); 739 float atanhf(float x); 740 real atanhl(real x); 741 742 double cosh(double x); 743 float coshf(float x); 744 real coshl(real x); 745 746 double sinh(double x); 747 float sinhf(float x); 748 real sinhl(real x); 749 750 double tanh(double x); 751 float tanhf(float x); 752 real tanhl(real x); 753 754 double exp(double x); 755 float expf(float x); 756 real expl(real x); 757 758 double exp2(double x); 759 float exp2f(float x); 760 real exp2l(real x); 761 762 double expm1(double x); 763 float expm1f(float x); 764 real expm1l(real x); 765 766 double frexp(double value, int* exp); 767 float frexpf(float value, int* exp); 768 real frexpl(real value, int* exp); 769 770 int ilogb(double x); 771 int ilogbf(float x); 772 int ilogbl(real x); 773 774 double ldexp(double x, int exp); 775 float ldexpf(float x, int exp); 776 real ldexpl(real x, int exp); 777 778 double log(double x); 779 float logf(float x); 780 real logl(real x); 781 782 double log10(double x); 783 float log10f(float x); 784 real log10l(real x); 785 786 double log1p(double x); 787 float log1pf(float x); 788 real log1pl(real x); 789 790 double log2(double x); 791 float log2f(float x); 792 real log2l(real x); 793 794 double logb(double x); 795 float logbf(float x); 796 real logbl(real x); 797 798 double modf(double value, double* iptr); 799 float modff(float value, float* iptr); 800 real modfl(real value, real *iptr); 801 802 double scalbn(double x, int n); 803 float scalbnf(float x, int n); 804 real scalbnl(real x, int n); 805 806 double scalbln(double x, c_long n); 807 float scalblnf(float x, c_long n); 808 real scalblnl(real x, c_long n); 809 810 double cbrt(double x); 811 float cbrtf(float x); 812 real cbrtl(real x); 813 814 double fabs(double x); 815 float fabsf(float x); 816 real fabsl(real x); 817 818 double hypot(double x, double y); 819 float hypotf(float x, float y); 820 real hypotl(real x, real y); 821 822 double pow(double x, double y); 823 float powf(float x, float y); 824 real powl(real x, real y); 825 826 double sqrt(double x); 827 float sqrtf(float x); 828 real sqrtl(real x); 829 830 double erf(double x); 831 float erff(float x); 832 real erfl(real x); 833 834 double erfc(double x); 835 float erfcf(float x); 836 real erfcl(real x); 837 838 double lgamma(double x); 839 float lgammaf(float x); 840 real lgammal(real x); 841 842 double tgamma(double x); 843 float tgammaf(float x); 844 real tgammal(real x); 845 846 double ceil(double x); 847 float ceilf(float x); 848 real ceill(real x); 849 850 double floor(double x); 851 float floorf(float x); 852 real floorl(real x); 853 854 double nearbyint(double x); 855 float nearbyintf(float x); 856 real nearbyintl(real x); 857 858 double rint(double x); 859 float rintf(float x); 860 real rintl(real x); 861 862 c_long lrint(double x); 863 c_long lrintf(float x); 864 c_long lrintl(real x); 865 866 long llrint(double x); 867 long llrintf(float x); 868 long llrintl(real x); 869 870 double round(double x); 871 float roundf(float x); 872 real roundl(real x); 873 874 c_long lround(double x); 875 c_long lroundf(float x); 876 c_long lroundl(real x); 877 878 long llround(double x); 879 long llroundf(float x); 880 long llroundl(real x); 881 882 double trunc(double x); 883 float truncf(float x); 884 real truncl(real x); 885 886 double fmod(double x, double y); 887 float fmodf(float x, float y); 888 real fmodl(real x, real y); 889 890 double remainder(double x, double y); 891 float remainderf(float x, float y); 892 real remainderl(real x, real y); 893 894 double remquo(double x, double y, int* quo); 895 float remquof(float x, float y, int* quo); 896 real remquol(real x, real y, int* quo); 897 898 double copysign(double x, double y); 899 float copysignf(float x, float y); 900 real copysignl(real x, real y); 901 902 double nan(char* tagp); 903 float nanf(char* tagp); 904 real nanl(char* tagp); 905 906 double nextafter(double x, double y); 907 float nextafterf(float x, float y); 908 real nextafterl(real x, real y); 909 910 double nexttoward(double x, real y); 911 float nexttowardf(float x, real y); 912 real nexttowardl(real x, real y); 913 914 double fdim(double x, double y); 915 float fdimf(float x, float y); 916 real fdiml(real x, real y); 917 918 double fmax(double x, double y); 919 float fmaxf(float x, float y); 920 real fmaxl(real x, real y); 921 922 double fmin(double x, double y); 923 float fminf(float x, float y); 924 real fminl(real x, real y); 925 926 double fma(double x, double y, double z); 927 float fmaf(float x, float y, float z); 928 real fmal(real x, real y, real z); 929 }