diff options
author | David Steinberg <david.steinberg.dev@gmail.com> | 2015-01-13 15:21:17 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-01-24 20:54:28 +0000 |
commit | ca377b10de006b48f75383664f5f765b202412df (patch) | |
tree | 4cd75eb6aa9186c27feeafef73aa4c26c744e259 /py/objint.h | |
parent | 8d427b7ab79d1d45d6aef2f0bbb73c65373247df (diff) | |
download | micropython-ca377b10de006b48f75383664f5f765b202412df.tar.gz micropython-ca377b10de006b48f75383664f5f765b202412df.zip |
py: Add float-to-int classification function
Diffstat (limited to 'py/objint.h')
-rw-r--r-- | py/objint.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/py/objint.h b/py/objint.h index fff325df84..c995f2632a 100644 --- a/py/objint.h +++ b/py/objint.h @@ -40,6 +40,16 @@ typedef struct _mp_obj_int_t { extern const mp_obj_int_t mp_maxsize_obj; +#if MICROPY_PY_BUILTINS_FLOAT +typedef enum { + MP_FP_CLASS_FIT_SMALLINT, + MP_FP_CLASS_FIT_LONGINT, + MP_FP_CLASS_OVERFLOW +} mp_fp_as_int_class_t; + +mp_fp_as_int_class_t mp_classify_fp_as_int(mp_float_t val); +#endif // MICROPY_PY_BUILTINS_FLOAT + void mp_obj_int_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind); char *mp_obj_int_formatted(char **buf, mp_uint_t *buf_size, mp_uint_t *fmt_size, mp_const_obj_t self_in, int base, const char *prefix, char base_char, char comma); |