Re: strtod and NaN vs. zero
| From: | Niklas Keller | Date: | Sun, 23 Oct 2016 11:49:58 +0000 |
| Subject: | Re: strtod and NaN vs. zero | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-96557@lists.php.net to get a copy of this message | ||
2016-10-23 12:55 GMT+02:00 Marc Bennewitz <dev@mabe.berlin>:
> Hi internals,
>
> On casting a non numeric value to a float in PHP the result will be
> float(0).
>
> In PHP-7.0 an exception was introduced that on casting a string
> "/\s*NaN\s*/i" will result in float(NaN).
>
> https://3v4l.org/2Xakm
>
> Wouldn't it be more logical and expected to return NaN in all cases of
> casting a non numeric string to a floating point number?
>
> Thanks
> Marc
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
+1
Regards, Niklas