mirror of
https://github.com/micropython/micropython.git
synced 2026-01-08 05:00:26 +01:00
py/objint: Do not use fpclassify.
For combinations of certain versions of glibc and gcc the definition of fpclassify always takes float as argument instead of adapting itself to float/double/long double as required by the C99 standard. At the time of writing this happens for instance for glibc 2.27 with gcc 7.5.0 when compiled with -Os and glibc 3.0.7 with gcc 9.3.0. When calling fpclassify with double as argument, as in objint.c, this results in an implicit narrowing conversion which is not really correct plus results in a warning when compiled with -Wfloat-conversion. So fix this by spelling out the logic manually.
This commit is contained in:
@@ -96,6 +96,7 @@ else:
|
||||
fp2int_test(1.9999999999999981 * 2.0 ** 1023.0, "large pos", False)
|
||||
|
||||
fp2int_test(float("inf"), "inf test", True)
|
||||
fp2int_test(float("-inf"), "inf test", True)
|
||||
fp2int_test(float("nan"), "NaN test", True)
|
||||
|
||||
# test numbers < 1 (this used to fail; see issue #1044)
|
||||
|
||||
@@ -93,6 +93,7 @@ else:
|
||||
fp2int_test(1.999999879 * 2.0 ** 126.0, "large pos", False)
|
||||
|
||||
fp2int_test(float("inf"), "inf test", True)
|
||||
fp2int_test(float("-inf"), "inf test", True)
|
||||
fp2int_test(float("nan"), "NaN test", True)
|
||||
|
||||
# test numbers < 1 (this used to fail; see issue #1044)
|
||||
|
||||
Reference in New Issue
Block a user