Re: Need help in converting strings to doubles
| From: | Andi Gutmans | Date: | Tue, 30 May 2000 15:05:15 +0000 |
| Subject: | Re: Need help in converting strings to doubles | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-19764@lists.php.net to get a copy of this message | ||
On Tue, 30 May 2000 thies@digicol.de wrote:
> On Mon, May 29, 2000 at 08:56:38PM +0300, Andi Gutmans wrote:
> > Guys,
> >
> > I wrote a conversion function which converts strings to double. I am
> > hoping to use it instead of strtod(). The main issue I have left (except
> > for supporting end_ptr which will take me a few minutes), is how to detect
> > overflow and underflows and thus, support the return of +/- HUGE_VAL and
> > the setting of errno to ERANGE like strtod() does.
> >
> > Does anyone here have an idea of how to write such support? The glibc
> > source looks quite horrible.
> >
> > Take a look at zend_operators.c:zend_string_to_double()
>
> as i said in my 1st mail, it looks too simple...
>
> have you had a look at the OpenBSD implemetation?
Looking too simple doesn't mean much. They deal with tons of locale crap
which I don't intend to deal with and they deal with overflows and
underflows which I intend to deal with.
I looked at the glibc implementation but it is quite complex. We probably
don't need such complexity although we still need to add some stuff.
Andi