#3981: Value of function differs for arguments of the same value
------------------------+---------------------------------------------------
    Reporter:  kirstin  |       Owner:                             
        Type:  bug      |      Status:  new                        
    Priority:  normal   |   Component:  Compiler                   
     Version:  6.12.1   |    Keywords:                             
          Os:  Linux    |    Testcase:                             
Architecture:  x86      |     Failure:  Incorrect result at runtime
------------------------+---------------------------------------------------
 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}}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3981>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to