[Banking-pm] What CPAN modules do you use?

Mark Blackman mark at blackmans.org
Thu Aug 23 01:58:21 PDT 2007


On 23 Aug 2007, at 07:19, mike at wormers.net wrote:

> Why use classes like BigFloat etc? Does it suggests a level
> of accuracy beyond the model? i.e. 'double' should be sufficient? The
> extra 'precision' probably isn't getting you a more accurate figure  
> (does
> depend on what exactly you are computing though I suppose).

Well, in the current 'double' model if you need to know if two
sums agree (i.e. different calculations that should produce identical  
results)
results, you can't guarantee that unless you make a point of rounding
at key stages. Math::BigFloat (and bignum) free you from the requirement
to worry about rounding in your application, with some performance  
penalty.

In any case, what I'm asking is, does anyone here on this list
need to care about this of agreement of two computations and what
do they tend to do about it? It's come up for me and the only two  
strategies
I identified were

* pay attention to your computations and round (via sprintf) at  
obvious points
* delegate the whole problem to Math::BigFloat (or similar)

the 'Accuracy' section of http://en.wikipedia.org/wiki/Floating_point
makes the point as well and the general problem that floating point
arithmetic in the IEEE754 standard is neither associative or  
distributive,
but you might very well assume that is.

- Mark





More information about the Banking-pm mailing list