[Python-Dev] Mixing float and Decimal -- thread reboot (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Sat Mar 20 16:11:12 CET 2010
- Previous message: [Python-Dev] Mixing float and Decimal -- thread reboot
- Next message: [Python-Dev] Mixing float and Decimal -- thread reboot
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Mark Dickinson <dickinsm gmail.com> writes:
On Fri, Mar 19, 2010 at 9:50 PM, Guido van Rossum <guido 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.
- Previous message: [Python-Dev] Mixing float and Decimal -- thread reboot
- Next message: [Python-Dev] Mixing float and Decimal -- thread reboot
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]