[GHC] #7460: Double literals generated bad core
GHC
cvs-ghc at haskell.org
Wed Dec 5 20:21:40 CET 2012
#7460: Double literals generated bad core
---------------------------------+------------------------------------------
Reporter: tibbe | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.4.2
Keywords: | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: Runtime performance bug
Difficulty: Unknown | Testcase:
Blockedby: | Blocking:
Related: |
---------------------------------+------------------------------------------
Comment(by tibbe):
This is how the C standard defines integer to/from floating point
conversions:
6.3.1.4 Real floating and integer
1 When a finite value of real floating type is converted to an integer type
other than _Bool,
the fractional part is discarded (i.e., the value is truncated toward
zero). If the value of
the integral part cannot be represented by the integer type, the behavior
is undefined.
61)
2 When a value of integer type is converted to a real floating type, if the
value being
converted can be represented exactly in the new type, it is unchanged. If
the value being
converted is in the range of values that can be represented but cannot be
represented
exactly, the result is either the nearest higher or nearest lower
representable value, chosen
in an implementation-defined manner. If the value being converted is
outside the range of
values that can be represented, the behavior is undefined. Results of some
implicit
conversions may be represented in greater range and precision than that
required by the
new type (see 6.3.1.8 and 6.8.6.4).
61) The remaindering operation performed when a value of integer type is
converted to unsigned type
need not be performed when a value of real floating type is converted to
unsigned type. Thus, the
range of portable real floating values is (−1, Utype_MAX+1).
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7460#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list