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

mike at wormers.net mike at wormers.net
Thu Aug 23 03:01:55 PDT 2007


Just curious about your useage thats all...

re: evaluating if two numbers are the same.

if two real numbers are equal you won't find a piece of model code that says
double x;
double y;
....
if ( x == y )

there will be (at the model level) some 'IsEqual' method that will default
a precision. My point being that inside a model say its pointless to use
greater than double b/c it implies a level of accurracy that simply
doesn't exist.

re: adding up swap notionals or some other total - then I'm suprised you'd
need it..

>
> 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