@@ -104,8 +104,18 @@ static inline bool mp_obj_is_immediate_obj(mp_const_obj_t o) {
104104#if MICROPY_PY_BUILTINS_FLOAT
105105#define mp_const_float_e MP_ROM_PTR(&mp_const_float_e_obj)
106106#define mp_const_float_pi MP_ROM_PTR(&mp_const_float_pi_obj)
107+ #if MICROPY_PY_MATH_CONSTANTS
108+ #define mp_const_float_tau MP_ROM_PTR(&mp_const_float_tau_obj)
109+ #define mp_const_float_inf MP_ROM_PTR(&mp_const_float_inf_obj)
110+ #define mp_const_float_nan MP_ROM_PTR(&mp_const_float_nan_obj)
111+ #endif
107112extern const struct _mp_obj_float_t mp_const_float_e_obj ;
108113extern const struct _mp_obj_float_t mp_const_float_pi_obj ;
114+ #if MICROPY_PY_MATH_CONSTANTS
115+ extern const struct _mp_obj_float_t mp_const_float_tau_obj ;
116+ extern const struct _mp_obj_float_t mp_const_float_inf_obj ;
117+ extern const struct _mp_obj_float_t mp_const_float_nan_obj ;
118+ #endif
109119
110120#define mp_obj_is_float (o ) mp_obj_is_type((o), &mp_type_float)
111121mp_float_t mp_obj_float_get (mp_obj_t self_in );
@@ -139,8 +149,18 @@ static inline bool mp_obj_is_immediate_obj(mp_const_obj_t o) {
139149#if MICROPY_PY_BUILTINS_FLOAT
140150#define mp_const_float_e MP_ROM_PTR(&mp_const_float_e_obj)
141151#define mp_const_float_pi MP_ROM_PTR(&mp_const_float_pi_obj)
152+ #if MICROPY_PY_MATH_CONSTANTS
153+ #define mp_const_float_tau MP_ROM_PTR(&mp_const_float_tau_obj)
154+ #define mp_const_float_inf MP_ROM_PTR(&mp_const_float_inf_obj)
155+ #define mp_const_float_nan MP_ROM_PTR(&mp_const_float_nan_obj)
156+ #endif
142157extern const struct _mp_obj_float_t mp_const_float_e_obj ;
143158extern const struct _mp_obj_float_t mp_const_float_pi_obj ;
159+ #if MICROPY_PY_MATH_CONSTANTS
160+ extern const struct _mp_obj_float_t mp_const_float_tau_obj ;
161+ extern const struct _mp_obj_float_t mp_const_float_inf_obj ;
162+ extern const struct _mp_obj_float_t mp_const_float_nan_obj ;
163+ #endif
144164
145165#define mp_obj_is_float (o ) mp_obj_is_type((o), &mp_type_float)
146166mp_float_t mp_obj_float_get (mp_obj_t self_in );
@@ -162,6 +182,11 @@ static inline bool mp_obj_is_small_int(mp_const_obj_t o) {
162182#if MICROPY_PY_BUILTINS_FLOAT
163183#define mp_const_float_e MP_ROM_PTR((mp_obj_t)(((0x402df854 & ~3) | 2) + 0x80800000))
164184#define mp_const_float_pi MP_ROM_PTR((mp_obj_t)(((0x40490fdb & ~3) | 2) + 0x80800000))
185+ #if MICROPY_PY_MATH_CONSTANTS
186+ #define mp_const_float_tau MP_ROM_PTR((mp_obj_t)(((0x40c90fdb & ~3) | 2) + 0x80800000))
187+ #define mp_const_float_inf MP_ROM_PTR((mp_obj_t)(((0x7f800000 & ~3) | 2) + 0x80800000))
188+ #define mp_const_float_nan MP_ROM_PTR((mp_obj_t)(((0xffc00000 & ~3) | 2) + 0x80800000))
189+ #endif
165190
166191static inline bool mp_obj_is_float (mp_const_obj_t o ) {
167192 return (((mp_uint_t )(o )) & 3 ) == 2 && (((mp_uint_t )(o )) & 0xff800007 ) != 0x00000006 ;
@@ -226,6 +251,11 @@ static inline bool mp_obj_is_immediate_obj(mp_const_obj_t o) {
226251
227252#define mp_const_float_e {((mp_obj_t)((uint64_t)0x4005bf0a8b145769 + 0x8004000000000000))}
228253#define mp_const_float_pi {((mp_obj_t)((uint64_t)0x400921fb54442d18 + 0x8004000000000000))}
254+ #if MICROPY_PY_MATH_CONSTANTS
255+ #define mp_const_float_tau {((mp_obj_t)((uint64_t)0x401921fb54442d18 + 0x8004000000000000))}
256+ #define mp_const_float_inf {((mp_obj_t)((uint64_t)0x7ff0000000000000 + 0x8004000000000000))}
257+ #define mp_const_float_nan {((mp_obj_t)((uint64_t)0xfff8000000000000 + 0x8004000000000000))}
258+ #endif
229259
230260static inline bool mp_obj_is_float (mp_const_obj_t o ) {
231261 return ((uint64_t )(o ) & 0xfffc000000000000 ) != 0 ;
0 commit comments