math – mathematical functions¶
The math module provides some basic mathematical functions for
working with floating-point numbers.
Note: On the pyboard, floating-point numbers have 32-bit precision.
Functions¶
- math.frexp(x: float) Tuple[float, int]¶
Decomposes a floating-point number into its mantissa and exponent. The returned value is the tuple
(m, e)such thatx == m * 2**eexactly. Ifx == 0then the function returns(0.0, 0), otherwise the relation0.5 <= abs(m) < 1holds.
- math.log(x: float) float¶
- math.log(x: float, base: float) float
With one argument, return the natural logarithm of x.
With two arguments, return the logarithm of x to the given base.