search

Home  >  Q&A  >  body text

java - scala给BigInt赋初值失败?

巴扎黑巴扎黑2945 days ago552

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-04-18 10:40:33

    The problem is not with BigInt, but with the literal on the right that cannot be evaluated.

    scala> 1881676371789154860897069000
    <console>:1: error: integer number too large
    1881676371789154860897069000

    BigInt can be initialized with string

    scala> BigInt("12345667890087234578023089723457234705892375071881676371789154860897069000")
    res0: scala.math.BigInt = 12345667890087234578023089723457234705892375071881676371789154860897069000

    reply
    0
  • Cancelreply