[GHC] #3070: floor(0/0) should not be defined
GHC
trac at galois.com
Wed Jul 15 15:49:59 EDT 2009
#3070: floor(0/0) should not be defined
---------------------------------+------------------------------------------
Reporter: carette | Owner: squadette
Type: bug | Status: new
Priority: normal | Milestone: 6.12.1
Component: Prelude | Version: 6.10.1
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Os: Unknown/Multiple
Architecture: Unknown/Multiple |
---------------------------------+------------------------------------------
Changes (by squadette):
* owner: => squadette
* cc: squadette at gmail.com (added)
Comment:
Same thing happens with exponent, significand, scaleFloat, truncate,
round, and ceiling.
I believe this patch should fix the problem:
http://mynd.rinet.ru/~alexm/floor-3070.patch
1. Of course, we get some performance hit, with two ifs for every call to
those functions, and the appearance of `undefined' (may it confuse the
optimizer somehow?)
However, most of them seem to be not very performance oriented (except
maybe for scaleFloat).
2. However, I believe that getting
significand (0/0) = -0.75
is not right, however fast it is.
3. withValidDouble could probably be made a monad of some sort?
4. properFraction should be reindented if this patch is applied. I did
not make it to minimize changes.
5. maybe we need a special compiler flag which means "do not bother
checking floats for validity, let the user handle details.
Thank you,
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3070#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list