From 26a11662d6d371a1d0c44de6bb028a1523ba4dc5 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Sun, 6 Jul 2008 23:53:04 +0200 Subject: Add class MLKNumber, unify arithmetic interface. --- MLKSingleFloat.m | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'MLKSingleFloat.m') diff --git a/MLKSingleFloat.m b/MLKSingleFloat.m index c10ccce..9c2902f 100644 --- a/MLKSingleFloat.m +++ b/MLKSingleFloat.m @@ -94,36 +94,36 @@ return value; } --(MLKFloat *) add:(MLKFloat *)arg +-(MLKNumber *) add:(MLKNumber *)arg { if ([arg isKindOfClass:[MLKDoubleFloat class]]) - return [MLKDoubleFloat doubleFloatWithDouble:(value + [arg doubleValue])]; + return [MLKDoubleFloat doubleFloatWithDouble:(value + [(MLKFloat*)arg doubleValue])]; else - return [MLKSingleFloat singleFloatWithFloat:(value + [arg floatValue])]; + return [MLKSingleFloat singleFloatWithFloat:(value + [(MLKFloat*)arg floatValue])]; } --(MLKFloat *) subtract:(MLKFloat *)arg +-(MLKNumber *) subtract:(MLKNumber *)arg { if ([arg isKindOfClass:[MLKDoubleFloat class]]) - return [MLKDoubleFloat doubleFloatWithDouble:(value - [arg doubleValue])]; + return [MLKDoubleFloat doubleFloatWithDouble:(value - [(MLKFloat*)arg doubleValue])]; else - return [MLKSingleFloat singleFloatWithFloat:(value - [arg floatValue])]; + return [MLKSingleFloat singleFloatWithFloat:(value - [(MLKFloat*)arg floatValue])]; } --(MLKFloat *) multiplyWith:(MLKFloat *)arg +-(MLKNumber *) multiplyWith:(MLKNumber *)arg { if ([arg isKindOfClass:[MLKDoubleFloat class]]) - return [MLKDoubleFloat doubleFloatWithDouble:(value * [arg doubleValue])]; + return [MLKDoubleFloat doubleFloatWithDouble:(value * [(MLKFloat*)arg doubleValue])]; else - return [MLKSingleFloat singleFloatWithFloat:(value * [arg floatValue])]; + return [MLKSingleFloat singleFloatWithFloat:(value * [(MLKFloat*)arg floatValue])]; } --(MLKFloat *) divideBy:(MLKFloat *)arg +-(MLKNumber *) divideBy:(MLKNumber *)arg { if ([arg isKindOfClass:[MLKDoubleFloat class]]) - return [MLKDoubleFloat doubleFloatWithDouble:(value / [arg doubleValue])]; + return [MLKDoubleFloat doubleFloatWithDouble:(value / [(MLKFloat*)arg doubleValue])]; else - return [MLKSingleFloat singleFloatWithFloat:(value / [arg floatValue])]; + return [MLKSingleFloat singleFloatWithFloat:(value / [(MLKFloat*)arg floatValue])]; } -(NSString *) description -- cgit v1.2.3