Commit a9256392 authored by Damien George's avatar Damien George
Browse files

py: Add math.e constant.

parent 2d7ff071
......@@ -17,6 +17,7 @@
mp_obj_t mp_math_ ## py_name(mp_obj_t x_obj, mp_obj_t y_obj) { return mp_obj_new_float(MICROPY_FLOAT_C_FUN(c_name)(mp_obj_get_float(x_obj), mp_obj_get_float(y_obj))); } \
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_math_## py_name ## _obj, mp_math_ ## py_name);
STATIC const mp_obj_float_t mp_math_e_obj = {{&mp_type_float}, M_E};
STATIC const mp_obj_float_t mp_math_pi_obj = {{&mp_type_float}, M_PI};
MATH_FUN_1(sqrt, sqrt)
......@@ -42,6 +43,7 @@ MATH_FUN_2(atan2, atan2)
STATIC const mp_map_elem_t mp_module_math_globals_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_math) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_e), (mp_obj_t)&mp_math_e_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_pi), (mp_obj_t)&mp_math_pi_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_sqrt), (mp_obj_t)&mp_math_sqrt_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_pow), (mp_obj_t)&mp_math_pow_obj },
......
......@@ -119,6 +119,7 @@ Q(module)
Q(slice)
Q(math)
Q(e)
Q(pi)
Q(sqrt)
Q(pow)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment