summaryrefslogtreecommitdiffstatshomepage
path: root/qemu-arm
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-03-24 10:40:25 +1100
committerDamien George <damien.p.george@gmail.com>2017-03-24 11:00:45 +1100
commit125eae1ba3c59b882fc95c82c95dccd2d93ceaa1 (patch)
tree138c06938686efa732f61672ec6e2545633221d8 /qemu-arm
parentfb161aa45a8110d18b08efa3175027b8fbac5463 (diff)
downloadmicropython-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 'qemu-arm')
-rw-r--r--qemu-arm/Makefile2
1 files changed, 1 insertions, 1 deletions
diff --git a/qemu-arm/Makefile b/qemu-arm/Makefile
index e8f5b359ef..d4bbe8d583 100644
--- a/qemu-arm/Makefile
+++ b/qemu-arm/Makefile
@@ -47,7 +47,7 @@ SRC_TEST_C = \
LIB_SRC_C = $(addprefix lib/,\
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 \