On 02/12/2013 12:27, Dave Angel wrote:
On Mon, 2 Dec 2013 16:28:38 +1000, Amit Saha <amitsaha...@gmail.com> wrote:
Indeed, that's a good point. Surprisingly, C does it just fine:


# include <stdio.h>


int main(int argc, char **argv)
{
  float x = 0.0;
  while(x<1)
    {
      x += 0.1;
      printf("%f\n", x);
    }


  return 0;
}


gives the following output:


0.100000
0.200000
0.300000
0.400000
0.500000
0.600000
0.700000
0.800000
0.900000
1.000000

Fine???? The output is pretty,  but thoroughly wrong. There's an extra
value at the end.


Exactly what I thought at first glance but I double checked, please take another look :)

--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to