Comment on PEP-0238

Edward Jason Riedy ejr at cs.berkeley.edu
Thu Jul 12 13:07:50 EDT 2001


And Greg Ewing writes:
 - 
 - It seems to me that, if you want adjustable precision at
 - all, you want to adjust it in a very fine-grained way
 - based on the kind of data you're using and what you're
 - doing with it.

For _fixed-point_ arithmetic, this is often true.  Your 
monetary example is best served by an extremely flexible 
arithmetic, as the laws governing the calculations are 
complex.  The Euro docs are a good, recent example.

 - So the notion of precision being part of some sort of
 - context that you establish and then go off and do your
 - calculations seems fundamentally wrong-headed.

For many geometric and scientific codes using floating-point,
this is exactly what you want.  You bump the precision up
once, or you multiply it after trying to get a good-enough 
answer.  The precision changes are always establishing a 
working precision related to some desired output precision.
You change the precision rarely.

If you know of floating-point codes that mix desired 
precisions frequently and intentionally, I'd really like to 
hear of them.

 - I don't know what the best solution to this is. I feel
 - it lies somewhere in the direction of using specialised
 - data types which know their own precision and also
 - what precisions are needed for various combinations
 - of them.

I don't have a copy of Martin Fowler's Analysis Patterns
handy, but I believe he addresses some of these issues.  
There are a few articles that might relate:
	http://martinfowler.com/articles.html

Jason
-- 



More information about the Python-list mailing list