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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Everything You Know Is Wrong Date: Wed, 2 Mar 2016 15:32:51 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <87twkrpvcf.fsf@adaheads.sparre-andersen.dk> <9974be39-f94d-4293-819e-bd1c9a1ddd65@googlegroups.com> NNTP-Posting-Host: bqgfK7NL3xTHnr0WRaLl4g.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:29646 Date: 2016-03-02T15:32:51+01:00 List-Id: On 02/03/2016 15:11, vincent.diemunsch@gmail.com wrote: > Le lundi 29 février 2016 13:14:09 UTC+1, Jacob Sparre Andersen a écrit : > >> Some of the rules which (apparently) aren't wrong yet: >> >> http://www.cse.msu.edu/~cse320/Documents/FloatingPoint.pdf >> >> Greetings, >> >> Jacob > > Very interesting ! > Here is the point about Ada : > > Remarkably enough, some languages don't clearly specify that if x is a > floating-point variable (with say a value of 3.0/10.0), then every occurrence > of (say) 10.0*x must have the same value. For example Ada, which is based > on Brown's model, seems to imply that floating-point arithmetic only has to > satisfy Brown's axioms, and thus expressions can have one of many possible > values. Thinking about floating-point in this fuzzy way stands in sharp > contrast to the IEEE model, where the result of each floating-point operation is > precisely defined. In the IEEE model, we can prove that (3.0/10.0)*10.0 > evaluates to 3 (Theorem 7). In Brown's model, we cannot. > > Maybe this could be a topic for a new revision of Ada ? No. IEEE model is wrong and Ada 83 model is right being closer to the interval computations. BTW, it is advisable to always turn the IEEE semantics off. E.g. not to use Float but subtype Proper_Float is Float range Float'Range; instead. This saves a lot of debugging later. From the computational, rounding error control, engineering, etc POVs there is no reason to suggest that (x/y)*y=x should hold for floating-point numbers. They are not reals and cannot be reals. The model must sacrifice some less important properties like (x/y)*y=x (which is wrong for any measured values anyway) for more important ones like rounding errors control, performance, optimization. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de