diff options
author | Patrik Nyblom <[email protected]> | 2010-08-30 14:19:46 +0200 |
---|---|---|
committer | Patrik Nyblom <[email protected]> | 2010-08-30 14:19:46 +0200 |
commit | 1297a3ade2851be787a4c6a64d5f57d81761c8f5 (patch) | |
tree | 8ba4430bea149f79918f218149318f6146730cd3 /erts/emulator/sys/unix | |
parent | 65334420f7d6e76372a8c1cf6a60ae47d3368d22 (diff) | |
parent | 01749000e1cdd379df0cbaefb5b49c27f2c496e9 (diff) | |
download | otp-1297a3ade2851be787a4c6a64d5f57d81761c8f5.tar.gz otp-1297a3ade2851be787a4c6a64d5f57d81761c8f5.tar.bz2 otp-1297a3ade2851be787a4c6a64d5f57d81761c8f5.zip |
Merge branch 'pan/list_to_float/OTP-7178' into dev
* pan/list_to_float/OTP-7178:
Teach Unix sys_float.c to ignore underflow in list_to_float and return 0.0
Diffstat (limited to 'erts/emulator/sys/unix')
-rw-r--r-- | erts/emulator/sys/unix/sys_float.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/erts/emulator/sys/unix/sys_float.c b/erts/emulator/sys/unix/sys_float.c index d6d06d0036..5a682ab045 100644 --- a/erts/emulator/sys/unix/sys_float.c +++ b/erts/emulator/sys/unix/sys_float.c @@ -799,8 +799,17 @@ sys_chars_to_double(char* buf, double* fp) } #ifdef NO_FPE_SIGNALS - if (errno == ERANGE && (*fp == 0.0 || *fp == HUGE_VAL || *fp == -HUGE_VAL)) { - return -1; + if (errno == ERANGE) { + if (*fp == HUGE_VAL || *fp == -HUGE_VAL) { + /* overflow, should give error */ + return -1; + } else if (t == s && *fp == 0.0) { + /* This should give 0.0 - OTP-7178 */ + errno = 0; + + } else if (*fp == 0.0) { + return -1; + } } #endif return 0; |