[Tutor] decimal floating point?

Yi Qiang yi at yiqiang.net
Tue May 2 16:46:19 CEST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

michel maho wrote, On 05/02/2006 07:33 AM:
> To all
>     I have the following calculation:
> 
>     "Je Body Mass Index is",gewicht/lengte**2
> 
>     The result is a (digital?)floating point figure with with 10 decimal numbers. For =
>     example 27.2345678487
>     Did I mis something? I would like to reduce it to one or two decimal =
>     numbers.(27.2) but round(_,1) does not work.
What exactly doesn't work?

>>> n = 27.2345678487
>>> round(n)
27.0
>>> round(n, 2)
27.23

Yi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEV3C7tXlIMrUVVksRAgBGAJ963EK8jkngIr53NNuT1e1NvoU97gCffslK
W/+Q4+/A2hoq3VXC0pR3J+Y=
=3RAJ
-----END PGP SIGNATURE-----


More information about the Tutor mailing list