标签: forth gforth
在Gforth中,有没有办法将整数值添加到浮点值?
像1 + 2.1这样的东西?如果我1 2.1e f+我得到一个错误,我猜是因为这些值不在同一个堆栈上。我知道我可以做1.0e 2.1e f+,但这不是我想弄明白该怎么做的。
1 + 2.1
1 2.1e f+
1.0e 2.1e f+
答案 0 :(得分:3)
Gforth有s>f和d>f个单词,分别将int(单个单元格和双单元格)转换为双Gforth浮点函数doc here
s>f
d>f
1 s>f 2.1e f+
应该可以做到。