In the example below, you will some examples where the INT that is expected is different than what is actually shown via PHP Version 7.0.33
Below is the PHP code with the expected vs unexpected results.
Any idea why some results are incorrect?
echo (int) (129.34 * 100) . '<br/>';
// WORKS: Result: 12934
echo (int) (129.66 * 100) . '<br/>';
// WORKS: Result: 12966
echo (int) (129.67 * 100) . '<br/>';
// WRONG!: Result: 12966
// Should be: 12967
echo (int) (129.68 * 100) . '<br/>';
// WORKS: Result: 12968
echo (int) (129.69 * 100) . '<br/>';
// WORKS: Result: 12969
echo (int) (259.34 * 100) . '<br/>';
// Doesn't work! Shows 25933, should be 25934
echo (int) (226.66 * 100) . '<br/>';
// WORKS: Result: 22666
// All work
echo (int) (25.92 * 100) . '<br/>';
echo (int) (25.93 * 100) . '<br/>';
echo (int) (25.94 * 100) . '<br/>';
// All work!
echo (int) (229.65 * 100) . '<br/>';
echo (int) (226.66 * 100) . '<br/>';
echo (int) (229.67 * 100) . '<br/>';
echo (int) (229.68 * 100) . '<br/>';
echo (int) (229.69 * 100) . '<br/>';