BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001382 [uClibc] Math Library minor always 06-06-07 10:42 06-12-07 06:51
Reporter chmeee View Status public  
Assigned To uClibc
Priority normal Resolution open  
Status assigned   Product Version
Summary 0001382: strtod() ERANGE not set on underflow
Description The Xerces test suite checks for underflow on strtod() parsing of the string

+2.250738585072014e-329

Also with the negative value of this. It correctly returns 0, but does not set errno to ERANGE.
Additional Information
Attached Files

- Relationships

- 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. */
 

- Issue History
Date Modified Username Field Change
06-06-07 10:42 chmeee New Issue
06-06-07 10:42 chmeee Status new => assigned
06-06-07 10:42 chmeee Assigned To  => uClibc
06-06-07 11:34 bernhardf Note Added: 0002459
06-06-07 11:35 bernhardf Note Edited: 0002459
06-07-07 11:33 chmeee Note Added: 0002461
06-12-07 06:51 chmeee Note Added: 0002476
06-12-07 06:51 chmeee Note Added: 0002477
06-12-07 06:51 chmeee Note Deleted: 0002476


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker