[VOTE] Deprecate implicit non-integer-compatible float to int conversions

php.internals

Girgias

5 years ago
Hello internals, It's been a couple of weeks and no further comments have been made as such voting is now open: https://wiki.php.net/rfc/implicit-float-int-deprecate It will run for two weeks until the 14th of April 2021. Best regards, George P. Banyard

Girgias

5 years ago
On Thu, 1 Apr 2021 at 12:39, G. P. B. <george.banyard@gmail.com> wrote:
> Hello internals, > > It's been a couple of weeks and no further comments have been made as such > voting is now open: > > https://wiki.php.net/rfc/implicit-float-int-deprecate > > It will run for two weeks until the 14th of April 2021. > > Best regards, > > George P. Banyard >
I'm happy to announce that this RFC has been unanimously approved with 29 votes in favor and 0 against. Best regards, George P. Banyard

Hans Henrik Bergan

5 years ago
just want to double check, 1.000000000000009 will then be an incompatible cast to int(1), right? because the 0.000000000000009 will be lost? On Wed, 14 Apr 2021 at 13:41, G. P. B. <george.banyard@gmail.com> wrote:

Nikita Popov

5 years ago
On Sat, Apr 17, 2021 at 4:30 PM Hans Henrik Bergan <divinity76@gmail.com> wrote:
> just want to double check, 1.000000000000009 will then be an incompatible > cast to int(1), right? because the 0.000000000000009 will be lost? >
That's right. Something to keep in mind is that your example could have just as well been 0.9999999999999999 -- which is going to be 0 when cast to an integer, not 1. A "negligible" difference of 10^-16 in a float can easily become a difference of 1 when interpreted as an integer. Nikita