diff options
| author | dherrada <dylan.herrada@gmail.com> | 2020-05-07 15:59:52 -0400 |
|---|---|---|
| committer | dherrada <dylan.herrada@gmail.com> | 2020-05-07 15:59:52 -0400 |
| commit | e31e9eeaa1e1dad1bd2243b7be76012aa2ee64b8 (patch) | |
| tree | 1daaec28f2c720b735bb0336c09b6b068efa6158 /shared-bindings/math | |
| parent | 4f33a20d17c7b7688e5dd1ee37346ff2d4f4a340 (diff) | |
Did math, microcontroller, and multiterminal
Diffstat (limited to 'shared-bindings/math')
| -rw-r--r-- | shared-bindings/math/__init__.c | 164 |
1 files changed, 80 insertions, 84 deletions
diff --git a/shared-bindings/math/__init__.c b/shared-bindings/math/__init__.c index 0bf8047c9..755bf7589 100644 --- a/shared-bindings/math/__init__.c +++ b/shared-bindings/math/__init__.c @@ -38,7 +38,7 @@ #define MP_PI MICROPY_FLOAT_CONST(3.14159265358979323846) -//| :mod:`math` --- mathematical functions +//| """:mod:`math` --- mathematical functions //| ======================================================== //| //| .. module:: math @@ -46,7 +46,7 @@ //| :platform: SAMD21/SAMD51 //| //| The `math` module provides some basic mathematical functions for -//| working with floating-point numbers. +//| working with floating-point numbers.""" //| STATIC NORETURN void math_error(void) { @@ -86,117 +86,113 @@ STATIC NORETURN void math_error(void) { //| Constants //| --------- //| - //| .. data:: e + //| e: Any = ... + //| """base of the natural logarithm""" //| - //| base of the natural logarithm - //| - //| .. data:: pi - //| - //| the ratio of a circle's circumference to its diameter + //| pi: Any = ... + //| """the ratio of a circle's circumference to its diameter""" //| //| Functions //| --------- //| - //| .. function:: acos(x) - //| - //| Return the inverse cosine of ``x``. - //| - //| .. function:: asin(x) - //| - //| Return the inverse sine of ``x``. - //| - //| .. function:: atan(x) - //| - //| Return the inverse tangent of ``x``. - //| - //| .. function:: atan2(y,x) - //| - //| Return the principal value of the inverse tangent of ``y/x``. - //| - //| .. function:: ceil(x) - //| - //| Return an integer, being ``x`` rounded towards positive infinity. - //| - //| .. function:: copysign(x,y) - //| - //| Return ``x`` with the sign of ``y``. - //| - //| .. function:: cos(x) - //| - //| Return the cosine of ``x``. - //| - //| .. function:: degrees(x) - //| - //| Return radians ``x`` converted to degrees. - //| - //| .. function:: exp(x) - //| - //| Return the exponential of ``x``. - //| - //| .. function:: fabs(x) - //| - //| Return the absolute value of ``x``. - //| - //| .. function:: floor(x) - //| - //| Return an integer, being ``x`` rounded towards negative infinity. - //| - //| .. function:: fmod(x,y) - //| - //| Return the remainder of ``x/y``. - //| - //| .. function:: frexp(x) + //| def acos(x: Any) -> Any: + //| """Return the inverse cosine of ``x``.""" + //| ... //| - //| Decomposes a floating-point number into its mantissa and exponent. - //| The returned value is the tuple ``(m, e)`` such that ``x == m * 2**e`` - //| exactly. If ``x == 0`` then the function returns ``(0.0, 0)``, otherwise - //| the relation ``0.5 <= abs(m) < 1`` holds. + //| def asin(x: Any) -> Any: + //| """Return the inverse sine of ``x``.""" + //| ... //| - //| .. function:: isfinite(x) + //| def atan(x: Any) -> Any: + //| """Return the inverse tangent of ``x``.""" + //| ... //| - //| Return ``True`` if ``x`` is finite. + //| def atan2(y: Any, x: Any) -> Any: + //| """Return the principal value of the inverse tangent of ``y/x``.""" + //| ... //| - //| .. function:: isinf(x) + //| def ceil(x: Any) -> Any: + //| """Return an integer, being ``x`` rounded towards positive infinity.""" + //| ... //| - //| Return ``True`` if ``x`` is infinite. + //| def copysign(x: Any, y: Any) -> Any: + //| """Return ``x`` with the sign of ``y``.""" + //| ... //| - //| .. function:: isnan(x) + //| def cos(x: Any) -> Any: + //| """Return the cosine of ``x``.""" + //| ... //| - //| Return ``True`` if ``x`` is not-a-number + //| def degrees(x: Any) -> Any: + //| """Return radians ``x`` converted to degrees.""" + //| ... //| - //| .. function:: ldexp(x, exp) + //| def exp(x: Any) -> Any: + //| """Return the exponential of ``x``.""" + //| ... //| - //| Return ``x * (2**exp)``. + //| def fabs(x: Any) -> Any: + //| """Return the absolute value of ``x``.""" + //| ... //| - //| .. function:: modf(x) + //| def floor(x: Any) -> Any: + //| """Return an integer, being ``x`` rounded towards negative infinity.""" + //| ... //| - //| Return a tuple of two floats, being the fractional and integral parts of - //| ``x``. Both return values have the same sign as ``x``. + //| def fmod(x: Any, y: Any) -> Any: + //| """Return the remainder of ``x/y``.""" + //| ... //| - //| .. function:: pow(x, y) + //| def frexp(x: Any) -> Any: + //| """Decomposes a floating-point number into its mantissa and exponent. + //| The returned value is the tuple ``(m, e)`` such that ``x == m * 2**e`` + //| exactly. If ``x == 0`` then the function returns ``(0.0, 0)``, otherwise + //| the relation ``0.5 <= abs(m) < 1`` holds.""" + //| ... //| - //| Returns ``x`` to the power of ``y``. + //| def isfinite(x: Any) -> Any: + //| """Return ``True`` if ``x`` is finite.""" + //| ... //| - //| .. function:: radians(x) + //| def isinf(x: Any) -> Any: + //| """Return ``True`` if ``x`` is infinite.""" + //| ... //| - //| Return degrees ``x`` converted to radians. + //| def isnan(x: Any) -> Any: + //| """Return ``True`` if ``x`` is not-a-number""" + //| ... //| - //| .. function:: sin(x) + //| def ldexp(x: Any, exp: Any) -> Any: + //| """Return ``x * (2**exp)``.""" + //| ... //| - //| Return the sine of ``x``. + //| def modf(x: Any) -> Any: + //| """Return a tuple of two floats, being the fractional and integral parts of + //| ``x``. Both return values have the same sign as ``x``.""" + //| ... //| - //| .. function:: sqrt(x) + //| def pow(x: Any, y: Any) -> Any: + //| """Returns ``x`` to the power of ``y``.""" //| - //| Returns the square root of ``x``. + //| def radians(x: Any) -> Any: + //| """Return degrees ``x`` converted to radians.""" //| - //| .. function:: tan(x) + //| def sin(x: Any) -> Any: + //| """Return the sine of ``x``.""" + //| ... //| - //| Return the tangent of ``x``. + //| def sqrt(x: Any) -> Any: + //| """Returns the square root of ``x``.""" + //| ... //| - //| .. function:: trunc(x) + //| def tan(x: Any) -> Any: ... + //| """Return the tangent of ``x``.""" + //| ... //| - //| Return an integer, being ``x`` rounded towards 0. + //| def trunc(x: Any) -> Any: + //| """Return an integer, being ``x`` rounded towards 0.""" + //| ... //| MATH_FUN_1_ERRCOND(sqrt, sqrt, (x < (mp_float_t)0.0)) |
