Skip to content

Commit

Permalink
rtutils: use jl_strtof_c to convert strings to float
Browse files Browse the repository at this point in the history
indirect conversion (string->double->float) will lose precision
  • Loading branch information
inkydragon committed Sep 14, 2024
1 parent 9df7b0e commit 517afa6
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/rtutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 517afa6

Please sign in to comment.