Development · Evolving reference
Abs
Returns an exact nonnegative magnitude when the destination can represent it.
Sn is under heavy development. This reference includes the intended 1.0 design; features may be incomplete in the current compiler. Read the status →
Module std.math
import std.math;Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.
fn
pub const fn Abs<T>(Value: T) -> T where T: Numeric, CopyableReturns an exact nonnegative magnitude when the destination can represent it. T: Copyable supported numeric representation. Value: Numeric input; no storage is retained. Return: Absolute value; floating negative zero becomes positive zero and NaN propagates. Warning: Signed minimum fatal-traps because its positive magnitude is unrepresentable.
Documentation snapshot: October 24, 2026 About versions ↗