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-17 04:48:14 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: float with 24-bit resolution Date: 17 Aug 2003 12:46:41 +0100 Organization: Pushface Sender: simon@smaug.pushface.org Message-ID: References: <3F3CCB0F.543478AF@adrianhoe.nospam.com.my> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1061120893 15253 62.49.19.209 (17 Aug 2003 11:48:13 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Sun, 17 Aug 2003 11:48:13 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: archiver1.google.com comp.lang.ada:41631 Date: 2003-08-17T12:46:41+01:00 List-Id: "Matthew Heaney" writes: > 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. > > You're not asking for a floating point type at all -- you're asking for a > fixed point type. to OP: in Ada, there are *real* numbers (which can have non-integer values): the way in which real numbers can be represented is either in floating-point or fixed-point. floating-point format has a mantissa and an exponent, and corresponds to C float or double; fixed-point has no exponent, and no C analog either, it's just 'int where the least significant bit represents (in your case) 2**-24'.