Skip to content

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

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.

Trac metadata
Trac field Value
Version 7.0.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information