simplify D→R and R→D, fix R→D test

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

View file

@ -91,7 +91,7 @@ module Rpl
# convert degrees to radians
def degrees_to_radians( stack, dictionary )
stack << { value: '𝛑 * 180 /',
stack << { value: '𝛑 180 / *',
type: :program }
Rpl::Lang::Core.eval( stack, dictionary )
@ -99,7 +99,7 @@ module Rpl
# convert radians to degrees
def radians_to_degrees( stack, dictionary )
stack << { value: '180 * 𝛑 /',
stack << { value: '𝛑 180 / /',
type: :program }
Rpl::Lang::Core.eval( stack, dictionary )

View file

@ -64,8 +64,8 @@ class TesttLanguageOperations < Test::Unit::TestCase
def test_rd
lang = Rpl::Language.new
lang.run '2.6179938780 r→d'
assert_equal [{ value: 150, type: :numeric, base: 10 }],
lang.run 'pi r→d'
assert_equal [{ value: 180, type: :numeric, base: 10 }],
lang.stack
end
end