再在ActionScript 3 present 9999999999999999 [英] Represent 9999999999999999 in actionscript 3

查看:145
本文介绍了再在ActionScript 3 present 9999999999999999的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图存储10 16 - 1在变量:

I tried storing 1016 - 1 in a Number variable:

var n:Number = 9999999999999999

而存储在值 N 最终被100000000亿,或10 17

but the value stored in n ends up being 10000000000000000, or 1017.

我怎样才能重新present 10 16 - 1在ActionScript 3

How can I represent 1016 - 1 in actionscript 3?

推荐答案

您已经跑出数类型$ P ​​$ pcision能力,所以你必须要设计出你自己的方式来存储数字这个大所要求的precision。其中一个操作长算术最常见的方式是使用字符串作为数据的持有人,另一种是使用向量整数的,再$ P $每个位置psenting 2 ^ 32为基础的系统的大数字。由于AS3的限制,我会说,整数的向量会更快,虽然显示很长的数字将与基于字符串的方法更简单。

You've ran out of Number type precision capability, so you'll have to devise your own way to store numbers this big with the required precision. One of the most common way to operate long arithmetic is using strings as data holders, another is using a vector of ints, each position representing a "big digit" of a 2^32 based system. Given AS3 constraints, I'd say a vector of ints would be faster, although displaying a long number will be easier with string based approach.

这篇关于再在ActionScript 3 present 9999999999999999的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆