3
I’m trying to use the function GCD
library Bigint.js. But somehow, I try to use raw numbers, but it returns 0
In the description it says
// bigInt GCD(x,y)
// return greatest common divisor of bigInts x and y (each with same number of elements).
And I try to use it like this:
GCD(1124,2048);
But it results 0. How to use it correctly?
you could tell me what is bigint?
– Vinícius Lara
It is a large integer, larger than the maximum Javascript supported (which is
9007199254740991
, or 2 53-1, represented in the JS in a structure equivalent to aDouble
, and insufficient for the encryption functions you are trying to implement).– bfavaretto
@bfavaretto a number? To half lost..
– Vinícius Lara
Yes, a number! Now I’m the one who’s lost, what you hoped it would be?
– bfavaretto
is why in the answers they said they had to transform the number in the format of
bigint
.. When I said it was a number I was half Hi? @bfavaretto– Vinícius Lara
A
bigInt
in this library is a data structure used to represent a large integer, that the JS is not able to represent with its typeNumber
. Therefore, abigInt
represents a number. @user3163662– bfavaretto
Ahhh, it’s like a smaller size "camouflage" since javascript can’t support more than a "double"? @bfavaretto
– Vinícius Lara
In fact they appear to be arrays, which represent such numbers.
– bfavaretto