无法增加 AWK 的阶乘 int 限制

发布于 2024-07-25 20:29:18 字数 295 浏览 3 评论 0原文

我运行 AWK 代码 我得到

The factorial of 200 is inf

这表明我AWK 不使用与 Python 相同的 int IEEE 标准模块。 看来AWK的极限是170!。

如何让 AWK 能够像 Python 一样理解大整数?

I run the AWK code and I get

The factorial of 200 is inf

This suggests me that AWK does not use the same int IEEE-standard -module as Python.
It seems that AWK's limit is 170!.

How can you make AWK understand as large integers as Python?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

朦胧时间 2024-08-01 20:29:18

来自此处

所有数字(包括整数)的内部表示都使用双精度浮点数。 在大多数现代系统上,这些都是 IEEE 754 标准格式。

Python 可以具有任意长度的整数,具体取决于有效内存。 这与 IEEE 754 无关。顺便说一句,该标准给出了双精度浮点数的限制,约为 10^(+/-308)。 log10(factorial(171)) 的值为 > 309. 另请参阅双精度每个科学家都应该了解浮点运算

From here:

The internal representation of all numbers, including integers, uses double-precision floating-point numbers. On most modern systems, these are in IEEE 754 standard format.

Python can have integers of any length, depending on available memory. This is independent of IEEE 754. BTW, that standard gives the limit of a double precision float at about 10^(+/-308). The value of log10(factorial(171)) is > 309. See also Double Precision and What Every Scientist Should Know About Floating-Point Arithmetic.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文