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, <mip...@meta.ua> 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 > Haskell@haskell.org > http://www.haskell.org/mailman/listinfo/haskell > -- Gregory Collins <g...@gregorycollins.net>
_______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell