Notes |
(0002459)
bernhardf
06-06-07 11:34
edited on: 06-06-07 11:35
|
May i suggest that you look into libc/stdlib/_strtod.c, looks like __fp_range_check() to verify that ERANGE is also set on underflow and submit a patch?
thanks,
|
| |
(0002461)
chmeee
06-07-07 11:33
|
I'm looking into it, and did read through that function before submitting the bug report, but I'm not quite sure how to fix it without breaking strtold. I've looked through glibc's strtod(), and that detects overflow and underflow during the parse, not afterwards, and it's the same with strtold() and strtof(). I was hoping someone with better floating point skills would be able to more easily address it. |
| |
(0002477)
chmeee
06-12-07 06:51
|
This fix seems to work, but someone with real floating point experience should verify:
Index: libc/stdlib/strtod.c
===================================================================
--- libc/stdlib/strtod.c (revision XXXX)
+++ libc/stdlib/strtod.c (working copy)
@@ -506,7 +506,7 @@ __fpmax_t __XL_NPP(__strtofpmax)(const W
extern void __fp_range_check(__fpmax_t y, __fpmax_t x)
{
if (__FPMAX_ZERO_OR_INF_CHECK(y) /* y is 0 or +/- infinity */
- && (y != 0) /* y is not 0 (could have x>0, y==0 if underflow) */
+ // && (y != 0) /* y is not 0 (could have x>0, y==0 if underflow) */
&& !__FPMAX_ZERO_OR_INF_CHECK(x) /* x is not 0 or +/- infinity */
) {
__set_errno(ERANGE); /* Then x is not in y's range. */ |
| |