diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-06-20 01:48:35 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-06-20 18:00:23 +0300 |
commit | 3b6f7b95eb487fc927a3bc4644b1941cfbe2612b (patch) | |
tree | e06661e63e4c8bd6f94494281237bc31f4d488eb /py/parsenum.c | |
parent | 7efbd325bb5ac540b746a594a76185c211963c46 (diff) | |
download | micropython-3b6f7b95eb487fc927a3bc4644b1941cfbe2612b.tar.gz micropython-3b6f7b95eb487fc927a3bc4644b1941cfbe2612b.zip |
py: Separate MICROPY_PY_BUILTINS_COMPLEX from MICROPY_PY_BUILTINS_FLOAT.
One thing is wanting to do 1 / 2 and get something else but 0, and quite
another - doing rocket science ;-).
Diffstat (limited to 'py/parsenum.c')
-rw-r--r-- | py/parsenum.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/py/parsenum.c b/py/parsenum.c index 1c1868ae0a..36b0690501 100644 --- a/py/parsenum.c +++ b/py/parsenum.c @@ -35,6 +35,7 @@ #include "parsenumbase.h" #include "parsenum.h" #include "smallint.h" +#include "runtime.h" #if MICROPY_PY_BUILTINS_FLOAT #include <math.h> @@ -252,10 +253,15 @@ mp_obj_t mp_parse_num_decimal(const char *str, uint len, bool allow_imag, bool f } // return the object +#if MICROPY_PY_BUILTINS_COMPLEX if (imag) { return mp_obj_new_complex(0, dec_val); } else if (force_complex) { return mp_obj_new_complex(dec_val, 0); +#else + if (imag || force_complex) { + mp_not_implemented("complex values not supported"); +#endif } else { return mp_obj_new_float(dec_val); } |