Re: [Haskell-cafe] Numeric Class Problem

2007-01-28 Thread Brandon S. Allbery KF8NH
On Jan 28, 2007, at 13:01 , Dennis Buchmann wrote: It should look like this: floor(j * (n / p2n)) where j is an Integer, n is the length of a list, therefore Integer too, and p2n is 2^n. When i use the former line in my Haskell code (pasted at the end of this mail), i get the fol

Re: [Haskell-cafe] Numeric Class Problem

2007-01-28 Thread Neil Mitchell
Hi Dennis, (/) :: Fractional a => a -> a -> a div :: Integral a => a -> a -> a Basically, use / on Float/Double like things, and div on Int/Integer like things: If you do want to use double like things throughout, then using fromInteger around the place will help: floor (fromInteger j * (fromI

[Haskell-cafe] Numeric Class Problem

2007-01-28 Thread Dennis Buchmann
I've got a little problem i don't understand. I need to calculate an index for a list (by use of !!). It should look like this: floor(j * (n / p2n)) where j is an Integer, n is the length of a list, therefore Integer too, and p2n is 2^n. When i use the former line in my Haskell code (past