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