Re: [SLUG] Numeric Storage Format

From: Daniel Jarboe (daniel.jarboe@gmail.com)
Date: Fri Dec 29 2006 - 15:17:38 EST


> Right. Two "Packed" BCD digits per byte. One "Unpacked" BCD digit per
byte.
>
> Unless you've done some IBM 370 assembler in your past, this is probably
> foreign to you.

That's right, I forgot you also ran Linux on s390 under hercules... we met
at one of the Tampa meetings. I support several images on a z990 (when I'm
not supporting the traditional mainframe stuff).

But you misunderstood.

Yes, I'm very comfortable with IBM 370 packed decimals and write s390/z9
assembler. IBM's packed decimal instructions encode the number with the
lowest nibble for sign, each other nibble for a single decimal digit. Unpack
and NC the bytes with x'F0' for the zone mask and you have printable numeric
EBCDIC digits.

But it really sounds like Paul was referring to a base 100 derivation of
packed BCD with the sign and power of ten information encoded somewhere else
in the structure.

I said:
> > I'm not sure why. BCD addition would be binary addition + 6 for each
> > nibble > decimal 9.

You said:

> BCD doesn't use values > decimal 9.

I was explaining how to perform BCD addition using binary addition. That
way, since he is probably not utilizing BCD opcodes from PHP, he does not
have to perform the conversion for each BCD digit, perform addition, then
convert back. He can perform binary addition on the encoded values, and add
six to the nibble if over 9 (of course, with carry). Within PHP, this would
likely be easier to do with 156 and the base 100 byte encoding he's talking
about, so you're not dealing with nibbles.

> Can we please just drop this BCD talk please? I don't want to confuse
> anyone

But it certainly seems relevant... ?

~ Daniel

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:16:30 EDT