diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2017-08-28 13:59:26 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-28 13:59:26 -0700 |
| commit | 447a4b1ecd5655357c9daaace03b91355d2e2c6d (patch) | |
| tree | 46ca08a93e9870aab4fbb533843f3c99796cbdf4 /py/modmath.c | |
| parent | 4e63d55d8d0df6d7600bb684fa90a8cb54708ba8 (diff) | |
| parent | c679c80c710fd4a0e37ad87200d8a721e19727aa (diff) | |
Merge pull request #208 from adafruit/merge-v1.9.2
Merge MicroPython v1.9.2
Diffstat (limited to 'py/modmath.c')
| -rw-r--r-- | py/modmath.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/py/modmath.c b/py/modmath.c index 517c1dacb..ab276786d 100644 --- a/py/modmath.c +++ b/py/modmath.c @@ -1,5 +1,5 @@ /* - * This file is part of the Micro Python project, http://micropython.org/ + * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * @@ -25,7 +25,7 @@ */ #include "py/builtin.h" -#include "py/nlr.h" +#include "py/runtime.h" #include "py/runtime.h" #if MICROPY_PY_BUILTINS_FLOAT && MICROPY_PY_MATH @@ -169,6 +169,12 @@ STATIC mp_obj_t mp_math_log(size_t n_args, const mp_obj_t *args) { mp_float_t base = mp_obj_get_float(args[1]); if (base <= (mp_float_t)0.0) { math_error(); +// Turn off warning when comparing exactly with integral value 1.0 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wfloat-equal" + } else if (base == (mp_float_t)1.0) { +#pragma GCC diagnostic pop + mp_raise_msg(&mp_type_ZeroDivisionError, "division by zero"); } return mp_obj_new_float(l / MICROPY_FLOAT_C_FUN(log)(base)); } |
