/// PMT公式
/// @param price 金额
/// @param rate 年利率
/// @param period 分多少期
- (NSString *)pmtWithPrice:(float)price rate:(float)rate period:(NSInteger)period;
-
(NSString )pmtWithPrice:(float)price rate:(float)rate period:(NSInteger)period{
// 本金月利率*(1+月利率)n/[(1+月利率)n-1];float a = price * rate / 12 * pow((1 + rate/ 12), period); float b = pow(1+rate/12, period) - 1;
return [NSString stringWithFormat:@"%ld",(NSInteger)(a/b)];
}
有用的话,记得点赞!!!
网友评论