Skip to main content

is_integer

Function is_integer 

Source
pub fn is_integer<S: Simd>(simd: S, x: F32s<S>) -> M32s<S>
Expand description

Whether x is integral.

Upstream writes this as self.trunc().simd_eq(self), where trunc is its round-to-zero conversion; this port uses the trunc helper instead. The two agree except for |x| >= 2^31, where upstream’s conversion of an out-of-range value says nothing about integrality while trunc returns x itself, which is the mathematically correct answer (every f32 at or above 2^23 is an integer).