[英]Handling Large Numbers in JavaScript
I just moved from Float
to BigDecimal
in my java code because I am dealing with large numbers. 我只是在Java代码中从Float
移到BigDecimal
,因为我正在处理大量数字。 Now i need to figure out how to handle these numbers in my JSP pages where I am using some validations on these numbers. 现在,我需要弄清楚如何在我的JSP页面中处理这些数字,在这些页面上我对这些数字使用一些验证。 I am currently handling the numbers in javascript in the following way: 我目前正在以以下方式处理javascript中的数字:
var largeValue = parseFloat(document.getElementById('lValue').value);
and then I compare largeValue
to other values. 然后将largeValue
与其他值进行比较。 (lvalue is id of a field where the large value is stored) (左值是存储大值的字段的ID)
i need to know what is the limit of the 'parseFloat' method? 我需要知道“ parseFloat”方法的局限性是什么? and what would be a better way of comparing large numbers in javascript? 以及在javascript中比较大量数字的更好方法是什么?
Regards, Kaddy 问候,凯迪
我想这将是相同的,一个浮子可存储的最大值,即, 1.7976931348623157e+308
根据此 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.