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