comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@gnat.com (Robert Dewar)
Subject: Re: Information Systems Annex was RE: Dispatching and generics - language lawyer question
Date: 16 Aug 2002 08:38:26 -0700
Date: 2002-08-16T15:38:27+00:00	[thread overview]
Message-ID: <5ee5b646.0208160738.dbdc60@posting.google.com> (raw)
In-Reply-To: mailman.1029282844.28090.comp.lang.ada@ada.eu.org

"Robert C. Leif" <rleif@rleif.com> wrote in message news:<mailman.1029282844.28090.comp.lang.ada@ada.eu.org>...
 
> 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).



  parent reply	other threads:[~2002-08-16 15:38 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-24  5:33 Dispatching and generics - language lawyer question Grein, Christoph
2002-07-24 22:55 ` Robert A Duff
2002-07-25 15:46   ` Ben Brosgol
2002-07-29 20:38     ` Robert A Duff
2002-07-31 22:52       ` Dmitry A.Kazakov
2002-07-31 20:18         ` Robert A Duff
2002-08-02  1:15           ` Dmitry A.Kazakov
2002-08-01 16:30             ` Hyman Rosen
2002-08-02 23:42               ` Dmitry A.Kazakov
2002-08-02 15:49                 ` Hyman Rosen
2002-08-02 17:48                   ` Stephen Leake
2002-08-10  3:03                     ` Warren W. Gay VE3WWG
2002-08-05 11:15                   ` Dmitry A. Kazakov
2002-08-12 12:44                   ` Robert Dewar
2002-08-13  2:00                     ` Information Systems Annex was " Robert C. Leif
2002-08-13  8:17                       ` Robert Dewar
2002-08-13 23:53                         ` Information Systems Annex Robert C. Leif
2002-08-13 17:37                       ` Information Systems Annex was RE: Dispatching and generics - language lawyer question Keith Thompson
2002-08-13 23:53                         ` Robert C. Leif
2002-08-14  8:52                           ` Keith Thompson
2002-08-14 21:53                             ` Robert C. Leif
2002-08-15  9:31                               ` Robert Dewar
2002-08-15 21:54                                 ` Decimal Floating point was " Robert C. Leif
2002-08-16  6:26                                   ` Keith Thompson
2002-08-16 16:26                                     ` Robert C. Leif
2002-08-16 18:17                                       ` Keith Thompson
2002-08-16 15:26                                   ` Robert Dewar
2002-08-16 15:29                                   ` Robert Dewar
2002-08-15  9:26                           ` Robert Dewar
2002-08-15 16:17                             ` Darren New
2002-08-15 17:25                               ` David C. Hoos
2002-08-15 17:31                                 ` Darren New
2002-08-15 19:59                                 ` Frank J. Lhota
2002-08-15 17:39                               ` tmoran
2002-08-15 19:18                               ` Information Systems Annex was RE: Dispatching and generics - Larry Kilgallen
2002-08-15 18:41                                 ` Hyman Rosen
2002-08-16 15:49                                 ` Robert Dewar
2002-08-17  6:31                                   ` Simon Wright
2002-08-17 14:17                                     ` Robert Dewar
2002-08-15 21:54                             ` Decimal Floating types was RE: Information Systems Annex was RE: Dispatching and generics - language lawyer question Robert C. Leif
2002-08-16 15:21                               ` Robert Dewar
2002-08-16 16:15                                 ` Decimal Floating types Warren W. Gay VE3WWG
2002-08-17 10:52                                   ` Robert Dewar
2002-08-17 14:30                                     ` Warren W. Gay VE3WWG
2002-08-20  0:26                                       ` Robert Dewar
2002-08-20  2:35                                         ` SteveD
2002-08-22 18:15                                         ` Richard Riehle
2002-08-23  3:23                                           ` Robert Dewar
2002-08-16 15:47                             ` Information Systems Annex (usefulness of Decimal Floats) Warren W. Gay VE3WWG
2002-08-17 10:54                               ` Robert Dewar
2002-08-17 14:06                                 ` Warren W. Gay VE3WWG
2002-08-17 10:56                               ` Robert Dewar
2002-08-17 14:12                                 ` Warren W. Gay VE3WWG
2002-08-17 19:04                                 ` Robert C. Leif
2002-08-20  0:25                                   ` Robert Dewar
2002-08-16 15:38                           ` Robert Dewar [this message]
2002-08-13 22:50           ` Dispatching and generics - language lawyer question Randy Brukardt
2002-08-14  0:02             ` Robert A Duff
2002-07-25  0:40 ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox