dart中整数的最大值是多少? [英] What is the max value of integer in dart?

查看:1875
本文介绍了dart中整数的最大值是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我到处都看过,但找不到任何与此主题相关的信息。
另外,dart中是否有java-像Long / BigDecimal数据类型?

I have looked everywhere but I couldnt find any information related to this topic. Also, Is there a java - like Long / BigDecimal datatype in dart?

推荐答案

这取决于您是否正在运行

That depends if you are running in the Dart VM or compiling to JavaScript.

在Dart VM上, int 是任意精度,没有限制

On the Dart VM an int is arbitrary precision and has no limit.

编译为JavaScript时,您实际上使用的是浮点数,因为这是JavaScript支持的全部。这意味着您只能代表-2 53 到2 53

When compiling to JavaScript you are actually using floating point numbers, since that is all that JavaScript supports. This means you are restricted to representing integers within the range -253 to 253

这篇关于dart中整数的最大值是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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