Reorganized File Structure
Added Documentation
This commit is contained in:
32
MathKit/MPNegatedTerm.m
Normal file
32
MathKit/MPNegatedTerm.m
Normal file
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// MPNegatedTerm.m
|
||||
// MathPad
|
||||
//
|
||||
// Created by Kim Wittenburg on 22.11.14.
|
||||
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPNegatedTerm.h"
|
||||
|
||||
@implementation MPNegatedTerm
|
||||
|
||||
- (instancetype)initWithTerm:(MPTerm *)term
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
NSAssert(term != nil, @"term must not be nil.");
|
||||
_term = term;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSDecimalNumber *)doEvaluation:(NSError *__autoreleasing *)error
|
||||
{
|
||||
NSDecimalNumber *value = [self.term evaluate:error];
|
||||
if (value) {
|
||||
value = [value decimalNumberByMultiplyingBy:[[NSDecimalNumber alloc] initWithInteger:-1]];
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user