std.math.operations
This is a submodule of std.math.
It contains several functions for work with floating point numbers.
Copyright
Copyright The D Language Foundation 2000 - 2011.
struct FloatingPointBitpattern
Types 1
structFloatingPointBitpattern(T) if (isFloatingPoint!T)
Fields
int exponentbool negativeFunctions 18
fn
real NaN(ulong payload) @trusted pure nothrow @nogcCreate a quiet , storing an integer inside the payload.fn
real nextUp(real x) @trusted pure nothrow @nogcCalculate the next largest floating point value after x.fn
real nextDown(real x) @safe pure nothrow @nogcCalculate the next smallest floating point value before x.fn
T nextafter(T)(const T x, const T y) @safe pure nothrow @nogcCalculates the next representable value after x in the direction of y.fn
real fdim(real x, real y) @safe pure nothrow @nogcReturns the positive difference between x and y.fn
F fmax(F)(const F x, const F y) if (__traits(isFloating, F)) @safe pure nothrow @nogcReturns the larger of `x` and `y`.fn
F fmin(F)(const F x, const F y) if (__traits(isFloating, F)) @safe pure nothrow @nogcReturns the smaller of `x` and `y`.fn
real fma(real x, real y, real z) @safe pure nothrow @nogcReturns (x * y) + z, rounding only once according to the current rounding mode.fn
int feqrel(X)(const X x, const X y) if (isFloatingPoint!(X)) @trusted pure nothrow @nogcTo what precision is x equal to y?fn
bool approxEqual(T, U, V)(T value, U reference, V maxRelDiff = 1e-2, V maxAbsDiff = 1e-5)deprecated approxEqual will be removed in 2.106.0. Please use isClose instead.
Computes whether a values is approximately equal to a reference value, admitting a maximum relative difference, and a maximum absolute difference.fn
bool isClose(T, U, V = CommonType!(FloatingPointBaseType!T, FloatingPointBaseType!U))(T lhs, U rhs, V maxRelDiff = CommonDefaultFor!(T, U), V maxAbsDiff = 0.0)Computes whether two values are approximately equal, admitting a maximum relative difference, and a maximum absolute difference.fn
int cmp(T)(const(T) x, const(T) y) if (isFloatingPoint!T) @nogc @trusted pure nothrowDefines a total order on all floating-point numbers.