Hi Ilia, all, I was just looking at zendi_smart_strcmp() and realized something I hadn't considered (more on that in a sec.). First, and unrelated to the new is_numeric_*, because _smart_strcmp() uses zend_strtod() if one operand is a double and the other isn't, it results in ('0.0' == '0x123') being TRUE! Seems like a bug. I think a (double) cast can be used there instead of zend_strtod(), since that's what's done in compare_function()? Would be faster too...
All right, now what's different with my new is_numeric_* functions: previously is_numeric_* ignored doubles that overflowed (INF), and returned 0 -- think like 500 digits -- and the operands would be compared as strings. So 2 strings that overflowed wouldn't wrongly be considered equal, I assume. Now that's different with IS_DOUBLE being returned always, which is appropriate for most cases like arithmetic. And it wasn't just overflown numbers that previously returned 0, but underflown also ('1e-1000' or a VERY small decimal number; they set ERANGE). I think the simplest way to keep the old behavior with the new is_numeric_* is to use errno in zendi_smart_strcmp(). That'll make it a little slower, but no slower on longs than the old version I don't think, and it'll still be much faster with doubles/non-numeric strings. Any other thoughts on how it should be handled? That is the correct and desired behavior to only compare numerically if both values can be accurately represented? I'll update the patches ASAP once I find out what to do... Matt ----- Original Message ----- From: "Ilia Alshanetsky" Sent: Tuesday, December 12, 2006 > Matt, > > Take a look at array.c and wddx.c > > On 12-Dec-06, at 11:14 AM, Matt Wilmas wrote: > > > ----- Original Message ----- > > From: "Ilia Alshanetsky" > > Sent: Tuesday, December 12, 2006 > > > >> As far as I can tell all tests still pass with the patch, although we > >> have a number of is_numeric_string() uses that will need to be > >> adjusted to accommodate the change to the function. > > > > Really, like what? I didn't see anything that stuck out... > > > >> Ilia Alshanetsky > > > > Matt > > Ilia Alshanetsky -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php