Attachments you submit will be routed for moderation. If you have an account, please
log in first.
Ticket #3363: 0001-Fix-error-in-Rational-division.patch
|
File 0001-Fix-error-in-Rational-division.patch, 0.8 KB
(added by miguelgarcia, 14 months ago)
|
|
patch for rational division
|
-
From c069c27df4c172ce90ff49370d8681255f0214e3 Mon Sep 17 00:00:00 2001
From: Miguel Garcia <miguel.garcia@gmail.com>
Date: Tue, 13 Mar 2012 04:30:41 -0300
Subject: [PATCH] Fix error in Rational division
---
rational.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/rational.py b/rational.py
index 34b298f..f99f610 100644
|
a
|
b
|
|
| 113 | 113 | |
| 114 | 114 | def __div__(self, rval): |
| 115 | 115 | if isinstance(rval, Rational): |
| 116 | | ret = Rational(self.d * rval.d, self.n * rval.n) |
| | 116 | ret = Rational(self.n * rval.d, self.d * rval.n) |
| 117 | 117 | elif type(rval) is types.IntType or type(rval) is types.LongType: |
| 118 | 118 | ret = Rational(self.n, self.d * rval) |
| 119 | 119 | else: |
Download in other formats: