The precision seems to be lost at the point where n gets initialized as an int64 (54 binary digits), although modulo still works normally for smaller int64 types. (Could be a coincidence).
n