Decimals in python

Ethan Furman ethan at stoneleaf.us
Tue Jun 17 20:33:33 EDT 2008


arslanburney at gmail.com wrote:
> Hello. New to using Python. Python automatically round off watver i
> calculate using the floor function. How wud i make the exact value
> appear?
> 
> Tried out fabs() in the math library but still confused. Cud some1
> elaborate on it.

[python]
---help(math.floor):
Help on built-in function floor in module math:

floor(...)
     floor(x)

     Return the floor of x as a float.
     This is the largest integral value <= x.
[/python]

The whole point of floor() is to round down.  If you want to see all the 
decimals, don't use floor(), and follow Aidan's advice to have at least 
one floating-point number in the calculation.
--
Ethan



More information about the Python-list mailing list