From 517afa651a75d1afeef60a16f86527ce1f722fc3 Mon Sep 17 00:00:00 2001 From: woclass Date: Tue, 9 May 2023 22:27:28 +0800 Subject: [PATCH] rtutils: use `jl_strtof_c` to convert strings to float indirect conversion (string->double->float) will lose precision --- src/rtutils.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/rtutils.c b/src/rtutils.c index 85a9be5e0b1dae..bd743ab3753069 100644 --- a/src/rtutils.c +++ b/src/rtutils.c @@ -518,11 +518,7 @@ JL_DLLEXPORT jl_nullable_float32_t jl_try_substrtof(char *str, size_t offset, si bstr = newstr; pend = bstr+len; } -#if defined(_OS_WINDOWS_) && !defined(_COMPILER_GCC_) - float out = (float)jl_strtod_c(bstr, &p); -#else float out = jl_strtof_c(bstr, &p); -#endif if (errno==ERANGE && (out==0 || out==HUGE_VALF || out==-HUGE_VALF)) { hasvalue = 0;