Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
howto:calculate-dc [2016/07/19 13:04]
tejr [Scale And Base] Prevent << becoming a double left angle quote
howto:calculate-dc [2017/01/02 08:25] (current)
gerbehar [Conditionals and Loops] typo corrected
Line 226: Line 226:
 </​code>​ </​code>​
  
-Some ''​dc''​ have ''>​R <R =R'',​ GNU ''​dc''​ had some more, check your manual. ​Not +Some ''​dc''​ have ''>​R <R =R'',​ GNU ''​dc''​ had some more, check your manual. ​Note 
-that the test "​consumes"​ its operands the 2 first elements are popped+that the test "​consumes"​ its operandsthe 2 first elements are popped
 off the stack (you can verify that ''​dc <<<​ "[f]sR 2 1 >R 1 2 >R f"''​ off the stack (you can verify that ''​dc <<<​ "[f]sR 2 1 >R 1 2 >R f"''​
 doesn'​t print anything) doesn'​t print anything)
Line 252: Line 252:
   1 -      # we decrement the index by one   1 -      # we decrement the index by one
   si    # store decremented index (i=i-1)   si    # store decremented index (i=i-1)
- 0 li >L   # if i > 0 the execute L+ 0 li >L   # if i > 0 then execute L
 ] sL       # store our macro with the name L ] sL       # store our macro with the name L