better implementation leveraging CHS and INV
This commit is contained in:
parent
6b57d03627
commit
dd8edd627d
1 changed files with 2 additions and 2 deletions
|
@ -99,7 +99,7 @@ module Rpl
|
||||||
|
|
||||||
# negate a variable. ex: 'name' sneg
|
# negate a variable. ex: 'name' sneg
|
||||||
def sto_negate( stack, dictionary )
|
def sto_negate( stack, dictionary )
|
||||||
stack << { value: '« dup rcl -1 * swap sto »',
|
stack << { value: '« dup rcl chs swap sto »',
|
||||||
type: :program }
|
type: :program }
|
||||||
|
|
||||||
Rpl::Lang::Core.eval( stack, dictionary )
|
Rpl::Lang::Core.eval( stack, dictionary )
|
||||||
|
@ -107,7 +107,7 @@ module Rpl
|
||||||
|
|
||||||
# inverse a variable. ex: 1 'name' sinv
|
# inverse a variable. ex: 1 'name' sinv
|
||||||
def sto_inverse( stack, dictionary )
|
def sto_inverse( stack, dictionary )
|
||||||
stack << { value: '« dup rcl 1 swap / swap sto »',
|
stack << { value: '« dup rcl inv swap sto »',
|
||||||
type: :program }
|
type: :program }
|
||||||
|
|
||||||
Rpl::Lang::Core.eval( stack, dictionary )
|
Rpl::Lang::Core.eval( stack, dictionary )
|
||||||
|
|
Loading…
Reference in a new issue