简体   繁体   English

Flex中的最大整数值是多少?

[英]What is the maximum integer value in Flex?

I was trying to display a number: 2893604342.00. 我试图显示一个数字:2893604342.00。 But, when i am displaying it it is displayed as: -2893604342. 但是,当我显示它时,它显示为:-2893604342。

Following is the code snippet ... 以下是代码片段......

avg += int(totalData[i][col.dataField]); 

I have even replaced it with Number , but it's still showing the same negative number. 我甚至用Number替换了它,但它仍然显示相同的负数。

Please let me know whether there is any problem with int or Number ! 请告诉我intNumber是否有任何问题!

The maximum values are accessible through each numeric type's static properties: 可以通过每个数字类型的静态属性访问最大值:

  • Number.MAX_VALUE
  • uint.MAX_VALUE
  • int.MAX_VALUE

(Just trace 'em.) (只是跟踪他们。)

integers in flash are 32 bits, so an unsigned int's max value is (2^32)-1, 0xffffff or 4294967295. a signed int's max positive value is (2^(32-1))-1 or 2147483647 (one of the bits is used for the sign). flash中的整数是32位,因此unsigned int的最大值是(2 ^ 32)-1,0xffffff或4294967295. signed int的最大正值是(2 ^(32-1)) - 1或2147483647(其中一个位用于符号)。 the Number type is 64 bits. 数字类型是64位。

in order to guarantee space for your result, type the variable to Number and cast the result to Number (or not at all). 为了保证结果的空间,将变量键入Number并将结果转换为Number(或根本不显示)。

var avg : Number = 0; var avg:Number = 0; ... avg += totalData[i][col.dataField] as Number; ... avg + = totalData [i] [col.dataField]为Number;

尝试将其转换为uint而不是int

The largest exact integral value is 2^53, Remember ActionScript is ECMA at heart. 最大的精确积分值是2 ^ 53,记住ActionScript是ECMA的核心。 Look for the operator ToInt32 for more info on that. 查找运营商ToInt32以获取更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM