[Ilugc] Problem in PHP Type conversion.

  • From: rmathews@xxxxxxxxx (Roshan Mathews)
  • Date: Tue Mar 17 11:30:25 2009

On Tue, Mar 17, 2009 at 11:05 AM, praba karan <prabampm@xxxxxxxxx> wrote:

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

Yes, but I don't know how PHP works.  Should be easy to check up online.

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

Floating point operations are inexact.

Regards,
Roshan

Other related posts: