Integer overflow. factorial 50 mod 2^32 = 0. Change "Int" to "Integer" to get the correct result (30414093201713378043612608166064768844377641568960512000000000000).
On Mon, Jan 21, 2013 at 12:17 AM, <[email protected]> wrote: > The program looks like this: > > --*********************** > factorial :: Int->Int > factorial n = product [1..n] > > main = do > print $ factorial 50 > --*********************** > > And that yields "0" (no errors). Is it a bug or feature? :) > > ______________________________ > Акция! Скидка до - 50% на колготы зимних коллекций в Линии магазинов EVA! > http://go.meta.ua/eva_colgotes > > > _______________________________________________ > Haskell mailing list > [email protected] > http://www.haskell.org/mailman/listinfo/haskell > -- Gregory Collins <[email protected]>
_______________________________________________ Haskell mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell
