alloy::core::f32

Function abs

source
pub const fn abs(x: f32) -> f32
Expand description

Computes the absolute value of a 32-bit floating point number at compile-time.

NOTE: Unlike the standard f32::abs function, this function will return the absolute value of a floating point number, even if it is a NaN. This means that the representation of the NaN may change by calling this, even though the value is still considered a NaN.

ยงParameters

  • x - The floating point number.