Re: What about big integers in Ada 2005?



On Tue, 04 Oct 2005 18:56:20 GMT, <adaworks@xxxxxxxxxxxxx> wrote:
<snip>
> BCD was originally a six bit (where 7 was a parity bit) representation. With
> the advent of the byte on the IBM System 360, BCD became Extended Binary
> Coded Decimal Interchange Code (EBCDIC).
>
The 6-bit character code was BCDIC -- Binary Coded Decimal Interchange
Code. With the advent of _8-bit_ bytes on S/360 it became EBCDIC.

BCD was/is any representation that uses 4-bits for each decimal digit,
hence the name. That can be an outright 4-bit processor like the
original 4004; 4-bits in a 6-bit (BCDIC) or 8-bit (EBCDIC) or 7-bit
(ASCII) character; or 2 4-bit nibbles packed in an 8-bit byte.

> In COBOL for the 360, we had several Picture clauses available.
>
> 05 Item-1 PICTURE XXX . which would be represented by
> EBCDIC
> 05 Number PICTURE S99999. which would also be EBCDIC
> 05 Hnumber PICTURE S99999 Usage Comp-3. which would be packed
>
> decimal.
>
> COMP-3 represented the numeric PICTURE by using a half-byte (nibble) for each 9
> in the picture and a nibble for the sign. In the example shown, Hnumber would
> occupy
> only three bytes where Number would occupy five bytes. In both cases, the
> high-order
> nibble is used for the sign.
>
Not that last; the S/360 decimal instructions (AP, SP, etc.) put the
sign in the low-order nibble, namely the low half of the highest
addressed byte, which is the low-valued one on big-endian S/360.

For DISPLAY numeric the sign is in the high nibble aka 'zone' of _one_
byte, IIRC the low-order (high-address) one by default but you can
specify SIGN [IS] LEADING | TRAILING .

> There are actually some additional formats available including USAGE
> COMPUTATIONAL
> which is the same as representing a value in pure binary within the size of a
> word.
>
Pure binary, but IIRC fullword or halfword depending on digits.

And [DISPLAY] numeric with SIGN ... [IS] SEPARATE a full byte for each
digit _plus_ one for sign. (And numeric edited even more, but that's
no longer just a number representation anyway.)

> I could write for a couple of hours on this topic, but I think this gets the
> gist of the issue.
>
> The central problem is that business data processing people use all of these
> formats
> at one time or another.
>

- David.Thompson1 at worldnet.att.net
.



Relevant Pages

  • Re: in which form real and integer values are saved in memory
    ... >> twos complement, BCD or others. ... BP> I don't think that BCD is a valid representation for C integer ... essentially the entire program state at every point). ...
    (comp.lang.c)
  • Re: in which form real and integer values are saved in memory
    ... >> intergers may be big endian or little endian, ... >> twos complement, BCD or others. ... BP> I don't think that BCD is a valid representation for C integer ...
    (comp.lang.c)
  • Re: understanding floats
    ... > exercise) to write floating point math routines that represent numbers ... > an analogous problem for a base 10 representation when dealing with ... and represented BCD numbers in 80 bits. ... I also seem to recall the ...
    (comp.lang.lisp)
  • Re: Currency Rounding Errors
    ... BCD offers no significant advantages over fixed-point binary. ... representation of 1234 was, in fact, the characters "1234". ... own data type and writing your own operations on that data type. ... "decimal fixed-point and floating-point are still important and continue ...
    (microsoft.public.vc.mfc)