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