10-16-2017, 05:15 PM
Edit: This programme is for the 49G, not the 50g. Sorry for the wrong indication.
For input two integers the programme returns the GCF, the programme is faster for integers of size (Edit: 1194 hex digits, ie 4500 dec digits) & greater, for smaller input the programme uses the inbuilt GCD.
Size: 191.
CkSum: # 2A81h
For input two integers the programme returns the GCF, the programme is faster for integers of size (Edit: 1194 hex digits, ie 4500 dec digits) & greater, for smaller input the programme uses the inbuilt GCD.
Size: 191.
CkSum: # 2A81h
Code:
::
CK2&Dispatch
# FFFF
::
2DUP
FPTR2 ^ZNMin
LENHXS
# 1195
#<case
FPTR2 ^ZGCDext
FPTR2 ^ZAbs
SWAP
FPTR2 ^ZAbs
2DUP
Z<
?SWAP
FPTR2 ^DupQIsZero?
caseDROP
DUPUNROT
FPTR2 ^ZMod
FPTR2 ^DupQIsZero?
caseDROP
SWAP
FPTR2 ^ZTrialDiv2
ROT
FPTR2 ^ZTrialDiv2
ROT
#MIN
ZINT 2
SWAP
FPTR2 ^PPow#
3UNROLL
BEGIN
2DUP
FPTR2 ^RSUBext
FPTR2 ^ZTrialDiv2
#0<>
WHILE
::
FPTR2 ^DupZIsNeg?
case
::
SWAPDROP
FPTR2 ^RNEGext
;
ROTDROPSWAP
;
REPEAT
2DROP
FPTR2 ^RMULText
;
;