Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
93e51b59
Commit
93e51b59
authored
May 03, 2014
by
Damien George
Browse files
stmhal: Enable cmath module.
parent
bb8ba7fc
Changes
2
Hide whitespace changes
Inline
Side-by-side
py/modcmath.c
View file @
93e51b59
...
...
@@ -65,7 +65,7 @@ mp_obj_t mp_cmath_sqrt(mp_obj_t z_obj) {
mp_obj_get_complex
(
z_obj
,
&
real
,
&
imag
);
mp_float_t
sqrt_abs
=
MICROPY_FLOAT_C_FUN
(
pow
)(
real
*
real
+
imag
*
imag
,
0
.
25
);
mp_float_t
theta
=
0
.
5
*
MICROPY_FLOAT_C_FUN
(
atan2
)(
imag
,
real
);
return
mp_obj_new_complex
(
sqrt_abs
*
cos
(
theta
),
sqrt_abs
*
sin
(
theta
));
return
mp_obj_new_complex
(
sqrt_abs
*
MICROPY_FLOAT_C_FUN
(
cos
)
(
theta
),
sqrt_abs
*
MICROPY_FLOAT_C_FUN
(
sin
)
(
theta
));
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
mp_cmath_sqrt_obj
,
mp_cmath_sqrt
);
...
...
stmhal/mpconfigport.h
View file @
93e51b59
...
...
@@ -19,6 +19,7 @@
#define MICROPY_ENABLE_LFN (1)
#define MICROPY_LFN_CODE_PAGE (437)
/* 1=SFN/ANSI 437=LFN/U.S.(OEM) */
#define MICROPY_MOD_SYS_STDFILES (1)
#define MICROPY_ENABLE_MOD_CMATH (1)
// extra built in names to add to the global namespace
extern
const
struct
_mp_obj_fun_native_t
mp_builtin_help_obj
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment