View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002935 | JEDI VCL | 00 JVCL Components | public | 2005-05-07 19:56 | 2006-06-08 02:28 |
Reporter | glchapman | Assigned To | obones | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | won't fix | ||
Product Version | 3.00 | ||||
Target Version | Fixed in Version | ||||
Summary | 0002935: StrToFloatDef does not allow for exponent | ||||
Description | The StrToFloatDef routine in JvJCLUtils begins by scanning the input string and removing invalid chars. Unfortunately, it does not include 'e' and 'E' in its valid chars, so these get removed, leading to incorrect results. I guess this scanning loop is intended to get rid of ThousandsSeparators, but it appears not to have been thought out completely. The routine parses '5xyz 8 &^2' as 582, which to me is surprising. Is the routine guaranteed to be only used in places where it is getting well-formed input? Also, the routine allows '-' to be a correct number, which evaluates to 0. To me this seems wrong, but perhaps other stuff depends on it. It also seems inconsistent to allow '-' but not '+' (with D5 anyway, TextToFloat rejects '+'; I assume the same happens for later versions). | ||||
Tags | No tags attached. | ||||
|
This function was created to prevent some TextToFloat bug; '+' and '-' should be considered as 0. This function delete all extra characters, that's why '5xyz 8 &^2' is understood as 582. Rejecting 'e' and 'E' is a bug, I fixed only this feature in the CVS. |
|
I think it is unfortunate that this function has the same name a standard Delphi function (post-D5) which behaves differently. I only have D5, but I'd be very surprised if the standard StrToFloatDef function, given the input '5xyz 8 &^2', returned something other than the Default argument. I think at least some review of the uses of this function in JVCL is in order: were any of the uses written with the expectation that the function worked like the standard Delphi function? |
|
What to do here? |
|
This function should be kept as it presently is. Some users may rely on its light-restrictive behavior. |
|
For backward compatibility reasons, this won't be fixed. However some warning text has been put in JvJCLUtils to inform people about the quirk. |
Date Modified | Username | Field | Change |
---|---|---|---|
2005-05-07 19:56 | glchapman | New Issue | |
2005-05-12 10:17 | outchy | Note Added: 0007142 | |
2005-05-12 11:56 | outchy | Status | new => feedback |
2005-05-14 08:00 | glchapman | Note Added: 0007155 | |
2006-03-30 08:02 | obones | Note Added: 0008769 | |
2006-03-31 11:45 | outchy | Note Added: 0008809 | |
2006-06-08 02:28 | obones | Status | feedback => resolved |
2006-06-08 02:28 | obones | Resolution | open => won't fix |
2006-06-08 02:28 | obones | Assigned To | => obones |
2006-06-08 02:28 | obones | Note Added: 0009428 |