Ad
  • Default User Avatar

    make sure your types can fit your values

    your rounding error probably comes from involving f64, python:

    >>> int(float(9**19))
    1350851717672992000
    

    likewise, make sure you use a large enough integer type - for example, 1350851717672992000 barely fits in a 64-bit int but not in a 32-bit int, and if you were to go a bit bigger than that you would overflow the 64-bit int as well

  • Default User Avatar

    Have you resolved it? I have the same problem