1 /** 2 * D header file for C99. 3 * 4 * $(C_HEADER_DESCRIPTION pubs.opengroup.org/onlinepubs/009695399/basedefs/_math.h.html, _math.h) 5 * 6 * Copyright: Copyright Sean Kelly 2005 - 2012. 7 * License: Distributed under the 8 * $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0). 9 * (See accompanying file LICENSE) 10 * Authors: Sean Kelly 11 * Source: $(DRUNTIMESRC core/stdc/_math.d) 12 */ 13 14 module core.stdc.math; 15 16 import core.stdc.config; 17 18 version (OSX) 19 version = Darwin; 20 else version (iOS) 21 version = Darwin; 22 else version (TVOS) 23 version = Darwin; 24 else version (WatchOS) 25 version = Darwin; 26 27 version (ARM) version = ARM_Any; 28 version (AArch64) version = ARM_Any; 29 version (HPPA) version = HPPA_Any; 30 version (MIPS32) version = MIPS_Any; 31 version (MIPS64) version = MIPS_Any; 32 version (PPC) version = PPC_Any; 33 version (PPC64) version = PPC_Any; 34 version (RISCV32) version = RISCV_Any; 35 version (RISCV64) version = RISCV_Any; 36 version (S390) version = IBMZ_Any; 37 version (SPARC) version = SPARC_Any; 38 version (SPARC64) version = SPARC_Any; 39 version (SystemZ) version = IBMZ_Any; 40 version (X86) version = X86_Any; 41 version (X86_64) version = X86_Any; 42 43 extern (C): 44 @trusted: // All functions here operate on floating point and integer values only. 45 nothrow: 46 @nogc: 47 48 /// 49 alias float float_t; 50 /// 51 alias double double_t; 52 53 /// 54 enum double HUGE_VAL = double.infinity; 55 /// 56 enum double HUGE_VALF = float.infinity; 57 /// 58 enum double HUGE_VALL = real.infinity; 59 60 /// 61 enum float INFINITY = float.infinity; 62 /// 63 enum float NAN = float.nan; 64 65 version (FreeBSD) 66 { 67 /// 68 enum int FP_ILOGB0 = -int.max; 69 /// 70 enum int FP_ILOGBNAN = int.max; 71 } 72 else version (NetBSD) 73 { 74 /// 75 enum int FP_ILOGB0 = -int.max; 76 /// 77 enum int FP_ILOGBNAN = int.max; 78 } 79 else version (OpenBSD) 80 { 81 /// 82 enum int FP_ILOGB0 = -int.max; 83 /// 84 enum int FP_ILOGBNAN = int.max; 85 } 86 else version (DragonFlyBSD) 87 { 88 /// 89 enum int FP_ILOGB0 = -int.max; 90 /// 91 enum int FP_ILOGBNAN = int.max; 92 } 93 else version (Solaris) 94 { 95 /// 96 enum int FP_ILOGB0 = -int.max; 97 /// 98 enum int FP_ILOGBNAN = int.max; 99 } 100 else version (CRuntime_Bionic) 101 { 102 /// 103 enum int FP_ILOGB0 = -int.max; 104 /// 105 enum int FP_ILOGBNAN = int.max; 106 } 107 else version (CRuntime_UClibc) 108 { 109 version (X86_Any) 110 { 111 /// 112 enum int FP_ILOGB0 = int.min; 113 /// 114 enum int FP_ILOGBNAN = int.min; 115 } 116 else version (MIPS_Any) 117 { 118 /// 119 enum int FP_ILOGB0 = -int.max; 120 /// 121 enum int FP_ILOGBNAN = int.max; 122 } 123 else version (ARM) 124 { 125 /// 126 enum int FP_ILOGB0 = -int.max; 127 /// 128 enum int FP_ILOGBNAN = int.max; 129 } 130 else 131 { 132 static assert(false, "Architecture not supported."); 133 } 134 } 135 else version (CRuntime_Glibc) 136 { 137 version (X86_Any) 138 { 139 /// 140 enum int FP_ILOGB0 = int.min; 141 /// 142 enum int FP_ILOGBNAN = int.min; 143 } 144 else version (ARM_Any) 145 { 146 /// 147 enum int FP_ILOGB0 = -int.max; 148 /// 149 enum int FP_ILOGBNAN = int.max; 150 } 151 else version (HPPA_Any) 152 { 153 /// 154 enum int FP_ILOGB0 = -int.max; 155 /// 156 enum int FP_ILOGBNAN = int.max; 157 } 158 else version (MIPS_Any) 159 { 160 /// 161 enum int FP_ILOGB0 = -int.max; 162 /// 163 enum int FP_ILOGBNAN = int.max; 164 } 165 else version (PPC_Any) 166 { 167 /// 168 enum int FP_ILOGB0 = -int.max; 169 /// 170 enum int FP_ILOGBNAN = int.max; 171 } 172 else version (RISCV_Any) 173 { 174 /// 175 enum int FP_ILOGB0 = -int.max; 176 /// 177 enum int FP_ILOGBNAN = int.max; 178 } 179 else version (SPARC_Any) 180 { 181 /// 182 enum int FP_ILOGB0 = -int.max; 183 /// 184 enum int FP_ILOGBNAN = int.max; 185 } 186 else version (IBMZ_Any) 187 { 188 /// 189 enum int FP_ILOGB0 = -int.max; 190 /// 191 enum int FP_ILOGBNAN = int.max; 192 } 193 else version (LoongArch64) 194 { 195 /// 196 enum int FP_ILOGB0 = -int.max; 197 /// 198 enum int FP_ILOGBNAN = int.max; 199 } 200 else 201 { 202 static assert(false, "Architecture not supported."); 203 } 204 } 205 else 206 { 207 /// 208 enum int FP_ILOGB0 = int.min; 209 /// 210 enum int FP_ILOGBNAN = int.min; 211 } 212 213 /// 214 enum int MATH_ERRNO = 1; 215 /// 216 enum int MATH_ERREXCEPT = 2; 217 /// 218 enum int math_errhandling = MATH_ERRNO | MATH_ERREXCEPT; 219 220 version (none) 221 { 222 // 223 // these functions are all macros in C 224 // 225 226 //int fpclassify(real-floating x); 227 pure int fpclassify(float x); 228 pure int fpclassify(double x); 229 pure int fpclassify(real x); 230 231 //int isfinite(real-floating x); 232 pure int isfinite(float x); 233 pure int isfinite(double x); 234 pure int isfinite(real x); 235 236 //int isinf(real-floating x); 237 pure int isinf(float x); 238 pure int isinf(double x); 239 pure int isinf(real x); 240 241 //int isnan(real-floating x); 242 pure int isnan(float x); 243 pure int isnan(double x); 244 pure int isnan(real x); 245 246 //int isnormal(real-floating x); 247 pure int isnormal(float x); 248 pure int isnormal(double x); 249 pure int isnormal(real x); 250 251 //int signbit(real-floating x); 252 pure int signbit(float x); 253 pure int signbit(double x); 254 pure int signbit(real x); 255 256 //int isgreater(real-floating x, real-floating y); 257 pure int isgreater(float x, float y); 258 pure int isgreater(double x, double y); 259 pure int isgreater(real x, real y); 260 261 //int isgreaterequal(real-floating x, real-floating y); 262 pure int isgreaterequal(float x, float y); 263 pure int isgreaterequal(double x, double y); 264 pure int isgreaterequal(real x, real y); 265 266 //int isless(real-floating x, real-floating y); 267 pure int isless(float x, float y); 268 pure int isless(double x, double y); 269 pure int isless(real x, real y); 270 271 //int islessequal(real-floating x, real-floating y); 272 pure int islessequal(float x, float y); 273 pure int islessequal(double x, double y); 274 pure int islessequal(real x, real y); 275 276 //int islessgreater(real-floating x, real-floating y); 277 pure int islessgreater(float x, float y); 278 pure int islessgreater(double x, double y); 279 pure int islessgreater(real x, real y); 280 281 //int isunordered(real-floating x, real-floating y); 282 pure int isunordered(float x, float y); 283 pure int isunordered(double x, double y); 284 pure int isunordered(real x, real y); 285 } 286 287 version (CRuntime_DigitalMars) 288 { 289 enum 290 { 291 /// 292 FP_NANS = 0, 293 /// 294 FP_NANQ = 1, 295 /// 296 FP_INFINITE = 2, 297 /// 298 FP_NORMAL = 3, 299 /// 300 FP_SUBNORMAL = 4, 301 /// 302 FP_ZERO = 5, 303 /// 304 FP_NAN = FP_NANQ, 305 /// 306 FP_EMPTY = 6, 307 /// 308 FP_UNSUPPORTED = 7, 309 } 310 311 enum 312 { 313 /// 314 FP_FAST_FMA = 0, 315 /// 316 FP_FAST_FMAF = 0, 317 /// 318 FP_FAST_FMAL = 0, 319 } 320 321 pure uint __fpclassify_f(float x); 322 pure uint __fpclassify_d(double x); 323 pure uint __fpclassify_ld(real x); 324 325 //int fpclassify(real-floating x); 326 /// 327 pragma(mangle, "__fpclassify_f") pure int fpclassify(float x); 328 /// 329 pragma(mangle, "__fpclassify_d") pure int fpclassify(double x); 330 /// 331 pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify_d" : "__fpclassify_ld") 332 pure int fpclassify(real x); 333 334 extern (D) 335 { 336 //int isfinite(real-floating x); 337 /// 338 pure int isfinite(float x) { return fpclassify(x) >= FP_NORMAL; } 339 /// 340 pure int isfinite(double x) { return fpclassify(x) >= FP_NORMAL; } 341 /// 342 pure int isfinite(real x) { return fpclassify(x) >= FP_NORMAL; } 343 344 //int isinf(real-floating x); 345 /// 346 pure int isinf(float x) { return fpclassify(x) == FP_INFINITE; } 347 /// 348 pure int isinf(double x) { return fpclassify(x) == FP_INFINITE; } 349 /// 350 pure int isinf(real x) { return fpclassify(x) == FP_INFINITE; } 351 352 //int isnan(real-floating x); 353 /// 354 pure int isnan(float x) { return fpclassify(x) <= FP_NANQ; } 355 /// 356 pure int isnan(double x) { return fpclassify(x) <= FP_NANQ; } 357 /// 358 pure int isnan(real x) { return fpclassify(x) <= FP_NANQ; } 359 360 //int isnormal(real-floating x); 361 /// 362 pure int isnormal(float x) { return fpclassify(x) == FP_NORMAL; } 363 /// 364 pure int isnormal(double x) { return fpclassify(x) == FP_NORMAL; } 365 /// 366 pure int isnormal(real x) { return fpclassify(x) == FP_NORMAL; } 367 368 //int signbit(real-floating x); 369 /// 370 pure int signbit(float x) { return (cast(short*)&(x))[1] & 0x8000; } 371 /// 372 pure int signbit(double x) { return (cast(short*)&(x))[3] & 0x8000; } 373 /// 374 pure int signbit(real x) 375 { 376 return (real.sizeof == double.sizeof) 377 ? (cast(short*)&(x))[3] & 0x8000 378 : (cast(short*)&(x))[4] & 0x8000; 379 } 380 } 381 } 382 else version (CRuntime_Microsoft) // fully supported since MSVCRT 12 (VS 2013) only 383 { 384 version (all) // legacy stuff to be removed in the future 385 { 386 enum 387 { 388 _FPCLASS_SNAN = 1, 389 _FPCLASS_QNAN = 2, 390 _FPCLASS_NINF = 4, 391 _FPCLASS_NN = 8, 392 _FPCLASS_ND = 0x10, 393 _FPCLASS_NZ = 0x20, 394 _FPCLASS_PZ = 0x40, 395 _FPCLASS_PD = 0x80, 396 _FPCLASS_PN = 0x100, 397 _FPCLASS_PINF = 0x200, 398 } 399 400 //deprecated("Please use the standard C99 function copysignf() instead.") 401 pure float _copysignf(float x, float s); 402 403 //deprecated("_chgsignf(x) is a non-standard MS extension. Please consider using -x instead.") 404 pure float _chgsignf(float x); 405 406 version (Win64) // not available in 32-bit runtimes 407 { 408 //deprecated("Please use the standard C99 function isfinite() instead.") 409 pure int _finitef(float x); 410 411 //deprecated("Please use the standard C99 function isnan() instead.") 412 pure int _isnanf(float x); 413 414 //deprecated("Please use the standard C99 function fpclassify() instead.") 415 pure int _fpclassf(float x); 416 } 417 418 //deprecated("Please use the standard C99 function copysign() instead.") 419 pure double _copysign(double x, double s); 420 421 //deprecated("_chgsign(x) is a non-standard MS extension. Please consider using -x instead.") 422 pure double _chgsign(double x); 423 424 //deprecated("Please use the standard C99 function isfinite() instead.") 425 pure int _finite(double x); 426 427 //deprecated("Please use the standard C99 function isnan() instead.") 428 pure int _isnan(double x); 429 430 //deprecated("Please use the standard C99 function fpclassify() instead.") 431 pure int _fpclass(double x); 432 } 433 434 version (MinGW) 435 { 436 enum 437 { 438 /// 439 FP_NAN = 0x0100, 440 /// 441 FP_NORMAL = 0x0400, 442 /// 443 FP_INFINITE = FP_NAN | FP_NORMAL, 444 /// 445 FP_ZERO = 0x0400, 446 /// 447 FP_SUBNORMAL = FP_NORMAL | FP_ZERO 448 } 449 450 pure int __fpclassifyf(float x); 451 pure int __fpclassify(double x); 452 pure int __fpclassifyl(real x); 453 454 pure int __isnanf(float x); 455 pure int __isnan(double x); 456 pure int __isnanl(real x); 457 458 pure int __signbitf(float x); 459 pure int __signbit(double x); 460 pure int __signbitl(real x); 461 462 //int fpclassify(real-floating x); 463 /// 464 pragma(mangle, "__fpclassifyf") pure int fpclassify(float x); 465 /// 466 pragma(mangle, "__fpclassify") pure int fpclassify(double x); 467 /// 468 pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify" : "__fpclassifyl") 469 pure int fpclassify(real x); 470 471 extern (D) 472 { 473 //int isfinite(real-floating x); 474 /// 475 pure int isfinite(float x) { return (fpclassify(x) & FP_NORMAL) == 0; } 476 /// 477 pure int isfinite(double x) { return (fpclassify(x) & FP_NORMAL) == 0; } 478 /// 479 pure int isfinite(real x) { return (fpclassify(x) & FP_NORMAL) == 0; } 480 481 //int isinf(real-floating x); 482 /// 483 pure int isinf(float x) { return fpclassify(x) == FP_INFINITE; } 484 /// 485 pure int isinf(double x) { return fpclassify(x) == FP_INFINITE; } 486 /// 487 pure int isinf(real x) { return fpclassify(x) == FP_INFINITE; } 488 } 489 490 //int isnan(real-floating x); 491 /// 492 pragma(mangle, "__isnanf") pure int isnan(float x); 493 /// 494 pragma(mangle, "__isnan") pure int isnan(double x); 495 /// 496 pragma(mangle, real.sizeof == double.sizeof ? "__isnan" : "__isnanl") 497 pure int isnan(real x); 498 499 extern (D) 500 { 501 //int isnormal(real-floating x); 502 /// 503 int isnormal(float x) { return fpclassify(x) == FP_NORMAL; } 504 /// 505 int isnormal(double x) { return fpclassify(x) == FP_NORMAL; } 506 /// 507 int isnormal(real x) { return fpclassify(x) == FP_NORMAL; } 508 } 509 510 //int signbit(real-floating x); 511 /// 512 pragma(mangle, "__signbitf") pure int signbit(float x); 513 /// 514 pragma(mangle, "__signbit") pure int signbit(double x); 515 /// 516 pragma(mangle, real.sizeof == double.sizeof ? "__signbit" : "__signbitl") 517 int signbit(real x); 518 } 519 else 520 { 521 enum 522 { 523 /// 524 FP_SUBNORMAL = -2, 525 /// 526 FP_NORMAL = -1, 527 /// 528 FP_ZERO = 0, 529 /// 530 FP_INFINITE = 1, 531 /// 532 FP_NAN = 2, 533 } 534 535 extern(D) 536 { 537 //int fpclassify(real-floating x); 538 /// 539 extern(C) pragma(mangle, "_fdclass") pure int fpclassify(float x); 540 /// 541 extern(C) pragma(mangle, "_dclass") pure int fpclassify(double x); 542 /// 543 pure int fpclassify()(real x) 544 { 545 static if (real.sizeof == double.sizeof) 546 return fpclassify(cast(double) x); 547 else 548 static assert(false, "fpclassify(real) not supported by MS C runtime"); 549 } 550 551 //int isfinite(real-floating x); 552 /// 553 pure int isfinite()(float x) { return fpclassify(x) <= 0; } 554 /// 555 pure int isfinite()(double x) { return fpclassify(x) <= 0; } 556 /// 557 pure int isfinite()(real x) { return fpclassify(x) <= 0; } 558 559 //int isinf(real-floating x); 560 /// 561 pure int isinf()(float x) { return fpclassify(x) == FP_INFINITE; } 562 /// 563 pure int isinf()(double x) { return fpclassify(x) == FP_INFINITE; } 564 /// 565 pure int isinf()(real x) { return fpclassify(x) == FP_INFINITE; } 566 567 //int isnan(real-floating x); 568 version (none) // requires MSVCRT 12+ (VS 2013) 569 { 570 /// 571 pure int isnan(float x) { return fpclassify(x) == FP_NAN; } 572 /// 573 pure int isnan(double x) { return fpclassify(x) == FP_NAN; } 574 /// 575 pure int isnan(real x) { return fpclassify(x) == FP_NAN; } 576 } 577 else // for backward compatibility with older runtimes 578 { 579 /// 580 pure int isnan(float x) { version (Win64) return _isnanf(x); else return _isnan(cast(double) x); } 581 /// 582 extern(C) pragma(mangle, "_isnan") pure int isnan(double x); 583 /// 584 pure int isnan(real x) { return _isnan(cast(double) x); } 585 } 586 587 //int isnormal(real-floating x); 588 /// 589 pure int isnormal()(float x) { return fpclassify(x) == FP_NORMAL; } 590 /// 591 pure int isnormal()(double x) { return fpclassify(x) == FP_NORMAL; } 592 /// 593 pure int isnormal()(real x) { return fpclassify(x) == FP_NORMAL; } 594 595 //int signbit(real-floating x); 596 /// 597 extern(C) pragma(mangle, "_fdsign") pure int signbit(float x); 598 /// 599 extern(C) pragma(mangle, "_dsign") pure int signbit(double x); 600 /// 601 pure int signbit()(real x) 602 { 603 static if (real.sizeof == double.sizeof) 604 return signbit(cast(double) x); 605 else 606 return (cast(short*)&(x))[4] & 0x8000; 607 } 608 } 609 } 610 } 611 else version (CRuntime_Glibc) 612 { 613 enum 614 { 615 /// 616 FP_NAN, 617 /// 618 FP_INFINITE, 619 /// 620 FP_ZERO, 621 /// 622 FP_SUBNORMAL, 623 /// 624 FP_NORMAL, 625 } 626 627 enum 628 { 629 /// 630 FP_FAST_FMA = 0, 631 /// 632 FP_FAST_FMAF = 0, 633 /// 634 FP_FAST_FMAL = 0, 635 } 636 637 pure int __fpclassifyf(float x); 638 pure int __fpclassify(double x); 639 pure int __fpclassifyl(real x); 640 641 pure int __finitef(float x); 642 pure int __finite(double x); 643 pure int __finitel(real x); 644 645 pure int __isinff(float x); 646 pure int __isinf(double x); 647 pure int __isinfl(real x); 648 649 pure int __isnanf(float x); 650 pure int __isnan(double x); 651 pure int __isnanl(real x); 652 653 pure int __signbitf(float x); 654 pure int __signbit(double x); 655 pure int __signbitl(real x); 656 657 //int fpclassify(real-floating x); 658 /// 659 pragma(mangle, "__fpclassifyf") pure int fpclassify(float x); 660 /// 661 pragma(mangle, "__fpclassify") pure int fpclassify(double x); 662 /// 663 pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify" : "__fpclassifyl") 664 pure int fpclassify(real x); 665 666 //int isfinite(real-floating x); 667 /// 668 pragma(mangle, "__finitef") pure int isfinite(float x); 669 /// 670 pragma(mangle, "__finite") pure int isfinite(double x); 671 /// 672 pragma(mangle, real.sizeof == double.sizeof ? "__finite" : "__finitel") 673 pure int isfinite(real x); 674 675 //int isinf(real-floating x); 676 /// 677 pragma(mangle, "__isinff") pure int isinf(float x); 678 /// 679 pragma(mangle, "__isinf") pure int isinf(double x); 680 /// 681 pragma(mangle, real.sizeof == double.sizeof ? "__isinf" : "__isinfl") 682 pure int isinf(real x); 683 684 //int isnan(real-floating x); 685 /// 686 pragma(mangle, "__isnanf") pure int isnan(float x); 687 /// 688 pragma(mangle, "__isnan") pure int isnan(double x); 689 /// 690 pragma(mangle, real.sizeof == double.sizeof ? "__isnan" : "__isnanl") 691 pure int isnan(real x); 692 693 //int isnormal(real-floating x); 694 /// 695 extern (D) pure int isnormal(float x) { return fpclassify(x) == FP_NORMAL; } 696 /// 697 extern (D) pure int isnormal(double x) { return fpclassify(x) == FP_NORMAL; } 698 /// 699 extern (D) pure int isnormal(real x) { return fpclassify(x) == FP_NORMAL; } 700 701 //int signbit(real-floating x); 702 /// 703 pragma(mangle, "__signbitf") pure int signbit(float x); 704 /// 705 pragma(mangle, "__signbit") pure int signbit(double x); 706 /// 707 pragma(mangle, real.sizeof == double.sizeof ? "__signbit" : "__signbitl") 708 pure int signbit(real x); 709 } 710 else version (CRuntime_Musl) 711 { 712 enum 713 { 714 /// 715 FP_NAN, 716 /// 717 FP_INFINITE, 718 /// 719 FP_ZERO, 720 /// 721 FP_SUBNORMAL, 722 /// 723 FP_NORMAL, 724 } 725 726 enum 727 { 728 /// 729 FP_FAST_FMA = 0, 730 /// 731 FP_FAST_FMAF = 0, 732 /// 733 FP_FAST_FMAL = 0, 734 } 735 736 pure { 737 int __fpclassifyf(float x); 738 int __fpclassify(double x); 739 int __fpclassifyl(real x); 740 741 int __signbitf(float x); 742 int __signbit(double x); 743 int __signbitl(real x); 744 } 745 746 //int fpclassify(real-floating x); 747 /// 748 pragma(mangle, "__fpclassifyf") pure int fpclassify(float x); 749 /// 750 pragma(mangle, "__fpclassify") pure int fpclassify(double x); 751 /// 752 pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify" : "__fpclassifyl") 753 pure int fpclassify(real x); 754 extern (D) pure 755 { 756 private uint __FLOAT_BITS(float __f) 757 { 758 union __u_t { 759 float __f; 760 uint __i; 761 } 762 __u_t __u; 763 __u.__f = __f; 764 return __u.__i; 765 } 766 private ulong __DOUBLE_BITS(double __f) 767 { 768 union __u_t { 769 double __f; 770 ulong __i; 771 } 772 __u_t __u; 773 __u.__f = __f; 774 return __u.__i; 775 } 776 777 //int isfinite(real-floating x); 778 /// 779 int isfinite(float x) { return (__FLOAT_BITS(x) & 0x7fffffff) < 0x7f800000; } 780 /// 781 int isfinite(double x) { return (__DOUBLE_BITS(x) & -1UL>>1) < 0x7ffUL<<52; } 782 /// 783 int isfinite(real x) 784 { 785 return (real.sizeof == double.sizeof) 786 ? isfinite(cast(double)x) 787 : __fpclassifyl(x) > FP_INFINITE; 788 } 789 790 //int isinf(real-floating x); 791 /// 792 int isinf(float x) { return (__FLOAT_BITS(x) & 0x7fffffff) == 0x7f800000; } 793 /// 794 int isinf(double x) { return (__DOUBLE_BITS(x) & -1UL>>1) == 0x7ffUL<<52; } 795 /// 796 int isinf(real x) 797 { 798 return (real.sizeof == double.sizeof) 799 ? isinf(cast(double)x) 800 : __fpclassifyl(x) == FP_INFINITE; 801 } 802 803 //int isnan(real-floating x); 804 /// 805 int isnan(float x) { return (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000; } 806 /// 807 int isnan(double x) { return (__DOUBLE_BITS(x) & -1UL>>1) > 0x7ffUL<<52; } 808 /// 809 int isnan(real x) 810 { 811 return (real.sizeof == double.sizeof) 812 ? isnan(cast(double)x) 813 : __fpclassifyl(x) == FP_NAN; 814 } 815 816 //int isnormal(real-floating x); 817 /// 818 int isnormal(float x) { return fpclassify(x) == FP_NORMAL; } 819 /// 820 int isnormal(double x) { return fpclassify(x) == FP_NORMAL; } 821 /// 822 int isnormal(real x) { return fpclassify(x) == FP_NORMAL; } 823 } 824 825 //int signbit(real-floating x); 826 /// 827 pragma(mangle, "__signbitf") pure int signbit(float x); 828 /// 829 pragma(mangle, "__signbit") pure int signbit(double x); 830 /// 831 pragma(mangle, real.sizeof == double.sizeof ? "__signbit" : "__signbitl") 832 pure int signbit(real x); 833 } 834 else version (CRuntime_UClibc) 835 { 836 enum 837 { 838 /// 839 FP_NAN, 840 /// 841 FP_INFINITE, 842 /// 843 FP_ZERO, 844 /// 845 FP_SUBNORMAL, 846 /// 847 FP_NORMAL, 848 } 849 850 enum 851 { 852 /// 853 FP_FAST_FMA = 0, 854 /// 855 FP_FAST_FMAF = 0, 856 /// 857 FP_FAST_FMAL = 0, 858 } 859 860 pure int __fpclassifyf(float x); 861 pure int __fpclassify(double x); 862 pure int __fpclassifyl(real x); 863 864 pure int __finitef(float x); 865 pure int __finite(double x); 866 pure int __finitel(real x); 867 868 pure int __isinff(float x); 869 pure int __isinf(double x); 870 pure int __isinfl(real x); 871 872 pure int __isnanf(float x); 873 pure int __isnan(double x); 874 pure int __isnanl(real x); 875 876 pure int __signbitf(float x); 877 pure int __signbit(double x); 878 pure int __signbitl(real x); 879 880 /// 881 pragma(mangle, "__fpclassifyf") pure int fpclassify(float x); 882 /// 883 pragma(mangle, "__fpclassify") pure int fpclassify(double x); 884 /// 885 pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify" : "__fpclassifyl") 886 pure int fpclassify(real x); 887 888 /// 889 pragma(mangle, "__finitef") pure int isfinite(float x); 890 /// 891 pragma(mangle, "__finite") pure int isfinite(double x); 892 /// 893 pragma(mangle, real.sizeof == double.sizeof ? "__finite" : "__finitel") 894 pure int isfinite(real x); 895 896 /// 897 pragma(mangle, "__isinff") pure int isinf(float x); 898 /// 899 pragma(mangle, "__isinf") pure int isinf(double x); 900 /// 901 pragma(mangle, real.sizeof == double.sizeof ? "__isinf" : "__isinfl") 902 pure int isinf(real x); 903 904 /// 905 pragma(mangle, "__isnanf") pure int isnan(float x); 906 /// 907 pragma(mangle, "__isnan") pure int isnan(double x); 908 /// 909 pragma(mangle, real.sizeof == double.sizeof ? "__isnan" : "__isnanl") 910 pure int isnan(real x); 911 912 extern (D) pure 913 { 914 /// 915 int isnormal(float x) { return fpclassify(x) == FP_NORMAL; } 916 /// 917 int isnormal(double x) { return fpclassify(x) == FP_NORMAL; } 918 /// 919 int isnormal(real x) { return fpclassify(x) == FP_NORMAL; } 920 } 921 922 /// 923 pragma(mangle, "__signbitf") pure int signbit(float x); 924 /// 925 pragma(mangle, "__signbit") pure int signbit(double x); 926 /// 927 pragma(mangle, real.sizeof == double.sizeof ? "__signbit" : "__signbitl") 928 pure int signbit(real x); 929 } 930 else version (Darwin) 931 { 932 enum 933 { 934 /// 935 FP_NAN = 1, 936 /// 937 FP_INFINITE = 2, 938 /// 939 FP_ZERO = 3, 940 /// 941 FP_NORMAL = 4, 942 /// 943 FP_SUBNORMAL = 5, 944 } 945 946 enum 947 { 948 /// 949 FP_FAST_FMA = 0, 950 /// 951 FP_FAST_FMAF = 0, 952 /// 953 FP_FAST_FMAL = 0, 954 } 955 956 pure int __fpclassifyf(float x); 957 pure int __fpclassifyd(double x); 958 959 pure int __isfinitef(float x); 960 pure int __isfinited(double x); 961 962 pure int __isinff(float x); 963 pure int __isinfd(double x); 964 965 pure int __isnanf(float x); 966 pure int __isnand(double x); 967 968 // __isnormal family exists, but iOS implementation returns wrong results 969 // for subnormals 970 971 pure int __signbitf(float x); 972 pure int __signbitd(double x); 973 pure int __signbitl(real x); 974 975 // Support of OSX < 10.8 needs legacy function names without "l" suffix 976 // with exception of __signbitl. Otherwise could use else version like 977 // other Darwins 978 version (OSX) 979 { 980 version (AArch64) 981 { 982 // Available in macOS ARM 983 pure int __fpclassifyl(real x); 984 pure int __isfinitel(real x); 985 pure int __isinfl(real x); 986 pure int __isnanl(real x); 987 } 988 else 989 { 990 pure int __fpclassify(real x); 991 pure int __isfinite(real x); 992 pure int __isinf(real x); 993 pure int __isnan(real x); 994 alias __fpclassifyl = __fpclassify; 995 alias __isfinitel = __isfinite; 996 alias __isinfl = __isinf; 997 alias __isnanl = __isnan; 998 } 999 } 1000 else 1001 { 1002 // Available OSX >= 10.8, iOS >= 6.0, all TVOS and WatchOS 1003 pure int __fpclassifyl(real x); 1004 pure int __isfinitel(real x); 1005 pure int __isinfl(real x); 1006 pure int __isnanl(real x); 1007 } 1008 1009 //int fpclassify(real-floating x); 1010 /// 1011 pragma(mangle, "__fpclassifyf") pure int fpclassify(float x); 1012 /// 1013 pragma(mangle, "__fpclassifyd") pure int fpclassify(double x); 1014 /// 1015 pragma(mangle, __fpclassifyl.mangleof) pure int fpclassify(real x); 1016 1017 //int isfinite(real-floating x); 1018 /// 1019 pragma(mangle, "__isfinitef") pure int isfinite(float x); 1020 /// 1021 pragma(mangle, "__isfinited") pure int isfinite(double x); 1022 /// 1023 pragma(mangle, __isfinitel.mangleof) pure int isfinite(real x); 1024 1025 //int isinf(real-floating x); 1026 /// 1027 pragma(mangle, "__isinff") pure int isinf(float x); 1028 /// 1029 pragma(mangle, "__isinfd") pure int isinf(double x); 1030 /// 1031 pragma(mangle, __isinfl.mangleof) pure int isinf(real x); 1032 1033 //int isnan(real-floating x); 1034 /// 1035 pragma(mangle, "__isnanf") pure int isnan(float x); 1036 /// 1037 pragma(mangle, "__isnand") pure int isnan(double x); 1038 /// 1039 pragma(mangle, __isnanl.mangleof) pure int isnan(real x); 1040 1041 extern (D) 1042 { 1043 //int isnormal(real-floating x); 1044 /// 1045 pure int isnormal(float x) { return fpclassify(x) == FP_NORMAL; } 1046 /// 1047 pure int isnormal(double x) { return fpclassify(x) == FP_NORMAL; } 1048 /// 1049 pure int isnormal(real x) { return fpclassify(x) == FP_NORMAL; } 1050 } 1051 1052 //int signbit(real-floating x); 1053 /// 1054 pragma(mangle, "__signbitf") pure int signbit(float x); 1055 /// 1056 pragma(mangle, "__signbitd") pure int signbit(double x); 1057 /// 1058 pragma(mangle, "__signbitl") pure int signbit(real x); 1059 } 1060 else version (FreeBSD) 1061 { 1062 enum 1063 { 1064 /// 1065 FP_INFINITE = 0x01, 1066 /// 1067 FP_NAN = 0x02, 1068 /// 1069 FP_NORMAL = 0x04, 1070 /// 1071 FP_SUBNORMAL = 0x08, 1072 /// 1073 FP_ZERO = 0x10, 1074 } 1075 1076 enum 1077 { 1078 /// 1079 FP_FAST_FMA = 0, 1080 /// 1081 FP_FAST_FMAF = 0, 1082 /// 1083 FP_FAST_FMAL = 0, 1084 } 1085 1086 pure int __fpclassifyd(double); 1087 pure int __fpclassifyf(float); 1088 pure int __fpclassifyl(real); 1089 pure int __isfinitef(float); 1090 pure int __isfinite(double); 1091 pure int __isfinitel(real); 1092 pure int __isinff(float); 1093 pure int __isinfl(real); 1094 pure int __isnanl(real); 1095 pure int __isnormalf(float); 1096 pure int __isnormal(double); 1097 pure int __isnormall(real); 1098 pure int __signbit(double); 1099 pure int __signbitf(float); 1100 pure int __signbitl(real); 1101 1102 //int fpclassify(real-floating x); 1103 /// 1104 pragma(mangle, "__fpclassifyf") pure int fpclassify(float x); 1105 /// 1106 pragma(mangle, "__fpclassifyd") pure int fpclassify(double x); 1107 /// 1108 pragma(mangle, "__fpclassifyl") pure int fpclassify(real x); 1109 1110 //int isfinite(real-floating x); 1111 /// 1112 pragma(mangle, "__isfinitef") pure int isfinite(float x); 1113 /// 1114 pragma(mangle, "__isfinite") pure int isfinite(double x); 1115 /// 1116 pragma(mangle, "__isfinitel") pure int isfinite(real x); 1117 1118 //int isinf(real-floating x); 1119 /// 1120 pragma(mangle, "__isinff") pure int isinf(float x); 1121 /// 1122 extern (D) pure int isinf(double x) { return __isinfl(x); } 1123 /// 1124 pragma(mangle, "__isinfl") pure int isinf(real x); 1125 1126 //int isnan(real-floating x); 1127 /// 1128 extern (D) pure int isnan(float x) { return __isnanl(x); } 1129 /// 1130 extern (D) pure int isnan(double x) { return __isnanl(x); } 1131 /// 1132 pragma(mangle, "__isnanl") pure int isnan(real x); 1133 1134 //int isnormal(real-floating x); 1135 /// 1136 pragma(mangle, "__isnormalf") pure int isnormal(float x); 1137 /// 1138 pragma(mangle, "__isnormal") pure int isnormal(double x); 1139 /// 1140 pragma(mangle, "__isnormall") pure int isnormal(real x); 1141 1142 //int signbit(real-floating x); 1143 /// 1144 pragma(mangle, "__signbitf") pure int signbit(float x); 1145 /// 1146 pragma(mangle, "__signbit") pure int signbit(double x); 1147 /// 1148 extern (D) pure int signbit(real x) { return __signbit(x); } 1149 } 1150 else version (OpenBSD) 1151 { 1152 enum 1153 { 1154 /// 1155 FP_INFINITE = 0x01, 1156 /// 1157 FP_NAN = 0x02, 1158 /// 1159 FP_NORMAL = 0x04, 1160 /// 1161 FP_SUBNORMAL = 0x08, 1162 /// 1163 FP_ZERO = 0x10, 1164 } 1165 1166 enum 1167 { 1168 /// 1169 FP_FAST_FMA = 1, 1170 /// 1171 FP_FAST_FMAF = 1, 1172 /// 1173 FP_FAST_FMAL = 1, 1174 } 1175 1176 pure int __fpclassify(double); 1177 pure int __fpclassifyf(float); 1178 pure int __fpclassifyl(real); 1179 pure int __isfinitef(float); 1180 pure int __isfinite(double); 1181 pure int __isfinitel(real); 1182 pure int __isinff(float); 1183 pure int __isinfl(real); 1184 pure int __isnanl(real); 1185 pure int __isnormalf(float); 1186 pure int __isnormal(double); 1187 pure int __isnormall(real); 1188 pure int __signbit(double); 1189 pure int __signbitf(float); 1190 pure int __signbitl(real); 1191 1192 //int fpclassify(real-floating x); 1193 /// 1194 pragma(mangle, "__fpclassifyf") pure int fpclassify(float x); 1195 /// 1196 pragma(mangle, "__fpclassify") pure int fpclassify(double x); 1197 /// 1198 pragma(mangle, "__fpclassifyl") pure int fpclassify(real x); 1199 1200 //int isfinite(real-floating x); 1201 /// 1202 pragma(mangle, "__isfinitef") pure int isfinite(float x); 1203 /// 1204 pragma(mangle, "__isfinite") pure int isfinite(double x); 1205 /// 1206 pragma(mangle, "__isfinitel") pure int isfinite(real x); 1207 1208 //int isinf(real-floating x); 1209 /// 1210 pragma(mangle, "__isinff") pure int isinf(float x); 1211 /// 1212 extern (D) pure int isinf(double x) { return __isinfl(x); } 1213 /// 1214 pragma(mangle, "__isinfl") pure int isinf(real x); 1215 1216 //int isnan(real-floating x); 1217 /// 1218 extern (D) pure int isnan(float x) { return __isnanl(x); } 1219 /// 1220 extern (D) pure int isnan(double x) { return __isnanl(x); } 1221 /// 1222 pragma(mangle, "__isnanl") pure int isnan(real x); 1223 1224 //int isnormal(real-floating x); 1225 /// 1226 pragma(mangle, "__isnormalf") pure int isnormal(float x); 1227 /// 1228 pragma(mangle, "__isnormal") pure int isnormal(double x); 1229 /// 1230 pragma(mangle, "__isnormall") pure int isnormal(real x); 1231 1232 //int signbit(real-floating x); 1233 /// 1234 pragma(mangle, "__signbitf") pure int signbit(float x); 1235 /// 1236 pragma(mangle, "__signbit") pure int signbit(double x); 1237 /// 1238 extern (D) pure int signbit(real x) { return __signbit(x); } 1239 } 1240 else version (NetBSD) 1241 { 1242 enum 1243 { 1244 /// 1245 FP_INFINITE = 0, 1246 /// 1247 FP_NAN = 1, 1248 /// 1249 FP_NORMAL = 2, 1250 /// 1251 FP_SUBNORMAL = 3, 1252 /// 1253 FP_ZERO = 4, 1254 } 1255 1256 enum 1257 { 1258 /// 1259 FP_FAST_FMA = 0, 1260 /// 1261 FP_FAST_FMAF = 0, 1262 /// 1263 FP_FAST_FMAL = 0, 1264 } 1265 1266 pure uint __fpclassifyf(float x); 1267 pure uint __fpclassifyd(double x); 1268 pure uint __fpclassifyl(real x); 1269 1270 //int fpclassify(real-floating x); 1271 /// 1272 pragma(mangle, "__fpclassifyf") pure int fpclassify(float x); 1273 /// 1274 pragma(mangle, "__fpclassifyd") pure int fpclassify(double x); 1275 /// 1276 pragma(mangle, real.sizeof == double.sizeof ? "__fpclassifyd" : "__fpclassifyl") 1277 pure int fpclassify(real x); 1278 1279 extern (D) 1280 { 1281 //int isfinite(real-floating x); 1282 /// 1283 pure int isfinite(float x) { return fpclassify(x) >= FP_NORMAL; } 1284 /// 1285 pure int isfinite(double x) { return fpclassify(x) >= FP_NORMAL; } 1286 /// 1287 pure int isfinite(real x) { return fpclassify(x) >= FP_NORMAL; } 1288 1289 //int isinf(real-floating x); 1290 /// 1291 pure int isinf(float x) { return fpclassify(x) == FP_INFINITE; } 1292 /// 1293 pure int isinf(double x) { return fpclassify(x) == FP_INFINITE; } 1294 /// 1295 pure int isinf(real x) { return fpclassify(x) == FP_INFINITE; } 1296 1297 //int isnan(real-floating x); 1298 /// 1299 pure int isnan(float x) { return fpclassify(x) == FP_NAN; } 1300 /// 1301 pure int isnan(double x) { return fpclassify(x) == FP_NAN; } 1302 /// 1303 pure int isnan(real x) { return fpclassify(x) == FP_NAN; } 1304 1305 //int isnormal(real-floating x); 1306 /// 1307 pure int isnormal(float x) { return fpclassify(x) == FP_NORMAL; } 1308 /// 1309 pure int isnormal(double x) { return fpclassify(x) == FP_NORMAL; } 1310 /// 1311 pure int isnormal(real x) { return fpclassify(x) == FP_NORMAL; } 1312 1313 //int signbit(real-floating x); 1314 /// 1315 pure int signbit(float x) { return (cast(short*)&(x))[1] & 0x8000; } 1316 /// 1317 pure int signbit(double x) { return (cast(short*)&(x))[3] & 0x8000; } 1318 /// 1319 pure int signbit(real x) 1320 { 1321 return (real.sizeof == double.sizeof) 1322 ? (cast(short*)&(x))[3] & 0x8000 1323 : (cast(short*)&(x))[4] & 0x8000; 1324 } 1325 } 1326 } 1327 else version (DragonFlyBSD) 1328 { 1329 enum 1330 { 1331 FP_INFINITE = 0x01, 1332 FP_NAN = 0x02, 1333 FP_NORMAL = 0x04, 1334 FP_SUBNORMAL = 0x08, 1335 FP_ZERO = 0x10, 1336 } 1337 1338 /* 1339 * /usr/include/math.h : martynas@openbsd believes only F version is true. 1340 enum FP_FAST_FMA = 1; 1341 enum FP_FAST_FMAL = 1; 1342 */ 1343 enum FP_FAST_FMAF = 1; 1344 1345 pure int __fpclassifyd(double); 1346 pure int __fpclassifyf(float); 1347 pure int __fpclassifyl(real); 1348 pure int __isfinitef(float); 1349 pure int __isfinite(double); 1350 pure int __isfinitel(real); 1351 pure int __isinff(float); 1352 pure int __isinf(double); 1353 pure int __isinfl(real); 1354 pure int __isnanf(float); 1355 pure int __isnan(double); 1356 pure int __isnanl(real); 1357 pure int __isnormalf(float); 1358 pure int __isnormal(double); 1359 pure int __isnormall(real); 1360 pure int __signbit(double); 1361 pure int __signbitf(float); 1362 pure int __signbitl(real); 1363 1364 pragma(mangle, "__fpclassifyf") pure int fpclassify(float x); 1365 pragma(mangle, "__fpclassifyd") pure int fpclassify(double x); 1366 pragma(mangle, "__fpclassifyl") pure int fpclassify(real x); 1367 1368 pragma(mangle, "__isfinitef") pure int isfinite(float x); 1369 pragma(mangle, "__isfinite") pure int isfinite(double x); 1370 pragma(mangle, "__isfinitel") pure int isfinite(real x); 1371 1372 pragma(mangle, "__isinff") pure int isinf(float x); 1373 pragma(mangle, "__isinf") pure int isinf(double x); 1374 pragma(mangle, "__isinfl") pure int isinf(real x); 1375 1376 pragma(mangle, "__isnanf") pure int isnan(float x); 1377 pragma(mangle, "__isnan") pure int isnan(double x); 1378 pragma(mangle, "__isnanl") pure int isnan(real x); 1379 1380 pragma(mangle, "__isnormalf") pure int isnormal(float x); 1381 pragma(mangle, "__isnormal") pure int isnormal(double x); 1382 pragma(mangle, "__isnormall") pure int isnormal(real x); 1383 1384 pragma(mangle, "__signbitf") pure int signbit(float x); 1385 pragma(mangle, "__signbit") pure int signbit(double x); 1386 pragma(mangle, "__signbitl") pure int signbit(real x); 1387 } 1388 else version (Solaris) 1389 { 1390 enum 1391 { 1392 FP_INFINITE = 3, 1393 FP_NAN = 4, 1394 FP_NORMAL = 2, 1395 FP_SUBNORMAL = 1, 1396 FP_ZERO = 0, 1397 } 1398 1399 enum 1400 { 1401 /// 1402 FP_FAST_FMA = 0, 1403 /// 1404 FP_FAST_FMAF = 0, 1405 /// 1406 FP_FAST_FMAL = 0, 1407 } 1408 1409 extern (D) 1410 { 1411 //int fpclassify(real-floating x); 1412 /// 1413 pure int fpclassify(float x) 1414 { 1415 return isnan(x) ? FP_NAN : isinf(x) ? FP_INFINITE : 1416 isnormal(x) ? FP_NORMAL : x == 0.0f ? FP_ZERO : 1417 FP_SUBNORMAL; 1418 } 1419 1420 /// 1421 pure int fpclassify(double x) 1422 { 1423 return isnan(x) ? FP_NAN : isinf(x) ? FP_INFINITE : 1424 isnormal(x) ? FP_NORMAL : x == 0.0 ? FP_ZERO : 1425 FP_SUBNORMAL; 1426 } 1427 1428 /// 1429 pure int fpclassify(real x) 1430 { 1431 return isnan(x) ? FP_NAN : isinf(x) ? FP_INFINITE : 1432 isnormal(x) ? FP_NORMAL : x == 0.0L ? FP_ZERO : 1433 FP_SUBNORMAL; 1434 } 1435 1436 //int isfinite(real-floating x); 1437 /// 1438 pure int isfinite(float x) { return !isnan(x) && !isinf(x); } 1439 /// 1440 pure int isfinite(double x) { return !isnan(x) && !isinf(x); } 1441 /// 1442 pure int isfinite(real x) { return !isnan(x) && !isinf(x); } 1443 1444 //int isinf(real-floating x); 1445 /// 1446 pure int isinf(float x) { return x == float.infinity || x == -float.infinity; } 1447 /// 1448 pure int isinf(double x) { return x == double.infinity || x == -double.infinity; } 1449 /// 1450 pure int isinf(real x) { return x == real.infinity || x == -real.infinity; } 1451 1452 //int isnan(real-floating x); 1453 /// 1454 pure int isnan(float x) { return x != x; } 1455 /// 1456 pure int isnan(double x) { return x != x; } 1457 /// 1458 pure int isnan(real x) { return x != x; } 1459 1460 //int isnormal(real-floating x); 1461 /// 1462 pure int isnormal(float x) 1463 { 1464 import core.math; 1465 return isfinite(x) && fabs(x) >= float.min_normal; 1466 } 1467 /// 1468 pure int isnormal(double x) 1469 { 1470 import core.math; 1471 return isfinite(x) && fabs(x) >= double.min_normal; 1472 } 1473 /// 1474 pure int isnormal(real x) 1475 { 1476 import core.math; 1477 return isfinite(x) && fabs(x) >= real.min_normal; 1478 } 1479 1480 //int signbit(real-floating x); 1481 /// 1482 pure int signbit(float x) 1483 { 1484 version (SPARC_Any) 1485 return cast(int)(*cast(uint*)&x >> 31); 1486 else version (X86_Any) 1487 return cast(int)(*cast(uint*)&x >> 31); 1488 else 1489 static assert(false, "Architecture not supported."); 1490 } 1491 /// 1492 pure int signbit(double x) 1493 { 1494 version (SPARC_Any) 1495 return cast(int)(*cast(uint*)&x >> 31); 1496 else version (X86_Any) 1497 return cast(int)((cast(uint*)&x)[1] >> 31); 1498 else 1499 static assert(false, "Architecture not supported."); 1500 } 1501 /// 1502 pure int signbit(real x) 1503 { 1504 version (SPARC_Any) 1505 return cast(int)(*cast(uint*)&x >> 31); 1506 else version (X86_Any) 1507 return cast(int)((cast(ushort *)&x)[4] >> 15); 1508 else 1509 static assert(false, "Architecture not supported."); 1510 } 1511 } 1512 } 1513 else version (CRuntime_Bionic) 1514 { 1515 enum 1516 { 1517 /// 1518 FP_INFINITE = 0x01, 1519 /// 1520 FP_NAN = 0x02, 1521 /// 1522 FP_NORMAL = 0x04, 1523 /// 1524 FP_SUBNORMAL = 0x08, 1525 /// 1526 FP_ZERO = 0x10, 1527 } 1528 1529 /// 1530 enum FP_FAST_FMAF; 1531 1532 pure int __fpclassifyd(double); 1533 pure int __fpclassifyf(float); 1534 pure int __fpclassifyl(real); 1535 1536 pure int __isfinitef(float); 1537 pure int __isfinite(double); 1538 pure int __isfinitel(real); 1539 1540 pure int __isinff(float); 1541 pure int __isinf(double); 1542 pure int __isinfl(real); 1543 1544 pure int isnanf(float); 1545 pure int isnan(double); 1546 pure int __isnanl(real); 1547 1548 pure int __isnormalf(float); 1549 pure int __isnormal(double); 1550 pure int __isnormall(real); 1551 1552 pure int __signbit(double); 1553 pure int __signbitf(float); 1554 pure int __signbitl(real); 1555 1556 //int fpclassify(real-floating x); 1557 /// 1558 pragma(mangle, "__fpclassifyf") pure int fpclassify(float x); 1559 /// 1560 pragma(mangle, "__fpclassifyd") pure int fpclassify(double x); 1561 /// 1562 pragma(mangle, "__fpclassifyl") pure int fpclassify(real x); 1563 1564 //int isfinite(real-floating x); 1565 /// 1566 pragma(mangle, "__isfinitef") pure int isfinite(float x); 1567 /// 1568 pragma(mangle, "__isfinite") pure int isfinite(double x); 1569 /// 1570 pragma(mangle, "__isfinitel") pure int isfinite(real x); 1571 1572 //int isinf(real-floating x); 1573 /// 1574 pragma(mangle, "__isinff") pure int isinf(float x); 1575 /// 1576 pragma(mangle, "__isinf") pure int isinf(double x); 1577 /// 1578 pragma(mangle, "__isinfl") pure int isinf(real x); 1579 1580 //int isnan(real-floating x); 1581 /// 1582 pragma(mangle, "isnanf") pure int isnan(float x); 1583 /// 1584 pragma(mangle, "__isnanl") pure int isnan(real x); 1585 1586 //int isnormal(real-floating x); 1587 /// 1588 pragma(mangle, "__isnormalf") pure int isnormal(float x); 1589 /// 1590 pragma(mangle, "__isnormal") pure int isnormal(double x); 1591 /// 1592 pragma(mangle, "__isnormall") pure int isnormal(real x); 1593 1594 //int signbit(real-floating x); 1595 /// 1596 pragma(mangle, "__signbitf") pure int signbit(float x); 1597 /// 1598 pragma(mangle, "__signbit") pure int signbit(double x); 1599 /// 1600 pragma(mangle, "__signbitl") pure int signbit(real x); 1601 } else extern(D) { 1602 1603 // 1604 // these functions are all macros in C 1605 // 1606 1607 //int fpclassify(real-floating x); 1608 pure int fpclassify(float x); 1609 pure int fpclassify(double x); 1610 pure int fpclassify(real x); 1611 1612 //int isfinite(real-floating x); 1613 pure int isfinite(float x); 1614 pure int isfinite(double x); 1615 pure int isfinite(real x); 1616 1617 //int isinf(real-floating x); 1618 pure int isinf(float x); 1619 pure int isinf(double x); 1620 pure int isinf(real x); 1621 1622 //int isnan(real-floating x); 1623 pure int isnan(float x); 1624 pure int isnan(double x); 1625 pure int isnan(real x); 1626 1627 //int isnormal(real-floating x); 1628 pure int isnormal(float x); 1629 pure int isnormal(double x); 1630 pure int isnormal(real x); 1631 1632 //int signbit(real-floating x); 1633 pure int signbit(float x); 1634 pure int signbit(double x); 1635 pure int signbit(real x); 1636 1637 //int isgreater(real-floating x, real-floating y); 1638 pure int isgreater(float x, float y); 1639 pure int isgreater(double x, double y); 1640 pure int isgreater(real x, real y); 1641 1642 //int isgreaterequal(real-floating x, real-floating y); 1643 pure int isgreaterequal(float x, float y); 1644 pure int isgreaterequal(double x, double y); 1645 pure int isgreaterequal(real x, real y); 1646 1647 //int isless(real-floating x, real-floating y); 1648 pure int isless(float x, float y); 1649 pure int isless(double x, double y); 1650 pure int isless(real x, real y); 1651 1652 //int islessequal(real-floating x, real-floating y); 1653 pure int islessequal(float x, float y); 1654 pure int islessequal(double x, double y); 1655 pure int islessequal(real x, real y); 1656 1657 //int islessgreater(real-floating x, real-floating y); 1658 pure int islessgreater(float x, float y); 1659 pure int islessgreater(double x, double y); 1660 pure int islessgreater(real x, real y); 1661 1662 //int isunordered(real-floating x, real-floating y); 1663 pure int isunordered(float x, float y); 1664 pure int isunordered(double x, double y); 1665 pure int isunordered(real x, real y); 1666 } 1667 1668 version(none) extern (D) 1669 { 1670 //int isgreater(real-floating x, real-floating y); 1671 /// 1672 pure int isgreater(float x, float y) { return x > y; } 1673 /// 1674 pure int isgreater(double x, double y) { return x > y; } 1675 /// 1676 pure int isgreater(real x, real y) { return x > y; } 1677 1678 //int isgreaterequal(real-floating x, real-floating y); 1679 /// 1680 pure int isgreaterequal(float x, float y) { return x >= y; } 1681 /// 1682 pure int isgreaterequal(double x, double y) { return x >= y; } 1683 /// 1684 pure int isgreaterequal(real x, real y) { return x >= y; } 1685 1686 //int isless(real-floating x, real-floating y); 1687 /// 1688 pure int isless(float x, float y) { return x < y; } 1689 /// 1690 pure int isless(double x, double y) { return x < y; } 1691 /// 1692 pure int isless(real x, real y) { return x < y; } 1693 1694 //int islessequal(real-floating x, real-floating y); 1695 /// 1696 pure int islessequal(float x, float y) { return x <= y; } 1697 /// 1698 pure int islessequal(double x, double y) { return x <= y; } 1699 /// 1700 pure int islessequal(real x, real y) { return x <= y; } 1701 1702 //int islessgreater(real-floating x, real-floating y); 1703 /// 1704 pure int islessgreater(float x, float y) { return x != y && !isunordered(x, y); } 1705 /// 1706 pure int islessgreater(double x, double y) { return x != y && !isunordered(x, y); } 1707 /// 1708 pure int islessgreater(real x, real y) { return x != y && !isunordered(x, y); } 1709 1710 //int isunordered(real-floating x, real-floating y); 1711 /// 1712 pure int isunordered(float x, float y) { return isnan(x) || isnan(y); } 1713 /// 1714 pure int isunordered(double x, double y) { return isnan(x) || isnan(y); } 1715 /// 1716 pure int isunordered(real x, real y) { return isnan(x) || isnan(y); } 1717 } 1718 1719 /* MS define some functions inline. 1720 * Additionally, their *l functions work with a 64-bit long double and are thus 1721 * useless for 80-bit D reals. So we use our own wrapper implementations working 1722 * internally with reduced 64-bit precision. 1723 * This also enables relaxing real to 64-bit double. 1724 */ 1725 version (CRuntime_Microsoft) // fully supported since MSVCRT 12 (VS 2013) only 1726 { 1727 /// 1728 double acos(double x); 1729 /// 1730 float acosf(float x); 1731 /// 1732 extern(D) real acosl()(real x) { return acos(cast(double) x); } 1733 1734 /// 1735 double asin(double x); 1736 /// 1737 float asinf(float x); 1738 /// 1739 extern(D) real asinl()(real x) { return asin(cast(double) x); } 1740 1741 /// 1742 pure double atan(double x); 1743 /// 1744 pure float atanf(float x); 1745 /// 1746 pure extern(D) real atanl()(real x) { return atan(cast(double) x); } 1747 1748 /// 1749 double atan2(double y, double x); 1750 /// 1751 float atan2f(float y, float x); 1752 /// 1753 extern(D) real atan2l()(real y, real x) { return atan2(cast(double) y, cast(double) x); } 1754 1755 /// 1756 pure double cos(double x); 1757 /// 1758 pure float cosf(float x); 1759 /// 1760 extern(D) pure real cosl()(real x) { return cos(cast(double) x); } 1761 1762 /// 1763 pure double sin(double x); 1764 /// 1765 pure float sinf(float x); 1766 /// 1767 extern(D) pure real sinl()(real x) { return sin(cast(double) x); } 1768 1769 /// 1770 pure double tan(double x); 1771 /// 1772 pure float tanf(float x); 1773 /// 1774 extern(D) pure real tanl()(real x) { return tan(cast(double) x); } 1775 1776 /// 1777 double acosh(double x); 1778 /// 1779 float acoshf(float x); 1780 /// 1781 extern(D) real acoshl()(real x) { return acosh(cast(double) x); } 1782 1783 /// 1784 pure double asinh(double x); 1785 /// 1786 pure float asinhf(float x); 1787 /// 1788 pure extern(D) real asinhl()(real x) { return asinh(cast(double) x); } 1789 1790 /// 1791 double atanh(double x); 1792 /// 1793 float atanhf(float x); 1794 /// 1795 extern(D) real atanhl()(real x) { return atanh(cast(double) x); } 1796 1797 /// 1798 double cosh(double x); 1799 /// 1800 float coshf(float x); 1801 /// 1802 extern(D) real coshl()(real x) { return cosh(cast(double) x); } 1803 1804 /// 1805 double sinh(double x); 1806 /// 1807 float sinhf(float x); 1808 /// 1809 extern(D) real sinhl()(real x) { return sinh(cast(double) x); } 1810 1811 /// 1812 pure double tanh(double x); 1813 /// 1814 pure float tanhf(float x); 1815 /// 1816 extern(D) pure real tanhl()(real x) { return tanh(cast(double) x); } 1817 1818 /// 1819 double exp(double x); 1820 /// 1821 float expf(float x); 1822 /// 1823 extern(D) real expl()(real x) { return exp(cast(double) x); } 1824 1825 /// 1826 double exp2(double x); 1827 /// 1828 float exp2f(float x); 1829 /// 1830 extern(D) real exp2l()(real x) { return exp2(cast(double) x); } 1831 1832 /// 1833 double expm1(double x); 1834 /// 1835 float expm1f(float x); 1836 /// 1837 extern(D) real expm1l()(real x) { return expm1(cast(double) x); } 1838 1839 /// 1840 pure double frexp(double value, int* exp); 1841 /// 1842 extern(D) pure float frexpf()(float value, int* exp) { return cast(float) frexp(value, exp); } 1843 /// 1844 extern(D) pure real frexpl()(real value, int* exp) { return frexp(cast(double) value, exp); } 1845 1846 /// 1847 int ilogb(double x); 1848 /// 1849 int ilogbf(float x); 1850 /// 1851 extern(D) int ilogbl()(real x) { return ilogb(cast(double) x); } 1852 1853 /// 1854 double ldexp(double x, int exp); 1855 /// 1856 extern(D) float ldexpf()(float x, int exp) { return cast(float) ldexp(x, exp); } 1857 /// 1858 extern(D) real ldexpl()(real x, int exp) { return ldexp(cast(double) x, exp); } 1859 1860 /// 1861 double log(double x); 1862 /// 1863 float logf(float x); 1864 /// 1865 extern(D) real logl()(real x) { return log(cast(double) x); } 1866 1867 /// 1868 double log10(double x); 1869 /// 1870 float log10f(float x); 1871 /// 1872 extern(D) real log10l()(real x) { return log10(cast(double) x); } 1873 1874 /// 1875 double log1p(double x); 1876 /// 1877 float log1pf(float x); 1878 /// 1879 extern(D) real log1pl()(real x) { return log1p(cast(double) x); } 1880 1881 /// 1882 double log2(double x); 1883 /// 1884 float log2f(float x); 1885 /// 1886 extern(D) real log2l()(real x) { return log2(cast(double) x); } 1887 1888 /// 1889 double logb(double x); 1890 /// 1891 float logbf(float x); 1892 /// 1893 extern(D) real logbl()(real x) { return logb(cast(double) x); } 1894 1895 /// 1896 pure double modf(double value, double* iptr); 1897 /// 1898 pure float modff(float value, float* iptr); 1899 /// 1900 extern(D) pure real modfl()(real value, real* iptr) 1901 { 1902 double i; 1903 double r = modf(cast(double) value, &i); 1904 *iptr = i; 1905 return r; 1906 } 1907 1908 /// 1909 double scalbn(double x, int n); 1910 /// 1911 float scalbnf(float x, int n); 1912 /// 1913 extern(D) real scalbnl()(real x, int n) { return scalbn(cast(double) x, n); } 1914 1915 /// 1916 double scalbln(double x, c_long n); 1917 /// 1918 float scalblnf(float x, c_long n); 1919 /// 1920 extern(D) real scalblnl()(real x, c_long n) { return scalbln(cast(double) x, n); } 1921 1922 /// 1923 pure double cbrt(double x); 1924 /// 1925 pure float cbrtf(float x); 1926 /// 1927 extern(D) pure real cbrtl()(real x) { return cbrt(cast(double) x); } 1928 1929 /// 1930 pure double fabs(double x); 1931 /// 1932 extern(D) pure float fabsf()(float x) { return cast(float) fabs(x); } 1933 /// 1934 extern(D) pure real fabsl()(real x) { return fabs(cast(double) x); } 1935 1936 /// 1937 extern(C) pragma(mangle, "_hypot") double hypot(double x, double y); 1938 /// 1939 extern(C) pragma(mangle, "_hypotf") float hypotf(float x, float y); 1940 /// 1941 extern(D) real hypotl(real x, real y) { return hypot(cast(double) x, cast(double) y); } 1942 1943 /// 1944 double pow(double x, double y); 1945 /// 1946 float powf(float x, float y); 1947 /// 1948 extern(D) real powl()(real x, real y) { return pow(cast(double) x, cast(double) y); } 1949 1950 /// 1951 double sqrt(double x); 1952 /// 1953 float sqrtf(float x); 1954 /// 1955 extern(D) real sqrtl()(real x) { return sqrt(cast(double) x); } 1956 1957 /// 1958 pure double erf(double x); 1959 /// 1960 pure float erff(float x); 1961 /// 1962 extern(D) pure real erfl()(real x) { return erf(cast(double) x); } 1963 1964 /// 1965 double erfc(double x); 1966 /// 1967 float erfcf(float x); 1968 /// 1969 extern(D) real erfcl()(real x) { return erfc(cast(double) x); } 1970 1971 /// 1972 double lgamma(double x); 1973 /// 1974 float lgammaf(float x); 1975 /// 1976 extern(D) real lgammal()(real x) { return lgamma(cast(double) x); } 1977 1978 /// 1979 double tgamma(double x); 1980 /// 1981 float tgammaf(float x); 1982 /// 1983 extern(D) real tgammal()(real x) { return tgamma(cast(double) x); } 1984 1985 /// 1986 pure double ceil(double x); 1987 /// 1988 pure float ceilf(float x); 1989 /// 1990 extern(D) pure real ceill()(real x) { return ceil(cast(double) x); } 1991 1992 /// 1993 pure double floor(double x); 1994 /// 1995 pure float floorf(float x); 1996 /// 1997 extern(D) pure real floorl()(real x) { return floor(cast(double) x); } 1998 1999 /// 2000 pure double nearbyint(double x); 2001 /// 2002 pure float nearbyintf(float x); 2003 /// 2004 extern(D) pure real nearbyintl()(real x) { return nearbyint(cast(double) x); } 2005 2006 /// 2007 pure double rint(double x); 2008 /// 2009 pure float rintf(float x); 2010 /// 2011 extern(D) pure real rintl()(real x) { return rint(cast(double) x); } 2012 2013 /// 2014 c_long lrint(double x); 2015 /// 2016 c_long lrintf(float x); 2017 /// 2018 extern(D) c_long lrintl()(real x) { return lrint(cast(double) x); } 2019 2020 /// 2021 long llrint(double x); 2022 /// 2023 long llrintf(float x); 2024 /// 2025 extern(D) long llrintl()(real x) { return llrint(cast(double) x); } 2026 2027 /// 2028 pure double round(double x); 2029 /// 2030 pure float roundf(float x); 2031 /// 2032 extern(D) pure real roundl()(real x) { return round(cast(double) x); } 2033 2034 /// 2035 c_long lround(double x); 2036 /// 2037 c_long lroundf(float x); 2038 /// 2039 extern(D) c_long lroundl()(real x) { return lround(cast(double) x); } 2040 2041 /// 2042 long llround(double x); 2043 /// 2044 long llroundf(float x); 2045 /// 2046 extern(D) long llroundl()(real x) { return llround(cast(double) x); } 2047 2048 /// 2049 pure double trunc(double x); 2050 /// 2051 pure float truncf(float x); 2052 /// 2053 extern(D) pure real truncl()(real x) { return trunc(cast(double) x); } 2054 2055 /// 2056 double fmod(double x, double y); 2057 /// 2058 float fmodf(float x, float y); 2059 /// 2060 extern(D) real fmodl()(real x, real y) { return fmod(cast(double) x, cast(double) y); } 2061 2062 /// 2063 double remainder(double x, double y); 2064 /// 2065 float remainderf(float x, float y); 2066 /// 2067 extern(D) real remainderl()(real x, real y) { return remainder(cast(double) x, cast(double) y); } 2068 2069 /// 2070 double remquo(double x, double y, int* quo); 2071 /// 2072 float remquof(float x, float y, int* quo); 2073 /// 2074 extern(D) real remquol()(real x, real y, int* quo) { return remquo(cast(double) x, cast(double) y, quo); } 2075 2076 /// 2077 pure double copysign(double x, double y); 2078 /// 2079 pure float copysignf(float x, float y); 2080 /// 2081 extern(D) pure real copysignl()(real x, real y) { return copysign(cast(double) x, cast(double) y); } 2082 2083 /// 2084 pure double nan(char* tagp); 2085 /// 2086 pure float nanf(char* tagp); 2087 /// 2088 extern(D) pure real nanl()(char* tagp) { return nan(tagp); } 2089 2090 /// 2091 double nextafter(double x, double y); 2092 /// 2093 float nextafterf(float x, float y); 2094 /// 2095 extern(D) real nextafterl()(real x, real y) { return nextafter(cast(double) x, cast(double) y); } 2096 2097 /// 2098 double nexttoward(double x, real y); 2099 /// 2100 float nexttowardf(float x, real y); 2101 /// 2102 extern(D) real nexttowardl()(real x, real y) { return nexttoward(cast(double) x, cast(double) y); } 2103 2104 /// 2105 double fdim(double x, double y); 2106 /// 2107 float fdimf(float x, float y); 2108 /// 2109 extern(D) real fdiml()(real x, real y) { return fdim(cast(double) x, cast(double) y); } 2110 2111 /// 2112 pure double fmax(double x, double y); 2113 /// 2114 pure float fmaxf(float x, float y); 2115 /// 2116 extern(D) pure real fmaxl()(real x, real y) { return fmax(cast(double) x, cast(double) y); } 2117 2118 /// 2119 pure double fmin(double x, double y); 2120 /// 2121 pure float fminf(float x, float y); 2122 /// 2123 extern(D) pure real fminl()(real x, real y) { return fmin(cast(double) x, cast(double) y); } 2124 2125 /// 2126 pure double fma(double x, double y, double z); 2127 /// 2128 pure float fmaf(float x, float y, float z); 2129 /// 2130 extern(D) pure real fmal()(real x, real y, real z) { return fma(cast(double) x, cast(double) y, cast(double) z); } 2131 } 2132 else version (FreeBSD) 2133 { 2134 /// 2135 double acos(double x); 2136 /// 2137 float acosf(float x); 2138 /// 2139 real acosl(real x); // since 8.0 2140 2141 /// 2142 double asin(double x); 2143 /// 2144 float asinf(float x); 2145 /// 2146 real asinl(real x); // since 8.0 2147 2148 /// 2149 pure double atan(double x); 2150 /// 2151 pure float atanf(float x); 2152 /// 2153 pure real atanl(real x); // since 8.0 2154 2155 /// 2156 double atan2(double y, double x); 2157 /// 2158 float atan2f(float y, float x); 2159 /// 2160 real atan2l(real y, real x); // since 8.0 2161 2162 /// 2163 pure double cos(double x); 2164 /// 2165 pure float cosf(float x); 2166 /// 2167 pure real cosl(real x); // since 8.0 2168 2169 /// 2170 pure double sin(double x); 2171 /// 2172 pure float sinf(float x); 2173 /// 2174 pure real sinl(real x); // since 8.0 2175 2176 /// 2177 pure double tan(double x); 2178 /// 2179 pure float tanf(float x); 2180 /// 2181 pure real tanl(real x); // since 8.0 2182 2183 /// 2184 double acosh(double x); 2185 /// 2186 float acoshf(float x); 2187 /// 2188 real acoshl(real x); // since 10.0 2189 2190 /// 2191 pure double asinh(double x); 2192 /// 2193 pure float asinhf(float x); 2194 /// 2195 pure real asinhl(real x); // since 10.0 2196 2197 /// 2198 double atanh(double x); 2199 /// 2200 float atanhf(float x); 2201 /// 2202 real atanhl(real x); // since 10.0 2203 2204 /// 2205 double cosh(double x); 2206 /// 2207 float coshf(float x); 2208 /// 2209 real coshl(real x); // since 10.1 2210 2211 /// 2212 double sinh(double x); 2213 /// 2214 float sinhf(float x); 2215 /// 2216 real sinhl(real x); // since 10.1 2217 2218 /// 2219 pure double tanh(double x); 2220 /// 2221 pure float tanhf(float x); 2222 /// 2223 pure real tanhl(real x); // since 10.1 2224 2225 /// 2226 double exp(double x); 2227 /// 2228 float expf(float x); 2229 /// 2230 real expl(real x); // since 10.0 2231 2232 /// 2233 double exp2(double x); 2234 /// 2235 float exp2f(float x); 2236 /// 2237 real exp2l(real x); // since 8.0 2238 2239 /// 2240 double expm1(double x); 2241 /// 2242 float expm1f(float x); 2243 /// 2244 real expm1l(real x); // since 10.0 2245 2246 /// 2247 pure double frexp(double value, int* exp); 2248 /// 2249 pure float frexpf(float value, int* exp); 2250 /// 2251 pure real frexpl(real value, int* exp); // since 6.0 2252 2253 /// 2254 int ilogb(double x); 2255 /// 2256 int ilogbf(float x); 2257 /// 2258 int ilogbl(real x); // since 5.4 2259 2260 /// 2261 double ldexp(double x, int exp); 2262 /// 2263 float ldexpf(float x, int exp); 2264 /// 2265 real ldexpl(real x, int exp); // since 6.0 2266 2267 /// 2268 double log(double x); 2269 /// 2270 float logf(float x); 2271 /// 2272 real logl(real x); // since 10.0 2273 2274 /// 2275 double log10(double x); 2276 /// 2277 float log10f(float x); 2278 /// 2279 real log10l(real x); // since 10.0 2280 2281 /// 2282 double log1p(double x); 2283 /// 2284 float log1pf(float x); 2285 /// 2286 real log1pl(real x); // since 10.0 2287 2288 /// 2289 double log2(double x); // since 8.3 2290 /// 2291 float log2f(float x); // since 8.3 2292 /// 2293 real log2l(real x); // since 10.0 2294 2295 /// 2296 double logb(double x); 2297 /// 2298 float logbf(float x); 2299 /// 2300 real logbl(real x); // since 8.0 2301 2302 /// 2303 pure double modf(double value, double* iptr); 2304 /// 2305 pure float modff(float value, float* iptr); 2306 /// 2307 pure real modfl(real value, real *iptr); // since 8.0 2308 2309 /// 2310 double scalbn(double x, int n); 2311 /// 2312 float scalbnf(float x, int n); 2313 /// 2314 real scalbnl(real x, int n); // since 6.0 2315 2316 /// 2317 double scalbln(double x, c_long n); 2318 /// 2319 float scalblnf(float x, c_long n); 2320 /// 2321 real scalblnl(real x, c_long n); // since 6.0 2322 2323 /// 2324 pure double cbrt(double x); 2325 /// 2326 pure float cbrtf(float x); 2327 /// 2328 pure real cbrtl(real x); // since 9.0 2329 2330 /// 2331 pure double fabs(double x); 2332 /// 2333 pure float fabsf(float x); 2334 /// 2335 pure real fabsl(real x); // since 5.3 2336 2337 /// 2338 double hypot(double x, double y); 2339 /// 2340 float hypotf(float x, float y); 2341 /// 2342 real hypotl(real x, real y); // since 8.0 2343 2344 /// 2345 double pow(double x, double y); 2346 /// 2347 float powf(float x, float y); 2348 /// 2349 real powl(real x, real y); // since 10.4 2350 2351 /// 2352 double sqrt(double x); 2353 /// 2354 float sqrtf(float x); 2355 /// 2356 real sqrtl(real x); // since 8.0 2357 2358 /// 2359 pure double erf(double x); 2360 /// 2361 pure float erff(float x); 2362 /// 2363 pure real erfl(real x); // since 10.1 2364 2365 /// 2366 double erfc(double x); 2367 /// 2368 float erfcf(float x); 2369 /// 2370 real erfcl(real x); // since 10.1 2371 2372 /// 2373 double lgamma(double x); 2374 /// 2375 float lgammaf(float x); 2376 /// 2377 real lgammal(real x); // since 10.2 2378 2379 /// 2380 double tgamma(double x); 2381 /// 2382 float tgammaf(float x); 2383 /// 2384 real tgammal(real x); // since 11.2 2385 2386 /// 2387 pure double ceil(double x); 2388 /// 2389 pure float ceilf(float x); 2390 /// 2391 pure real ceill(real x); // since 5.4 2392 2393 /// 2394 pure double floor(double x); 2395 /// 2396 pure float floorf(float x); 2397 /// 2398 pure real floorl(real x); // since 5.4 2399 2400 /// 2401 pure double nearbyint(double x); 2402 /// 2403 pure float nearbyintf(float x); 2404 /// 2405 pure real nearbyintl(real x); // since 8.0 2406 2407 /// 2408 pure double rint(double x); 2409 /// 2410 pure float rintf(float x); 2411 /// 2412 pure real rintl(real x); // since 8.0 2413 2414 /// 2415 c_long lrint(double x); 2416 /// 2417 c_long lrintf(float x); 2418 /// 2419 c_long lrintl(real x); // since 8.0 2420 2421 /// 2422 long llrint(double x); 2423 /// 2424 long llrintf(float x); 2425 /// 2426 long llrintl(real x); // since 8.0 2427 2428 /// 2429 pure double round(double x); 2430 /// 2431 pure float roundf(float x); 2432 /// 2433 pure real roundl(real x); // since 6.0 2434 2435 /// 2436 c_long lround(double x); 2437 /// 2438 c_long lroundf(float x); 2439 /// 2440 c_long lroundl(real x); // since 6.0 2441 2442 /// 2443 long llround(double x); 2444 /// 2445 long llroundf(float x); 2446 /// 2447 long llroundl(real x); // since 6.0 2448 2449 /// 2450 pure double trunc(double x); 2451 /// 2452 pure float truncf(float x); 2453 /// 2454 pure real truncl(real x); // since 6.0 2455 2456 /// 2457 double fmod(double x, double y); 2458 /// 2459 float fmodf(float x, float y); 2460 /// 2461 real fmodl(real x, real y); // since 8.0 2462 2463 /// 2464 double remainder(double x, double y); 2465 /// 2466 float remainderf(float x, float y); 2467 /// 2468 real remainderl(real x, real y); // since 8.0 2469 2470 /// 2471 double remquo(double x, double y, int* quo); 2472 /// 2473 float remquof(float x, float y, int* quo); 2474 /// 2475 real remquol(real x, real y, int* quo); // since 8.0 2476 2477 /// 2478 pure double copysign(double x, double y); 2479 /// 2480 pure float copysignf(float x, float y); 2481 /// 2482 pure real copysignl(real x, real y); // since 5.3 2483 2484 /// 2485 pure double nan(const char*); // since 8.0 2486 /// 2487 pure float nanf(const char*); // since 8.0 2488 /// 2489 pure real nanl(const char*); // since 8.0 2490 2491 /// 2492 double nextafter(double x, double y); 2493 /// 2494 float nextafterf(float x, float y); 2495 /// 2496 real nextafterl(real x, real y); // since 6.0 2497 2498 /// 2499 double nexttoward(double x, real y); 2500 /// 2501 float nexttowardf(float x, real y); 2502 /// 2503 real nexttowardl(real x, real y); // since 6.0 2504 2505 /// 2506 double fdim(double x, double y); 2507 /// 2508 float fdimf(float x, float y); 2509 /// 2510 real fdiml(real x, real y); // since 5.3 2511 2512 /// 2513 pure double fmax(double x, double y); 2514 /// 2515 pure float fmaxf(float x, float y); 2516 /// 2517 pure real fmaxl(real x, real y); // since 5.3 2518 2519 /// 2520 pure double fmin(double x, double y); 2521 /// 2522 pure float fminf(float x, float y); 2523 /// 2524 pure real fminl(real x, real y); // since 5.3 2525 2526 /// 2527 pure double fma(double x, double y, double z); 2528 /// 2529 pure float fmaf(float x, float y, float z); 2530 /// 2531 pure real fmal(real x, real y, real z); // since 6.0 2532 } 2533 else version (NetBSD) 2534 { 2535 2536 /// 2537 real acosl(real x); 2538 /// 2539 real asinl(real x); 2540 /// 2541 pure real atanl(real x); 2542 /// 2543 real atan2l(real y, real x); 2544 /// 2545 pure real cosl(real x); 2546 /// 2547 pure real sinl(real x); 2548 /// 2549 pure real tanl(real x); 2550 /// 2551 real exp2l(real x); 2552 /// 2553 pure real frexpl(real value, int* exp); 2554 /// 2555 int ilogbl(real x); 2556 /// 2557 real ldexpl(real x, int exp); 2558 /// 2559 real logbl(real x); 2560 /// 2561 pure real modfl(real value, real *iptr); 2562 /// 2563 real scalbnl(real x, int n); 2564 /// 2565 real scalblnl(real x, c_long n); 2566 /// 2567 pure real fabsl(real x); 2568 /// 2569 real hypotl(real x, real y); 2570 /// 2571 real sqrtl(real x); 2572 /// 2573 pure real ceill(real x); 2574 /// 2575 pure real floorl(real x); 2576 /// 2577 pure real nearbyintl(real x); 2578 /// 2579 pure real rintl(real x); 2580 /// 2581 extern(D) c_long lrintl(real x) { return cast(c_long)rintl(x); } 2582 /// 2583 pure real roundl(real x); 2584 /// 2585 extern(D) c_long lroundl(real x) { return cast(c_long)roundl(x);} 2586 /// 2587 extern(D) long llroundl(real x) { return cast(long)roundl(x);} 2588 /// 2589 pure real truncl(real x); 2590 /// 2591 real fmodl(real x, real y); 2592 /// 2593 real remainderl(real x, real y) { return remainder(x,y); } 2594 /// 2595 real remquol(real x, real y, int* quo){ return remquo(x,y,quo); } 2596 /// 2597 pure real copysignl(real x, real y); 2598 /// 2599 pure double nan(char* tagp); 2600 /// 2601 pure float nanf(char* tagp); 2602 /// 2603 pure real nanl(char* tagp); 2604 /// 2605 real nextafterl(real x, real y); 2606 /// 2607 extern(D) real nexttowardl(real x, real y) { return nexttoward(cast(double) x, cast(double) y); } 2608 /// 2609 real fdiml(real x, real y); 2610 /// 2611 pure real fmaxl(real x, real y); 2612 /// 2613 pure real fminl(real x, real y); 2614 /// 2615 pure real fmal(real x, real y, real z); 2616 2617 /// 2618 double acos(double x); 2619 /// 2620 float acosf(float x); 2621 2622 /// 2623 double asin(double x); 2624 /// 2625 float asinf(float x); 2626 2627 /// 2628 pure double atan(double x); 2629 /// 2630 pure float atanf(float x); 2631 2632 /// 2633 double atan2(double y, double x); 2634 /// 2635 float atan2f(float y, float x); 2636 2637 /// 2638 pure double cos(double x); 2639 /// 2640 pure float cosf(float x); 2641 2642 /// 2643 pure double sin(double x); 2644 /// 2645 pure float sinf(float x); 2646 2647 /// 2648 pure double tan(double x); 2649 /// 2650 pure float tanf(float x); 2651 2652 /// 2653 double acosh(double x); 2654 /// 2655 float acoshf(float x); 2656 /// 2657 real acoshl(real x); 2658 2659 /// 2660 pure double asinh(double x); 2661 /// 2662 pure float asinhf(float x); 2663 /// 2664 pure real asinhl(real x); 2665 2666 /// 2667 double atanh(double x); 2668 /// 2669 float atanhf(float x); 2670 /// 2671 real atanhl(real x); 2672 2673 /// 2674 double cosh(double x); 2675 /// 2676 float coshf(float x); 2677 /// 2678 real coshl(real x); 2679 2680 /// 2681 double sinh(double x); 2682 /// 2683 float sinhf(float x); 2684 /// 2685 real sinhl(real x); 2686 2687 /// 2688 pure double tanh(double x); 2689 /// 2690 pure float tanhf(float x); 2691 /// 2692 pure real tanhl(real x); 2693 2694 /// 2695 double exp(double x); 2696 /// 2697 float expf(float x); 2698 /// 2699 real expl(real x); 2700 2701 /// 2702 double exp2(double x); 2703 /// 2704 float exp2f(float x); 2705 2706 /// 2707 double expm1(double x); 2708 /// 2709 float expm1f(float x); 2710 /// 2711 real expm1l(real x) { return expm1(cast(double) x); } 2712 2713 /// 2714 pure double frexp(double value, int* exp); 2715 /// 2716 pure float frexpf(float value, int* exp); 2717 2718 /// 2719 int ilogb(double x); 2720 /// 2721 int ilogbf(float x); 2722 2723 /// 2724 double ldexp(double x, int exp); 2725 /// 2726 float ldexpf(float x, int exp); 2727 2728 /// 2729 double log(double x); 2730 /// 2731 float logf(float x); 2732 /// NetBSD has no logl. It is just alias log(double) 2733 real logl(real x) 2734 { 2735 if (x<0) return real.nan; 2736 if (x==0) return -real.infinity; 2737 if (isnan(x) || isinf(x)) return x; 2738 real rs = 0; 2739 if (x>double.max) 2740 { 2741 immutable MAX = log(double.max); 2742 for (; x>double.max; x /= double.max) 2743 rs += MAX; 2744 } 2745 else if (x<double.min_normal) 2746 { 2747 immutable MIN = log(double.min_normal); 2748 for (; x<double.min_normal; x /= double.min_normal) 2749 rs += MIN; 2750 } 2751 rs += log(x); 2752 return rs; 2753 } 2754 2755 /// 2756 double log10(double x); 2757 /// 2758 float log10f(float x); 2759 ///NetBSD has no log10l. It is just alias log(double) 2760 real log10l(real x) 2761 { 2762 if (x<0) return real.nan; 2763 if (x==0) return -real.infinity; 2764 if (isnan(x) || isinf(x)) return x; 2765 2766 real rs = 0; 2767 if (x>double.max) 2768 { 2769 immutable MAX = log10(double.max); 2770 for (; x>double.max; x /= double.max) 2771 rs += MAX; 2772 } 2773 else if (x<double.min_normal) 2774 { 2775 immutable MIN = log10(double.min_normal); 2776 for (; x<double.min_normal; x /= double.min_normal) 2777 rs += MIN; 2778 } 2779 rs += log10(x); 2780 return rs; 2781 } 2782 2783 2784 /// 2785 double log1p(double x); 2786 /// 2787 float log1pf(float x); 2788 /// 2789 extern(D) real log1pl(real x) { return log1p(cast(double) x); } 2790 2791 private enum real ONE_LN2 = 1 / 0x1.62e42fefa39ef358p-1L; 2792 /// 2793 extern(D) double log2(double x) { return log(x) * ONE_LN2; } 2794 /// 2795 extern(D) float log2f(float x) { return logf(x) * ONE_LN2; } 2796 /// 2797 real log2l(real x) { return logl(x) * ONE_LN2; } 2798 2799 /// 2800 double logb(double x); 2801 /// 2802 float logbf(float x); 2803 2804 /// 2805 pure double modf(double value, double* iptr); 2806 /// 2807 pure float modff(float value, float* iptr); 2808 2809 /// 2810 double scalbn(double x, int n); 2811 /// 2812 float scalbnf(float x, int n); 2813 2814 /// 2815 double scalbln(double x, c_long n); 2816 /// 2817 float scalblnf(float x, c_long n); 2818 2819 /// 2820 pure double cbrt(double x); 2821 /// 2822 pure float cbrtf(float x); 2823 /// 2824 pure real cbrtl(real x); 2825 2826 /// 2827 pure double fabs(double x); 2828 /// 2829 pure float fabsf(float x); 2830 2831 /// 2832 double hypot(double x, double y); 2833 /// 2834 float hypotf(float x, float y); 2835 2836 /// 2837 double pow(double x, double y); 2838 /// 2839 float powf(float x, float y); 2840 /// 2841 real powl(real x, real y); 2842 2843 /// 2844 double sqrt(double x); 2845 /// 2846 float sqrtf(float x); 2847 2848 /// 2849 pure double erf(double x); 2850 /// 2851 pure float erff(float x); 2852 /// 2853 extern(D) pure real erfl(real x) { return erf(cast(double) x); } 2854 2855 /// 2856 double erfc(double x); 2857 /// 2858 float erfcf(float x); 2859 /// 2860 real erfcl(real x) { return erfc(cast(double) x); } 2861 2862 /// 2863 double lgamma(double x); 2864 /// 2865 float lgammaf(float x); 2866 /// 2867 real lgammal(real x){ return lgamma(x); } 2868 2869 /// 2870 double tgamma(double x); 2871 /// 2872 float tgammaf(float x); 2873 /// 2874 real tgammal(real x){ return tgamma(cast(double) x); } 2875 2876 /// 2877 pure double ceil(double x); 2878 /// 2879 pure float ceilf(float x); 2880 2881 /// 2882 pure double floor(double x); 2883 /// 2884 pure float floorf(float x); 2885 2886 /// 2887 pure double nearbyint(double x); 2888 /// 2889 pure float nearbyintf(float x); 2890 2891 /// 2892 pure double rint(double x); 2893 /// 2894 pure float rintf(float x); 2895 2896 /// 2897 c_long lrint(double x); 2898 /// 2899 c_long lrintf(float x); 2900 2901 /// 2902 long llrint(double x); 2903 /// 2904 long llrintf(float x); 2905 /// 2906 extern(D) long llrintl(real x) { return cast(long)rintl(x); } 2907 2908 /// 2909 pure double round(double x); 2910 /// 2911 pure float roundf(float x); 2912 2913 /// 2914 c_long lround(double x); 2915 /// 2916 c_long lroundf(float x); 2917 2918 /// 2919 long llround(double x); 2920 /// 2921 long llroundf(float x); 2922 2923 /// 2924 pure double trunc(double x); 2925 /// 2926 pure float truncf(float x); 2927 2928 /// 2929 double fmod(double x, double y); 2930 /// 2931 float fmodf(float x, float y); 2932 2933 /// 2934 double remainder(double x, double y); 2935 /// 2936 float remainderf(float x, float y); 2937 2938 /// 2939 double remquo(double x, double y, int* quo); 2940 /// 2941 float remquof(float x, float y, int* quo); 2942 2943 /// 2944 pure double copysign(double x, double y); 2945 /// 2946 pure float copysignf(float x, float y); 2947 2948 /// 2949 double nextafter(double x, double y); 2950 /// 2951 float nextafterf(float x, float y); 2952 2953 /// 2954 double nexttoward(double x, real y); 2955 /// 2956 float nexttowardf(float x, real y); 2957 2958 /// 2959 double fdim(double x, double y); 2960 /// 2961 float fdimf(float x, float y); 2962 2963 /// 2964 pure double fmax(double x, double y); 2965 /// 2966 pure float fmaxf(float x, float y); 2967 2968 /// 2969 pure double fmin(double x, double y); 2970 /// 2971 pure float fminf(float x, float y); 2972 2973 /// 2974 pure double fma(double x, double y, double z); 2975 /// 2976 pure float fmaf(float x, float y, float z); 2977 } 2978 else version (OpenBSD) 2979 { 2980 /// 2981 double acos(double x); 2982 /// 2983 double asin(double x); 2984 /// 2985 pure double atan(double x); 2986 /// 2987 double atan2(double, double); 2988 /// 2989 pure double cos(double x); 2990 /// 2991 pure double sin(double x); 2992 /// 2993 pure double tan(double x); 2994 /// 2995 double cosh(double x); 2996 /// 2997 double sinh(double x); 2998 /// 2999 pure double tanh(double x); 3000 /// 3001 double exp(double x); 3002 /// 3003 pure double frexp(double, int *exp); 3004 /// 3005 double ldexp(double, int exp); 3006 /// 3007 double log(double x); 3008 /// 3009 double log10(double x); 3010 /// 3011 pure double modf(double x, double *iptr); 3012 /// 3013 double pow(double x, double y); 3014 /// 3015 double sqrt(double x); 3016 /// 3017 pure double ceil(double x); 3018 /// 3019 pure double fabs(double x); 3020 /// 3021 pure double floor(double x); 3022 /// 3023 double fmod(double x, double); 3024 /// 3025 double acosh(double x); 3026 /// 3027 pure double asinh(double x); 3028 /// 3029 double atanh(double x); 3030 /// 3031 double exp2(double x); 3032 /// 3033 double expm1(double x); 3034 /// 3035 int ilogb(double x); 3036 /// 3037 double log1p(double x); 3038 /// 3039 double log2(double x); 3040 /// 3041 double logb(double x); 3042 /// 3043 double scalbn(double x, int n); 3044 /// 3045 double scalbln(double x, c_long n); 3046 /// 3047 pure double cbrt(double x); 3048 /// 3049 double hypot(double x, double y); 3050 /// 3051 pure double erf(double x); 3052 /// 3053 double erfc(double x); 3054 /// 3055 double lgamma(double x); 3056 /// 3057 double tgamma(double x); 3058 /// 3059 pure double nearbyint(double x); 3060 /// 3061 pure double rint(double x); 3062 /// 3063 c_long lrint(double x); 3064 /// 3065 long llrint(double x); 3066 /// 3067 pure double round(double x); 3068 /// 3069 c_long lround(double x); 3070 /// 3071 long llround(double x); 3072 /// 3073 pure double trunc(double x); 3074 /// 3075 double remainder(double x , double y); 3076 /// 3077 double remquo(double x, double y, int * quo); 3078 /// 3079 pure double copysign(double x, double y); 3080 /// 3081 pure double nan(const char *); 3082 /// 3083 double nextafter(double x, double y); 3084 /// 3085 double nexttoward(double x, real y); 3086 /// 3087 double fdim(double x, double y); 3088 /// 3089 pure double fmax(double x, double y); 3090 /// 3091 pure double fmin(double x, double y); 3092 /// 3093 pure double fma(double x, double y, double z); 3094 /// 3095 double j0(double x); 3096 /// 3097 double j1(double x); 3098 /// 3099 double jn(int, double); 3100 /// 3101 double y0(double x); 3102 /// 3103 double y1(double x); 3104 /// 3105 double yn(int, double); 3106 /// 3107 double gamma(double x); 3108 /// 3109 double scalb(double x, double y); 3110 /// 3111 double drem(double x, double y); 3112 /// 3113 int finite(double x); 3114 /// 3115 double gamma_r(double x, int *); 3116 /// 3117 double lgamma_r(double x, int *); 3118 /// 3119 double significand(double x); 3120 3121 /// 3122 float acosf(float x); 3123 /// 3124 float asinf(float x); 3125 /// 3126 pure float atanf(float x); 3127 /// 3128 float atan2f(float x, float y); 3129 /// 3130 pure float cosf(float x); 3131 /// 3132 pure float sinf(float x); 3133 /// 3134 pure float tanf(float x); 3135 /// 3136 float acoshf(float x); 3137 /// 3138 pure float asinhf(float x); 3139 /// 3140 float atanhf(float x); 3141 /// 3142 float coshf(float x); 3143 /// 3144 float sinhf(float x); 3145 /// 3146 pure float tanhf(float x); 3147 /// 3148 float expf(float x); 3149 /// 3150 float exp2f(float x); 3151 /// 3152 float expm1f(float x); 3153 /// 3154 pure float frexpf(float x, int *exp); 3155 /// 3156 int ilogbf(float x); 3157 /// 3158 float ldexpf(float x, int exp); 3159 /// 3160 float logf(float x); 3161 /// 3162 float log10f(float x); 3163 /// 3164 float log1pf(float x); 3165 /// 3166 float log2f(float x); 3167 /// 3168 float logbf(float x); 3169 /// 3170 pure float modff(float x, float *iptr); 3171 /// 3172 float scalbnf(float x, int y); 3173 /// 3174 float scalblnf(float x, c_long y); 3175 /// 3176 pure float cbrtf(float x); 3177 /// 3178 pure float fabsf(float x); 3179 /// 3180 float hypotf(float x, float y); 3181 /// 3182 float powf(float x, float y); 3183 /// 3184 float sqrtf(float x); 3185 /// 3186 pure float erff(float x); 3187 /// 3188 float erfcf(float x); 3189 /// 3190 float lgammaf(float x); 3191 /// 3192 float tgammaf(float x); 3193 /// 3194 pure float ceilf(float x); 3195 /// 3196 pure float floorf(float x); 3197 /// 3198 pure float nearbyintf(float x); 3199 /// 3200 pure float rintf(float x); 3201 /// 3202 c_long lrintf(float x); 3203 /// 3204 long llrintf(float x); 3205 /// 3206 pure float roundf(float x); 3207 /// 3208 c_long lroundf(float x); 3209 /// 3210 long llroundf(float x); 3211 /// 3212 pure float truncf(float x); 3213 /// 3214 pure float fmodf(float x, float y); 3215 /// 3216 float remainderf(float x, float y); 3217 /// 3218 float remquof(float x, float y, int *iptr); 3219 /// 3220 pure float copysignf(float x, float y); 3221 /// 3222 pure float nanf(const char *); 3223 /// 3224 float nextafterf(float x, float y); 3225 /// 3226 float nexttowardf(float x, real y); 3227 /// 3228 float fdimf(float x, float y); 3229 /// 3230 pure float fmaxf(float x, float y); 3231 /// 3232 pure float fminf(float x, float y); 3233 /// 3234 pure float fmaf(float x, float y, float z); 3235 /// 3236 float j0f(float x); 3237 /// 3238 float j1f(float x); 3239 /// 3240 float jnf(int, float); 3241 /// 3242 float scalbf(float x, float); 3243 /// 3244 float y0f(float x); 3245 /// 3246 float y1f(float x); 3247 /// 3248 float ynf(int, float); 3249 /// 3250 float gammaf(float x); 3251 /// 3252 float dremf(float x, float); 3253 /// 3254 pure int finitef(float x); 3255 /// 3256 pure int isinff(float x); 3257 /// 3258 pure int isnanf(float x); 3259 /// 3260 float gammaf_r(float x, int *); 3261 /// 3262 float lgammaf_r(float x, int *); 3263 /// 3264 float significandf(float x); 3265 /// 3266 3267 /// 3268 pure real acosl(real x); 3269 /// 3270 pure real asinl(real x); 3271 /// 3272 pure real atanl(real x); 3273 /// 3274 real atan2l(real y, real x); 3275 /// 3276 pure real cosl(real x); 3277 /// 3278 pure real sinl(real x); 3279 /// 3280 pure real tanl(real x); 3281 /// 3282 real acoshl(real x); 3283 /// 3284 pure real asinhl(real x); 3285 /// 3286 real atanhl(real x); 3287 /// 3288 real coshl(real x); 3289 /// 3290 real sinhl(real x); 3291 /// 3292 pure real tanhl(real x); 3293 /// 3294 real expl(real x); 3295 /// 3296 real exp2l(real x); 3297 /// 3298 real expm1l(real x); 3299 /// 3300 pure real frexpl(real x, int *exp); 3301 /// 3302 int ilogbl(real x); 3303 /// 3304 real ldexpl(real x, int exp); 3305 /// 3306 real logl(real x); 3307 /// 3308 real log10l(real x); 3309 /// 3310 real log1pl(real x); 3311 /// 3312 real log2l(real x); 3313 /// 3314 real logbl(real x); 3315 /// 3316 pure real modfl(real x, real *iptr); 3317 /// 3318 real scalbnl(real x, int y); 3319 /// 3320 real scalblnl(real x, c_long y); 3321 /// 3322 pure real cbrtl(real x); 3323 /// 3324 pure real fabsl(real x); 3325 /// 3326 real hypotl(real x, real y); 3327 /// 3328 real powl(real x, real y); 3329 /// 3330 real sqrtl(real x); 3331 /// 3332 pure real erfl(real x); 3333 /// 3334 real erfcl(real x); 3335 /// 3336 real lgammal(real x); 3337 /// 3338 real tgammal(real x); 3339 /// 3340 pure real ceill(real x); 3341 /// 3342 pure real floorl(real x); 3343 /// 3344 pure real nearbyintl(real x); 3345 /// 3346 pure real rintl(real x); 3347 /// 3348 c_long lrintl(real x); 3349 /// 3350 long llrintl(real x); 3351 /// 3352 pure real roundl(real x); 3353 /// 3354 c_long lroundl(real x); 3355 /// 3356 long llroundl(real x); 3357 /// 3358 pure real truncl(real x); 3359 /// 3360 pure real fmodl(real x, real); 3361 /// 3362 pure real remainderl(real x, real); 3363 /// 3364 pure real remquol(real x, real y, int *iptr); 3365 /// 3366 pure real copysignl(real x, real y); 3367 /// 3368 pure real nanl(const char *); 3369 /// 3370 real nextafterl(real x, real y); 3371 /// 3372 real nexttowardl(real x, real y); 3373 /// 3374 real fdiml(real x, real y); 3375 /// 3376 pure real fmaxl(real x, real y); 3377 /// 3378 pure real fminl(real x, real y); 3379 /// 3380 pure real fmal(real x, real, real); 3381 } 3382 else version (DragonFlyBSD) 3383 { 3384 /* double */ 3385 double acos(double x); 3386 double asin(double x); 3387 pure double atan(double x); 3388 double atan2(double, double); 3389 pure double cos(double x); 3390 pure double sin(double x); 3391 pure double tan(double x); 3392 3393 double cosh(double x); 3394 double sinh(double x); 3395 pure double tanh(double x); 3396 3397 double exp(double x); 3398 pure double frexp(double, int *exp); 3399 double ldexp(double, int exp); 3400 double log(double x); 3401 double log10(double x); 3402 pure double modf(double x, double *iptr); 3403 3404 double pow(double x, double y); 3405 double sqrt(double x); 3406 3407 pure double ceil(double x); 3408 pure double fabs(double x); 3409 pure double floor(double x); 3410 double fmod(double x, double); 3411 3412 double acosh(double x); 3413 pure double asinh(double x); 3414 double atanh(double x); 3415 3416 double exp2(double x); 3417 double expm1(double x); 3418 int ilogb(double x); 3419 double log1p(double x); 3420 double log2(double x); 3421 double logb(double x); 3422 double scalbn(double x, int n); 3423 double scalbln(double x, c_long n); 3424 3425 pure double cbrt(double x); 3426 double hypot(double x, double y); 3427 3428 pure double erf(double x); 3429 double erfc(double x); 3430 double lgamma(double x); 3431 double tgamma(double x); 3432 3433 pure double nearbyint(double x); 3434 pure double rint(double x); 3435 c_long lrint(double x); 3436 long llrint(double x); 3437 pure double round(double x); 3438 c_long lround(double x); 3439 long llround(double x); 3440 pure double trunc(double x); 3441 3442 double remainder(double x , double y); 3443 double remquo(double x, double y, int * quo); 3444 3445 pure double copysign(double x, double y); 3446 pure double nan(const char *); 3447 double nextafter(double x, double y); 3448 double nexttoward(double x, real y); 3449 3450 double fdim(double x, double y); 3451 pure double fmax(double x, double y); 3452 pure double fmin(double x, double y); 3453 3454 pure double fma(double x, double y, double z); 3455 3456 double j0(double x); 3457 double j1(double x); 3458 double jn(int, double); 3459 double y0(double x); 3460 double y1(double x); 3461 double yn(int, double); 3462 3463 double gamma(double x); 3464 double scalb(double x, double y); 3465 3466 double drem(double x, double y); 3467 int finite(double x); 3468 double gamma_r(double x, int *); 3469 double lgamma_r(double x, int *); 3470 3471 double significand(double x); 3472 3473 /* float */ 3474 float acosf(float x); 3475 float asinf(float x); 3476 pure float atanf(float x); 3477 float atan2f(float x, float y); 3478 pure float cosf(float x); 3479 pure float sinf(float x); 3480 pure float tanf(float x); 3481 3482 float acoshf(float x); 3483 pure float asinhf(float x); 3484 float atanhf(float x); 3485 float coshf(float x); 3486 float sinhf(float x); 3487 pure float tanhf(float x); 3488 3489 float expf(float x); 3490 float exp2f(float x); 3491 float expm1f(float x); 3492 pure float frexpf(float x, int *exp); 3493 int ilogbf(float x); 3494 float ldexpf(float x, int exp); 3495 float logf(float x); 3496 float log10f(float x); 3497 float log1pf(float x); 3498 float log2f(float x); 3499 float logbf(float x); 3500 pure float modff(float x, float *iptr); 3501 float scalbnf(float x, int y); 3502 float scalblnf(float x, c_long y); 3503 3504 pure float cbrtf(float x); 3505 pure float fabsf(float x); 3506 float hypotf(float x, float y); 3507 float powf(float x, float y); 3508 float sqrtf(float x); 3509 3510 pure float erff(float x); 3511 float erfcf(float x); 3512 float lgammaf(float x); 3513 float tgammaf(float x); 3514 3515 pure float ceilf(float x); 3516 pure float floorf(float x); 3517 pure float nearbyintf(float x); 3518 pure float rintf(float x); 3519 c_long lrintf(float x); 3520 long llrintf(float x); 3521 pure float roundf(float x); 3522 c_long lroundf(float x); 3523 long llroundf(float x); 3524 pure float truncf(float x); 3525 3526 pure float fmodf(float x, float y); 3527 float remainderf(float x, float y); 3528 float remquof(float x, float y, int *iptr); 3529 3530 pure float copysignf(float x, float y); 3531 pure float nanf(const char *); 3532 float nextafterf(float x, float y); 3533 float nexttowardf(float x, real y); 3534 3535 float fdimf(float x, float y); 3536 pure float fmaxf(float x, float y); 3537 pure float fminf(float x, float y); 3538 3539 pure float fmaf(float x, float y, float z); 3540 3541 float j0f(float x); 3542 float j1f(float x); 3543 float jnf(int, float); 3544 float scalbf(float x, float); 3545 float y0f(float x); 3546 float y1f(float x); 3547 float ynf(int, float); 3548 float gammaf(float x); 3549 float dremf(float x, float); 3550 pure int finitef(float x); 3551 pure int isinff(float x); 3552 pure int isnanf(float x); 3553 3554 float gammaf_r(float x, int *); 3555 float lgammaf_r(float x, int *); 3556 float significandf(float x); 3557 3558 /* real */ 3559 pure real acosl(real x); 3560 pure real asinl(real x); 3561 pure real atanl(real x); 3562 real atan2l(real y, real x); 3563 pure real cosl(real x); 3564 pure real sinl(real x); 3565 pure real tanl(real x); 3566 3567 real acoshl(real x); 3568 pure real asinhl(real x); 3569 real atanhl(real x); 3570 real coshl(real x); 3571 real sinhl(real x); 3572 pure real tanhl(real x); 3573 3574 real expl(real x); 3575 real exp2l(real x); 3576 real expm1l(real x); 3577 pure real frexpl(real x, int *exp); 3578 int ilogbl(real x); 3579 real ldexpl(real x, int exp); 3580 real logl(real x); 3581 real log10l(real x); 3582 real log1pl(real x); 3583 real log2l(real x); 3584 real logbl(real x); 3585 pure real modfl(real x, real *iptr); 3586 real scalbnl(real x, int y); 3587 real scalblnl(real x, c_long y); 3588 3589 pure real cbrtl(real x); 3590 pure real fabsl(real x); 3591 real hypotl(real x, real y); 3592 real powl(real x, real y); 3593 real sqrtl(real x); 3594 3595 pure real erfl(real x); 3596 real erfcl(real x); 3597 real lgammal(real x); 3598 real tgammal(real x); 3599 3600 pure real ceill(real x); 3601 pure real floorl(real x); 3602 pure real nearbyintl(real x); 3603 pure real rintl(real x); 3604 c_long lrintl(real x); 3605 long llrintl(real x); 3606 pure real roundl(real x); 3607 c_long lroundl(real x); 3608 long llroundl(real x); 3609 pure real truncl(real x); 3610 3611 pure real fmodl(real x, real); 3612 pure real remainderl(real x, real); 3613 pure real remquol(real x, real y, int *iptr); 3614 3615 pure real copysignl(real x, real y); 3616 pure real nanl(const char *); 3617 real nextafterl(real x, real y); 3618 real nexttowardl(real x, real y); 3619 3620 real fdiml(real x, real y); 3621 pure real fmaxl(real x, real y); 3622 pure real fminl(real x, real y); 3623 3624 pure real fmal(real x, real, real); 3625 } 3626 else version (CRuntime_Bionic) 3627 { 3628 /// 3629 double acos(double x); 3630 /// 3631 float acosf(float x); 3632 /// Added since Lollipop 3633 real acosl(real x); 3634 3635 /// 3636 double asin(double x); 3637 /// 3638 float asinf(float x); 3639 /// Added since Lollipop 3640 real asinl(real x); 3641 3642 /// 3643 pure double atan(double x); 3644 /// 3645 pure float atanf(float x); 3646 /// Added since Lollipop 3647 pure real atanl(real x); 3648 3649 /// 3650 double atan2(double y, double x); 3651 /// 3652 float atan2f(float y, float x); 3653 /// Added since Lollipop 3654 real atan2l(real y, real x); 3655 3656 /// 3657 pure double cos(double x); 3658 /// 3659 pure float cosf(float x); 3660 /// 3661 pure real cosl(real x); 3662 3663 /// 3664 pure double sin(double x); 3665 /// 3666 pure float sinf(float x); 3667 /// Added since Lollipop 3668 pure real sinl(real x); 3669 3670 /// 3671 pure double tan(double x); 3672 /// 3673 pure float tanf(float x); 3674 /// Added since Lollipop 3675 pure real tanl(real x); 3676 3677 /// 3678 double acosh(double x); 3679 /// 3680 float acoshf(float x); 3681 /// Added since Lollipop 3682 real acoshl(real x); 3683 3684 /// 3685 pure double asinh(double x); 3686 /// 3687 pure float asinhf(float x); 3688 /// Added since Lollipop 3689 pure real asinhl(real x); 3690 3691 /// 3692 double atanh(double x); 3693 /// 3694 float atanhf(float x); 3695 /// Added since Lollipop 3696 real atanhl(real x); 3697 3698 /// 3699 double cosh(double x); 3700 /// 3701 float coshf(float x); 3702 /// Added since Lollipop 3703 real coshl(real x); 3704 3705 /// 3706 double sinh(double x); 3707 /// 3708 float sinhf(float x); 3709 /// Added since Lollipop 3710 real sinhl(real x); 3711 3712 /// 3713 pure double tanh(double x); 3714 /// 3715 pure float tanhf(float x); 3716 /// Added since Lollipop 3717 pure real tanhl(real x); 3718 3719 /// 3720 double exp(double x); 3721 /// 3722 float expf(float x); 3723 /// 3724 real expl(real x); 3725 3726 /// 3727 double exp2(double x); 3728 /// 3729 float exp2f(float x); 3730 /// Added since Lollipop 3731 real exp2l(real x); 3732 3733 /// 3734 double expm1(double x); 3735 /// 3736 float expm1f(float x); 3737 /// Added since Lollipop 3738 real expm1l(real x); 3739 3740 /// 3741 pure double frexp(double value, int* exp); 3742 /// 3743 pure float frexpf(float value, int* exp); 3744 /// Added since Lollipop 3745 pure real frexpl(real value, int* exp); 3746 3747 /// 3748 int ilogb(double x); 3749 /// 3750 int ilogbf(float x); 3751 /// 3752 int ilogbl(real x); 3753 3754 /// 3755 double ldexp(double x, int exp); 3756 /// 3757 float ldexpf(float x, int exp); 3758 /// 3759 real ldexpl(real x, int exp); 3760 3761 /// 3762 double log(double x); 3763 /// 3764 float logf(float x); 3765 /// Added since Lollipop 3766 real logl(real x); 3767 3768 /// 3769 double log10(double x); 3770 /// 3771 float log10f(float x); 3772 /// Added since Lollipop 3773 real log10l(real x); 3774 3775 /// 3776 double log1p(double x); 3777 /// 3778 float log1pf(float x); 3779 /// Added since Lollipop 3780 real log1pl(real x); 3781 3782 /// 3783 double log2(double x); 3784 /// 3785 float log2f(float x); 3786 /// 3787 real log2l(real x); 3788 3789 /// 3790 double logb(double x); 3791 /// 3792 float logbf(float x); 3793 /// 3794 real logbl(real x); 3795 3796 /// 3797 pure double modf(double value, double* iptr); 3798 /// 3799 pure float modff(float value, float* iptr); 3800 /// Added since Lollipop 3801 pure real modfl(real value, real *iptr); 3802 3803 /// 3804 double scalbn(double x, int n); 3805 /// 3806 float scalbnf(float x, int n); 3807 /// 3808 real scalbnl(real x, int n); 3809 3810 /// 3811 double scalbln(double x, c_long n); 3812 /// 3813 float scalblnf(float x, c_long n); 3814 /// 3815 real scalblnl(real x, c_long n); 3816 3817 /// 3818 pure double cbrt(double x); 3819 /// 3820 pure float cbrtf(float x); 3821 /// Added since Lollipop 3822 pure real cbrtl(real x); 3823 3824 /// 3825 pure double fabs(double x); 3826 /// 3827 pure float fabsf(float x); 3828 /// 3829 pure real fabsl(real x); 3830 3831 /// 3832 double hypot(double x, double y); 3833 /// 3834 float hypotf(float x, float y); 3835 /// Added since Lollipop 3836 real hypotl(real x, real y); 3837 3838 /// 3839 double pow(double x, double y); 3840 /// 3841 float powf(float x, float y); 3842 /// Added since Lollipop 3843 real powl(real x, real y); 3844 3845 /// 3846 double sqrt(double x); 3847 /// 3848 float sqrtf(float x); 3849 /// Added since Lollipop 3850 real sqrtl(real x); 3851 3852 /// 3853 pure double erf(double x); 3854 /// 3855 pure float erff(float x); 3856 /// Added since Lollipop 3857 pure real erfl(real x); 3858 3859 /// 3860 double erfc(double x); 3861 /// 3862 float erfcf(float x); 3863 /// Added since Lollipop 3864 real erfcl(real x); 3865 3866 /// 3867 double lgamma(double x); 3868 /// 3869 float lgammaf(float x); 3870 /// Added since Lollipop 3871 real lgammal(real x); 3872 3873 /// 3874 double tgamma(double x); 3875 /// 3876 float tgammaf(float x); 3877 /// Added since Lollipop 3878 real tgammal(real x); 3879 3880 /// 3881 pure double ceil(double x); 3882 /// 3883 pure float ceilf(float x); 3884 /// 3885 pure real ceill(real x); 3886 3887 /// 3888 pure double floor(double x); 3889 /// 3890 pure float floorf(float x); 3891 /// 3892 pure real floorl(real x); 3893 3894 /// 3895 pure double nearbyint(double x); 3896 /// 3897 pure float nearbyintf(float x); 3898 /// Added since Lollipop 3899 pure real nearbyintl(real x); 3900 3901 /// 3902 pure double rint(double x); 3903 /// 3904 pure float rintf(float x); 3905 /// Added since Lollipop 3906 pure real rintl(real x); 3907 3908 /// 3909 c_long lrint(double x); 3910 /// 3911 c_long lrintf(float x); 3912 /// Added since Lollipop 3913 c_long lrintl(real x); 3914 3915 /// 3916 long llrint(double x); 3917 /// 3918 long llrintf(float x); 3919 /// Added since Lollipop 3920 long llrintl(real x); 3921 3922 /// 3923 pure double round(double x); 3924 /// 3925 pure float roundf(float x); 3926 /// 3927 pure real roundl(real x); 3928 3929 /// 3930 c_long lround(double x); 3931 /// 3932 c_long lroundf(float x); 3933 /// 3934 c_long lroundl(real x); 3935 3936 /// 3937 long llround(double x); 3938 /// 3939 long llroundf(float x); 3940 /// 3941 long llroundl(real x); 3942 3943 /// 3944 pure double trunc(double x); 3945 /// 3946 pure float truncf(float x); 3947 /// 3948 pure real truncl(real x); 3949 3950 /// 3951 double fmod(double x, double y); 3952 /// 3953 float fmodf(float x, float y); 3954 /// Added since Lollipop 3955 real fmodl(real x, real y); 3956 3957 /// 3958 double remainder(double x, double y); 3959 /// 3960 float remainderf(float x, float y); 3961 /// Added since Lollipop 3962 real remainderl(real x, real y); 3963 3964 /// 3965 double remquo(double x, double y, int* quo); 3966 /// 3967 float remquof(float x, float y, int* quo); 3968 /// Added since Lollipop 3969 real remquol(real x, real y, int* quo); 3970 3971 /// 3972 pure double copysign(double x, double y); 3973 /// 3974 pure float copysignf(float x, float y); 3975 /// 3976 pure real copysignl(real x, real y); 3977 3978 /// 3979 pure double nan(char* tagp); 3980 /// 3981 pure float nanf(char* tagp); 3982 /// 3983 pure real nanl(char* tagp); 3984 3985 /// 3986 double nextafter(double x, double y); 3987 /// 3988 float nextafterf(float x, float y); 3989 /// Added since Lollipop 3990 real nextafterl(real x, real y); 3991 3992 /// 3993 double nexttoward(double x, real y); 3994 /// 3995 float nexttowardf(float x, real y); 3996 /// 3997 real nexttowardl(real x, real y); 3998 3999 /// 4000 double fdim(double x, double y); 4001 /// 4002 float fdimf(float x, float y); 4003 /// 4004 real fdiml(real x, real y); 4005 4006 /// 4007 pure double fmax(double x, double y); 4008 /// 4009 pure float fmaxf(float x, float y); 4010 /// 4011 pure real fmaxl(real x, real y); 4012 4013 /// 4014 pure double fmin(double x, double y); 4015 /// 4016 pure float fminf(float x, float y); 4017 /// 4018 pure real fminl(real x, real y); 4019 4020 /// 4021 pure double fma(double x, double y, double z); 4022 /// 4023 pure float fmaf(float x, float y, float z); 4024 /// Added since Lollipop 4025 pure real fmal(real x, real y, real z); 4026 } 4027 else version (CRuntime_UClibc) 4028 { 4029 // uClibc wraps 'long double' to double, so we do the same for 'real' 4030 4031 /// 4032 double acos(double x); 4033 /// 4034 float acosf(float x); 4035 /// 4036 extern(D) real acosl(real x) { return acos(cast(double) x); } 4037 4038 /// 4039 double asin(double x); 4040 /// 4041 float asinf(float x); 4042 /// 4043 extern(D) real asinl(real x) { return asin(cast(double) x); } 4044 4045 /// 4046 pure double atan(double x); 4047 /// 4048 pure float atanf(float x); 4049 /// 4050 extern(D) pure real atanl(real x) { return atan(cast(double) x); } 4051 4052 /// 4053 double atan2(double y, double x); 4054 /// 4055 float atan2f(float y, float x); 4056 /// 4057 extern(D) real atan2l(real y, real x) { return atan2(cast(double) y, cast(double) x); } 4058 4059 /// 4060 pure double cos(double x); 4061 /// 4062 pure float cosf(float x); 4063 /// 4064 extern(D) pure real cosl(real x) { return cos(cast(double) x); } 4065 4066 /// 4067 pure double sin(double x); 4068 /// 4069 pure float sinf(float x); 4070 /// 4071 extern(D) pure real sinl(real x) { return sin(cast(double) x); } 4072 4073 /// 4074 pure double tan(double x); 4075 /// 4076 pure float tanf(float x); 4077 /// 4078 extern(D) pure real tanl(real x) { return tan(cast(double) x); } 4079 4080 /// 4081 double acosh(double x); 4082 /// 4083 float acoshf(float x); 4084 /// 4085 extern(D) real acoshl(real x) { return acosh(cast(double) x); } 4086 4087 /// 4088 pure double asinh(double x); 4089 /// 4090 pure float asinhf(float x); 4091 /// 4092 extern(D) pure real asinhl(real x) { return asinh(cast(double) x); } 4093 4094 /// 4095 double atanh(double x); 4096 /// 4097 float atanhf(float x); 4098 /// 4099 extern(D) real atanhl(real x) { return atanh(cast(double) x); } 4100 4101 /// 4102 double cosh(double x); 4103 /// 4104 float coshf(float x); 4105 /// 4106 extern(D) real coshl(real x) { return cosh(cast(double) x); } 4107 4108 /// 4109 double sinh(double x); 4110 /// 4111 float sinhf(float x); 4112 /// 4113 extern(D) real sinhl(real x) { return sinh(cast(double) x); } 4114 4115 /// 4116 double tanh(double x); 4117 /// 4118 float tanhf(float x); 4119 /// 4120 extern(D) real tanhl(real x) { return tanh(cast(double) x); } 4121 4122 /// 4123 double exp(double x); 4124 /// 4125 float expf(float x); 4126 /// 4127 extern(D) real expl(real x) { return exp(cast(double) x); } 4128 4129 /// 4130 double exp2(double x); 4131 /// 4132 float exp2f(float x); 4133 /// 4134 extern(D) real exp2l(real x) { return exp2(cast(double) x); } 4135 4136 /// 4137 double expm1(double x); 4138 /// 4139 float expm1f(float x); 4140 /// 4141 extern(D) real expm1l(real x) { return expm1(cast(double) x); } 4142 4143 /// 4144 pure double frexp(double value, int* exp); 4145 /// 4146 pure float frexpf(float value, int* exp); 4147 /// 4148 extern(D) pure real frexpl(real value, int* exp) { return frexp(cast(double) value, exp); } 4149 4150 /// 4151 int ilogb(double x); 4152 /// 4153 int ilogbf(float x); 4154 /// 4155 extern(D) int ilogbl(real x) { return ilogb(cast(double) x); } 4156 4157 /// 4158 double ldexp(double x, int exp); 4159 /// 4160 float ldexpf(float x, int exp); 4161 /// 4162 extern(D) real ldexpl(real x, int exp) { return ldexp(cast(double) x, exp); } 4163 4164 /// 4165 double log(double x); 4166 /// 4167 float logf(float x); 4168 /// 4169 extern(D) real logl(real x) { return log(cast(double) x); } 4170 4171 /// 4172 double log10(double x); 4173 /// 4174 float log10f(float x); 4175 /// 4176 extern(D) real log10l(real x) { return log10(cast(double) x); } 4177 4178 /// 4179 double log1p(double x); 4180 /// 4181 float log1pf(float x); 4182 /// 4183 extern(D) real log1pl(real x) { return log1p(cast(double) x); } 4184 4185 /// 4186 double log2(double x); 4187 /// 4188 float log2f(float x); 4189 /// 4190 extern(D) real log2l(real x) { return log2(cast(double) x); } 4191 4192 /// 4193 double logb(double x); 4194 /// 4195 float logbf(float x); 4196 /// 4197 extern(D) real logbl(real x) { return logb(cast(double) x); } 4198 4199 /// 4200 pure double modf(double value, double* iptr); 4201 /// 4202 pure float modff(float value, float* iptr); 4203 /// 4204 extern(D) pure real modfl(real value, real *iptr) 4205 { 4206 static if (double.sizeof == real.sizeof) 4207 return modf(cast(double) value, cast(double*) iptr); 4208 else 4209 { 4210 double i; 4211 double r = modf(cast(double) value, &i); 4212 *iptr = i; 4213 return r; 4214 } 4215 } 4216 4217 /// 4218 double scalbn(double x, int n); 4219 /// 4220 float scalbnf(float x, int n); 4221 /// 4222 extern(D) real scalbnl(real x, int n) { return scalbln(cast(double) x, n); } 4223 4224 /// 4225 double scalbln(double x, c_long n); 4226 /// 4227 float scalblnf(float x, c_long n); 4228 /// 4229 extern(D) real scalblnl(real x, c_long n) { return scalbln(cast(double) x, n); } 4230 4231 /// 4232 pure double cbrt(double x); 4233 /// 4234 pure float cbrtf(float x); 4235 /// 4236 extern(D) pure real cbrtl(real x) { return cbrt(cast(double) x); } 4237 4238 /// 4239 pure double fabs(double x); 4240 /// 4241 pure float fabsf(float x); 4242 /// 4243 extern(D) pure real fabsl(real x) { return fabs(cast(double) x); } 4244 4245 /// 4246 double hypot(double x, double y); 4247 /// 4248 float hypotf(float x, float y); 4249 /// 4250 extern(D) real hypotl(real x, real y) { return hypot(cast(double) x, cast(double) y); } 4251 4252 /// 4253 double pow(double x, double y); 4254 /// 4255 float powf(float x, float y); 4256 /// 4257 extern(D) real powl(real x, real y) { return pow(cast(double) x, cast(double) y); } 4258 4259 /// 4260 double sqrt(double x); 4261 /// 4262 float sqrtf(float x); 4263 /// 4264 extern(D) real sqrtl(real x) { return sqrt(cast(double) x); } 4265 4266 /// 4267 pure double erf(double x); 4268 /// 4269 pure float erff(float x); 4270 /// 4271 extern(D) pure real erfl(real x) { return erf(cast(double) x); } 4272 4273 /// 4274 double erfc(double x); 4275 /// 4276 float erfcf(float x); 4277 /// 4278 extern(D) real erfcl(real x) { return erfc(cast(double) x); } 4279 4280 /// 4281 double lgamma(double x); 4282 /// 4283 float lgammaf(float x); 4284 /// 4285 extern(D) real lgammal(real x) { return lgamma(cast(double) x); } 4286 4287 /// 4288 double tgamma(double x); 4289 /// 4290 float tgammaf(float x); 4291 /// 4292 extern(D) real tgammal(real x) { return tgamma(cast(double) x); } 4293 4294 /// 4295 pure double ceil(double x); 4296 /// 4297 pure float ceilf(float x); 4298 /// 4299 extern(D) pure real ceill(real x) { return ceil(cast(double) x); } 4300 4301 /// 4302 pure double floor(double x); 4303 /// 4304 pure float floorf(float x); 4305 /// 4306 extern(D) pure real floorl(real x) { return floor(cast(double) x); } 4307 4308 /// 4309 pure double nearbyint(double x); 4310 /// 4311 pure float nearbyintf(float x); 4312 /// 4313 extern(D) pure real nearbyintl(real x) { return nearbyint(cast(double) x); } 4314 4315 /// 4316 pure double rint(double x); 4317 /// 4318 pure float rintf(float x); 4319 /// 4320 extern(D) pure real rintl(real x) { return rint(cast(double) x); } 4321 4322 /// 4323 c_long lrint(double x); 4324 /// 4325 c_long lrintf(float x); 4326 /// 4327 extern(D) c_long lrintl(real x) { return lrint(cast(double) x); } 4328 4329 /// 4330 long llrint(double x); 4331 /// 4332 long llrintf(float x); 4333 /// 4334 extern(D) long llrintl(real x) { return llrint(cast(double) x); } 4335 4336 /// 4337 pure double round(double x); 4338 /// 4339 pure float roundf(float x); 4340 /// 4341 extern(D) pure real roundl(real x) { return round(cast(double) x); } 4342 4343 /// 4344 c_long lround(double x); 4345 /// 4346 c_long lroundf(float x); 4347 /// 4348 extern(D) c_long lroundl(real x) { return lround(cast(double) x); } 4349 4350 /// 4351 long llround(double x); 4352 /// 4353 long llroundf(float x); 4354 /// 4355 extern(D) long llroundl(real x) { return llround(cast(double) x); } 4356 4357 /// 4358 pure double trunc(double x); 4359 /// 4360 pure float truncf(float x); 4361 /// 4362 extern(D) pure real truncl(real x) { return trunc(cast(double) x); } 4363 4364 /// 4365 double fmod(double x, double y); 4366 /// 4367 float fmodf(float x, float y); 4368 /// 4369 extern(D) real fmodl(real x, real y) { return fmod(cast(double) x, cast(double) y); } 4370 4371 /// 4372 double remainder(double x, double y); 4373 /// 4374 float remainderf(float x, float y); 4375 /// 4376 extern(D) real remainderl(real x, real y) { return remainder(cast(double) x, cast(double) y); } 4377 4378 /// 4379 double remquo(double x, double y, int* quo); 4380 /// 4381 float remquof(float x, float y, int* quo); 4382 /// 4383 extern(D) real remquol(real x, real y, int* quo) { return remquo(cast(double) x, cast(double) y, quo); } 4384 4385 /// 4386 pure double copysign(double x, double y); 4387 /// 4388 pure float copysignf(float x, float y); 4389 /// 4390 extern(D) pure real copysignl(real x, real y) { return copysign(cast(double) x, cast(double) y); } 4391 4392 /// 4393 pure double nan(char* tagp); 4394 /// 4395 pure float nanf(char* tagp); 4396 /// 4397 extern(D) pure real nanl(char* tagp) { return nan(tagp); } 4398 4399 /// 4400 double nextafter(double x, double y); 4401 /// 4402 float nextafterf(float x, float y); 4403 /// 4404 extern(D) real nextafterl(real x, real y) { return nextafter(cast(double) x, cast(double) y); } 4405 4406 /// 4407 double nexttoward(double x, real y); 4408 /// 4409 float nexttowardf(float x, real y); 4410 /// 4411 extern(D) real nexttowardl(real x, real y) { return nexttoward(cast(double) x, cast(double) y); } 4412 4413 /// 4414 double fdim(double x, double y); 4415 /// 4416 float fdimf(float x, float y); 4417 /// 4418 extern(D) real fdiml(real x, real y) { return fdim(cast(double) x, cast(double) y); } 4419 4420 /// 4421 pure double fmax(double x, double y); 4422 /// 4423 pure float fmaxf(float x, float y); 4424 /// 4425 extern(D) pure real fmaxl(real x, real y) { return fmax(cast(double) x, cast(double) y); } 4426 4427 /// 4428 pure double fmin(double x, double y); 4429 /// 4430 pure float fminf(float x, float y); 4431 /// 4432 extern(D) pure real fminl(real x, real y) { return fmin(cast(double) x, cast(double) y); } 4433 4434 /// 4435 pure double fma(double x, double y, double z); 4436 /// 4437 pure float fmaf(float x, float y, float z); 4438 /// 4439 extern(D) pure real fmal(real x, real y, real z) { return fma(cast(double) x, cast(double) y, cast(double) z); } 4440 } 4441 else 4442 { 4443 /// 4444 double acos(double x); 4445 /// 4446 float acosf(float x); 4447 /// 4448 real acosl(real x); 4449 4450 /// 4451 double asin(double x); 4452 /// 4453 float asinf(float x); 4454 /// 4455 real asinl(real x); 4456 4457 /// 4458 pure double atan(double x); 4459 /// 4460 pure float atanf(float x); 4461 /// 4462 pure real atanl(real x); 4463 4464 /// 4465 double atan2(double y, double x); 4466 /// 4467 float atan2f(float y, float x); 4468 /// 4469 real atan2l(real y, real x); 4470 4471 /// 4472 pure double cos(double x); 4473 /// 4474 pure float cosf(float x); 4475 /// 4476 pure real cosl(real x); 4477 4478 /// 4479 pure double sin(double x); 4480 /// 4481 pure float sinf(float x); 4482 /// 4483 pure real sinl(real x); 4484 4485 /// 4486 pure double tan(double x); 4487 /// 4488 pure float tanf(float x); 4489 /// 4490 pure real tanl(real x); 4491 4492 /// 4493 double acosh(double x); 4494 /// 4495 float acoshf(float x); 4496 /// 4497 real acoshl(real x); 4498 4499 /// 4500 pure double asinh(double x); 4501 /// 4502 pure float asinhf(float x); 4503 /// 4504 pure real asinhl(real x); 4505 4506 /// 4507 double atanh(double x); 4508 /// 4509 float atanhf(float x); 4510 /// 4511 real atanhl(real x); 4512 4513 /// 4514 double cosh(double x); 4515 /// 4516 float coshf(float x); 4517 /// 4518 real coshl(real x); 4519 4520 /// 4521 double sinh(double x); 4522 /// 4523 float sinhf(float x); 4524 /// 4525 real sinhl(real x); 4526 4527 /// 4528 pure double tanh(double x); 4529 /// 4530 pure float tanhf(float x); 4531 /// 4532 pure real tanhl(real x); 4533 4534 /// 4535 double exp(double x); 4536 /// 4537 float expf(float x); 4538 /// 4539 real expl(real x); 4540 4541 /// 4542 double exp2(double x); 4543 /// 4544 float exp2f(float x); 4545 /// 4546 real exp2l(real x); 4547 4548 /// 4549 double expm1(double x); 4550 /// 4551 float expm1f(float x); 4552 /// 4553 real expm1l(real x); 4554 4555 /// 4556 pure double frexp(double value, int* exp); 4557 /// 4558 pure float frexpf(float value, int* exp); 4559 /// 4560 pure real frexpl(real value, int* exp); 4561 4562 /// 4563 int ilogb(double x); 4564 /// 4565 int ilogbf(float x); 4566 /// 4567 int ilogbl(real x); 4568 4569 /// 4570 double ldexp(double x, int exp); 4571 /// 4572 float ldexpf(float x, int exp); 4573 /// 4574 real ldexpl(real x, int exp); 4575 4576 /// 4577 double log(double x); 4578 /// 4579 float logf(float x); 4580 /// 4581 real logl(real x); 4582 4583 /// 4584 double log10(double x); 4585 /// 4586 float log10f(float x); 4587 /// 4588 real log10l(real x); 4589 4590 /// 4591 double log1p(double x); 4592 /// 4593 float log1pf(float x); 4594 /// 4595 real log1pl(real x); 4596 4597 /// 4598 double log2(double x); 4599 /// 4600 float log2f(float x); 4601 /// 4602 real log2l(real x); 4603 4604 /// 4605 double logb(double x); 4606 /// 4607 float logbf(float x); 4608 /// 4609 real logbl(real x); 4610 4611 /// 4612 pure double modf(double value, double* iptr); 4613 /// 4614 pure float modff(float value, float* iptr); 4615 /// 4616 pure real modfl(real value, real *iptr); 4617 4618 /// 4619 double scalbn(double x, int n); 4620 /// 4621 float scalbnf(float x, int n); 4622 /// 4623 real scalbnl(real x, int n); 4624 4625 /// 4626 double scalbln(double x, c_long n); 4627 /// 4628 float scalblnf(float x, c_long n); 4629 /// 4630 real scalblnl(real x, c_long n); 4631 4632 /// 4633 pure double cbrt(double x); 4634 /// 4635 pure float cbrtf(float x); 4636 /// 4637 pure real cbrtl(real x); 4638 4639 /// 4640 pure double fabs(double x); 4641 version (CRuntime_Microsoft) 4642 { 4643 } 4644 else 4645 { 4646 /// 4647 pure float fabsf(float x); 4648 /// 4649 pure real fabsl(real x); 4650 } 4651 4652 /// 4653 double hypot(double x, double y); 4654 /// 4655 float hypotf(float x, float y); 4656 /// 4657 real hypotl(real x, real y); 4658 4659 /// 4660 double pow(double x, double y); 4661 /// 4662 float powf(float x, float y); 4663 /// 4664 real powl(real x, real y); 4665 4666 /// 4667 double sqrt(double x); 4668 /// 4669 float sqrtf(float x); 4670 /// 4671 real sqrtl(real x); 4672 4673 /// 4674 pure double erf(double x); 4675 /// 4676 pure float erff(float x); 4677 /// 4678 pure real erfl(real x); 4679 4680 /// 4681 double erfc(double x); 4682 /// 4683 float erfcf(float x); 4684 /// 4685 real erfcl(real x); 4686 4687 /// 4688 double lgamma(double x); 4689 /// 4690 float lgammaf(float x); 4691 /// 4692 real lgammal(real x); 4693 4694 /// 4695 double tgamma(double x); 4696 /// 4697 float tgammaf(float x); 4698 /// 4699 real tgammal(real x); 4700 4701 /// 4702 pure double ceil(double x); 4703 /// 4704 pure float ceilf(float x); 4705 /// 4706 pure real ceill(real x); 4707 4708 /// 4709 pure double floor(double x); 4710 /// 4711 pure float floorf(float x); 4712 /// 4713 pure real floorl(real x); 4714 4715 /// 4716 pure double nearbyint(double x); 4717 /// 4718 pure float nearbyintf(float x); 4719 /// 4720 pure real nearbyintl(real x); 4721 4722 /// 4723 pure double rint(double x); 4724 /// 4725 pure float rintf(float x); 4726 /// 4727 pure real rintl(real x); 4728 4729 /// 4730 c_long lrint(double x); 4731 /// 4732 c_long lrintf(float x); 4733 /// 4734 c_long lrintl(real x); 4735 4736 /// 4737 long llrint(double x); 4738 /// 4739 long llrintf(float x); 4740 /// 4741 long llrintl(real x); 4742 4743 /// 4744 pure double round(double x); 4745 /// 4746 pure float roundf(float x); 4747 /// 4748 pure real roundl(real x); 4749 4750 /// 4751 c_long lround(double x); 4752 /// 4753 c_long lroundf(float x); 4754 /// 4755 c_long lroundl(real x); 4756 4757 /// 4758 long llround(double x); 4759 /// 4760 long llroundf(float x); 4761 /// 4762 long llroundl(real x); 4763 4764 /// 4765 pure double trunc(double x); 4766 /// 4767 pure float truncf(float x); 4768 /// 4769 pure real truncl(real x); 4770 4771 /// 4772 double fmod(double x, double y); 4773 /// 4774 float fmodf(float x, float y); 4775 /// 4776 real fmodl(real x, real y); 4777 4778 /// 4779 double remainder(double x, double y); 4780 /// 4781 float remainderf(float x, float y); 4782 /// 4783 real remainderl(real x, real y); 4784 4785 /// 4786 double remquo(double x, double y, int* quo); 4787 /// 4788 float remquof(float x, float y, int* quo); 4789 /// 4790 real remquol(real x, real y, int* quo); 4791 4792 /// 4793 pure double copysign(double x, double y); 4794 /// 4795 pure float copysignf(float x, float y); 4796 /// 4797 pure real copysignl(real x, real y); 4798 4799 /// 4800 pure double nan(char* tagp); 4801 /// 4802 pure float nanf(char* tagp); 4803 /// 4804 pure real nanl(char* tagp); 4805 4806 /// 4807 double nextafter(double x, double y); 4808 /// 4809 float nextafterf(float x, float y); 4810 /// 4811 real nextafterl(real x, real y); 4812 4813 /// 4814 double nexttoward(double x, real y); 4815 /// 4816 float nexttowardf(float x, real y); 4817 /// 4818 real nexttowardl(real x, real y); 4819 4820 /// 4821 double fdim(double x, double y); 4822 /// 4823 float fdimf(float x, float y); 4824 /// 4825 real fdiml(real x, real y); 4826 4827 /// 4828 pure double fmax(double x, double y); 4829 /// 4830 pure float fmaxf(float x, float y); 4831 /// 4832 pure real fmaxl(real x, real y); 4833 4834 /// 4835 pure double fmin(double x, double y); 4836 /// 4837 pure float fminf(float x, float y); 4838 /// 4839 pure real fminl(real x, real y); 4840 4841 /// 4842 pure double fma(double x, double y, double z); 4843 /// 4844 pure float fmaf(float x, float y, float z); 4845 /// 4846 pure real fmal(real x, real y, real z); 4847 }