From: Adrian Hoe <mailbox@nospam.adrianhoe.com.my>
Subject: Re: float with 24-bit resolution
Date: Fri, 15 Aug 2003 20:54:29 +0800
Date: 2003-08-15T20:54:29+08:00 [thread overview]
Message-ID: <3f3cd84f$1_2@news.tm.net.my> (raw)
In-Reply-To: <3f3cd7f4$1_2@news.tm.net.my>
Adrian Hoe wrote:
> Jeffrey Creem wrote:
>
>> <mailbox@adrianhoe.nospam.com.my> wrote in message
>> news:3F3CCB0F.543478AF@adrianhoe.nospam.com.my...
>>
>>> Hi,
>>>
>>> I looked through the LRM and searched CLA but I could not find any
>>> solution. Perhaps I've overlook somewhere.
>>>
>>> I need a float with 24-bit resolution. My data needs to be encoded into
>>> 24 bits at a scaling of 720 degrees / 2^24 bits with the most
>>> significant bit being the sign bit. This results in a value that ranges
>>> from +359.9999571 degrees (0x7FFFFF) to -360.0000000 degrees (0x800000)
>>> at increments of approximately 4.291534424e-5 degrees per bit.
>>
>>
>>
>> This does not sound anything like a float at all. It sounds much more
>> like a
>> typical implementation of a fixed point type. Something along the
>> lines of
>>
>> package My_Pack is
>>
>> The_Delta : constant := 4.291534424e-5;
>>
>> type Probably_Gonna_Work_But_Language_Lawyers_Will_Complain_Type is
>> delta
>> The_Delta range - 360.0 .. 359.9999571;
>> for
>> Probably_Gonna_Work_But_Language_Lawyers_Will_Complain_Type'Small use
>> The_Delta;
>> for Probably_Gonna_Work_But_Language_Lawyers_Will_Complain_Type'Size
>> use
>> 24;
>>
>>
>> end My_Pack;
>>
>> There are all sorts of things you can get bitten by here...especially
>> with
>> the 24 bit requirement but when looking for
>>
>> a specific representation the details can be tricky.
>>
>>
>>
>> What are you really trying to achieve at a higher level (e.g. talking to
>> some hardware, sending some message to a device, etc?)
>>
>>
>>
>>
>
>
> Consider I have another data type which is to be encoded into 24 bits at
> a scaling of 3600 degrees/sec / 2^24 bits with the most significant bit
> being the sign bit. This results in a value that ranges from
> +1799.999785 degrees per second (0x7FFFFF) to -1800.000 degrees per
> second (0x800000) at increments of approximately 2.14576721e-4 degrees
> per second per bit.
>
> Can I declare just one 24-bit resolution float with a 24 bit storage
> size for both problems? How?
>
> Thanks.
>
> --
> Adrian Hoe
> To email, remove "nospam" and "my"
>
Sorry, I missed this.
Yes, I am trying to talk to some hardware.
--
Adrian Hoe
To email, remove "nospam" and "my"
next prev parent reply other threads:[~2003-08-15 12:54 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-15 11:59 float with 24-bit resolution mailbox
2003-08-15 12:24 ` Jeffrey Creem
2003-08-15 12:52 ` Adrian Hoe
2003-08-15 12:54 ` Adrian Hoe [this message]
2003-08-15 15:01 ` Jeffrey Creem
2003-08-16 15:29 ` Matthew Heaney
2003-08-15 13:39 ` Mark Johnson
2003-08-15 16:56 ` Robert I. Eachus
2003-08-15 18:08 ` Mark Johnson
2003-08-16 3:30 ` Robert I. Eachus
2003-08-18 13:39 ` Mark Johnson
2003-08-20 21:12 ` Robert I. Eachus
2003-08-21 13:38 ` Mark Johnson
2003-08-16 15:32 ` Matthew Heaney
2003-08-16 15:26 ` Matthew Heaney
2003-08-15 19:56 ` Simon Wright
2003-08-16 4:21 ` Adrian Hoe
2003-08-16 12:59 ` Jeffrey Creem
2003-08-16 15:35 ` Matthew Heaney
2003-08-17 11:40 ` Simon Wright
2003-08-17 13:46 ` Matthew Heaney
2003-08-18 5:05 ` Adrian Hoe
2003-08-18 13:14 ` Matthew Heaney
2003-08-19 3:09 ` Adrian Hoe
2003-08-19 13:00 ` Matthew Heaney
2003-08-30 5:02 ` Randy Brukardt
2003-09-02 16:05 ` Adrian Hoe
2003-09-03 3:31 ` Matthew Heaney
2003-09-03 20:46 ` Simon Wright
2003-09-04 1:43 ` Randy Brukardt
2003-09-04 9:53 ` Jean-Pierre Rosen
2003-09-05 3:46 ` Randy Brukardt
2003-09-05 17:16 ` Warren W. Gay VE3WWG
2003-09-05 19:37 ` Randy Brukardt
2003-09-06 20:48 ` Warren W. Gay VE3WWG
2003-09-08 7:53 ` Dmitry A. Kazakov
2003-09-04 1:45 ` Randy Brukardt
2003-08-16 3:42 ` Robert I. Eachus
2003-08-16 15:38 ` Matthew Heaney
2003-08-16 16:36 ` Robert I. Eachus
2003-08-16 15:22 ` Matthew Heaney
2003-08-17 11:46 ` Simon Wright
2003-08-18 10:04 ` Martin Dowie
2003-08-20 19:53 ` Robert I. Eachus
2003-08-20 23:36 ` Ludovic Brenta
2003-08-21 13:54 ` Mark Johnson
2003-08-21 14:35 ` Ludovic Brenta
2003-08-22 14:07 ` Mark Johnson
2003-08-22 15:12 ` Jean-Pierre Rosen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox