Re: [Haskell-cafe] A few questions on primes generating.

2007-08-13 Thread ajb
G'day all. Quoting Andrew Coppin <[EMAIL PROTECTED]>: So many other programming languages allow weird things to happen with numeric overflows... it would be nice if Haskell didn't. It would nice if CPUs supported trapping integer arithmetic. Cheers, Andrew Bromage ___

Re: [Haskell-cafe] A few questions on primes generating.

2007-08-13 Thread Sebastian Sylvan
On 13/08/07, Pekka Karjalainen <[EMAIL PROTECTED]> wrote: > On 8/13/07, L.Guo <[EMAIL PROTECTED]> wrote: > > Hi All: > > Hello, > > > > > I am reading http://www.haskell.org/haskellwiki/Prime_numbers > > > > The code in sector "1 Bitwise prime sieve". > > > > I have 3 questions about it. > > > > 1)

Re: [Haskell-cafe] A few questions on primes generating.

2007-08-13 Thread Isaac Dupree
Andrew Coppin wrote: Stefan O'Rear wrote: Also, large numbers don't (this is arguably a bug...) have restricted types: [EMAIL PROTECTED]:~$ ghc -e '100 :: Int' -1486618624 So many other programming languages allow weird things to happen with numeric overflows... it would b

Re: [Haskell-cafe] A few questions on primes generating.

2007-08-13 Thread Andrew Coppin
Stefan O'Rear wrote: Also, large numbers don't (this is arguably a bug...) have restricted types: [EMAIL PROTECTED]:~$ ghc -e '100 :: Int' -1486618624 So many other programming languages allow weird things to happen with numeric overflows... it would be nice if Haskell didn

Re: [Haskell-cafe] A few questions on primes generating.

2007-08-13 Thread Isaac Dupree
L.Guo wrote: > Because 10,000,000 is too large for a Int On my pitiful system, > maxBound::Int 2147483647 is certainly greater than 1000 . > it is always in type of Integer or some higher level data type. Haskell doesn't do static checking like that. In GHC on my system (where 10,000,000,000

Re: [Haskell-cafe] A few questions on primes generating.

2007-08-13 Thread Stefan O'Rear
On Mon, Aug 13, 2007 at 11:23:59PM +0800, L.Guo wrote: > Because 10,000,000 is too large for a Int, it is always in type of Integer or > some higher level data type. In Haskell, Int always supports at least -536,870,912 to 536,870,911. Also, large numbers don't (this is arguably a bug...) have r

Re: [Haskell-cafe] A few questions on primes generating.

2007-08-13 Thread L.Guo
: [Haskell-cafe] A few questions on primes generating. On Tuesday 14 August 2007 00:22, L.Guo wrote: > 2) We have this type definition : > pureSieve :: Int -> Int >Why there is no error (type mismatch) of this call in func main : > pureSieve 1000 The Haskell Report s

Re: [Haskell-cafe] A few questions on primes generating.

2007-08-13 Thread Pekka Karjalainen
On 8/13/07, L.Guo <[EMAIL PROTECTED]> wrote: > Hi All: Hello, > > I am reading http://www.haskell.org/haskellwiki/Prime_numbers > > The code in sector "1 Bitwise prime sieve". > > I have 3 questions about it. > > 1) In function go, what does the number 46340 mean ? Is it sqrt(MAX_LONG) ? Yes, it

Re: [Haskell-cafe] A few questions on primes generating.

2007-08-13 Thread Alexis Hazell
On Tuesday 14 August 2007 00:22, L.Guo wrote: > 2) We have this type definition : > pureSieve :: Int -> Int >Why there is no error (type mismatch) of this call in func main : > pureSieve 1000 The Haskell Report says that an Int covers at least the range [- 2^29, 2^29 - 1], which

[Haskell-cafe] A few questions on primes generating.

2007-08-13 Thread L.Guo
Hi All: I am reading http://www.haskell.org/haskellwiki/Prime_numbers The code in sector "1 Bitwise prime sieve". I have 3 questions about it. 1) In function go, what does the number 46340 mean ? Is it sqrt(MAX_LONG) ? 2) We have this type definition : pureSieve :: Int -> Int Why there i