1 Jul 16:06
Re: what does when do here? fib(1200000) so slow, erlang cant handle big numbers?
From: Jesper Louis Andersen <jesper.louis.andersen <at> gmail.com>
Subject: Re: what does when do here? fib(1200000) so slow, erlang cant handle big numbers?
Newsgroups: gmane.comp.lang.erlang.general
Date: 2008-07-01 14:06:55 GMT
Subject: Re: what does when do here? fib(1200000) so slow, erlang cant handle big numbers?
Newsgroups: gmane.comp.lang.erlang.general
Date: 2008-07-01 14:06:55 GMT
2008/7/1 Edwin Fine <erlang-questions_efine <at> usa.net>: >The N > 0 prevents infinite recursion if you call fib(-1). It is much more powerful than that, as it also fails calls like fib(0.5) though it does so after a considerable amount of time. One could imagine moving the guard to the fib/1 call rather than having it on fib_i/3 with the possibility that the VM has to check it each time (I don't know what the VM does here, specifically). A check on is_integer/1 could eliminate the wait time as well.
RSS Feed