Integers to Ints

Steinitz, Dominic J Dominic.J.Steinitz@BritishAirways.com
16 May 2001 12:47:25 Z


The consensus is that this is a bug.
---------------------- Forwarded by Dominic Steinitz/HEATHROW/BRITISH AIRWAYS/GB on 16/05/2001 13:48 ---------------------------


rjchaaft@cs.uu.nl on 16/05/2001 11:54:00
To:	haskell
cc:	
bcc:	Dominic Steinitz
Subject:	Re: Integers to Ints

Hello,

>Can someone explain the following behaviour? Or is it a bug in hugs?

I can not explain it. Rather strange is that even this is allowed:
(fromIntegral (toInteger (minBound::Int) + 1) -1) :: Int
yielding
-2147483648

> > (fromIntegral(toInteger(minBound::Int))::Int)
>
>Program error: {primIntegerToInt (-2147483648)}
>(15 reductions, 70 cells)
>
> > (fromIntegral(toInteger((minBound::Int)+1))::Int)
>-2147483647
>(21 reductions, 29 cells)
>
> > minBound::Int
>-2147483648
>(9 reductions, 19 cells)


_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell



-------------------------------------------------------------------------------------------------
21st century air travel     http://www.britishairways.com