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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6a77269912f77a70 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-27 11:01:28 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-post-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Why no 'Floor for fixed point types Date: Mon, 27 Oct 2003 12:59:40 -0600 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <3F99FBE1.1030601@comcast.net> <3F9AFB67.5080401@comcast.net> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 X-Complaints-To: abuse@supernews.com Xref: archiver1.google.com comp.lang.ada:1744 Date: 2003-10-27T12:59:40-06:00 List-Id: "Robert I. Eachus" wrote in message news:3F9AFB67.5080401@comcast.net... > But you didn't pay attention above. The compiler allows you to think > about fixed-point types as if they are real (non-integer) values. But > they are not implemented that way. Any compiler that uses > floating-point arithmetic to do fixed-point computations has a lot of > bugs in it. They just havent been found yet. (And I think it was ACVC > 1.4 that added a lot of tests which found such bugs.) As usual with blanket statements, this is wrong. Janus/Ada in fact does use floating-point arithmetic to implement fixed point in some cases (especially the mixed multiply). We did the error analysis on these operations, and they are fine - they'll get the right answer in all cases that Ada 95 requires that. (There are some cases where no technique will get the "right" answer as defined in Ada 83, and those of course we might get wrong for some bit patterns. Many Ada 83 compilers simply avoided the issue by restricting 'Small to powers of two, which of course is trivial to get right. And rather restrictive.) Since, in a generic, you don't know the 'Smalls involved, and you don't know the magatude of the values, there isn't much else to do except use the highest precision math that you have available. As with everything, it depends on how you use it. Randy. Randy.