Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
7703d719
Commit
7703d719
authored
Aug 11, 2014
by
Damien George
Browse files
py, modcmath: Fix doc comment, and add some more of them.
parent
9749b2fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
py/modcmath.c
View file @
7703d719
...
@@ -68,7 +68,7 @@ mp_obj_t mp_cmath_polar(mp_obj_t z_obj) {
...
@@ -68,7 +68,7 @@ mp_obj_t mp_cmath_polar(mp_obj_t z_obj) {
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
mp_cmath_polar_obj
,
mp_cmath_polar
);
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
mp_cmath_polar_obj
,
mp_cmath_polar
);
/// \function rect(r, phi)
/// \function rect(r, phi)
/// Returns the complex number with modul
e
s `r` and phase `phi`.
/// Returns the complex number with modul
u
s `r` and phase `phi`.
mp_obj_t
mp_cmath_rect
(
mp_obj_t
r_obj
,
mp_obj_t
phi_obj
)
{
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
r
=
mp_obj_get_float
(
r_obj
);
mp_float_t
phi
=
mp_obj_get_float
(
phi_obj
);
mp_float_t
phi
=
mp_obj_get_float
(
phi_obj
);
...
@@ -77,6 +77,7 @@ mp_obj_t mp_cmath_rect(mp_obj_t r_obj, mp_obj_t phi_obj) {
...
@@ -77,6 +77,7 @@ mp_obj_t mp_cmath_rect(mp_obj_t r_obj, mp_obj_t phi_obj) {
STATIC
MP_DEFINE_CONST_FUN_OBJ_2
(
mp_cmath_rect_obj
,
mp_cmath_rect
);
STATIC
MP_DEFINE_CONST_FUN_OBJ_2
(
mp_cmath_rect_obj
,
mp_cmath_rect
);
/// \function exp(z)
/// \function exp(z)
/// Return the exponential of `z`.
mp_obj_t
mp_cmath_exp
(
mp_obj_t
z_obj
)
{
mp_obj_t
mp_cmath_exp
(
mp_obj_t
z_obj
)
{
mp_float_t
real
,
imag
;
mp_float_t
real
,
imag
;
mp_obj_get_complex
(
z_obj
,
&
real
,
&
imag
);
mp_obj_get_complex
(
z_obj
,
&
real
,
&
imag
);
...
@@ -86,6 +87,7 @@ mp_obj_t mp_cmath_exp(mp_obj_t z_obj) {
...
@@ -86,6 +87,7 @@ mp_obj_t mp_cmath_exp(mp_obj_t z_obj) {
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
mp_cmath_exp_obj
,
mp_cmath_exp
);
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
mp_cmath_exp_obj
,
mp_cmath_exp
);
/// \function log(z)
/// \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
// TODO can take second argument, being the base
mp_obj_t
mp_cmath_log
(
mp_obj_t
z_obj
)
{
mp_obj_t
mp_cmath_log
(
mp_obj_t
z_obj
)
{
mp_float_t
real
,
imag
;
mp_float_t
real
,
imag
;
...
@@ -95,6 +97,7 @@ mp_obj_t mp_cmath_log(mp_obj_t z_obj) {
...
@@ -95,6 +97,7 @@ mp_obj_t mp_cmath_log(mp_obj_t z_obj) {
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
mp_cmath_log_obj
,
mp_cmath_log
);
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
mp_cmath_log_obj
,
mp_cmath_log
);
/// \function log10(z)
/// \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
)
{
mp_obj_t
mp_cmath_log10
(
mp_obj_t
z_obj
)
{
mp_float_t
real
,
imag
;
mp_float_t
real
,
imag
;
mp_obj_get_complex
(
z_obj
,
&
real
,
&
imag
);
mp_obj_get_complex
(
z_obj
,
&
real
,
&
imag
);
...
@@ -103,6 +106,7 @@ mp_obj_t mp_cmath_log10(mp_obj_t z_obj) {
...
@@ -103,6 +106,7 @@ mp_obj_t mp_cmath_log10(mp_obj_t z_obj) {
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
mp_cmath_log10_obj
,
mp_cmath_log10
);
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
mp_cmath_log10_obj
,
mp_cmath_log10
);
/// \function sqrt(z)
/// \function sqrt(z)
/// Return the square-root of `z`.
mp_obj_t
mp_cmath_sqrt
(
mp_obj_t
z_obj
)
{
mp_obj_t
mp_cmath_sqrt
(
mp_obj_t
z_obj
)
{
mp_float_t
real
,
imag
;
mp_float_t
real
,
imag
;
mp_obj_get_complex
(
z_obj
,
&
real
,
&
imag
);
mp_obj_get_complex
(
z_obj
,
&
real
,
&
imag
);
...
@@ -113,6 +117,7 @@ mp_obj_t mp_cmath_sqrt(mp_obj_t z_obj) {
...
@@ -113,6 +117,7 @@ mp_obj_t mp_cmath_sqrt(mp_obj_t z_obj) {
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
mp_cmath_sqrt_obj
,
mp_cmath_sqrt
);
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
mp_cmath_sqrt_obj
,
mp_cmath_sqrt
);
/// \function cos(z)
/// \function cos(z)
/// Return the cosine of `z`.
mp_obj_t
mp_cmath_cos
(
mp_obj_t
z_obj
)
{
mp_obj_t
mp_cmath_cos
(
mp_obj_t
z_obj
)
{
mp_float_t
real
,
imag
;
mp_float_t
real
,
imag
;
mp_obj_get_complex
(
z_obj
,
&
real
,
&
imag
);
mp_obj_get_complex
(
z_obj
,
&
real
,
&
imag
);
...
@@ -121,6 +126,7 @@ mp_obj_t mp_cmath_cos(mp_obj_t z_obj) {
...
@@ -121,6 +126,7 @@ mp_obj_t mp_cmath_cos(mp_obj_t z_obj) {
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
mp_cmath_cos_obj
,
mp_cmath_cos
);
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
mp_cmath_cos_obj
,
mp_cmath_cos
);
/// \function sin(z)
/// \function sin(z)
/// Return the sine of `z`.
mp_obj_t
mp_cmath_sin
(
mp_obj_t
z_obj
)
{
mp_obj_t
mp_cmath_sin
(
mp_obj_t
z_obj
)
{
mp_float_t
real
,
imag
;
mp_float_t
real
,
imag
;
mp_obj_get_complex
(
z_obj
,
&
real
,
&
imag
);
mp_obj_get_complex
(
z_obj
,
&
real
,
&
imag
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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