2
I discovered a BUG in the php language and I’m looking for a logical explanation for this, I have the following Code:
<?php
echo (int) ((0.1 + 0.7) * 10);
?>
And the result shown is: 7. Why is this? a php bug?
take the test: http://phpio.net/s/ryn
This is not a bug it’s a Feature. This is a rounded float. This question is a duplicate.
– Inkeliz
This is not unique to PHP, but a floating point problem: What Every Computer Scientist Should Know About Floating-Point Arithmetic
– Gabriel Heming
You can send the @Inkeliz link
– Rui
PHP is used by millions of people every day and several years ago. If there was such a bug, it would have been fixed long ago. Before you think any strange behavior is a bug, do some research on why these things happen. You’ll learn a lot about things you never imagined existed and become a better programmer ;)
– Oralista de Sistemas