[Ilugc] Problem in PHP Type conversion.

  • From: prabampm@xxxxxxxxx (praba karan)
  • Date: Tue Mar 17 11:06:02 2009

In a Python REPL:


0.7 + 0.1
0.79999999999999993
_ * 10
7.9999999999999991
int(_)
7




Thanks a lot  Roshan , Ya i do agree with you and the same thing should
happen in php as well i guess but if it is so then

*echo (float) ((0.1+0.7)*10);
*
should print the value as "7.99999993" instead of "8".. so getting confused
here again..

Why python gives 7.99999993 instead of 8..wat was the logic behind that???

Regards,
Praba

Other related posts: