What is the maximum value of an int in ChucK? Is there a symbolic constant for it?
ChucK中int的最大值是多少?它有一个象征性的常数吗?
2 个解决方案
#1
5
New in the latest version!
最新版本中的新功能!
<<<Math.INT_MAX>>>;
For reference though, it uses the "long
" keyword in C++ to represent integers. So on 32-bit computers the max should be 0x7FFFFFFF
, or 2147483647
. On 64-bit computers it will be 0x7FFFFFFFFFFFFFFFFF
, or 9223372036854775807
.
但作为参考,它使用C ++中的“long”关键字来表示整数。所以在32位计算机上,max应该是0x7FFFFFFF,或2147483647.在64位计算机上,它将是0x7FFFFFFFFFFFFFFFFF,或9223372036854775807。
Answer from Kassen and Stephen Sinclair on the chuck-users mailing list.
Kassen和Stephen Sinclair在chuck-users邮件列表上的回答。
#2
1
The ChucK API reference uses the C int
type, so the maximum value would depend on your local machine (2^31-1, around two billion on standard 32-bit x86). I don't see any references to retrieving limits, but if ChucK is extensible using C you could add a function that returns MAXINT
.
ChucK API引用使用C int类型,因此最大值将取决于您的本地计算机(2 ^ 31-1,标准32位x86上大约20亿)。我没有看到任何引用检索限制,但如果ChucK可以使用C扩展,则可以添加一个返回MAXINT的函数。
#1
5
New in the latest version!
最新版本中的新功能!
<<<Math.INT_MAX>>>;
For reference though, it uses the "long
" keyword in C++ to represent integers. So on 32-bit computers the max should be 0x7FFFFFFF
, or 2147483647
. On 64-bit computers it will be 0x7FFFFFFFFFFFFFFFFF
, or 9223372036854775807
.
但作为参考,它使用C ++中的“long”关键字来表示整数。所以在32位计算机上,max应该是0x7FFFFFFF,或2147483647.在64位计算机上,它将是0x7FFFFFFFFFFFFFFFFF,或9223372036854775807。
Answer from Kassen and Stephen Sinclair on the chuck-users mailing list.
Kassen和Stephen Sinclair在chuck-users邮件列表上的回答。
#2
1
The ChucK API reference uses the C int
type, so the maximum value would depend on your local machine (2^31-1, around two billion on standard 32-bit x86). I don't see any references to retrieving limits, but if ChucK is extensible using C you could add a function that returns MAXINT
.
ChucK API引用使用C int类型,因此最大值将取决于您的本地计算机(2 ^ 31-1,标准32位x86上大约20亿)。我没有看到任何引用检索限制,但如果ChucK可以使用C扩展,则可以添加一个返回MAXINT的函数。