Double Precision Binary to BCD Conversion
tomcrawford
Posts: 1,126
in Propeller 1
I couldn't find extended precision binary-to-BCD conversion in spin, so here one is. It does up to (2^64)-1. You give it two longs and it return 20 bytes of BCD. I checked it against all 64 powers of two, which it got correct. The method is discussed in the comment section of the code, but basically it repeatedly subtracts powers of 10.
Comments