Opened 9 years ago

Closed 9 years ago

#5178 closed bug (fixed)

RULES "minusFloat x x" and "timesFloat 0.0 x" break IEEE-754 compatibility

Reported by: liyang Owned by: simonmar
Priority: high Milestone: 7.2.1
Component: libraries/base Version: 7.0.3
Keywords: Cc: hackage.haskell.org@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect result at runtime Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

In GHC/Base.lhs, a comment around line ~778 notes that the following rules for Doubles give the wrong answer for NaN:

"minusDouble x x"    forall x#. (-##) x#    x#    = 0.0##
"timesDouble 0.0 x"  forall x#. (*##) 0.0## x#    = 0.0##
"timesDouble x 0.0"  forall x#. (*##) x#    0.0## = 0.0##

However, immediately above are corresponding rules for Floats:

"minusFloat x x"    forall x#. minusFloat# x#   x#   = 0.0#
"timesFloat x 0.0"  forall x#. timesFloat# x#   0.0# = 0.0#
"timesFloat0.0 x"   forall x#. timesFloat# 0.0# x#   = 0.0#

These should probably be removed.

Change History (3)

comment:1 Changed 9 years ago by liyang

Cc: hackage.haskell.org@… added

I've uploaded a hackage for users who want these rules: http://hackage.haskell.org/package/fast-math

comment:2 Changed 9 years ago by simonmar

Milestone: 7.2.1
Owner: set to simonmar
Priority: normalhigh

comment:3 Changed 9 years ago by simonmar

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.