On 2017-04-25 17:01, Devin Asay via use-livecode wrote:
However, it doesn’t seem to be reliable for very large numbers (> 100
digits) as the fellow wants. My math skills are pretty creaky. Anybody
want a crack at this? It’s a fun challenge, plus it can boost LC’s
presence on stackoverflow.
You
On 04/25/2017 11:15 AM, Mike Kerner via use-livecode wrote:
Long Math is a longstanding ACL contest theme, and I think we've talked
about it here, before, too, because every language runs into precision
issues - sooner or later you're going to run out of digits in the register.
In addition, it'
A modification from the web, similar, adapted to LC:
on mouseUp
local tNum
put fld 2 into tNum
put "" into fld 1
put isPrime(tNum) into fld 1
end mouseUp
function isPrime pNum
if pNum ≤ 1 then return false
if pNum ≤ 3 then return true
if pNum mod 2 = 0 or pNum mod 3 = 0 then
Long Math is a longstanding ACL contest theme, and I think we've talked
about it here, before, too, because every language runs into precision
issues - sooner or later you're going to run out of digits in the register.
So in LC
Put the value into a container
Write the math algorithms that does it
Devin.
i don't get an overflow error til 309 digits. Where did the guy set a limit?
Making some sort of composite gadget, like we played around with a while ago
on the forum to allow long multiplications, additions, etc. without limit
would be a general solution without, er, limit.
Maybe Hermann