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: <43653F2C.B20F75B5@fakeaddress.nil> Date: Sun, 30 Oct 2005 22:46:20 +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.77.232.85 X-Original-NNTP-Posting-Host: 83.77.232.85 X-Trace: news.bluewin.ch 1130708783 83.77.232.85 (30 Oct 2005 22:46:23 +0100) Organization: Bluewin AG Complaints-To: abuse@bluewin.ch X-Original-NNTP-Posting-Host: 127.0.0.1 Path: g2news1.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!news-zh.switch.ch!switch.ch!news.ip-plus.net!newsfeed.ip-plus.net!news.bluewin.ch!not-for-mail Xref: g2news1.google.com comp.lang.ada:6060 Date: 2005-10-30T22:46:20+01:00 List-Id: mnamky wrote: > 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? > > Thank you It is also easy in Ada - something like... procedure Fixed_12 is type F1 is delta 2.0**(-11) range -1.0 .. 1.0; type F2 is delta 2.0**(-14) range -2.0 .. 2.0; x : F1; y,b: F2; begin x:= 0.12345; b:= 1.23456; y:= x * b; end; The precision is guaranteed - better than good... But you want to do this in C ?! By Jove! Fortunately, your subconscient suggested you the right newsgroup. BTW, something is wrong, either with your Shift key, or with your Caps Lock key - see the title. I can only sympathize, after having a similar problem: some beer had found unexpectedly its way into my keyboard. ______________________________________________________________ Gautier -- http://www.mysunrise.ch/users/gdm/index.htm Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm TeXCAD -- http://www.mysunrise.ch/users/gdm/texcad.htm NB: For a direct answer, e-mail address on the Web site!