search for: fib1

Displaying 2 results from an estimated 2 matches for "fib1".

Did you mean: fib
2010 Mar 03
1
[LLVMdev] llvm hangs: fibonacci numbers, recursive
...2 %fib) %i.next = add i32 %i, 1 %cond = icmp ult i32 %i.next, 7 br i1 %cond, label %loop, label %exit exit: ret void } define i32 @fib(i32 %n) nounwind { %cond = icmp ult i32 %n, 2 br i1 %cond, label %c1, label %c2 c1: ret i32 1 c2: %n1 = sub i32 %n, 1 %n2 = sub i32 %n, 2 %fib1 = call i32 @fib(i32 %n1) %fib2 = call i32 @fib(i32 %n2) %r = add i32 %fib1, %fib2 ret i32 %r } declare i32 @printf(i8*, ...) nounwind -------------- next part -------------- A non-text attachment was scrubbed... Name: fib.bc Type: application/octet-stream Size: 496 bytes Desc: not available...
2011 Apr 08
1
R and lazy evaluation
Haskell is the prototypical lazy evaluation language. One can compute a Fibonacci sequence by the Haaskell equivalent of the following R code. > fibs <- c(0, 1, rep(0, 8)) > fibs[3:10] <- fibs + fibs[-1] This works as follows. fibs = 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 fibs = 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 When one adds fibs to fibs[-1], one is effectively adding diagonally: fibs[3] <-