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: 103376,65b3f028266fd999 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Question about ordinary fixed point types. References: <4c685fac$0$2373$4d3efbfe@news.sover.net> <82aaomvn02.fsf@stephe-leake.org> <4c692129$0$2385$4d3efbfe@news.sover.net> Date: Mon, 16 Aug 2010 22:03:08 -0400 Message-ID: <82iq3at2qr.fsf@stephe-leake.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (windows-nt) Cancel-Lock: sha1:zBUBNTskG7u1nQB/G9prOw9xLy0= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 6f8554c69edcce029e66104499 Xref: g2news1.google.com comp.lang.ada:13440 Date: 2010-08-16T22:03:08-04:00 List-Id: "Peter C. Chapin" writes: > On 2010-08-16 07:02, Stephen Leake wrote: > >>> type Angle_Type is delta 0.0005 range -3.1416 .. 3.1416; >>> Angle : Angle_Type; >> >> Why do you not specify: >> >> for Angle_Type'small use 0.0005; > > I don't think I'm too concerned about the actual value of Small used. In > fact, I'd like to let the compiler choose so that it can optimize the > code better. Isn't it the case that using a power of two allows for more > efficient code generation for certain mathematical operations? Marginally. The representation is an integer with a scale = 1 / angle_type'small. The scale is only used when converting to other numeric types. > I'm not sure, but I seem to recall reading that somewhere. If that is > true, then I want that. My machine isn't very fast. Get it logical first, then optimize. > My original question wasn't about how to force the type to use a Small > that I want, rather it was about how can I be sure to visit every value > of the type in a loop for test purposes. Then you need to make the loop step by 'Small. -- -- Stephe