How to Calculate 0.1 Plus 0.2 Correctly in PHP?
The PHP Foundation thanks guest author Weilin Du for this post! Quick quiz before you read: <?php var_dump(0.1 + 0.2 === 0.3); This returns false. Now, as developers who proudly know IEEE's floating rules, many of you may take a sip of your coffee and say: Hey, that's not news anymore. We all know this classic case that warns generations of junior developers that calculating directly with floats might cause bugs. However, let's see this case here (64-bit): <?php var_dump((9223372036854775808 -…
Soutenez The PHP Foundation en consultant la ressource originale
Lire l'article originalVous aimez découvrir ces sources ?
Soutenez-moi sur Patreon