From dd8edd627db73df28c6054c6120d7b2a11bf84b5 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Wed, 8 Dec 2021 16:07:16 +0100 Subject: [PATCH] better implementation leveraging CHS and INV --- lib/core/store.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/core/store.rb b/lib/core/store.rb index 2192277..20f06de 100644 --- a/lib/core/store.rb +++ b/lib/core/store.rb @@ -99,7 +99,7 @@ module Rpl # negate a variable. ex: 'name' sneg def sto_negate( stack, dictionary ) - stack << { value: '« dup rcl -1 * swap sto »', + stack << { value: '« dup rcl chs swap sto »', type: :program } Rpl::Lang::Core.eval( stack, dictionary ) @@ -107,7 +107,7 @@ module Rpl # inverse a variable. ex: 1 'name' sinv def sto_inverse( stack, dictionary ) - stack << { value: '« dup rcl 1 swap / swap sto »', + stack << { value: '« dup rcl inv swap sto »', type: :program } Rpl::Lang::Core.eval( stack, dictionary )