On Sunday, 5. October 2008 04:23:42 Darren Duncan wrote:
> Note that just as integers are naturally radix independent, the unlimited
> rationals should be too, and the latter can compactly represent all
> rationals as a triple of integers corresponding roughly to a (normalized)
> [mantissa, radix, exponent] triple; with that approach you also get 
> unlimited floats for free, so no reason to make floats an exception where
> they aren't unlimited where integers and other rationals are; after all,
> what is a float or scientific notation than just another notation for a
> rational value literal.
>
At 18:06 +0200 10/5/08, TSa (Thomas Sandlaß) wrote:
>I want to stress this last point. We have the three types Int, Rat and Num.
>What exactly is the purpose of Num? The IEEE formats will be handled
>by num64 and the like. Is it just there for holding properties? Or does
>it do some more advanced numeric stuff?
>
>Another matter is how to represent irrationals. With IEEE floats which are
>basically non-uniformly spaced integers imprecession is involved anyway.
>But sqrt(2) is a ratio of two infinite integers. How is that handled? Here
>I see a way for Num to shine as a type that also involves lazy approximations.
>But then we need a way for the programmer to specify how these approximations
>shall be handled. 

I'm not so sure that sophisticated numbering is necessary for a practical 
extraction and report language. But. . .

Symbolic algebra packages handle irrationals like sqrt(2) with a "root of" 
function which can be included in a result before it is deliberately converted 
to an approximation in a later step. Perl should NOT do things like that.

As for unlimited precision in floats I'd rather see a floating point number 
triple that includes, in its structure, an estimate of error, and physical 
units.

Multiplying amperes by volts would then return watts with an appropriately 
calculated estimate of the error. Testing for zero would include the error 
estimate.

When I work with data from the power company expressed in MMBTU I can add to a 
working table of units that MMBTU translates to 10^6 BTU because the M means 
1000 as in millia pasuum. I could also provide a conversion from BTU to joules 
and have it properly handled.

Many arithmetic errors are the result of not keeping the units inside of the 
evaluation. The result is newspaper articles that confuse energy and power as 
they extract from data provided by power company engineers. "1 kW per day" is 
meaningless. I wonder if they use perl to extract the data.

And what are those two infinite integers? I wonder if there is a series that 
expresses each one?

-- 

--> A fair tax is one that you pay but I don't <--

Reply via email to