Is there a constant for max/min int/double value in dart?

前端 未结 3 727
南笙
南笙 2020-12-20 12:01

Is there a constant in dart that tells us what is the max/min int/double value ?

Something like double.infinity but instead double.maxValue

相关标签:
3条回答
  • 2020-12-20 12:17

    I found this from dart_numerics package.

    0 讨论(0)
  • 2020-12-20 12:35

    here you are the int64 max value:

    const int int64MaxValue = 9223372036854775807;
    
    0 讨论(0)
  • 2020-12-20 12:38

    For double there are

    double.maxFinite (1.7976931348623157e+308)
    double.minPositive (5e-324)

    In Dart 1 there was no such number for int. The size of integers was limited only by available memory

    In Dart 2 int is limited to 64 bit, but it doesn't look like there are constants yet.

    For dart2js different rules apply

    When compiling to JavaScript, integers are therefore restricted to 53 significant bits because all JavaScript numbers are double-precision floating point values.

    0 讨论(0)
提交回复
热议问题