[php-src] Issue #8028: Problem with casting into (int) or intval()

From: Date: Thu, 03 Feb 2022 15:38:11 +0000
Subject: [php-src] Issue #8028: Problem with casting into (int) or intval()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-239444@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8028 Author: VILQ ### Description The following code: ```php <?php $a = 42.85 * 100 - 34.84 * 100; $b = (int)$a; $c = (int)round($a); echo $a."\n".$b."\n".$c; ``` Resulted in this output: ``` 801 800 801 ``` But I expected this output instead: ``` 801 801 801 ``` The result is consistent when we change '34.84' to e.g. '34.85', '34.86' or '34.83'. Eval link: https://3v4l.org/geEpE When $b = intval($a) the result is the same. ### PHP Version 8.0.22 ### Operating System _No response_

« previous php.bugs (#239444) next »