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,18f7f6e041b3e0bf X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-08-16 08:38:27 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: dewar@gnat.com (Robert Dewar) Newsgroups: comp.lang.ada Subject: Re: Information Systems Annex was RE: Dispatching and generics - language lawyer question Date: 16 Aug 2002 08:38:26 -0700 Organization: http://groups.google.com/ Message-ID: <5ee5b646.0208160738.dbdc60@posting.google.com> References: NNTP-Posting-Host: 205.232.38.14 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1029512307 17617 127.0.0.1 (16 Aug 2002 15:38:27 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 16 Aug 2002 15:38:27 GMT Xref: archiver1.google.com comp.lang.ada:28114 Date: 2002-08-16T15:38:27+00:00 List-Id: "Robert C. Leif" wrote in message news:... > Since I have never worked with binary fixed-point types, > please forgive > a naive question. Would the same capacity to create types > with exponents > at run-time be of any use or is this equivalent to > floating-point? I had not noticed this earlier, but in fact this may account for a lot of the issues here. Bob, I am not sure you understand what fixed point is all about in COBOL or in Ada, and that may explain things. There is of course no exponent for fixed-point numbers, static or otherwise. They are simply scaled integers, and the arithmetic is scaled integer arithmetic. The request for decimal floating-point is a completely orthogonal issue. Just as binary floating-point has nothing whatever to do with with binary fixed-point from a representation point of view, it is the case that decimal fixed-point has nothing to do with decimal floating-point. Doing my best to guess what you are thinking here. I suspect that you are assuming that decimal fixed point representation is like floating point but with a fixed exponent (which you have called static), and that leads to your confusing discussion of allowing this exponent to be dynamic. But there *is* no exponent at all in decimal fixed-point so this viewpoint is unhelpfully confusing. Fixed-point in Ada is just like Fixed-point in COBOL or PL/1. In all three languages we are just talking about scaled integer arithmetic, so if you write type Money is delta 0.01 digits 10; then you are just asking that values of type Money be stored in pennies. So that if you write M : Money := 34.56; then M contains the integer 3456 Note that it does not matter for most practical purposes whether this integer is stored in binary or decimal, since that will not affect any calculation results. In GNAT we normally store such values in binary. There is some work towards supporting IBM mainframe compatible packed decimal for the purposes of interfacing with COBOL, but no one ever showed any interest in this, so this work was not completed (see i-pacdec if you are interested in looking at this partial work -- indeed i-pacdec can be used directly from user code, but the idea was to have the compiler generate calls for arithmetic on decimal fixed-point represented in decimal form).