comp.lang.ada
 help / color / mirror / Atom feed
From: Qun-Ying <zhu.qunying@gmail.com>
Subject: Re: Fixed-point question
Date: Fri, 26 Jun 2015 16:14:09 -0700
Date: 2015-06-26T16:14:09-07:00	[thread overview]
Message-ID: <mmkma5$gib$1@speranza.aioe.org> (raw)
In-Reply-To: 6a104bde-67ea-48a5-a035-6be3f9235d42@googlegroups.com

In my test with Linux x86_64 with FSF GNAT 4.9.2

C1 :=  14.664
C2 :=  17.000
Small :=  3.90625000000000000E-03
1/180 :=  5.55555555555555556E-03

With Jeffrey's changes I got:
C1 :=  14.667
C2 :=  18.000
Small :=  5.55555555555555556E-03
1/180 :=  5.55555555555555556E-03


Patrick Noffke wrote:
> On Friday, June 26, 2015 at 11:56:44 AM UTC-5, Jeffrey R. Carter wrote:
>> On 06/26/2015 06:20 AM, Patrick Noffke wrote:
>>>
>>>     type Fixed_Type is delta 1.0 / 180.0 range 0.0 .. 65535.0 / 180.0;
>>
>> What is Fixed_Type'Small?
>
> It is 1/180.
>
>>
>>>     C1 : constant Fixed_Type := Fixed_Type (N / D);
>>
>> What is C1'Size?
>>
>> If you really want to use multiples of 1/180, you probably want to do
>>
>> Delta_And_Small : constant := 1.0 / 180.0;
>>
>> type Fixed_Type is delta Delta_And_Small range 0.0 .. 65535.0 * Delta_And_Small;
>> for Fixed_Type'Small use Delta_And_Small;
>>
>
> I do that in my application.  I just did the above for a simple test case.  Doing as you suggest does not change the result on either platform.
>
> Pat
>



  parent reply	other threads:[~2015-06-26 23:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-26 13:20 Fixed-point question Patrick Noffke
2015-06-26 16:56 ` Jeffrey R. Carter
2015-06-26 18:21   ` Patrick Noffke
2015-06-26 20:21     ` Anh Vo
2015-06-26 20:25     ` Jeffrey R. Carter
2015-06-27  2:55       ` Patrick Noffke
2015-06-26 23:14     ` Qun-Ying [this message]
2015-06-27  3:00       ` Patrick Noffke
2015-06-27  4:44         ` Jeffrey R. Carter
2015-06-27 17:59           ` Patrick Noffke
2015-06-27 18:38             ` Jeffrey R. Carter
2015-06-27 19:20               ` Bob Duff
2015-06-27 19:57                 ` Jeffrey R. Carter
2015-06-27 20:42                   ` Bob Duff
2015-06-28 11:39                     ` Brian Drummond
2015-06-29 13:28                     ` Patrick Noffke
2015-06-29 14:13                       ` Bob Duff
2015-06-27 23:41               ` Anh Vo
  -- strict thread matches above, loose matches on Subject: below --
1995-04-01  0:00 Garlington KE
1995-04-06  0:00 ` Robert Dewar
1995-04-07  0:00   ` Robert I. Eachus
1995-04-07  0:00     ` Robert Dewar
1995-04-07  0:00   ` Garlington KE
1995-04-07  0:00     ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox