
On 2004-10-15 at 00:55PDT Krasimir Angelov wrote:
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.
Is there anything about Decimal that makes it hard to implement in standard Haskell based on Integer? For time periods, an Integer number of picoseconds should continue to be accurate enough for quite a time, since a picosecond is about the shortest length of time we can accurately measure at the moment, though it may be wise to leave a factor of ten or so to spare. If we want to be completely future-proof, an Integral multiple of some value less than the Planck time, which is > 1e-44s, so 2**(-146)s should be short enough, though I suspect that this would be more than a little overkill! Jón -- Jón Fairbairn Jon.Fairbairn@cl.cam.ac.uk