NSDecimalAdd
十進数の足し算をします。
NSCalculationError NSDecimalAdd ( NSDecimal * result , const NSDecimal * leftOperand , const NSDecimal * rightOperand , NSRoundingMode roundingMode );
解説
十進数の足し算をします。
返り値
引数
( NSDecimal * )result
( const NSDecimal * )leftOperand
( const NSDecimal * )rightOperand
( NSRoundingMode )roundingMode
フレームワーク
Foundation
クラス
NSDecimalAdd
Function
使用可能
10.0
参照
NSCopyObject
NSAllocateObject
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { NSDecimalNumber *dNum1 = [[[NSDecimalNumber alloc] initWithString:@"5"] autorelease]; NSDecimal number1 = [dNum1 decimalValue]; NSDecimalNumber *dNum2 = [[[NSDecimalNumber alloc] initWithString:@"10"] autorelease]; NSDecimal number2 = [dNum2 decimalValue]; NSCalculationError err; NSDecimal result; err = NSDecimalAdd(&result,&number1,&number2,NSRoundBankers); NSLog(NSDecimalString(&result,nil)); } @end