10000 stmhal: Enable cmath module. · hellcoderz/micropython@93e51b5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 93e51b5

Browse files
committed
stmhal: Enable cmath module.
1 parent bb8ba7f commit 93e51b5

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

py/modcmath.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ mp_obj_t mp_cmath_sqrt(mp_obj_t z_obj) {
6565
mp_obj_get_complex(z_obj, &real, &imag);
6666
mp_float_t sqrt_abs = MICROPY_FLOAT_C_FUN(pow)(real*real + imag*imag, 0.25);
6767
mp_float_t theta = 0.5 * MICROPY_FLOAT_C_FUN(atan2)(imag, real);
68-
return mp_obj_new_complex(sqrt_abs * cos(theta), sqrt_abs * sin(theta));
68+
return mp_obj_new_complex(sqrt_abs * MICROPY_FLOAT_C_FUN(cos)(theta), sqrt_abs * MICROPY_FLOAT_C_FUN(sin)(theta));
6969
}
7070
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_cmath_sqrt_obj, mp_cmath_sqrt);
7171

stmhal/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#define MICROPY_ENABLE_LFN (1)
2020
#define MICROPY_LFN_CODE_PAGE (437) /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
2121
#define MICROPY_MOD_SYS_STDFILES (1)
22+
#define MICROPY_ENABLE_MOD_CMATH (1)
2223

2324
// extra built in names to add to the global namespace
2425
extern const struct _mp_obj_fun_native_t mp_builtin_help_obj;

0 commit comments

Comments
 (0)
0