A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-August/067939.html below:

[Python-Dev] Rounding float to int directly ...

[Python-Dev] Rounding float to int directly ...Nick Maclaren nmm1 at cus.cam.ac.uk
Thu Aug 3 21:43:07 CEST 2006
Ka-Ping Yee <python-dev at zesty.ca> wrote:
>
> That's my experience as well.  In my opinion, the purpose of round()
> is most commonly described as "to make an integer".  So it should
> yield an integer.

Grrk.  No, that logic is flawed.

There are algorithms where the operation of rounding (or truncation)
is needed, but where the value may be larger than can be held in an
integer, and that is not an error.  If the only rounding or truncation
primitive converts to an integer, those algorithms are unimplementable.
You need at least one primitive that converts a float to an integer,
held as a float.

Which is independent of whether THIS particular facility should yield
an integer or float!


Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email:  nmm1 at cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4