gcd() ... wrong answer, lcm() hangs

#1
This is correct.
Code:
v:\> echo %@eval[gcd(2546068882500000000 99999900000000000)]
357142500000000
If I multiply both numbers by 10, their GCD should be multiplied by 10. But this is not correct.
Code:
v:\> echo %@eval[gcd(25460688825000000000 999999000000000000)]
3584
And this puts TCC in an uninterruptible, 100% CPU usage state.
Code:
v:\> echo %@eval[lcm(25460688825000000000 999999000000000000)]
 
#5
WAD - you're overflowing the 64-bit integer arguments & result. I've added an overflow check to lcm in build 47 to prevent it from looping.

Those operators could (with substantial effort) be rewritten to use BCD instead, but I doubt you actually need it.
Actually, I needed it. How do you think I discovered it?
 
#6
LCM's overflow check apparently works. GCD can also hang TCC and would seem to need a similar check. THis will do it.
Code:
echo %@eval[gcd(1111111111118077966350999 1111111111118077966350888)]