Hi there,
I've been looking at the different string->number related functions lately.
It looks like is_numeric_string|unicode could be optimized. Here's what
I was thinking: Can functions like zend_[string|unicode]to_number() be
added? Then is_numeric* could always call only 1 function that would
handle long and double (like in _php_math_basetozval). Now strtol() or
zend_strtod() can be called unnecessarily, depending on the scenario.
BUT, in order for me to do this, can doubles/floats be handled
correctly/accurately using simple code such as in the existing
zend_string_to_double()? So you know what I mean, the function prototype
might look like this:
zend_uchar zend_string_to_number(char *str, char **end, int base, long
*lval, double *dval)
This is the type of function I think would be nice (on its own) where I was
updating PHP's dec*() functions to handle larger values --
is_numeric_string/convert_scalar_to_number aren't right, IMO, because they
allow hex strings (in dechex()
?? :-)), besides being more inefficient
because of the current is_numeric_string. I was looking for more of a plain
convert_to_number, like convert_to_long, but would use a double if needed.
Thoughts?
Thanks,
Matt