jQuery,如何处理大量数字 [英] Jquery, how to work with high numbers

查看:103
本文介绍了jQuery,如何处理大量数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要验证一些22个字符长的整数.我需要除以该数字并得到商和其余的占卜.但是,当我将其发送到模函数时,它将返回7.04406000774059e + 21

I need to validate some integer number which is 22 chars long. I need to divide that number and get quotient as well as remainder of divining. BUT, when I send it to modulo function, it returns 7.04406000774059e+21

labas = modulo(7044060007740589212932, 97);
function modulo (divident, divisor){
alert(divident);
}

推荐答案

有两个库可用于处理js中的大数:

There are a couple of libraries for handling big numbers in js:

  • biginteger (and description)
  • bignumber
  • jsbn
  • bignum

这篇关于jQuery,如何处理大量数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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