Skip to content

Commit 38e455a

Browse files
committed
py/formatfloat: Fix exact int formatting on 32-bit mingw.
When compiler optimizations are enabled on the mingw version of gcc, we are getting failing tests because of rounding issues, for example: print(float("1e24")) would print 9.999999999999999e+23 instead of 1e+24 It turns out special compiler options are needed to get GCC to use the SSE instruction set instead of the 387 coprocessor. This also lets us re-enable other failing tests. Signed-off-by: David Lechner <david@pybricks.com>
1 parent bb77c1d commit 38e455a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ports/windows/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,17 @@ ifneq ($(FROZEN_MANIFEST),)
8484
CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool -DMICROPY_MODULE_FROZEN_MPY=1 -DMPZ_DIG_SIZE=16
8585
endif
8686

87+
ifeq ($(shell $(CC) -dumpmachine),i686-w64-mingw32)
88+
# https://lemire.me/blog/2020/06/26/gcc-not-nearest
89+
CFLAGS += -msse -mfpmath=sse -march=pentium4
90+
endif
91+
8792
CXXFLAGS += $(filter-out -std=gnu99,$(CFLAGS))
8893

8994
include $(TOP)/py/mkrules.mk
9095

9196
.PHONY: test test_full
9297

93-
RUN_TESTS_SKIP += -e math_fun -e float2int_double -e float_parse -e math_domain_special
94-
9598
test: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py
9699
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
97100
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) $(PYTHON) ./run-tests.py $(RUN_TESTS_SKIP)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy