aboutsummaryrefslogtreecommitdiff
path: root/py/modcmath.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-12-10 22:07:04 +0000
committerDamien George <damien.p.george@gmail.com>2014-12-10 22:08:14 +0000
commit969a6b37bfc655609e540053c2bdcce8a6fdc64d (patch)
tree5e7d74f72d702efd07ff6ba6d93d3a10e4e00fd2 /py/modcmath.c
parentd51107927d53a80835195ba1ac97048c203f05f2 (diff)
py: Make functions static where appropriate.
Diffstat (limited to 'py/modcmath.c')
-rw-r--r--py/modcmath.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/py/modcmath.c b/py/modcmath.c
index 4cd3a8235..7514a8c02 100644
--- a/py/modcmath.c
+++ b/py/modcmath.c
@@ -47,7 +47,7 @@ extern const mp_obj_float_t mp_math_pi_obj;
/// \function phase(z)
/// Returns the phase of the number `z`, in the range (-pi, +pi].
-mp_obj_t mp_cmath_phase(mp_obj_t z_obj) {
+STATIC mp_obj_t mp_cmath_phase(mp_obj_t z_obj) {
mp_float_t real, imag;
mp_obj_get_complex(z_obj, &real, &imag);
return mp_obj_new_float(MICROPY_FLOAT_C_FUN(atan2)(imag, real));
@@ -56,7 +56,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_phase_obj, mp_cmath_phase);
/// \function polar(z)
/// Returns, as a tuple, the polar form of `z`.
-mp_obj_t mp_cmath_polar(mp_obj_t z_obj) {
+STATIC mp_obj_t mp_cmath_polar(mp_obj_t z_obj) {
mp_float_t real, imag;
mp_obj_get_complex(z_obj, &real, &imag);
mp_obj_t tuple[2] = {
@@ -69,7 +69,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_polar_obj, mp_cmath_polar);
/// \function rect(r, phi)
/// Returns the complex number with modulus `r` and phase `phi`.
-mp_obj_t mp_cmath_rect(mp_obj_t r_obj, mp_obj_t phi_obj) {
+STATIC mp_obj_t mp_cmath_rect(mp_obj_t r_obj, mp_obj_t phi_obj) {
mp_float_t r = mp_obj_get_float(r_obj);
mp_float_t phi = mp_obj_get_float(phi_obj);
return mp_obj_new_complex(r * MICROPY_FLOAT_C_FUN(cos)(phi), r * MICROPY_FLOAT_C_FUN(sin)(phi));
@@ -78,7 +78,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_cmath_rect_obj, mp_cmath_rect);
/// \function exp(z)
/// Return the exponential of `z`.
-mp_obj_t mp_cmath_exp(mp_obj_t z_obj) {
+STATIC mp_obj_t mp_cmath_exp(mp_obj_t z_obj) {
mp_float_t real, imag;
mp_obj_get_complex(z_obj, &real, &imag);
mp_float_t exp_real = MICROPY_FLOAT_C_FUN(exp)(real);
@@ -89,7 +89,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_exp_obj, mp_cmath_exp);
/// \function log(z)
/// Return the natural logarithm of `z`. The branch cut is along the negative real axis.
// TODO can take second argument, being the base
-mp_obj_t mp_cmath_log(mp_obj_t z_obj) {
+STATIC mp_obj_t mp_cmath_log(mp_obj_t z_obj) {
mp_float_t real, imag;
mp_obj_get_complex(z_obj, &real, &imag);
return mp_obj_new_complex(0.5 * MICROPY_FLOAT_C_FUN(log)(real*real + imag*imag), MICROPY_FLOAT_C_FUN(atan2)(imag, real));
@@ -98,7 +98,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_log_obj, mp_cmath_log);
/// \function log10(z)
/// Return the base-10 logarithm of `z`. The branch cut is along the negative real axis.
-mp_obj_t mp_cmath_log10(mp_obj_t z_obj) {
+STATIC mp_obj_t mp_cmath_log10(mp_obj_t z_obj) {
mp_float_t real, imag;
mp_obj_get_complex(z_obj, &real, &imag);
return mp_obj_new_complex(0.5 * MICROPY_FLOAT_C_FUN(log10)(real*real + imag*imag), MICROPY_FLOAT_C_FUN(atan2)(imag, real));
@@ -107,7 +107,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_log10_obj, mp_cmath_log10);
/// \function sqrt(z)
/// Return the square-root of `z`.
-mp_obj_t mp_cmath_sqrt(mp_obj_t z_obj) {
+STATIC mp_obj_t mp_cmath_sqrt(mp_obj_t z_obj) {
mp_float_t real, imag;
mp_obj_get_complex(z_obj, &real, &imag);
mp_float_t sqrt_abs = MICROPY_FLOAT_C_FUN(pow)(real*real + imag*imag, 0.25);
@@ -118,7 +118,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_sqrt_obj, mp_cmath_sqrt);
/// \function cos(z)
/// Return the cosine of `z`.
-mp_obj_t mp_cmath_cos(mp_obj_t z_obj) {
+STATIC mp_obj_t mp_cmath_cos(mp_obj_t z_obj) {
mp_float_t real, imag;
mp_obj_get_complex(z_obj, &real, &imag);
return mp_obj_new_complex(MICROPY_FLOAT_C_FUN(cos)(real) * MICROPY_FLOAT_C_FUN(cosh)(imag), -MICROPY_FLOAT_C_FUN(sin)(real) * MICROPY_FLOAT_C_FUN(sinh)(imag));
@@ -127,7 +127,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_cos_obj, mp_cmath_cos);
/// \function sin(z)
/// Return the sine of `z`.
-mp_obj_t mp_cmath_sin(mp_obj_t z_obj) {
+STATIC mp_obj_t mp_cmath_sin(mp_obj_t z_obj) {
mp_float_t real, imag;
mp_obj_get_complex(z_obj, &real, &imag);
return mp_obj_new_complex(MICROPY_FLOAT_C_FUN(sin)(real) * MICROPY_FLOAT_C_FUN(cosh)(imag), MICROPY_FLOAT_C_FUN(cos)(real) * MICROPY_FLOAT_C_FUN(sinh)(imag));