Lester Caine wrote:

> On 18/02/15 23:09, Christoph Becker wrote:
>> It seems to me that this behavior is hard to deal with generally for
>> programmers as well as static analyzers.  Andreas' bigint RFC[1] would
>> solve that issue, but it has been withdrawn, and AFAIK nobody is working
>> on it.  OTOH, bigint would make the widening from int to float
>> potentially even more lossy (i.e. inaccurate) than it is now (64bit ints
>> vs. IEEE 754 doubles).
> 
> The 'unconstrained integer' RFC adds it' own problems, but the int ->
> float overflow is only a problem with 32bit builds anyway. 64bit builds
> will not overflow until they run out of space anyway.

It seems to me you're thinking too much (maybe only?) about "database
types".  IMHO PHP can be used more versatile, and there might be issues
which are exemplified in the RFC[1]:

  var_dump(2 ** 64); // float(1.844674407371E+19)

Clearly an int->float overflow that'll also happen on 64bit builds.

[1]
<https://wiki.php.net/rfc/scalar_type_hints_v5#integer_overflow_to_float_behavior>

-- 
Christoph M. Becker



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to