I have never stumbled upon this issue before. What is wrown with the following comparison:
$longest_side = 2.9;
if ($longest_side > 2.9) echo 'Too long'; // Returns true, incorrect
Some debugging:
var_dump($longest_side, 2.9) // Displays float(2.9) float(2.9)
The only way to make it work was to stringify the values
if ((string)$longest_side > (string)2.9) echo 'Too long'; // Returns false, OK
Is this a PHP bug or as constructed?