11 ms·
> there are very few software RPN calculators _that aren't just HP emulators. What about dc?
by u801e 3y ago
> there are very few software RPN calculators _that aren't just HP emulators.
What about dc?
- dheera 3y agohttps://i.imgur.com/2gPCYOF.png https://i.imgur.com/2gPCYOF.png wtf ok i'm going back to my HP49 emulator
- u801e 3y agoYou stored 3.14159 in register i and removed it from the top of the main stack. Then you tried to print the top of the empty stack with n and pop it. That's why you got the stack empty error.
- jacknobody 3y ago(Y)
- copperx 3y agoIt takes a minute to understand its operation, unlike any text editor.
- u801e 3y agoThe only real way to understand it is to read the man page. That said, once you get the hang of it, you can sum all numbers on the stack with the following program [ + z 1 <s ] ss ls x p The [ and ] delimit the macro definition that's placed on top of the stack. ss stores the just defined macro in register s and removes it from the top of the main stack. ls loads the macro from register s and places it on the top of the main stack. x executes the macro and p prints the final result. As for the macro, + pops the top two elements on the stack, adds them and places the result on the top of the stack. z pushes the stack size on top of the stack. 1 pushes 1 on top of the stack. <s pops the top two elemenets on the stack, compares them, and if the top element is less than the the second element, it executes the macro stored in register s. Otherwise, it doesn't do anything. The macro will execute as long as the stack size is greater than 1. Once the stack size is 1, it will terminate and the p command prints the sum of all the numbers on the stack.