Back to Programming Languages forum
I have had trouble with a few problems now that involve large numbers, large enough to require BigInt, but I can't seem to be able to use it. I get the error message saying BigInt is not defined. Some of them I could skirt around with using modulous and dividing by ten. Am I not doing something right? Is there another way to deal with these large numbers?
Hi there, it is a good question :)
Such problems - about "long arithmetic" really meant that people may try and implement long calculations manually, using arrays or strings.
Some languages provide ready long numbers (LISP was one of the first, but now Python and Java are most well-known for this).
But some other does not. JavaScript got BigInt at some point. But it seems our "sandbox" is using older version.
By the way, the site is written in PHP and checkers for problems too. PHP don't have long arithmetics "out of the box" so I myself needed to implement several operations with long numbers from scratch.
So you have two options: