You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is actually doing a bit-XOR between 10 * 10 = 100 and 6. In the provided test code, you can just print it and see. It actually does
100 ---> 0b1100100
6 ---> 0b0000110
----------------------
98 <--- 0b1100010 (result of XOR'ing the bits)
The math should be fixed (i.e. use the proper operators/methods) to actually yield 10 million, that is 10 tokens using 6 decimal places. As this stackoverflow answer points out, the ^ in Rust is doing a bitwise XOR and not exponentiation.
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. Remove stale label or comment or this will be closed in 5 days.
The following lines (program and test) actually yields 98 instead of the expected 10 million.
developer-content/content/courses/onchain-development/anchor-cpi.md
Line 557 in 3a4505e
developer-content/content/courses/onchain-development/anchor-cpi.md
Line 676 in 3a4505e
This is actually doing a bit-XOR between
10 * 10 = 100
and6
. In the provided test code, you can just print it and see. It actually doesThe math should be fixed (i.e. use the proper operators/methods) to actually yield 10 million, that is 10 tokens using 6 decimal places. As this stackoverflow answer points out, the
^
in Rust is doing a bitwise XOR and not exponentiation.The text was updated successfully, but these errors were encountered: