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 Message-ID: <4369243F.319524C9@fakeaddress.nil> Date: Wed, 02 Nov 2005 21:40:31 +0100 From: Gautier Write-only X-Mailer: Mozilla 4.8 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Simulation of fixed point in c WITH DIFFERENT BIT-WIDTH References: <1130690498.388857.225170@g49g2000cwa.googlegroups.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 83.76.239.209 X-Original-NNTP-Posting-Host: 83.76.239.209 X-Trace: news.bluewin.ch 1130964038 83.76.239.209 (2 Nov 2005 21:40:38 +0100) Organization: Bluewin AG Complaints-To: abuse@bluewin.ch X-Original-NNTP-Posting-Host: 127.0.0.1 Path: g2news1.google.com!news4.google.com!news3.google.com!news.glorb.com!wns13feed!worldnet.att.net!164.128.36.58!news.ip-plus.net!newsfeed.ip-plus.net!news.bluewin.ch!not-for-mail Xref: g2news1.google.com comp.lang.ada:6133 Date: 2005-11-02T21:40:31+01:00 List-Id: 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. Some people were perverse enough to do it even in Ada, e.g.: http://homepage.sunrise.ch/mysunrise/gdm/e3d_html/svgaeffe__adb.htm#258_13 Shocking, isn't it ? The method was also useful for a short time with Pentiums, but before the 3D graphics cards, since you can make the FPU and the CPU work simultaneously. For grabbing "manually" (i.e. withouth 3D hardware) single pixels on a texture map, you also gain time by not using the FPU for each pixel: otherwise, you would have each time one FPU division, plus a conversion to an array index, which must be slower than a single integer addition for the same index. G.