Re: Fibonacci solution on RosettaCode
- Posted by jimcbrown (admin) Jan 30, 2011
- 1605 views
coconut said...
bruce1961 said...
I really like Euphoria! So incredibly expressive ...
I just put together a solution for Fibonacci Sequence, using an embedded byte-coded interpreter approach. I can see myself using this for quite a number of the other tasks.
Kind regards, Bruce.
Be serious, they where not asking for a compiler design exercice they were just asking for a fibonacci function. I added iterative and recursive version of it.
The stdlib version is just two lines:
include std/math.e ? fib(x)
It's implemented using the constant time formula.
public function fib(integer i) return floor((power( mathcons:PHI, i) / mathcons:SQRT5) + 0.5) end function