[Tutor] floating point accuracy
Stephen Ng
steveng at pop.jaring.my
Thu Aug 7 03:52:12 EDT 2003
Hi!
Thanks for the info.
I guess I'll have to be careful when using floating point operations.
Stephen Ng
On Thu, 2003-08-07 at 00:13, Alan Trautman wrote:
> That is normal for all base 8 cpu's (almost all made). The only method to be
> highly precise is to do longhand division (ie.. subtract many times) using
> integers or to purchase a large scale vector-based cpu machine $$$$. You
> just happened to pick a really simple to reproduce example.
>
> It has nothing to do with the language used, although some languages hide
> this fact from you, it is just a hardware based limitation.
>
> HTH,
> Alan
>
> -----Original Message-----
> From: Stephen Ng [mailto:steveng at pop.jaring.my]
> Sent: Wednesday, August 06, 2003 12:55 AM
> To: tutor at python.org
> Subject: [Tutor] floating point accuracy
>
>
> Hi!
>
> I am a total newcomer to python so still trying to find out what its all
> about.
>
> I tried the following 2/5.0 and received 0.40000000000000002.
>
> The 2 at the end makes me wonder whether this is normal and how accurate
> floating point arithmetic is.
>
> Stephen Ng
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list