From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: Question about ordinary fixed point types.
Date: Mon, 16 Aug 2010 22:03:08 -0400
Date: 2010-08-16T22:03:08-04:00 [thread overview]
Message-ID: <82iq3at2qr.fsf@stephe-leake.org> (raw)
In-Reply-To: 4c692129$0$2385$4d3efbfe@news.sover.net
"Peter C. Chapin" <chapinp@acm.org> 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
next prev parent reply other threads:[~2010-08-17 2:03 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-15 21:43 Question about ordinary fixed point types Peter C. Chapin
2010-08-15 21:55 ` Shark8
2010-08-16 0:46 ` Peter C. Chapin
2010-08-16 4:13 ` Jeffrey Carter
2010-08-16 8:57 ` Simon Wright
2010-08-15 22:08 ` Yannick Duchêne (Hibou57)
2010-08-16 1:03 ` Peter C. Chapin
2010-08-16 4:11 ` Jeffrey Carter
2010-08-16 10:03 ` Ludovic Brenta
2010-08-17 14:35 ` sjw
2010-08-17 15:51 ` Ludovic Brenta
2010-08-16 11:31 ` Peter C. Chapin
2010-08-16 9:23 ` Simon Wright
2010-08-16 15:47 ` Simon Wright
2010-08-17 14:37 ` sjw
2010-08-16 11:02 ` Stephen Leake
2010-08-16 11:29 ` Peter C. Chapin
2010-08-16 12:53 ` Dmitry A. Kazakov
2010-08-16 20:28 ` Peter C. Chapin
2010-08-16 20:58 ` Adam Beneschan
2010-08-16 13:01 ` Dmitry A. Kazakov
2010-08-16 14:28 ` Robert A Duff
2010-08-16 20:31 ` Peter C. Chapin
2010-08-16 23:01 ` Robert A Duff
2010-08-16 23:17 ` Peter C. Chapin
2010-08-17 0:56 ` Robert A Duff
2010-08-17 2:03 ` Stephen Leake [this message]
2010-08-20 1:21 ` Yannick Duchêne (Hibou57)
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox