V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
TimLang
V2EX  ›  程序员

javascript 怎么支持 64bit 的 integer 做异或运算

  •  
  •   TimLang · 2014-09-02 18:14:29 +08:00 · 3868 次点击
    这是一个创建于 3495 天前的主题,其中的信息可能已经有所发展或是发生改变。
    比如python: (14213636171468116403 ^ 3918389676463170483)
    #return 17519020606549733888
    6 条回复    2014-09-03 09:49:49 +08:00
    pengweiqhca
        1
    pengweiqhca  
       2014-09-02 20:56:21 +08:00
    javascript的integer是一个大整数,在一定范围内你可以认为它是无限大的
    Golevka
        2
    Golevka  
       2014-09-02 21:35:10 +08:00
    toctan
        3
    toctan  
       2014-09-02 21:53:21 +08:00
    JS has only one number type, 64-bit floating point, no integers.
    Mutoo
        4
    Mutoo  
       2014-09-02 22:09:22 +08:00
    js的位运算会丢失32位以上的部分。似乎真的没办法支持64位。
    tdwyx
        5
    tdwyx  
       2014-09-03 09:20:21 +08:00
    http://mathjs.org/

    math.add(math.bignumber('12345678901234567890'), math.bignumber('12345678901234567890'));
    tdwyx
        6
    tdwyx  
       2014-09-03 09:49:49 +08:00
    又看了下,那个好像没有位运算的功能
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   959 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 21:44 · PVG 05:44 · LAX 14:44 · JFK 17:44
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.