rpl.rb/lib/core/mode.rb

28 lines
532 B
Ruby
Raw Normal View History

2021-12-07 16:09:17 +01:00
# frozen_string_literal: true
2022-02-10 14:50:59 +01:00
module Lang
module Core
module_function
2022-02-10 14:50:59 +01:00
# set float precision in bits. ex: 256 prec
def prec
args = stack_extract( [%i[numeric]] )
2022-02-10 14:50:59 +01:00
@precision = args[0][:value]
end
2022-02-10 14:50:59 +01:00
# set float representation and precision to default
def default
@precision = default_precision
end
2022-02-10 14:50:59 +01:00
# show type of stack first entry
def type
args = stack_extract( [:any] )
2022-02-10 14:50:59 +01:00
@stack << { type: :string,
value: args[0][:type].to_s }
end
end
end