At 03:11 PM 7/14/2001 +0200, Bart Lateur wrote:
>On Thu, 12 Jul 2001 18:09:07 -0400, Dan Sugalski wrote:
>
> >Precision is a useful thing with bigfloats so something like 1/3 doesn't
> >chew up all your available memory.
>
>1/3 would better be represented as a ratio, 1 over 3.
>
>We've been here before, haven't we?

Yup. Yay, lazy math! (With full algebraic transformation, if we want to 
keep things as accurate as we can... :)

>Ratio's,  or whatever you'd want to call them, with both nominator and
>denominator integers, would be a very useful internal representation for
>many numerical applications. $1.23 can be represented as 123 over 100,
>or EXACTLY 123 cents. You can't have that with floats.

Nope, but you don't need ratios either. Base 10 numbers are enough.

>Multiplication
>and division can happen without loss of precision. A Greatest Common
>Divisor algorithm like Euclid's, can prevent nominators and denominators
>from getting out of control.

Yep. I'll point out (I'm sure you know, but others might not) that the 
"can"s in those statements aren't "won't"s. Things will still get dodgy and 
imprecise no matter what scheme or collection of schemes we go with. At 
some point you will have a transform into a representation that can't 
accurately handle the original number.


                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to