diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-12-30 00:22:10 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-12-30 00:22:50 +0200 |
commit | 12033df511a5a5f0237a764379aacfbceb6c45dd (patch) | |
tree | 226ec32b42cfa23f51ce55e3b82a03b08e46714b /py/obj.h | |
parent | e3fa8278b45447b9e099e896bb24a84bb79e4cf0 (diff) | |
download | micropython-12033df511a5a5f0237a764379aacfbceb6c45dd.tar.gz micropython-12033df511a5a5f0237a764379aacfbceb6c45dd.zip |
py: Partially fix float to int conversion.
This fixes conversion when float type has more mantissa bits than small int,
and float value has small exponent. This is for example the case of 32-bit
platform using doubles, and converting value of time.time(). Conversion of
floats with larg exponnet is still not handled correctly.
Diffstat (limited to 'py/obj.h')
-rw-r--r-- | py/obj.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -399,6 +399,7 @@ mp_obj_t mp_obj_new_int_from_uint(mp_uint_t value); mp_obj_t mp_obj_new_int_from_str_len(const char **str, mp_uint_t len, bool neg, mp_uint_t base); mp_obj_t mp_obj_new_int_from_ll(long long val); // this must return a multi-precision integer object (or raise an overflow exception) mp_obj_t mp_obj_new_int_from_ull(unsigned long long val); // this must return a multi-precision integer object (or raise an overflow exception) +mp_obj_t mp_obj_new_int_from_float(mp_float_t val); mp_obj_t mp_obj_new_str(const char* data, mp_uint_t len, bool make_qstr_if_not_already); mp_obj_t mp_obj_new_bytes(const byte* data, mp_uint_t len); mp_obj_t mp_obj_new_bytearray(mp_uint_t n, void *items); |