ANSI Forth BASE上限与gforth上限之间的相互关系? [英] ANSI Forth BASE upper limit vs. gforth upper limit, to and from?

查看:105
本文介绍了ANSI Forth BASE上限与gforth上限之间的相互关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用BASEgforth版本显示BASE可以用于大多数语言允许的值之后的值.例如,这将以十进制打印数字 0ABC(base 15950),反之亦然:

Fiddling with the gforth version of BASE shows that BASE can be used for values past those most languages permit. For example, this prints the number 0ABC (base 15950) in decimal, and vice versa:

gforth -e '15950 base ! ABC decimal . cr bye'
gforth -e '2544200462 15950 base ! . cr bye'

输出:

2544200462
ABC

在不编写其他 Forth 单词的情况下,对于和<的有意义的转换,默认的Gforth和 ANSI Forth BASE的上限是多少?是来自不同基数的?

Without writing additional Forth words, what are the default Gforth and ANSI Forth BASE upper limits for meaningful conversions both to and from numbers of different bases?

(暂时忽略映射现有字符集以描绘任意基数的复杂性,或者想象一个无尽的分形字符集,当需要新字符时,该字符集只会增加30-150度的衬线.)

(Ignore for the moment the complexities of mapping an existing character set to depict some arbitrary radix, or else imagine an endless fractal character set that adds little 30-150 degree serifs when new characters are needed.)

推荐答案

根据 standard ,是

BASE

BASE

(--a-addr)

a-addr是包含当前数字转换基数{{2 ... 36}}的单元格的地址.

a-addr is the address of a cell containing the current number-conversion radix {{2...36}}.

现在是2..36.

这很有道理,不是吗?

That makes sense, doesn't it?

  • 下限为2,因为任何小于2的数字都是无用的.
  • 上限为36,因为它允许数字0-9和A-Z,不区分大小写.

这篇关于ANSI Forth BASE上限与gforth上限之间的相互关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆