[erlang-bugs] error in rem operator

Jay Anderson <>
Thu May 10 06:04:17 CEST 2007

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


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

Now from the shell I did this:

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

This incorrectly gives 823543 instead of 0. Thanks!


More information about the erlang-bugs mailing list