05-31-2015, 02:12 PM
The 49G converts zints to hexadecimal strings by R->B, first transforming the zint to a real & thereby loosing significant digits.
This programme does Z->B & B->Z to full accuracy.
eg For input
9898989898989898979
the programme returns
# 9898989898989898979d
& applying the programme again returns the original zint.
This programme does Z->B & B->Z to full accuracy.
eg For input
9898989898989898979
the programme returns
# 9898989898989898979d
& applying the programme again returns the original zint.
Code:
::
CK1&Dispatch
# FF
::
BINT64
dostws
FPTR2 ^DupZIsNeg?
casedrop
HXS 00001 0
ZINT 18446744073709551615
FPTR2 ^ZNMin
DUP
FPTR2 ^Z>R
%>#
DUP
HXS>%
FPTR2 ^R>Z
ROT
FPTR2 ^RSUBext
FPTR2 ^Z>R
% 100000000.
DUPUNROT
%+SWAP
%>#
bit%#-
bit-
;
BINT11
::
BINT64
dostws
DUP
HXS>%
DUP
FPTR2 ^R>Z
SWAPROT
bit%#-
% 100000000.
DUPUNROT
%>#
bit+
HXS>%
SWAP
%-
FPTR2 ^R>Z
FPTR2 ^RSUBext
;
;