From 01749000e1cdd379df0cbaefb5b49c27f2c496e9 Mon Sep 17 00:00:00 2001 From: Patrik Nyblom Date: Tue, 8 Jun 2010 09:59:30 +0200 Subject: Teach Unix sys_float.c to ignore underflow in list_to_float and return 0.0 OTP-7178 --- erts/emulator/sys/unix/sys_float.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'erts/emulator/sys/unix/sys_float.c') 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; -- cgit v1.2.3