JavaScript的64位数字precision [英] JavaScript 64 bit numeric precision
本文介绍了JavaScript的64位数字precision的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法重新present一批比53位precision在JavaScript中高?换句话说,有没有办法重新present 64位precision多少?
Is there a way to represent a number with higher than 53-bit precision in JavaScript? In other words, is there a way to represent 64-bit precision number?
我想实现一些逻辑,其中重presents东西一个64位数字的每一位。我失去了低显著位,当我尝试设置位高于2 ^ 53。
I am trying to implement some logic in which each bit of a 64-bit number represents something. I lose the lower significant bits when I try to set bits higher than 2^53.
Math.pow(2,53) + Math.pow(2,0) == Math.pow(2,53)
有没有一种方法来实现自定义库或东西来实现这一目标?
Is there a way to implement a custom library or something to achieve this?
推荐答案
谷歌的封闭图书馆拥有的 goog.math.Long 用于这一目的。
Google's Closure library has goog.math.Long for this purpose.
这篇关于JavaScript的64位数字precision的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文