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