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