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-Thread: a07f3367d7,6fabd104d18f3943 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!newsfeed.straub-nv.de!news.albasani.net!not-for-mail From: Dirk Herrmann Newsgroups: comp.lang.ada Subject: Re: conversions between fixed-point types Date: Sat, 26 Sep 2009 16:43:22 +0200 Organization: albasani.net Message-ID: References: <4abc8389$1_1@glkas0286.greenlnk.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net oOAo7SIIHv+Mu1ftHboXmQ1ofpBgu8EgM9VoEfEpiOZyATRRRrPOo0jpGa+GxzBc6rEsDL0m7FVuRFw1tPpuaxUcz/xmu72pNzTU2UO8/Eft+FklL9br0ShnYm8l7Bhc X-Complaints-To: abuse@albasani.net NNTP-Posting-Date: Sat, 26 Sep 2009 14:43:23 +0000 (UTC) X-User-ID: sLREkwE919hbiccgDl5QSw0frNXsN6YlEXkVqB2du8ECK52yodLyT04nZPvQWwbA0xtB4v7ibEZaF5ODU2yJ4A== In-Reply-To: <4abc8389$1_1@glkas0286.greenlnk.net> Cancel-Lock: sha1:B/U0sIK+ydtux4b6GcAitI6uac4= User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090706) X-NNTP-Posting-Host: 6miEB80Ule8r+E0B9NK64Q40u1iZ0h5tWhO+8EY61wE= Xref: g2news2.google.com comp.lang.ada:8484 Date: 2009-09-26T16:43:22+02:00 List-Id: Stuart wrote: > Having played with this on GNATPro 6.1.2 (to PC target) it does report > FpB'Machine_Rounds as false. It also rounds values like -1.59999 down to > -1.2 (which is a logical consequence). Technically this is still within the > error bounds declared for FpB (delta 0.4) so it is not "wrong" within the > rules of the language definition. But it is very counter-intuitive and is > the sort of thing I find frustrating. > > I also tested the problem on GreenHills AdaMULTI (4.2.3 to PowerPC target); > this gave FpB'Machine_Rounds as true and gave the more intuitive results. > > -1.5 -> -1.6 > -1.40001 -> -1.6 > -1.4 -> -1.2 > > So although there does look to be a language "gotcha" here, it depends upon > the compiler's choice of 'Machine_Rounds. Whom could I contact to figure out whether this is an omission in the language definition (which could then be fixed) or whether it is intentional? I would also like to ask about another issue: Dirk Herrmann wrote: > Robert A Duff wrote: >> By the way, you can say: >> >> for T'Small use T'Delta; >> >> to avoid repeating yourself. > > I have tried that, especially since the very same recommendation was > given in the Barnes book "Ada 2005". But, GNAT gives an error message. > It seems that the very moment you reference T'Delta the type T gets > "frozen" such that the "use" statement itself freezes T before it can > modify it. I don't know if this is what the authors of the reference > manual had intended, but GNAT interprets it that way. -- Dirk