macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

NSDecimalDivide

わり算をします
NSCalculationError  NSDecimalDivide ( 
                    NSDecimal *   result , 
                    const NSDecimal *l   leftOperand , 
                    const NSDecimal *   rightOperand , 
                    NSRoundingMode   roundingMode );

解説

わり算をします。

返り値

引数

( NSDecimal * )result
( const NSDecimal *l )leftOperand
( const NSDecimal * )rightOperand
( NSRoundingMode )roundingMode

クラス

NSDecimalDivide

Function

使用可能

10.0

参照

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
NSDecimalNumber *dNum1 = [[[NSDecimalNumber alloc] initWithString:@"100"] autorelease];
NSDecimal leftOperand = [dNum1 decimalValue];
NSDecimalNumber *dNum2 = [[[NSDecimalNumber alloc] initWithString:@"32"] autorelease];
NSDecimal rightOperand = [dNum2 decimalValue];
NSCalculationError err;
NSDecimal result;

err = NSDecimalDivide(&result,&leftOperand,&rightOperand,NSRoundBankers);

NSLog(NSDecimalString(&result,nil));

}

@end