[erlang-bugs] error in rem operator

Jay Anderson horndude77@REDACTED
Thu May 10 06:04:17 CEST 2007


I think I may have found a bug. Here's my factorial function:

/////
-module(fact).
-export([fact/1]).

fact(N) -> fact(N,1).
fact(0,P) -> P;
fact(N,P) -> fact(N-1,P*N).
/////

Now from the shell I did this:

c(fact).
X = fact:fact(1000).
X rem 823543. %7^7=823543

This incorrectly gives 823543 instead of 0. Thanks!

-----Jay




More information about the erlang-bugs mailing list