fix ACOS and pass some tests (still fragile)

This commit is contained in:
Gwenhael Le Moine 2022-02-02 16:15:44 +01:00
parent 0c0bd2ea9f
commit 77946e56f7
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
2 changed files with 7 additions and 7 deletions

View file

@ -57,7 +57,7 @@ module Rpl
def arg_cosinus( stack, dictionary )
stack << { value: '
dup 0 ==
« 𝛑 2 / »
« drop 𝛑 2 / »
«
dup sq 1 swap - sqrt / atan
dup 0 <

View file

@ -22,8 +22,8 @@ class TesttLanguageOperations < Test::Unit::TestCase
def test_asin
lang = Rpl::Language.new
lang.run '0.14112000806 asin'
assert_equal [{ value: Math.asin( 0.14112000806 ), type: :numeric, base: 10 }],
lang.run '1 asin pi 2 / =='
assert_equal [{ value: true, type: :boolean }],
lang.stack
end
@ -36,15 +36,15 @@ class TesttLanguageOperations < Test::Unit::TestCase
def test_acos
lang = Rpl::Language.new
lang.run '0.5 acos'
assert_equal [{ value: Math.acos( 0.5 ), type: :numeric, base: 10 }],
lang.run '0 acos pi 2 / =='
assert_equal [{ value: true, type: :boolean }],
lang.stack
end
def test_tan
lang = Rpl::Language.new
lang.run '1 tan'
assert_equal [{ value: Math.tan( 1 ), type: :numeric, base: 10 }],
lang.run '0 tan 0 =='
assert_equal [{ value: true, type: :boolean }],
lang.stack
end