math.abs() function

The math.abs() function returns the absolute value of x.

*Output data type: Float*

  1. import "math"
  2. math.abs(x: -1.22)
  3. // Returns 1.22

Parameters

x

The value used in the operation.

*Data type: Float*

Special cases

  1. math.abs(x: ±Inf) // Returns +Inf
  2. math.abs(x: NaN) // Returns NaN