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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7a2d45f282a1da1c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-08-15 06:18:13 PST Date: Fri, 15 Aug 2003 20:54:29 +0800 From: Adrian Hoe User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: float with 24-bit resolution References: <3F3CCB0F.543478AF@adrianhoe.nospam.com.my> <3f3cd7f4$1_2@news.tm.net.my> In-Reply-To: <3f3cd7f4$1_2@news.tm.net.my> X-Enigmail-Version: 0.71.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 219.95.187.227 X-Original-NNTP-Posting-Host: 219.95.187.227 Message-ID: <3f3cd84f$1_2@news.tm.net.my> X-Trace: news.tm.net.my 1060952143 219.95.187.227 (15 Aug 2003 20:55:43 +0800) Organization: TMnet Malaysia Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!news-out.cwix.com!pullfeed!newsfeed.cwix.com!news1.tm.net.my Xref: archiver1.google.com comp.lang.ada:41509 Date: 2003-08-15T20:54:29+08:00 List-Id: Adrian Hoe wrote: > Jeffrey Creem wrote: > >> 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"