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,7cda96e9413b780c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-30 08:23:39 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "John H. Lindsay" Newsgroups: comp.lang.ada Subject: Re: Floating Decimal Package/Library? Date: Tue, 30 Jul 2002 11:20:49 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <3D46BCE1.8060709@kingston.net> User-Agent: Mozilla/5.0 (OS/2; U; Warp 4; en-US; rv:0.9.4) Gecko/20020328 X-Accept-Language: en-us MIME-Version: 1.0 References: <3D4575F4.8090408@cogeco.ca> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: newsabuse@supernews.com Xref: archiver1.google.com comp.lang.ada:27484 Date: 2002-07-30T11:20:49-05:00 List-Id: tmoran@acm.org wrote: > ..... A fixed point type > *is* an integer. Owch! We've got a terminological problem here; Sure, integers (any length or unlimited length) are fixed point in that the decimal (binory, hexadecimal, ....) point (actual or virtual) sits in a position fixed with respect to the units digit or with respect to any fraction digits. But other quantities, dollars and cents amounts and currency conversion and interest rates, and often other commercial numeric quantities with a fixed number of digit places after the decimal point (usually, too, with a fixed number before the decimal point) have this property too. This must be me wearing a COBOL or PL/I hat speaking. The usual work- around in languages that don't have data types which allow a fixed number of digit positions after the decimal point is to carry such quantities as a multiple of the intended value by a power of ten to allow storage as some sort of integer, and (painfully) allowing for the multipliers all through the code. There's a bit of confusion too about the handling of fixed point quantities (of various radices) by compilers. The confusion arises because of two views of the meaning of these -- accurate to within a half a unit of the last digit shown or stored (the usual scientific view if an error range is not stated) or totally accurate as shown (a frequent commercial interpretation). The former view leads to the some of the PL/I type conversion rules; the latter leads to most of the COBOL implementations of handling numeric operations, and COBOL people to gasp at PL/I and PL/I people to sputter over COBOL. John. -- John H. Lindsay jlindsay@kingston.net