crossbind
GitHub
TUTORIAL · STEP 2 OF 7

Numbers and BigInt

int, double and bool arrive as numbers and booleans. A 64-bit integer arrives as a BigInt, so no digit goes missing.

A JavaScript number holds integers exactly only up to 2^53. That is why int64_t and the other 64-bit integer types cross as BigInt: fibonacci(90) keeps all nineteen digits, while turning it into a Number rounds the last ones off.

The other way round, a 64-bit parameter takes a BigInt, or a Number that is a safe integer.

Try it
Make fibonacci return double instead of int64_t, run it again and compare the last digits with the BigInt result.
Runs without a compile until you edit the C++.
Console
Press Run, or Ctrl+Enter, to run main.js.
Type to search every guide page and section.
↑↓ navigate↵ openesc close