isInfinity

Determines if x is ±∞.

@nogc @trusted pure nothrow
bool
isInfinity
(
X
)
(
X x
)

Parameters

x X

a floating point number.

Return Value

Type: bool

true if x is ±∞.

Examples

assert(!isInfinity(float.init));
assert(!isInfinity(-float.init));
assert(!isInfinity(float.nan));
assert(!isInfinity(-float.nan));
assert(isInfinity(float.infinity));
assert(isInfinity(-float.infinity));
assert(isInfinity(-1.0f / 0.0f));

Meta