From 9c3236394224167b31eeb402fa78928a0e3eb7fe Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Tue, 29 Jul 2008 19:56:21 +0200 Subject: Add a non-trivial number of arithmetic methods to number classes. --- MLKSingleFloat.m | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'MLKSingleFloat.m') diff --git a/MLKSingleFloat.m b/MLKSingleFloat.m index 9c2902f..1d3f957 100644 --- a/MLKSingleFloat.m +++ b/MLKSingleFloat.m @@ -126,6 +126,22 @@ return [MLKSingleFloat singleFloatWithFloat:(value / [(MLKFloat*)arg floatValue])]; } +-(NSComparisonResult) compare:(MLKSingleFloat *)arg +{ + if (self->value == arg->value) + return NSOrderedSame; + else if (self->value < arg->value) + return NSOrderedAscending; + else + return NSOrderedDescending; +} + +-(BOOL) isEqual:(id)arg +{ + return ([arg isKindOfClass:[MLKSingleFloat class]] + && self->value == ((MLKSingleFloat *)arg)->value); +} + -(NSString *) description { NSString *str = [NSString stringWithFormat:@"%e", value]; -- cgit v1.2.3