summaryrefslogtreecommitdiffstats
path: root/general/Frac.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-02-23 03:40:24 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-02-23 03:40:24 +0000
commitd7bc310363c98994457e7882e7010e276169f00a (patch)
treeb59a7e27c9c5a9fc15c959a289b9ab105127a4aa /general/Frac.cpp
parent426721374e515ed14fc3b8d2afabfbb34e223e60 (diff)
downloadsigen-d7bc310363c98994457e7882e7010e276169f00a.tar.gz
sigen-d7bc310363c98994457e7882e7010e276169f00a.tar.xz
sigen-d7bc310363c98994457e7882e7010e276169f00a.zip
[FIX] Frac bug with type of Over1
[FIX] PokemodUI vtable errors [FIX] Manual .pro file clean up [FIX] Was attempting to emit a slot... git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@72 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'general/Frac.cpp')
-rw-r--r--general/Frac.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/general/Frac.cpp b/general/Frac.cpp
index 9cf47aca..317fdc53 100644
--- a/general/Frac.cpp
+++ b/general/Frac.cpp
@@ -24,7 +24,7 @@
void Frac::set(const int n, const int d) throw(Exception)
{
- if (((type == Improper) || ((n <= d) && (type == Proper)) || ((d < n) && (type == Over1))) && (0 < d))
+ if (((type == Improper) || ((n <= d) && (type == Proper)) || ((d <= n) && (type == Over1))) && (0 < d))
{
num = n;
denom = d;
@@ -64,13 +64,8 @@ void Frac::reduce()
{
int i = num;
int j = denom;
- int k;
- while (j)
- {
- k = j;
- j = i % j;
- i = k;
- }
+ while (i - j)
+ (i > j) ? (i -= j) : (j -= i);
num /= i;
denom /= i;
}