summaryrefslogtreecommitdiff
path: root/MLKRatio.m
diff options
context:
space:
mode:
Diffstat (limited to 'MLKRatio.m')
-rw-r--r--MLKRatio.m5
1 files changed, 3 insertions, 2 deletions
diff --git a/MLKRatio.m b/MLKRatio.m
index 3685f1c..476af42 100644
--- a/MLKRatio.m
+++ b/MLKRatio.m
@@ -41,6 +41,7 @@
self = [super init];
mpq_init (value);
mpq_set_str (value, [string UTF8String], 10);
+ mpq_canonicalize (value);
return self;
}
@@ -49,8 +50,8 @@
negative:(BOOL)negative
base:(unsigned int)base
{
- return [self initWithString:[NSString stringWithFormat:@"%c%@/%@",
- (negative ? '-' : '+'),
+ return [self initWithString:[NSString stringWithFormat:@"%s%@/%@",
+ (negative ? "-" : ""),
numerString,
denomString]
base:base];