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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,6a8952cbe009f3ed X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.14.215.198 with SMTP id e46mr10299772eep.2.1360478205852; Sat, 09 Feb 2013 22:36:45 -0800 (PST) Path: g1ni2204wig.0!nntp.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!216.196.110.142.MISMATCH!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsgate.cuhk.edu.hk!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Nasser M. Abbasi" Newsgroups: comp.lang.ada Subject: Re: Numerical calculations: Why not use fixed point types for everything? Date: Sat, 02 Feb 2013 15:08:50 -0600 Organization: Aioe.org NNTP Server Message-ID: References: <4905b963-0036-4129-8050-fb26ef0154d6@googlegroups.com> <32314026-23ae-45b8-a4c5-e589e7d79de2@googlegroups.com> <64e3c342-d042-40a2-8a16-b1f0cdff9f16@googlegroups.com> <91527f7c-0679-4c21-95c7-a07f3fff265d@googlegroups.com> Reply-To: nma@12000.org NNTP-Posting-Host: e4YiwBKsKkxsbP43nIG0aw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2013-02-02T15:08:50-06:00 List-Id: On 2/1/2013 4:53 AM, Ada novice wrote: > What about using fixed point number representation for loop counters? > It is common for example we have a time index in a program that >is increasing with a value say t:= t + 0.01 seconds for each index in a loop Well, it is common only in sloppy programming. loop counters should always be discrete. as in integers, enumeration set, etc... In Matlab, they do anything and it runs since there is no error checking, but it will be code full of bugs. I am sure in Ada the loop counter must belong to a discrete type. One good thing in Ada about Ada. For your example, one will find the length, say number of samples, and use a natural for an index, and inside the loop, then access the data using this index. The data itself can be float ofcourse. Much safer than using the index itself for the time steps update. --Nasser