飞镖的最大/最小整数/双精度值是否有常数? [英] Is there a constant for max/min int/double value in dart?
问题描述
dart中是否有一个常量告诉我们最大/最小int / double值是什么?
Is there a constant in dart that tells us what is the max/min int/double value ?
类似于 double.infinity
而是 double.maxValue
吗?
推荐答案
对于 double
,有
double.maxFinite
( 1.7976931348623157e + 308
)
double.minPositive
( 5e-324
)
在Dart 1中, int
没有这样的数字。整数的大小仅受可用内存限制
In Dart 1 there was no such number for int
. The size of integers was limited only by available memory
在Dart 2中, int
限制为64位,但是
In Dart 2 int
is limited to 64 bit, but it doesn't look like there are constants yet.
对于dart2js,适用不同的规则
For dart2js different rules apply
编译为JavaScript时,由于所有JavaScript数字都是双精度浮点值,因此整数限制为53个有效位。
When compiling to JavaScript, integers are therefore restricted to 53 significant bits because all JavaScript numbers are double-precision floating point values.
这篇关于飞镖的最大/最小整数/双精度值是否有常数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!