1- :mod: `math ` --- mathematical functions
2- ======================================
1+ :mod: `math ` -- mathematical functions
2+ =====================================
33
44.. module :: math
55 :synopsis: mathematical functions
66
77The ``math `` module provides some basic mathematical funtions for
88working with floating-point numbers.
99
10+ *Note: * On the pyboard, floating-point numbers have 32-bit precision.
1011
1112Functions
1213---------
1314
1415.. function :: acos(x)
1516
17+ Return the inverse cosine of ``x ``.
1618
1719.. function :: acosh(x)
1820
21+ Return the inverse hyperbolic cosine of ``x ``.
1922
2023.. function :: asin(x)
2124
25+ Return the inverse sine of ``x ``.
2226
2327.. function :: asinh(x)
2428
29+ Return the inverse hyperbolic sine of ``x ``.
2530
2631.. function :: atan(x)
2732
33+ Return the inverse tangent of ``x ``.
2834
2935.. function :: atan2(y, x)
3036
37+ Return the principal value of the inverse tangent of ``y/x ``.
3138
3239.. function :: atanh(x)
3340
41+ Return the inverse hyperbolic tangent of ``x ``.
3442
3543.. function :: ceil(x)
3644
45+ Return an integer, being ``x `` rounded towards positive infinity.
3746
3847.. function :: copysign(x, y)
3948
49+ Return ``x `` with the sign of ``y ``.
4050
4151.. function :: cos(x)
4252
53+ Return the cosine of ``x ``.
4354
4455.. function :: cosh(x)
4556
57+ Return the hyperbolic cosine of ``x ``.
4658
4759.. function :: degrees(x)
4860
61+ Return radians ``x `` converted to degrees.
4962
5063.. function :: erf(x)
5164
@@ -57,18 +70,23 @@ Functions
5770
5871.. function :: exp(x)
5972
73+ Return the exponential of ``x ``.
6074
6175.. function :: expm1(x)
6276
77+ Return ``exp(x) - 1 ``.
6378
6479.. function :: fabs(x)
6580
81+ Return the absolute value of ``x ``.
6682
6783.. function :: floor(x)
6884
85+ Return an integer, being ``x `` rounded towards negative infinity.
6986
7087.. function :: fmod(x, y)
7188
89+ Return the remainder of ``x/y ``.
7290
7391.. function :: frexp(x)
7492
@@ -80,58 +98,72 @@ Functions
8098
8199.. function :: isfinite(x)
82100
101+ Return ``True `` if ``x `` is finite.
83102
84103.. function :: isinf(x)
85104
105+ Return ``True `` if ``x `` is infinite.
86106
87107.. function :: isnan(x)
88108
109+ Return ``True `` if ``x `` is not-a-number
89110
90111.. function :: ldexp(x, exp)
91112
113+ Return ``x * (2**exp) ``.
92114
93115.. function :: lgamma(x)
94116
95- return the natural logarithm of the gamma function of ``x ``.
117+ Return the natural logarithm of the gamma function of ``x ``.
96118
97119.. function :: log(x)
98120
121+ Return the natural logarithm of ``x ``.
99122
100123.. function :: log10(x)
101124
125+ Return the base-10 logarithm of ``x ``.
102126
103127.. function :: log2(x)
104128
129+ Return the base-2 logarithm of ``x ``.
105130
106131.. function :: modf(x)
107132
133+ Return a tuple of two floats, being the fractional and integral parts of
134+ ``x ``. Both return values have the same sign as ``x ``.
108135
109136.. function :: pow(x, y)
110137
111138 Returns ``x `` to the power of ``y ``.
112139
113140.. function :: radians(x)
114141
142+ Return degrees ``x `` converted to radians.
115143
116144.. function :: sin(x)
117145
146+ Return the sine of ``x ``.
118147
119148.. function :: sinh(x)
120149
150+ Return the hyperbolic sine of ``x ``.
121151
122152.. function :: sqrt(x)
123153
124- Returns the square root of ``x ``.
154+ Return the square root of ``x ``.
125155
126156.. function :: tan(x)
127157
158+ Return the tangent of ``x ``.
128159
129160.. function :: tanh(x)
130161
162+ Return the hyperbolic tangent of ``x ``.
131163
132164.. function :: trunc(x)
133165
134-
166+ Return an integer, being `` x `` rounded towards 0.
135167
136168Constants
137169---------
0 commit comments