Archived
1

Reorganized File Structure

Added Documentation
This commit is contained in:
Kim Wittenburg
2014-12-12 00:39:30 +01:00
parent c367b1dbe8
commit 8f1f730358
90 changed files with 1270 additions and 1216 deletions

32
MathKit/MPFactorialTerm.m Normal file
View File

@@ -0,0 +1,32 @@
//
// MPFactorialTerm.m
// MathPad
//
// Created by Kim Wittenburg on 15.11.14.
// Copyright (c) 2014 Kim Wittenburg. All rights reserved.
//
#import "MPFactorialTerm.h"
@implementation MPFactorialTerm
- (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) {
return nil;
}
return [[NSDecimalNumber alloc] initWithDouble:tgamma(value.doubleValue + 1)];
}
@end