VOOZH about

URL: https://www.geeksforgeeks.org/python/python-math-fabs-function/

⇱ Python | math.fabs() function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Python | math.fabs() function

Last Updated : 20 Feb, 2023

In Python, math module contains a number of mathematical operations, which can be performed with ease using the module. math.fabs() function returns the absolute value of the number.

Syntax: math.fabs(x)

Parameter:
x: This is a numeric expression.

Returns: the absolute value of the number.
 Time Complexity: O(1)
 Auxiliary Space: O(1)

Code #1: 

Output:
The fabs of 33.7 is : 33.7

  Code #2: 

Output:
math.fabs(-13.1) : 13.1
math.fabs(101.96) : 101.96
Comment
Article Tags: