HP Forums

Full Version: (49G) Negadecimal to Decimal Programme & OEIS A256639
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Below a programme to convert negadecimal base numbers to decimal.

The advantage of negadecimal base is that there is no need for a negative sign. Indeed, the old problem of the existence of negative numbers disappears as they become interleaved with the positives. & what happens to the question of sign? The notational resolution of these two bugbears of traditional numeration is surely of some utility.

Reading the digits of a negadecimal number from right to left, they represent

units, negative tens, hundreds, negative thousands, ten thousands,......

eg Negadecimal 36123 is 3+2*(-10)+1*(100)+6*(-1000)+3*(10000), or base 10 24083.

Similarly, 1066 negadecimal becomes -1054 decimal.

For conversion decimal to negadecimal programme see:

http://oeis.org/A256639

::
CK1&Dispatch
# FF
::
ZINT -10
1LAMBIND
FPTR2 ^DupZIsNeg?
SWAP
FPTR2 ^ZABS
Z1_
Z0_
ROT
BEGIN
FPTR2 ^DupQIsZero?
NOT_WHILE
::
ZINT 10
FPTR2 ^ZDIVext
4ROLL
DUP
1GETLAM
FPTR2 ^RMULText
5UNROLL
FPTR2 ^RMULText
ROT
FPTR2 ^RADDext
SWAP
;
REPEAT
ABND
DROPSWAPDROP
SWAP
case
FPTR2 ^RNEGext
;
;
Reference URL's