1

When the user passes a number larger than 2^64 - 1 to a native function then the integer can't fit into a unit64_t.

What is the simplest way to write a synchronous native extension that can handle integers of arbitrarily large size? Since it appears we must use the Dart_Embedding API to retrieve values from a Dart_NativeArguments instance, how do we retrieve these values without loss of precision?

kjh
  • 3,407
  • 8
  • 42
  • 79
  • "handle values of this size" is unclear. All you have said is that the number is larger than "2^64 - 1". You have not specified an upper bound - or it it boundless? If you only need 65-bit precision [long double](https://en.wikipedia.org/wiki/Long_double) may work for you. – chux - Reinstate Monica Jun 22 '15 at 17:38
  • @chux Thanks for catching that, I've updated the question – kjh Jun 22 '15 at 19:09

1 Answers1

0

Blasphemous suggestion: pass it as a string ? ;-)

Or [de]mangle it into/out of byte array ?