diff options
author | Damien George <damien.p.george@gmail.com> | 2017-03-24 10:40:25 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-03-24 11:00:45 +1100 |
commit | 125eae1ba3c59b882fc95c82c95dccd2d93ceaa1 (patch) | |
tree | 138c06938686efa732f61672ec6e2545633221d8 /esp8266 | |
parent | fb161aa45a8110d18b08efa3175027b8fbac5463 (diff) | |
download | micropython-125eae1ba3c59b882fc95c82c95dccd2d93ceaa1.tar.gz micropython-125eae1ba3c59b882fc95c82c95dccd2d93ceaa1.zip |
py/modbuiltins: For round() builtin use nearbyint instead of round.
The C nearbyint function has exactly the semantics that Python's round()
requires, whereas C's round() requires extra steps to handle rounding of
numbers half way between integers. So using nearbyint reduces code size
and potentially eliminates any source of errors in the handling of half-way
numbers.
Also, bare-metal implementations of nearbyint can be more efficient than
round, so further code size is saved (and efficiency improved).
nearbyint is provided in the C99 standard so it should be available on all
supported platforms.
Diffstat (limited to 'esp8266')
-rw-r--r-- | esp8266/Makefile | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/esp8266/Makefile b/esp8266/Makefile index 4710f4cdc2..28dbf08a64 100644 --- a/esp8266/Makefile +++ b/esp8266/Makefile @@ -108,7 +108,7 @@ LIB_SRC_C = $(addprefix lib/,\ libc/string0.c \ libm/math.c \ libm/fmodf.c \ - libm/roundf.c \ + libm/nearbyintf.c \ libm/ef_sqrt.c \ libm/kf_rem_pio2.c \ libm/kf_sin.c \ |