Re: Fw: BCD-lib

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Sat, 13 Apr 2002 21:15:59 -0500, Kat <gertie at PELL.NET> wrote:

> The question is how will 
>Eu store the BCD bytes for us?

Off the top of my head, a "short" BCD could be held in an integer,
which is 31 bits. The natural scheme would be sign+ 7 nibbles
(therefore seven significant digits), using 29 bits, leaving space for
a 2-bit mantissa (therefore between 0 and 3 decimal places). That
could accurately hold 0.001 or 9,999,999. The largest money value it
could hold would be 99,999.99. Longer BCD values could be held as a
sequence of n integers, with up to 7*n significant digits and 3*n
decimal places.

Alternatively, you explicitly specify how many decimal places you need
at the start of the program and the routines return the shortest
possible sequence which will hold the calculated result.

Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu