[Python-Dev] calculator module (original) (raw)
Gareth McCaughan gmccaughan at synaptics-uk.com
Wed Mar 10 10:26:17 EST 2004
- Previous message: [Python-Dev] calculator module
- Next message: [Python-Dev] calculator module
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wednesday 2004-03-10 at 15:03, Guido van Rossum wrote:
Maybe this project should use decimal arithmetic throughout? After all, student calculators use decimal, and explaining binary is a source of unneeded confusion during student's early steps. It would also be a good way to get the Decimal numbers project integrated into core Python.
Decimal doesn't currently support the functions (cos, exp, log, ...) currently in the "math" module. Making Raymond's proposal work with Decimal objects would require implementing all those things for Decimals. That's appreciably more work than implementing just the new functions for doubles.
Further, I'd argue that since Decimal can work with numbers of arbitrary precision, an implementation of (say) exp that works on Decimals ought to work with something like full precision, unless it's only intended for casual use. Writing implementations of all these things would be a considerable amount of work.
Doing everything with Decimals would also reduce the utility[1] of these functions for people who want to do something other than interactive calculations with them, at least for as long as such people continue to be mostly using ordinary Python floats. I'd guess that that's approximately for ever.
[1] Perhaps only the perceived utility, since there are
conversions to and from the Decimal type.
To my mind, the loss isn't worth the gain.
-- g
- Previous message: [Python-Dev] calculator module
- Next message: [Python-Dev] calculator module
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]