The usage of ratio is also too slow. The disadvantage of Double and Float is that often the result of computation isn't correct. For example if we have a lot of small values then its sum will not be precise. This is very important in financial applications. For such reason in SQL is defined decimal data type. In MS COM there are DECIMAL and in .NET there are decimal types. I would like to see Decimal type in Haskell too. In the Mono project there is a free and portable implementation of decimals which we can adopt in Haskell. The Ratio type is simply too expensive in many cases. Of course to adopt Decimal properly in Haskell we need to have support in the compiler too. Cheers, Krasimir --- Tomasz Zielonka <t.zielonka@students.mimuw.edu.pl> wrote:
On Fri, Oct 15, 2004 at 01:15:16AM -0400, David Menendez wrote:
Tomasz Zielonka writes:
Hmmm, that's right. Perhaps it would be best to use some fixed-point type with unbounded integral part, like those used for representing currency, but not necessarily decimal.
I'd go with ratios. Haskell has a built-in type, and they can give you as many digits of precision as you need--unless you're dealing with an irrational timeout value.
Unfortunately, they have the unpleasant tendency that after many operations even if the absolute value is small, the two integers that constitute the ratio can be very big. That's why (I think) it's not that good idea to solve linear equation systems using unbounded ratios.
Why not use typeclasses and let the user decide?
Best regards, Tom
-- .signature: Too many levels of symbolic links _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
_______________________________ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com