aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2010-06-08 09:59:30 +0200
committerPatrik Nyblom <[email protected]>2010-06-23 14:50:10 +0200
commit01749000e1cdd379df0cbaefb5b49c27f2c496e9 (patch)
tree9702f0205261e62dd261ec17beb6b3363c8f424f /erts/emulator/sys
parentc1e94fa9a6fe4ae717d35dfbd1b628dc2e06d26a (diff)
downloadotp-01749000e1cdd379df0cbaefb5b49c27f2c496e9.tar.gz
otp-01749000e1cdd379df0cbaefb5b49c27f2c496e9.tar.bz2
otp-01749000e1cdd379df0cbaefb5b49c27f2c496e9.zip
Teach Unix sys_float.c to ignore underflow in list_to_float and return 0.0
OTP-7178
Diffstat (limited to 'erts/emulator/sys')
-rw-r--r--erts/emulator/sys/unix/sys_float.c13
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 c59c99f65e..0a27b4cafb 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;