just a simple question regarding calculations in IJVM as I couldn't find the solution in their documentation.
Suppose we need to perform the following calculation:
BIPUSH 0x32 // PUSH 2
BIPUSH 0x33 // PUSH 3
IADD // PUSH sum(2,3)
OUT // output: "e"
IADD ----> Pop two words from stack; push their sum
I know the solution is likely straight forward, but for the life of me I can't recall on how to convert the addition/output to the actual digits. How to make it output "5" instead of this stupid "e"? :)
Cheers.
As expected, the answer to this problem was very simple. That's very much contradictory to actually finding the answer as no one seem to bother to mention this anywhere in the docs. Awesome.
Solution:
Or the actual code:
Subtracting 0 after performing addition forces it to treat this as an actual mathematical task with integers so to speak.