[FRPythoneers] Numerical Accuracy

Keith Hellman kehellman at yahoo.com
Sat May 18 13:25:17 MDT 2002


Hello all:

I just typed the following and was surprised at the result.  Can someone
point me to documentation concerning why this is?  Particularly, I'm
curious why the identical parsing and computation yields an accurate 38.3
in both /usr/bin/bc and a simple C program.

Do I need additional syntax to reduce error for floating calculations?

TIA

=====================================================================
khellman at linux:~> python                     
Python 2.2.1c2 (#1, Apr  8 2002, 13:32:43) 
[GCC 2.95.3 20010315 (SuSE)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 29.8+2.5+4*1.5
38.299999999999997
>>> 29.8+2.5+(4*1.5)
38.299999999999997
>>>
=====================================================================

=====
Keith E. Hellman
kehellman at yahoo.com

__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com



More information about the FRPythoneers mailing list