Hi Jamin,
That's correct. That method can't be used with simple values that are automatically converted to native script language datatypes, such as strings and numbers.
That's the correct approach, but you've found an odd case. JavaScript (the language) doesn't support 64-bit integers; its only numeric datatype is 64-bit floating point. On the other hand, JScript (the engine) is implemented as a COM automation component and should therefore be able to handle 64-bit integer arguments.
This is where JScript appears to have a bug; instead of converting 64-bit integers to floating point, it imports them directly and treats them as "unrecognized data". In your example,
For now all we can recommend is that you avoid this situation. Convert 64-bit integers to
Thanks for bringing this to our attention!
I'm getting an error on the AddHostObject call.
That's correct. That method can't be used with simple values that are automatically converted to native script language datatypes, such as strings and numbers.
I also tried replacing the engine.AddHostObject() with engine.Script reference
That's the correct approach, but you've found an odd case. JavaScript (the language) doesn't support 64-bit integers; its only numeric datatype is 64-bit floating point. On the other hand, JScript (the engine) is implemented as a COM automation component and should therefore be able to handle 64-bit integer arguments.
This is where JScript appears to have a bug; instead of converting 64-bit integers to floating point, it imports them directly and treats them as "unrecognized data". In your example,
typeof bigNumber
evaluates to "unknown", which isn't even legal JavaScript. Very strange!For now all we can recommend is that you avoid this situation. Convert 64-bit integers to
double
before passing them to JScript. We'll investigate this issue and consider making this conversion automatic in a future release.Thanks for bringing this to our attention!