comp.lang.ada
 help / color / mirror / Atom feed
From: "John H. Lindsay" <jlindsay@kingston.net>
Subject: Re: Floating Decimal Package/Library?
Date: Tue, 30 Jul 2002 11:20:49 -0500
Date: 2002-07-30T11:20:49-05:00	[thread overview]
Message-ID: <3D46BCE1.8060709@kingston.net> (raw)
In-Reply-To: Y6f19.18869$vX4.189933792@newssvr13.news.prodigy.com

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




  parent reply	other threads:[~2002-07-30 16:20 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-12 17:19 Floating Decimal Package/Library? Warren W. Gay VE3WWG
2002-07-12 22:58 ` Robert Wessel
2002-07-12 23:30   ` Dann Corbit
2002-07-15 13:34     ` Warren W. Gay VE3WWG
2002-07-16  5:04       ` Robert C. Leif
2002-07-16  7:01         ` tmoran
2002-07-16 15:50           ` Robert C. Leif
2002-07-17  1:24             ` tmoran
2002-07-17  2:53               ` Robert C. Leif
2002-07-17  4:41                 ` tmoran
2002-07-17 16:30                   ` Warren W. Gay VE3WWG
2002-07-17 22:09                     ` tmoran
2002-07-29 17:05                       ` Warren W. Gay VE3WWG
2002-07-29 17:41                         ` tmoran
2002-07-30  8:58                           ` Jean-Pierre Rosen
2002-07-30 16:20                           ` John H. Lindsay [this message]
2002-07-16 16:32           ` Pascal Obry
2002-07-16 17:53           ` Warren W. Gay VE3WWG
2002-07-17  1:24             ` tmoran
2002-07-17  8:28               ` Vadim Godunko
2002-07-17 13:32                 ` Warren W. Gay VE3WWG
2002-07-22 23:33                   ` Robert I. Eachus
2002-07-23 13:16                     ` Marin David Condic
2002-07-24 15:18                       ` Darren New
2002-07-24 15:43                         ` Hyman Rosen
2002-07-24 16:17                         ` Fraser Wilson
2002-07-17 13:30               ` Warren W. Gay VE3WWG
2002-07-13 21:55 ` Björn Lundin
2002-07-15 13:37   ` Warren W. Gay VE3WWG
2002-07-17 21:56 ` Waldek Hebisch
2002-07-18 14:13   ` Robert C. Leif
2002-07-19 14:41     ` Waldek Hebisch
2002-07-19 17:29   ` Warren W. Gay VE3WWG
2002-07-19 21:50     ` Waldek Hebisch
replies disabled

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