[comp.lang.c] Any-length numbers

exodus@uop.UUCP (Greg Onufer) (03/19/87)

****************************************************
Wanted: C BCD routines for any-length numbers!!!!
Does anybody have short & sweet routines for 
adding, subtracting, multiplying, and dividing packed
(or unpacked) BCD digits stored in C unsigned char
arrays?  [Packed: 2 BCD digits per byte]
Any help would be greatly appreciated.  Thanx in advance...

Send responses through mail or Snailmail only...


--------------------------------------------------------------------------------
| The secret to flying is jumping and missing the ground...                    |
|  				-Hitchhiker's Guide to the Universe	       |
|..............................................................................|
| Greg Onufer (EXODUS)							       |
| Mail: University of the Pacific, Casa Jackson #311, Stockton, CA 95211       |
| UUCP: ...ucdavis!uop!exodus						       |
| Voice: (209) 944-7484							       |
--------------------------------------------------------------------------------
-- 
--------------------------------------------------------------------------------
| The secret to flying is jumping and missing the ground...                    |
|  				-Hitchhiker's Guide to the Universe	       |
|..............................................................................|
| Greg Onufer (EXODUS)							       |
| Mail: University of the Pacific, Casa Jackson #311, Stockton, CA 95211       |
| UUCP: ...ucdavis!uop!exodus						       |
| Voice: (209) 944-7484							       |
--------------------------------------------------------------------------------

jjbaker@phoenix.UUCP (03/22/87)

In article <139@uop.UUCP>, exodus@uop.UUCP (Greg Onufer) writes:
> ****************************************************
> Wanted: C BCD routines for any-length numbers!!!!
> Does anybody have short & sweet routines for 
> adding, subtracting, multiplying, and dividing packed
> (or unpacked) BCD digits stored in C unsigned char
> arrays?  [Packed: 2 BCD digits per byte]
> Any help would be greatly appreciated.  Thanx in advance...
> 
> Send responses through mail or Snailmail only...

Me too!
Me too!

I'm writing a simulator of an IBM 650 computer, which used 10-decimal-digit
words.  I used VAX assembler for the arithmetic, but want to port to PC
and others, so I need C routines.  Actually, my numbers are stored in
ASCII form, and the CVTSP instruction converts to packed BCD for the
arithmetic machine instructions.

                             Thanbo
                             (...!princeton!phoenix!jjbaker)
                             (6056626@pucc.BITNET)