-
Notifications
You must be signed in to change notification settings - Fork 907
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
bug: 0.0041 * LAMPORTS_PER_SOL #2282
Comments
That's weird. The math should evaluate to /**
* There are 1-billion lamports in one SOL
*/
export const LAMPORTS_PER_SOL = 1000000000; Do you have some repro code? |
That's just IEEE 754 maths I'm afraid. https://www.typescriptlang.org/play?#code/MYewdgziA2CmB00QHMAUAGe70BYCMABAFQF4D626F216AlEA I'd recommend never using floating points for handling financial values. |
Hi @EdogawaDenji, Thanks for your question! We want to make sure to keep signal strong in the GitHub issue tracker – to make sure that it remains the best place to track issues that affect the development of the Solana JavaScript SDK itself. Questions like yours deserve a purpose-built Q&A forum. Unless there exists evidence that this is a bug with the Solana JavaScript SDK itself, please post your question to the Solana Stack Exchange using this link: https://solana.stackexchange.com/questions/ask This automated message is a result of having added the ‘question’ tag. |
You will like what we're working on – a set of utilities to make annoying math like this possible on fixed-point integers. Follow along in solana-labs/web3.js-issue-conveyer#21. |
Because there has been no activity on this issue for 7 days since it was closed, it has been automatically locked. Please open a new issue if it requires a follow up. |
0.0041 * LAMPORTS_PER_SOL equal to 4100000.0000000005?
RangeError: The number 4100000.0000000005 cannot be converted to a BigInt because it is not an integer
The text was updated successfully, but these errors were encountered: