Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating ConstantInts of very large numbers #75

Closed
vihanb opened this issue Dec 11, 2018 · 2 comments
Closed

Creating ConstantInts of very large numbers #75

vihanb opened this issue Dec 11, 2018 · 2 comments

Comments

@vihanb
Copy link
Contributor

vihanb commented Dec 11, 2018

I was recently implementing an algorithm that used a very large number 0xdf900294d8f554a5 in my language which compiles with llvm-node however I noticed an unusual issue is that JS cannot accurately represent such large numbers so the outputted LLVM contains an inaccurate number too. First thought was a .get() that takes a string and is parsed in C++ as a uint64 and then passed to LLVM could help solve this issue.

@MichaReiser
Copy link
Owner

Hi @vihanb

Unfortunately, v8 was not capable to represent arbitrary large uint64 numbers when I started implementing the library. And there is a chance that the library does not handle overflows correctly so far.

It might be worth it to take a look into BigInt that seems to be supported with Node 10. For older node versions it would at least be desirable to catch the cases where the number overflows.

ovr added a commit to ovr/llvm-node that referenced this issue Dec 14, 2018
Signed-off-by: Dmitry Patsura <talk@dmtry.me>
ovr added a commit to ovr/llvm-node that referenced this issue Dec 14, 2018
Signed-off-by: Dmitry Patsura <talk@dmtry.me>
@MichaReiser
Copy link
Owner

This issue is fixed by the PR #76 from @ovr

You can use the string overload to retrieve large numbers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants