[GHC] #1254: truncate = float2Int rule is incorrect

GHC trac at galois.com
Thu Jun 7 05:31:44 EDT 2007


#1254: truncate = float2Int rule is incorrect
-----------------------------------+----------------------------------------
    Reporter:  brian at brianweb.net  |        Owner:             
        Type:  bug                 |       Status:  new        
    Priority:  lowest              |    Milestone:  6.8        
   Component:  libraries/base      |      Version:  6.7        
    Severity:  minor               |   Resolution:             
    Keywords:                      |   Difficulty:  Easy (1 hr)
          Os:  Multiple            |     Testcase:  arith005   
Architecture:  powerpc             |  
-----------------------------------+----------------------------------------
Changes (by simonmar):

  * milestone:  _|_ => 6.8
  * testcase:  => arith005

Comment:

 There's more: float2Int# is implemented in the C backend as a cast.  The C
 spec does not define the result of the cast when the result would be
 outside the range of the destination type, so we get unpredictable
 results.

 The Haskell report doesn't say what should happen in the case of
 `truncate` when the result doesn't fit, and the description for
 `properFraction` doesn't either.  Therefore I guess the result is
 undefined for Haskell 98, we should clarify for Haskell'.

 Bottom line: I think the test should be fixed (arith005), and this isn't a
 bug.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1254>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
-------------- next part --------------
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs at haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


More information about the Glasgow-haskell-bugs mailing list