Integers vs. Long Integers Was: RE: [AccessD] Global Variable

John W. Colby jwcolby at colbyconsulting.com
Thu May 19 19:01:34 CDT 2005


BCD was available back in the Borland turbo Pascal compiler for the 80x86
for doing precision decimal math.  A number could be precisely represented
with none of the binary rounding problems.

John W. Colby
www.ColbyConsulting.com 

Contribute your unused CPU cycles to a good cause:
http://folding.stanford.edu/

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of MartyConnelly
Sent: Thursday, May 19, 2005 6:14 PM
To: Access Developers discussion and problem solving
Subject: Re: Integers vs. Long Integers Was: RE: [AccessD] Global Variable


Actually Honeywell used both BCD and IEEE floating point arithmetic, and
some of the lower end IBM 360's only came with  standard BCD. BCD arithmetic
is much easier to do than converting to binary and back. There are well
known methods to doing BCD arithmetic on a basically binary ALU, related to
adding 66666666 at the appropriate 
time.
So you could do higher precision in BCD arithmetic on  a 36 bit rather 
than 32 bit machine.

 BCD is neither base 10 nor base 16...it uses 4-bit fields to express
digits between 0-9.   The same as hexadecimal uses 4 bits, but
incrementing a BCD field with the value '9' results in a new BCD number '10'
(8 bits), while incrementing a HEX field with the value '9' results in the
next number 'A' (still 4 bits). You may also have to determine if your data
is stored in big-endian 
(i.e. 12 34 56)
or little-endian  (i.e. 56 34 12).  The width of the field probably has 
to be known
beforehand so you will know where to place the decimal - usually, mainframe
data assumes a decimal place but doesn't actually store it. The '+' sign is
stored as 0xC and the '-' sign is 0xD. The sign is usually stored at the end
(i.e. if you had -123456, then it would be stored as 01 23 45 6D).





More information about the AccessD mailing list