mirror of
https://github.com/php/php-src.git
synced 2024-12-18 06:21:41 +08:00
03f8bccaf5
For a division like [1..1]/[2..2] produce [0..1] as a result, which would be the integer envelope of the floating-point result. The implementation is pretty ugly (we're now taking min/max across eight values...) but I couldn't come up with a more elegant way to handle this that doesn't make things a lot more complex (the division sign handling is the annoying issue here).
12 lines
167 B
PHP
12 lines
167 B
PHP
--TEST--
|
|
Bug #80404: Incorrect range inference result when division results in float
|
|
--FILE--
|
|
<?php
|
|
|
|
$n = 63;
|
|
var_dump((int) ($n / 120 * 100));
|
|
|
|
?>
|
|
--EXPECT--
|
|
int(52)
|