Math Functions
math.fabs()
Return the magnitude of a real number as a float, unlike abs which may preserve integer type.
Formal Syntax & Structure
python syntaxpython
math.fabs(x, /)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | real number | Input real value. |
Return Value
float
Floating-point result; finite precision and domain restrictions apply.
Working Example
Example Snippetpython
import mathprint(math.fabs(-4))