On this page
  1. math.fabs
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

math.fabs

Prev: math.expm1 | Up: math | Next: math.factorial
Rel: math.acos, math.acosh, math.asin, math.asinh
Ref: docs.python.org — math.fabs
Tags: #public #python3 #stdlib #math


Import

import math
from math import fabs

Signature & Overview

math.fabs(x, /)

Return the absolute value of the float x.

Usage

import math

assert math.fabs(-5) == 5.0 and isinstance(math.fabs(-5), float)

Gotchas

REPL Inspect

from math import fabs
help(fabs)

Linked from

Related notes