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/2010-March/098608.html below:

[Python-Dev] Mixing float and Decimal -- thread reboot

[Python-Dev] Mixing float and Decimal -- thread reboot [Python-Dev] Mixing float and Decimal -- thread rebootAntoine Pitrou solipsis at pitrou.net
Sat Mar 20 16:11:12 CET 2010
Mark Dickinson <dickinsm <at> gmail.com> writes:
> 
> On Fri, Mar 19, 2010 at 9:50 PM, Guido van Rossum <guido <at> python.org>
wrote:
> > There is one choice which I'm not sure about. Should a mixed
> > float/Decimal operation return a float or a Decimal?
> 
> I'll just say that it's much easier to return a Decimal if you want to
> be able to make guarantees about rounding behaviour, basically because
> floats can be converted losslessly to Decimals.  I also like the fact
> that the decimal module offers more control (rounding mode, precision,
> flags, wider exponent range) than float.

A problem, though, is that decimals are much slower than floats. If you have a
decimal creeping in some part of a calculation it could degrade performance
quite a bit.

Regards

Antoine.


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