Contains the elementary mathematical functions (powers, roots, and trigonometric functions), and low-level floating-point operations. Mathematical special functions are available in std.mathspecial.
|Constants||E PI PI_2 PI_4 M_1_PI M_2_PI M_2_SQRTPI LN10 LN2 LOG2 LOG2E LOG2T LOG10E SQRT2 SQRT1_2|
|Algebraic||abs fabs sqrt cbrt hypot poly nextPow2 truncPow2|
|Trigonometry||sin cos tan asin acos atan atan2 sinh cosh tanh asinh acosh atanh|
|Rounding||ceil floor round lround trunc rint lrint nearbyint rndtol quantize|
|Exponentiation & Logarithms||pow powmod exp exp2 expm1 ldexp frexp log log2 log10 logb ilogb log1p scalbn|
|Remainder||fmod modf remainder remquo|
|Floating-point operations||approxEqual feqrel fdim fmax fmin fma isClose nextDown nextUp nextafter NaN getNaNPayload cmp|
|Introspection||isFinite isIdentical isInfinity isNaN isNormal isSubnormal signbit sgn copysign isPowerOf2|
|Hardware Control||IeeeFlags ieeeFlags resetIeeeFlags FloatingPointControl|
The functionality closely follows the IEEE754-2008 standard for floating-point arithmetic, including the use of camelCase names rather than C99-style lower case names. All of these functions behave correctly when presented with an infinity or NaN.
The following IEEE 'real' formats are currently supported:
Unlike C, there is no global 'errno' variable. Consequently, almost all of these functions are pure nothrow.
Copyright The D Language Foundation 2000 - 2011. D implementations of tan, atan, atan2, exp, expm1, exp2, log, log10, log1p, log2, floor, ceil and lrint functions are based on the CEPHES math library, which is Copyright (C) 2001 Stephen L. Moshier <firstname.lastname@example.org> and are incorporated herein by permission of the author. The author reserves the right to distribute this material elsewhere under different copying permissions. These modifications are distributed here under the following terms: