• 请不要在回答技术问题时复制粘贴 AI 生成的内容
TimLang
V2EX  ›  程序员

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

  •  
  •   TimLang · Sep 2, 2014 · 4852 views
    This topic created in 4288 days ago, the information mentioned may be changed or developed.
    比如python: (14213636171468116403 ^ 3918389676463170483)
    #return 17519020606549733888
    6 replies    2014-09-03 09:49:49 +08:00
    pengweiqhca
        1
    pengweiqhca  
       Sep 2, 2014
    javascript的integer是一个大整数,在一定范围内你可以认为它是无限大的
    Golevka
        2
    Golevka  
       Sep 2, 2014
    toctan
        3
    toctan  
       Sep 2, 2014
    JS has only one number type, 64-bit floating point, no integers.
    Mutoo
        4
    Mutoo  
       Sep 2, 2014
    js的位运算会丢失32位以上的部分。似乎真的没办法支持64位。
    tdwyx
        5
    tdwyx  
       Sep 3, 2014
    http://mathjs.org/

    math.add(math.bignumber('12345678901234567890'), math.bignumber('12345678901234567890'));
    tdwyx
        6
    tdwyx  
       Sep 3, 2014
    又看了下,那个好像没有位运算的功能
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2920 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 62ms · UTC 03:19 · PVG 11:19 · LAX 20:19 · JFK 23:19
    ♥ Do have faith in what you're doing.