From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,37e5589e32d8f03f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!proxad.net!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Floating-Point Numbers and Internal Representation Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1843142.NoXPLYbHQs@linux1.krischik.com> <4fnetd7d1gzw$.6esjklahq38$.dlg@40tude.net> Date: Sun, 4 Dec 2005 19:14:23 +0100 Message-ID: NNTP-Posting-Date: 04 Dec 2005 19:14:21 MET NNTP-Posting-Host: 0038ae82.newsread2.arcor-online.net X-Trace: DXC=;T020124OLEUhhl_USDNiOQ5U85hF6f;DjW\KbG]kaMHA@_25la3nbBUDH0aM^2R8K[6LHn;2LCVN[ 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