DoxigAlpha

isInf

Returns whether x is an infinity, ignoring sign.

Function parameters

Parameters

#
x:anytype

Returns whether x is an infinity, ignoring sign.

Functions

#
isInf
Returns whether x is an infinity, ignoring sign.
isPositiveInf
Returns whether x is an infinity with a positive sign.
isNegativeInf
Returns whether x is an infinity with a negative sign.

Source

Implementation

#
pub inline fn isInf(x: anytype) bool {
    const T = @TypeOf(x);
    const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
    const remove_sign = ~@as(TBits, 0) >> 1;
    return @as(TBits, @bitCast(x)) & remove_sign == @as(TBits, @bitCast(math.inf(T)));
}