Flash 如何处理从带有浮点数的数组中调用值?
How does flash handle calling a value from an array with a float?
我正在查看一些闪存代码,它从数组中调用一个值,索引是包含小数点的 'number' 数据类型。
该数组有 100 个索引长,并且在循环中使用不断变化的变量调用一个值,该值一度为 5.3。闪存如何处理这个问题?它是下限、上限还是四舍五入的值?没有异常被抛出。我正在将代码转换为 C#,所以我需要知道如何处理它。
var _loc8_:int = 0;
var _loc2_:String = param1.toString();
var _loc3_:int = _loc2_.length;
var _loc4_:int = 10;
var _loc5_:Number = 1;
var _loc6_:String = "";
var _loc7_:int = 0;
while(_loc7_ < _loc3_)
{
_loc8_ = param1 % _loc4_;
_loc8_ = _loc8_ * _loc5_;
_loc6_ = _loc6_ + this.scoreArray[_loc8_];
_loc4_ = _loc4_ * 10;
_loc5_ = _loc5_ * 0.1;
_loc7_++;
}
程序在闪存状态下运行良好,但我无法在 C# 中正确编译它。
提前致谢!
"A value is being called... at one point, is 5.3. How does flash handle this? Does it floor, ceiling, or round the value? No exceptions are thrown. I'm converting the code to C#"
AS3 的 Number data-type 是 "a data type representing an IEEE-754 double-precision floating-point number".
您可能希望使用 C# Double
来处理来自 Flash/AS3 的小数部分。
其中 AS3:
var myNum :Number = 5.3;
在 C# 中,其中一个可以工作...
float myFloat = 5.3f; //# 32-bit floating-point val... Has "f" suffix
double myDouble = 5.3d; //# 64-bit floating-point val... Has "d" suffix
我正在查看一些闪存代码,它从数组中调用一个值,索引是包含小数点的 'number' 数据类型。
该数组有 100 个索引长,并且在循环中使用不断变化的变量调用一个值,该值一度为 5.3。闪存如何处理这个问题?它是下限、上限还是四舍五入的值?没有异常被抛出。我正在将代码转换为 C#,所以我需要知道如何处理它。
var _loc8_:int = 0;
var _loc2_:String = param1.toString();
var _loc3_:int = _loc2_.length;
var _loc4_:int = 10;
var _loc5_:Number = 1;
var _loc6_:String = "";
var _loc7_:int = 0;
while(_loc7_ < _loc3_)
{
_loc8_ = param1 % _loc4_;
_loc8_ = _loc8_ * _loc5_;
_loc6_ = _loc6_ + this.scoreArray[_loc8_];
_loc4_ = _loc4_ * 10;
_loc5_ = _loc5_ * 0.1;
_loc7_++;
}
程序在闪存状态下运行良好,但我无法在 C# 中正确编译它。
提前致谢!
"A value is being called... at one point, is 5.3. How does flash handle this? Does it floor, ceiling, or round the value? No exceptions are thrown. I'm converting the code to C#"
AS3 的 Number data-type 是 "a data type representing an IEEE-754 double-precision floating-point number".
您可能希望使用 C# Double
来处理来自 Flash/AS3 的小数部分。
其中 AS3:
var myNum :Number = 5.3;
在 C# 中,其中一个可以工作...
float myFloat = 5.3f; //# 32-bit floating-point val... Has "f" suffix
double myDouble = 5.3d; //# 64-bit floating-point val... Has "d" suffix