pub enum Classify {
Unordered,
LessGreater,
Nan,
Infinite,
Finite,
Normal,
SignBit,
InfiniteSign,
}Expand description
Which question one of the floating point classification builtins asks.
The four that this does not have are isgreater, isgreaterequal, isless and
islessequal, which are >, >=, < and <= and are those.
Variants§
Unordered
isunordered(a, b), true when either of the two is a NaN and so the two cannot be put
in an order at all. C has no operator for this one.
LessGreater
islessgreater(a, b), which is a < b || a > b and so is false when either is a NaN.
That is not a != b, which is true of a NaN, so C has no operator for this one either.
Nan
isnan(x), the value that is not in an order with itself.
Infinite
isinf(x), either infinity.
Finite
isfinite(x), which is neither an infinity nor a NaN.
Normal
isnormal(x), which is finite and whose magnitude is at least the smallest normal of its
format, so it is false of a zero and of a subnormal as well as of the two isfinite
rules out.
SignBit
signbit(x), which asks about the sign and not about the value, so it is true of a
negative zero and of a NaN whose sign bit is set.
InfiniteSign
isinf_sign(x), which is isinf with a sign: one for a positive infinity, minus one for
a negative one and zero for everything else. It is the one question in the family whose
answer is a number rather than a bit.
Implementations§
Source§impl Classify
impl Classify
Sourcepub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
How the question is written in the typed tree’s textual form.
Sourcepub const fn is_pair(self) -> bool
pub const fn is_pair(self) -> bool
Whether the question is about a pair of values rather than about one.
Sourcepub const fn answers_a_bit(self) -> bool
pub const fn answers_a_bit(self) -> bool
Whether the answer is one bit, which is every question here but isinf_sign.
The type of the whole node is int either way. What this decides is whether the walk to
the IR has a bit to widen into one or a number that is already one.