Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
.
Added.
When I do not use
bignumber.js
at all, the tests fail because test suite is missing therequire
. Is it possible to put therequire
in the test suite, so solutions which do not need it do not have to include it?My code (
arr
is array of nativeBigInt
):Output:
As you see,
BN.toFixed
is able to get accurate representation.Why not print BigInts as strings, then? Is it difficult to convert bigint to string and display it?
Not easy (because Bignumber.js doesnt't display well very big numbers) but I'll try to explain that your result is wrong.
with JS
They seem pretty close.
with Python or another language with native big integers:
I expect my answer is clear enough, if not please tell.
I looked at your code and trie it and unfortunately I am sorry to think that you are not in the right way.
Edit: It seems you now Python so you can try it on this kata and have no problem with big integeers.
in JavaScript, even using bignumber.js, there are some tests that are (or at least i find) impossible to pass.
ej:
Actual 3,38575890503412110
Possible expect 20534466401280000,32656316659200000
Product to get 1.4880993281312406429302784e+33
Your AA + BB 1.488099328131240613479552494652109e+33
Error
Actual 1374771,7309774025
Possible expect 2190443200,6973862400
Product to get 53432798186560000000
Your AA + BB 53432798186560003066
Error
Actual 3,38575890503412110
Possible expect 20534466401280000,32656316659200000
Product to get 1.4880993281312406429302784e+33
Your AA + BB 1.488099328131240613479552494652109e+33
Error