[MLton] Re: [Haskell-cafe] fastest Fibonacci numbers in the West
William Lee Irwin III
wli@holomorphy.com
Thu, 27 Jan 2005 10:31:47 -0800
On Thu, Jan 27, 2005 at 10:19:15AM -0800, Stephen Weeks wrote:
>> I suspect the difference in output file sizes is an off by one error
>> in the index of the number being printed. I'm curious how Matthew got
>> them to agree. Below is the code that I used to compare them -- it
>> fails with "not equal" for any input value.
On Thu, Jan 27, 2005 at 10:26:44AM -0800, William Lee Irwin III wrote:
> I start at fib 0 = 0; fib 1 = 1. Terpstra's starts at fib 1 = 0; fib 2 = 1.
> It's not usually an error per se, but merely a difference in conventions.
--- terpstra.sml.orig 2005-01-27 10:29:51.000000000 -0800
+++ terpstra.sml 2005-01-27 10:29:57.000000000 -0800
@@ -11,4 +11,4 @@
val fib = ((0, 1), (1, 1))
val n = (valOf o fromString o hd o CommandLine.arguments) ()
val ((a, b), (c, d)) = exp (fib, n)
-val () = print (LargeInt.toString a ^ "\n")
+val () = print (LargeInt.toString c ^ "\n")