comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Floating-Point Numbers and Internal Representation
Date: Sun, 4 Dec 2005 19:14:23 +0100
Date: 2005-12-04T19:14:21+01:00	[thread overview]
Message-ID: <bkwh9yuc82z0$.4neofrvaqnrb.dlg@40tude.net> (raw)
In-Reply-To: slrndp626d.kk1.mccratch@thrakhath.kilrathi.lcn

On Sun, 4 Dec 2005 16:15:31 +0100, Matthias Kretschmer wrote:

> as I hope I said in my original posting, I am very well aware of this,
> but I had this special case where I wanted to use explicitly equality.
> There are times, when one is sure, that even with rounding errors, the
> two compared floating point numbers are really equal or not if one is
> using some good enough precision. So from some defined point on all
> following digits can be considered garbage, as it was in my case.

This is exactly definition of an interval: [xx.xxx0(0), xx.xxxx9(9)]

> The
> best solution would be that I had used Q (or a fixed subset of it)
> instead an approximation of R for my calculations, but I was too lazy :)

No, this contradicts to your statement about "following digits" being
garbage. In the case of Q they are not.

> Maybe I should take the time and port it to such a solution or implement
> something like that myself. At least in many circumstances using exact
> numbers instead of unexact ones causes much less trouble :)

Ah but this is a completely different story. If you *really* know that
multiplication and division are exact then Ada's fixed point types is just
what you need. Fixed point numbers are perfectly comparable.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2005-12-04 18:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-04 10:33 Floating-Point Numbers and Internal Representation Matthias Kretschmer
2005-12-04 11:12 ` Martin Krischik
2005-12-04 14:11   ` Martin Dowie
2005-12-04 14:50     ` Dmitry A. Kazakov
2005-12-04 15:15       ` Matthias Kretschmer
2005-12-04 18:14         ` Dmitry A. Kazakov [this message]
2005-12-04 21:16           ` Matthias Kretschmer
2005-12-06  2:54     ` Steve
2005-12-05 23:38   ` Randy Brukardt
2005-12-04 11:46 ` Dmitry A. Kazakov
2005-12-04 21:29 ` Gautier Write-only
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox