WTF ?

Peter Hickman peter.hickman at semantico.com
Mon Jan 15 17:14:59 GMT 2007


David Cantrell wrote:
> You (for p5p values of you) could hypothetically add a flag to the
> gigantic structure that represents numbers in perl to note if a number
> is precise and propagate it to numbers calculated from those numbers.
> Of course, as soon as a calculation involves an imprecise number, the
> result is imprecise.
>
>   

Given that the calculation between two precise numbers can result in an 
imprecise number there would be little to be gained in propagating such 
a flag especially if the hardware was flagging the (im)preciseness of 
the calculation. Of course if you were working out the (im)preciseness 
in software then you could sometimes short circuit such a check. But not 
always. Sometimes a precise number and an imprecise number will result 
in a precise answer. I give you:

X * 0

For the sake of argument X is imprecise and 0 is precise. Just how many 
such cases exist for the various operations I do not know. But doing 
this in software is not going to be cheap. Quite what you would gain in 
knowing that a number was imprecise I do not know, but them I'm a web 
developer :) not an accountant.

-- 
Peter Hickman.

Semantico, Lees House, 21-23 Dyke Road, Brighton BN1 3FE
t: 01273 722222
f: 01273 723232
e: peter.hickman at semantico.com
w: www.semantico.com



More information about the london.pm mailing list