format all the stack comments nicer

This commit is contained in:
jacekpoz 2024-06-23 13:11:33 +02:00
parent 1fa0b20964
commit 440ba87529
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8

View file

@ -34,29 +34,29 @@
\ otherwise 0 0 0
: diophantine ( c b a -- y x result )
{: | _d _c _b _a :}
over over ( c b a -- c b a b a )
check-2-top-0 if ( c b a b a -- c b a )
drop drop drop ( c b a -- )
0 0 0
else ( c b a b a -- c b a )
rot to _c ( c b a -- b a )
over over to _a to _b ( b a -- b a )
extended-gcd ( b a -- y x d ) \ b a extended-gcd
dup to _d ( y x d -- y x d )
_c swap mod ( y x d -- y x c%d )
0 = invert if ( y x c%d -- y x )
drop drop ( y x -- )
0 0 0
else ( y x c%d -- y x )
_c _d / ( y x -- y x [c/d] = e )
dup rot ( y x e -- y e e x )
* ( y e e x -- y e [e*x] = f )
rot rot ( y e f -- f y e )
* ( f y e -- f [y*e] = g )
over over ( c b a -- c b a b a )
check-2-top-0 if ( c b a b a -- c b a )
drop drop drop ( c b a -- )
0 0 0 ( -- 0 0 0 )
else ( c b a b a -- c b a )
rot to _c ( c b a -- b a )
over over to _a to _b ( b a -- b a )
extended-gcd ( b a -- y x d ) \ b a extended-gcd
dup to _d ( y x d -- y x d )
_c swap mod ( y x d -- y x c%d )
0 = invert if ( y x c%d -- y x )
drop drop ( y x -- )
0 0 0 ( -- 0 0 0 )
else ( y x c%d -- y x )
_c _d / ( y x -- y x [c/d] = e )
dup rot ( y x e -- y e e x )
* ( y e e x -- y e [e*x] = f )
rot rot ( y e f -- f y e )
* ( f y e -- f [y*e] = g )
_b 0 < if -1 * then ( x0 y0 -- x0 -y0 )
swap ( x0 y0 -- y0 x0 )
swap ( x0 y0 -- y0 x0 )
_a 0 < if -1 * then ( y0 x0 -- y0 -x0 )
-1 ( y0 x0 -- y0 x0 -1 ) \ x = x0; y = y0; result = -1 - true
-1 ( y0 x0 -- y0 x0 -1 ) \ x = x0; y = y0; result = -1 - true
then
then ;