[project @ 2000-06-22 14:40:22 by simonpj]
authorsimonpj <unknown>
Thu, 22 Jun 2000 14:40:22 +0000 (14:40 +0000)
committersimonpj <unknown>
Thu, 22 Jun 2000 14:40:22 +0000 (14:40 +0000)
*** MERGE WITH 4.07 ***

* The divide by zero check in the constant-folding
  rules was testing the numerator not denominator!
  (For Float and Double.)

ghc/compiler/prelude/PrelRules.lhs

index 5f2c0df..bdf3627 100644 (file)
@@ -226,7 +226,7 @@ floatOp2  op name (MachFloat f1) (MachFloat f2)
 floatOp2  op name l1 l2 = Nothing
 
 floatOp2Z op name (MachFloat f1) (MachFloat f2)
-  | f1 /= 0   = Just (name, mkFloatVal (f1 `op` f2))
+  | f2 /= 0   = Just (name, mkFloatVal (f1 `op` f2))
 floatOp2Z op name l1 l2 = Nothing
 
 --------------------------
@@ -235,7 +235,7 @@ doubleOp2  op name (MachDouble f1) (MachDouble f2)
 doubleOp2 op name l1 l2 = Nothing
 
 doubleOp2Z op name (MachDouble f1) (MachDouble f2)
-  | f1 /= 0   = Just (name, mkDoubleVal (f1 `op` f2))
+  | f2 /= 0   = Just (name, mkDoubleVal (f1 `op` f2))
 doubleOp2Z op name l1 l2 = Nothing