#37 10 ** 70 == 0?

open
nobody
None
5
2013-01-25
2007-09-30
Maciej Piechotka
No

It should notice that the noumber is too big rather then giving 0.
Zsh 2.3.4

Discussion

  • Still valid for 4.3.9

     
  • pir
    pir
    2010-07-28

    In fact, it's still worse.
    $ echo $((10**18))
    1000000000000000000
    $ echo $((10**19))
    -8446744073709551616
    $ echo $((2**63-1))
    9223372036854775807
    $ echo $((2**63))
    -9223372036854775808
    $ bc
    2^63-1
    9223372036854775807
    2^63
    9223372036854775808
    $ echo $ZSH_VERSION
    4.3.10

    So, the results are wrong from 2**63.
    The same results appear in bash, so it could not be a zsh problem.

    I don't think this is important because one doesn't make big math in the shell.
    bc works well.