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-Thread: 103376,509f8e43dc081fde X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!dotsrc.org!news.dotsrc.org!not-for-mail Date: Wed, 02 Nov 2005 16:49:14 +0200 Subject: Re: Simulation of fixed point in c WITH DIFFERENT BIT-WIDTH Newsgroups: comp.lang.ada References: <1130690498.388857.225170@g49g2000cwa.googlegroups.com> From: "Martin Krischik" Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: User-Agent: Opera M2/8.50 (Win32, build 7700) Organization: SunSITE.dk - Supporting Open source NNTP-Posting-Host: 213.154.202.65 X-Trace: news.sunsite.dk DXC=Gk2i>79nY5OlZiKmBn9NRLYSB=nbEKnkKX164Y4IX4D@S5daR30PdPEV:_8RJBabHM;O^i0GOe`^Cofe`J\FNoJ@a1J?3`8DYWF X-Complaints-To: staff@sunsite.dk Xref: g2news1.google.com comp.lang.ada:6126 Date: 2005-11-02T16:49:14+02:00 List-Id: Am 02.11.2005, 12:57 Uhr, schrieb Colin Paul Gloster : > Mnamky posted to news:comp.lang.ada : > > "Hi all; > > Consider the following exaple > y = x * b' > > where x is 12-bit wordlength and 11-bit fraction > and b is 16-bit wordlength and 14-bit fraction > > simulation of this code is rather easy im Matlab but how could we do a > full analysis of this code in C with a good precision?" > > I fail to see the relevance of this to Ada. In C, you could use ints and > interpret some bits as an integer and some bits as a vulgar fraction, as > in computer games books for 386s and 486s (before Pentiums which had > faster floating point support than integer support) in the 1990s, such > as "Building a 3D Engine in C++" and La Mothe; Ratcliff; et al., > "Tricks of the Game Programming Gurus", SAMS Publishing. > > A worse way would be to use bitfields. Well sounds to me you want a fixed poind type: http://en.wikibooks.org/wiki/Ada_Programming/Types/delta Tricky part is all the bit fideling you wish for. In Ada you usualy ask for a needed precision and prehaps a overall bit size and then let Ada sort out the rest. Martin