> val ((a, b), (c, d)) = exp (fib, n) > -val () = print (LargeInt.toString a ^ "\n") > +val () = print (LargeInt.toString c ^ "\n") I made this change and now the outputs agree, and it is converted to decimal and printed without problems for input 25,999,999.