math.fabs

Full name
math.fabs
Library
math
Syntax

math.fabs(number)

Description

The math.fabs function returns the absolute value of a number, which must be an integer or real (complex numbers are not supported).

Parameters
  • number: number whose absolute value is to be obtained.
Result

The math.fabs function returns a real number.

Examples

Examples of use are shown below:

math.fabs(-2)

2.0

Note that the result is a real number even though the argument of the function is an integer.

math.fabs(-2.16)

2.16

Submitted by admin on Wed, 01/20/2021 - 11:05