内部类型转换方法-ToInt32
2013-08-18 20:43
183 查看
ToInt32: (Signed 32 Bit Integer)
The abstract operation ToInt32 converts its argument to one of 232 integer values in the range −231 through231−1, inclusive. This abstract operation functions as follows:Let number be the result of calling ToNumber on the input argument.If number is NaN, +0, −0, +∞, or −∞, return +0.
Let posInt be sign(number) * floor(abs(number)).
Let int32bit be posInt modulo 232;
that is, a finite integer value k of Number type with positive sign and less than 232 in magnitude such that the mathematical difference of posInt and k is mathematically an integer multiple of 232.
If int32bit is greater than or equal to 231, return int32bit − 232, otherwise return int32bit.
sign , floor , abs , modulo 用法参见-> 这里
翻译成中文 !!!
抽象方法ToInt32将传入的参数转换成(-2^31,2^31-1]中的一个值。这个抽象方法的执行过程如下:1.将传入参数进行ToNumber转换,设结果为number2.如果number是NaN, +0, −0, +∞, or −∞ 直接返回03.设posInt 为sign(number) *floor(abs(number)) 4.设int32bit为posIntmodulo 2^32的值5.如果int32bit大于等于2^31,返回int32bit − 2^32, 否则返回 int32bit相关文章推荐
- 无法将类型为“IList”的对象强制转换为类型“System.Data.DataRowView” 。的解决方法
- 整型-文件-方法名-日期-文件拷贝-缩略图-JSON创建-PDF-HTTP-单例-抓屏-目录-ZIP-XML-Map-邮件-Array-beanCopy-数组类型转换-数组集合转换-枚举示例
- 总结c/c++中各种基本数据类型转换方法
- 基于java中byte数组与int类型的转换(两种方法)
- 对象不能从DBNull 转换为其他类型的解决方法
- Lua类型判断和转换的简易方法
- C++中四种类型转换运算符的使用方法
- 字符串格式格林威治时间转换为Date类型的方法
- 时间日期转换为字符串String类型及常用的方法
- winform dateTime数据类型转换方法
- siteweaver数据库类型由SQL Server转换成Access的方法_优化版
- 使用ASP.NET AJAX异步调用Web Service和页面中的类方法(9):服务器端和客户端数据类型的自动转换:DataTable和DataSet
- int类型和String类型相互转换方法总结
- java对象转换String类型的三种方法
- GSON toJson()以及fromJson()方法中int 和string类型都可以相互转换的
- PHP将对象转换成数组的方法(兼容多维数组类型)
- 求助!!java!! 求一个将 1维整型数组转换为字符串类型的方法!
- Python数据类型转换常用方法
- 浮点性(float)转化为字符串类型 自定义实现和深入探讨C++内部实现方法
- SQL Server数据类型转换方法