Re: [RFC] Safe Casting Functions
| From: | Andrea Faulds | Date: | Fri, 24 Oct 2014 18:54:55 +0000 |
| Subject: | Re: [RFC] Safe Casting Functions | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-78312@lists.php.net to get a copy of this message | ||
> On 24 Oct 2014, at 19:52, Marc Bennewitz <php@mabe.berlin> wrote:
>> Floats are special, they are not expected to be precise. If we reject this, then perhaps we
>> should also reject 0.1, because it can’t be precisely represented by a float?
> It's a difference casting string to float or int to float.
> Floats are often used to make sure an argument is a valid number but
> this results in data loss incl. on internal functions.
You’re not using the right function, then.
--
Andrea Faulds
http://ajf.me/