a very weird result

From: ai lian (ai2003lian_at_yahoo.com)
Date: 07/29/04


Date: 29 Jul 2004 11:29:37 -0700

The code is as the following:

{
        double limit= 0.02*33.00;
        double limit1= 0.06*11.00;
        double limit2= 0.03*22.00;
        double limit3= 0.01*66.00;

        limit=(floor(limit*100))/100;
        limit1=(floor(limit1*100))/100;
        limit2=(floor(limit2*100))/100;
        limit3=(floor(limit3*100))/100;

        printf("limit= %.2f\n",limit);
        printf("limit1 = %.2f\n",limit1);
        printf("limit2 = %.2f\n",limit2);
        printf("limit3 = %.2f\n",limit3);
}

What's weird is the output:

limit= 0.66
limit1 = 0.65
limit2 = 0.65
limit3 = 0.66

Why are the result for limit1 and limit2 is 0.65 instead of 0.66?

Thanks in advance.