comp.lang.ada
 help / color / mirror / Atom feed
From: "Warren W. Gay VE3WWG" <ve3wwg@cogeco.ca>
Subject: Re: Information Systems Annex (usefulness of Decimal Floats)
Date: Fri, 16 Aug 2002 11:47:49 -0400
Date: 2002-08-16T11:47:49-04:00	[thread overview]
Message-ID: <3D5D1EA5.1040406@cogeco.ca> (raw)
In-Reply-To: 5ee5b646.0208150126.ac9f65e@posting.google.com

Robert Dewar wrote:
> "Robert C. Leif" <rleif@rleif.com> wrote in message news:<mailman.1029282844.28090.comp.lang.ada@ada.eu.org>...
> 
>>Ada decimal types (as currently defined) are fixed-point
>>types.
>>
>>Are you asking for decimal floating-point?
> 
> Decimal floating-point would be quite useless in financial
> applications as far as I can see (COBOL does not have this
> facility). 

"Useless" is extreme. There are situations where decimal floating
point is useful in computing financial values, but normally as
intermediate results. The final values of financial calculations
are obviously stored in fixed point.

Currency conversions are often performed in floating point
decimal since the currencies move all over the map in
relative terms in terms of scale. As long as the precision
is maintained in the intermediate results, and that you
properly anticipate the resulting scale and precision, the
use of decimal floats as intermediates work well, with
the final results being stored in a fixed point decimal form.

One recent example of this, was the Euro conversion,
where we had to do those triangulation computations (three
currencies were involved). You have a broad range of values
between British pound and the Turkish Lira, for example.

For smaller numbers you might still cry foul, but when you're
computing the asset value of fund or fund(s) or management
company(ies), you run into larger numbers ;-)

Again of course, you _could_ structure your computations such
that you don't need decimal floats, but this requires
extreme care and good testing (something you don't often
get from junior programmers - but that is a different issue ;-).
So often it is just easier and safer to use decimal floats
provided that the necessary precision is maintained.

As a side note I should mention that in C/C++ code, floating
point decimal is really the only other choice to binary
floating point values. Database vendors INFORMIX
and ORACLE for example, provide routines for decimal
floating point computations (but not for fixed point).
--
Warren W. Gay VE3WWG
http://home.cogeco.ca/~ve3wwg




  parent reply	other threads:[~2002-08-16 15:47 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                             ` Warren W. Gay VE3WWG [this message]
2002-08-17 10:54                               ` Information Systems Annex (usefulness of Decimal Floats) 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                           ` Information Systems Annex was RE: Dispatching and generics - language lawyer question Robert Dewar
2002-08-13 22:50           ` 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