aboutsummaryrefslogtreecommitdiff
path: root/py/objint_mpz.c
diff options
context:
space:
mode:
authorDavid Steinberg <david.steinberg.dev@gmail.com>2015-01-02 12:39:22 +0000
committerDamien George <damien.p.george@gmail.com>2015-01-02 22:31:41 +0000
commit6e0b6d02dbe238e6e3d675b51e44b2ac798ddd20 (patch)
treee9d05c0e7b27da54ee3af4fd27ebd7e227c3bf08 /py/objint_mpz.c
parentffc96a901a13f6f114368ad50a1d7189c0826822 (diff)
py: Fix float to int conversion for large exponents.
Diffstat (limited to 'py/objint_mpz.c')
-rw-r--r--py/objint_mpz.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/py/objint_mpz.c b/py/objint_mpz.c
index 554ec9657..23e300023 100644
--- a/py/objint_mpz.c
+++ b/py/objint_mpz.c
@@ -298,9 +298,9 @@ mp_obj_t mp_obj_new_int_from_uint(mp_uint_t value) {
#if MICROPY_PY_BUILTINS_FLOAT
mp_obj_t mp_obj_new_int_from_float(mp_float_t val) {
- // TODO: This doesn't handle numbers with large exponent
- long long i = MICROPY_FLOAT_C_FUN(trunc)(val);
- return mp_obj_new_int_from_ll(i);
+ mp_obj_int_t *o = mp_obj_int_new_mpz();
+ mpz_set_from_float(&o->mpz, val);
+ return o;
}
#endif