Value of function differs for arguments of the same value
I'm getting a different result from the same function depending on whether I pass a value or a function that returns that value. This happens with ghci and ghc.
I would expect to the the same result. Given:
x = [(),(),(),(),(),(),(),(),(),(),(),(),(),(),()]
choose 0 _ = 0
choose _ 0 = 0
choose n m = factorial n `div` (factorial (n - m) * factorial m)
factorial n = product [1..n]
Then:
> length x
=> 15
> choose (length x) 2
=> -5
> choose 15 2
=> 105
Info:
Debian Squeeze: Linux velox 2.6.32-trunk-686 #1 SMP Sun Jan 10 06:32:16 UTC 2010 i686 GNU/Linux
Trac metadata
Trac field | Value |
---|---|
Version | 6.12.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |