From 799debe8d71768560322ca5aabecbe7f94eaa12c Mon Sep 17 00:00:00 2001
From: Daniel Fischer <daniel.is.fischer@googlemail.com>
Date: Mon, 30 May 2011 03:12:37 +0200
Subject: [PATCH] Change gcd to reduce occurrences of negative results.
---
GHC/Real.lhs | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/GHC/Real.lhs b/GHC/Real.lhs
index 27b1b6c..f935151 100644
|
a
|
b
|
|
| 530 | 530 | -- the result may be negative if one of the arguments is @'minBound'@ (and |
| 531 | 531 | -- necessarily is if the other is @0@ or @'minBound'@) for such types. |
| 532 | 532 | gcd :: (Integral a) => a -> a -> a |
| 533 | | gcd x y = gcd' (abs x) (abs y) |
| | 533 | gcd x y = abs (gcd' (abs x) (abs y)) |
| 534 | 534 | where gcd' a 0 = a |
| 535 | 535 | gcd' a b = gcd' b (a `rem` b) |
| 536 | 536 | |