From 826f05eb75c884168171adf367cb94d5a36ca073 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 8 Nov 2023 11:32:42 +0100 Subject: [PATCH 1/2] Fix number rounding with MinGW --- quickjs.c | 2 +- tests/test_builtin.js | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/quickjs.c b/quickjs.c index b6a2df5f..5be082ff 100644 --- a/quickjs.c +++ b/quickjs.c @@ -62,7 +62,7 @@ #define MALLOC_OVERHEAD 8 #endif -#if !defined(_WIN32) +#if !defined(_WIN32) || defined(__MINGW32__) /* define it if printf uses the RNDN rounding mode instead of RNDNA */ #define CONFIG_PRINTF_RNDN #endif diff --git a/tests/test_builtin.js b/tests/test_builtin.js index 4ce2355c..4e571aa4 100644 --- a/tests/test_builtin.js +++ b/tests/test_builtin.js @@ -341,11 +341,6 @@ function test_number() assert(Number.isNaN(Number("-"))); assert(Number.isNaN(Number("\x00a"))); - // TODO: Fix rounding error on MinGW. - if (std.getenv('MSYSTEM')) { - return; - } - assert((25).toExponential(0), "3e+1"); assert((-25).toExponential(0), "-3e+1"); assert((2.5).toPrecision(1), "3"); From 19c95b2e9d1c46f3ed72f48e26a15c75cde5f914 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 8 Nov 2023 11:40:21 +0100 Subject: [PATCH 2/2] test --- quickjs.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/quickjs.c b/quickjs.c index 5be082ff..7ea4a3d8 100644 --- a/quickjs.c +++ b/quickjs.c @@ -62,10 +62,8 @@ #define MALLOC_OVERHEAD 8 #endif -#if !defined(_WIN32) || defined(__MINGW32__) /* define it if printf uses the RNDN rounding mode instead of RNDNA */ #define CONFIG_PRINTF_RNDN -#endif #if !defined(EMSCRIPTEN) /* enable stack limitation */