Jonathan Cast [EMAIL PROTECTED] writes:
On Friday 13 July 2007, Jon Fairbairn wrote:
Henning Thielemann [EMAIL PROTECTED] writes:
On Thu, 12 Jul 2007, Jon Fairbairn wrote:
Surely the first few digits can be computed?
That was my first thought, too.
We can't define
data Real =
Henning Thielemann [EMAIL PROTECTED] writes:
On Thu, 12 Jul 2007, Jon Fairbairn wrote:
(ie limited precision, but unbounded magnitude). If we were
to use BigFloat the base would need to be a power of ten to
get the desired results for things like Don's example)
People will be confused,
On Friday 13 July 2007, Jon Fairbairn wrote:
Henning Thielemann [EMAIL PROTECTED] writes:
On Thu, 12 Jul 2007, Jon Fairbairn wrote:
(ie limited precision, but unbounded magnitude). If we were
to use BigFloat the base would need to be a power of ten to
get the desired results for things
Donald Bruce Stewart wrote:
should Rational, or something similar be used instead,
given that Doubles and Float are broken for a lot of
basic things (like Eq and Ord), much as we default
to Integer already.
The issues raised regarding Rational was that you can unexpectedly
build up large
On Thu, 12 Jul 2007, Jon Fairbairn wrote:
Now, a proper exact real type is doubtless very inefficient,
but wouldn't it be possible to define something that had a
fairly efficient head, and a lazy tail? So you'd have, say
data Real = R {big::(Ratio !Int !Int), small:: More_Precision}
for
Henning Thielemann [EMAIL PROTECTED] writes:
On Thu, 12 Jul 2007, Jon Fairbairn wrote:
Now, a proper exact real type is doubtless very inefficient,
but wouldn't it be possible to define something that had a
fairly efficient head, and a lazy tail? So you'd have, say
data Real = R
Bryan O'Sullivan wrote:
apfelmus wrote:
In a sense, the instances of Eq and Ord for floating point numbers are
wrong. What about rolling new classes for approximate equality and
ordering?
class ApproxEq a where
(≈) :: a - a - Bool -- almost equal to
The problems with this
On Thu, 12 Jul 2007, Jon Fairbairn wrote:
Henning Thielemann [EMAIL PROTECTED] writes:
On Thu, 12 Jul 2007, Jon Fairbairn wrote:
Now, a proper exact real type is doubtless very inefficient,
but wouldn't it be possible to define something that had a
fairly efficient head, and a
On 13 Jul 2007, at 2:58 am, apfelmus wrote:
What I wanted to do is to capture common patterns
x - y = epsilon
abs (x - y) = epsilon
for comparing floating point numbers in nice functions
x y = x - y = epsilon
x ≈ y = abs (x - y) = epsilon
See Knuth, The Art of Computer