• hadesM
    link
    fedilink
    arrow-up
    9
    ·
    4 months ago

    it all fit in int64 tho, so could be worse

    • cabhan@discuss.tchncs.de
      link
      fedilink
      arrow-up
      2
      ·
      4 months ago

      I always have this thought. I’m doing it in Rust, so I check if there are negative numbers: if not, use usize. But I’m always terrified there will be an overflow somewhere.

      If I were using Kotlin or Java, I might always use BigInteger just out of fear.

      • hadesM
        link
        fedilink
        arrow-up
        1
        ·
        4 months ago

        That’s a very interesting thought! I was thinking of writing my own Rust data type that would automatically upgrade to big integer, similarly to the int type in Python.

      • GiantTree@feddit.org
        link
        fedilink
        arrow-up
        1
        ·
        4 months ago

        I am doing AOC in Kotlin. Longs are fine. I haven’t encountered a puzzle that required ULong or BigInteger.