klyn.math.Math.abs
method
public static abs<NUMBER_TYPE extends AbstractNumber>(value as NUMBER_TYPE) as NUMBER_TYPE
Description

Returns the absolute value of a scalar number.

Signed numeric values are mirrored when they are negative, while unsigned values are returned unchanged. Floating-point negative zero becomes positive zero; NaN remains NaN.

Throws
  • ValueException if a signed integer magnitude cannot fit in its type.
Example
import klyn.math

print(Math.abs(-12))
print(Math.abs(12u))
print(Math.abs(-3.5))