[Python-Dev] Mixing float and Decimal -- thread reboot (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Sun Mar 21 00:20:56 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 ]
Adam Olsen wrote:
For a little context, we have this numeric tower:
int -> Fraction -> float -> complex Decimal is more precise, and pays a performance cost for it. It also seems odd to stick it between float and complex (nobody's planning a ComplexDecimal, right?) That suggests it should go between Fraction and float. Decimal/float -> float.
There are two ways in which that linear tower is overly simplistic:
It conflates the notions of exactness and width. They're really orthogonal concepts, and to reflect this you would need two parallel towers, with exact and inexact versions of each type.
Decimal and float really belong side-by-side in the tower, rather than one above the other. Neither of them is inherently any more precise or exact than the other.
There doesn't seem to be any good solution here. For every use case in which Decimal+float->float appears better, there seems to be another one for which Decimal+float->Decimal appears better.
-- Greg
- 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 ]