0
Try This and Comment
if ((0.1+0.2)==0.3) { echo "0.1 + 0.2 is equal to 0.3"; }else{ echo "0.1 + 0.2 is not equal to 0.3"; }
3 Answers
+ 1
Floating point representation of a number is always an approximation. So, 0.1 + 0.2 gives you 0.30000000000000004. That is why you should never compare floating point numbers with the equality/inequality operators
0
and to understand my answer more make an echo to this code :
echo ((0.1+0.2)-0.3) ;
and see the result đ
0
i van say floating number is sensitive