summaryrefslogtreecommitdiff
path: root/py/parsenum.c
diff options
context:
space:
mode:
authorstijn <stijn@ignitron.net>2020-04-09 09:05:48 +0200
committerDamien George <damien.p.george@gmail.com>2020-04-18 22:36:14 +1000
commit0ba68f8a1dae84de950420aebf8ad46582a38e66 (patch)
treec996a9b3d26f58b286ef6f9deb508de141b66574 /py/parsenum.c
parentb909e8b2dd007d8e7d61547768518b29bb4f833c (diff)
all: Fix implicit floating point promotion.
Initially some of these were found building the unix coverage variant on MacOS because that build uses clang and has -Wdouble-promotion enabled, and clang performs more vigorous promotion checks than gcc. Additionally the codebase has been compiled with clang and msvc (the latter with warning level 3), and with MICROPY_FLOAT_IMPL_FLOAT to find the rest of the conversions. Fixes are implemented either as explicit casts, or by using the correct type, or by using one of the utility functions to handle floating point casting; these have been moved from nativeglue.c to the public API.
Diffstat (limited to 'py/parsenum.c')
-rw-r--r--py/parsenum.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/parsenum.c b/py/parsenum.c
index 234248c9d..e665da7d8 100644
--- a/py/parsenum.c
+++ b/py/parsenum.c
@@ -220,7 +220,7 @@ mp_obj_t mp_parse_num_decimal(const char *str, size_t len, bool allow_imag, bool
if (str + 2 < top && (str[1] | 0x20) == 'n' && (str[2] | 0x20) == 'f') {
// inf
str += 3;
- dec_val = INFINITY;
+ dec_val = (mp_float_t)INFINITY;
if (str + 4 < top && (str[0] | 0x20) == 'i' && (str[1] | 0x20) == 'n' && (str[2] | 0x20) == 'i' && (str[3] | 0x20) == 't' && (str[4] | 0x20) == 'y') {
// infinity
str += 5;