美文网首页
计算等额本息等

计算等额本息等

作者: 音吹 | 来源:发表于2017-08-18 15:58 被阅读11次
  • 计算公式
    调用

double hhh = [self calculatePrincipalAndInterestBidWithInvestInterest:20 amount:@"2000"];

- (double)calculatePrincipalAndInterestBidWithInvestInterest:(double)interest
                                                      amount:(NSString *)investAmount{
    
    NSDecimalNumberHandler *roundBanker = [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundBankers
                                                                                                 scale:2.0f
                                                                                      raiseOnExactness:NO
                                                                                       raiseOnOverflow:NO
                                                                                      raiseOnUnderflow:NO
                                                                                   raiseOnDivideByZero:YES];
    NSDecimalNumber *investAmountDec = [[NSDecimalNumber alloc] initWithString:investAmount];//投资金额
    NSDecimalNumber *monthInterestDec = [[NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%f",interest/100]] decimalNumberByDividingBy:[NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%f",12.00]]];//月利率
    
    double month = 12;//标的募集期数
//    if (selectBid.creditType == CreditType_DaylyOneOffPayment) {
//        //按天标,转化为月份
//        month = month/30.00;
//    }
    NSDecimalNumber *monthDec = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%f",month]];//还款月数
    //    *  公式: 每月本息还款额=(投资金额*月利率*(1+月利率)^还款月数)/(((1+月利率)^还款月数)-1)
    NSDecimalNumber *decNum1 = [[[[[NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%d",1]] decimalNumberByAdding:monthInterestDec] decimalNumberByRaisingToPower:month] decimalNumberByMultiplyingBy:monthInterestDec] decimalNumberByMultiplyingBy:investAmountDec];
    NSDecimalNumber *decNum2 = [[[[NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%d",1]] decimalNumberByAdding:monthInterestDec] decimalNumberByRaisingToPower:month] decimalNumberBySubtracting:[NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%d",1]]];
    NSDecimalNumber *monthIncomeDec = [decNum1 decimalNumberByDividingBy:decNum2];//月本息还款额
    NSDecimalNumber *totalIncomeDec = [[monthDec decimalNumberByMultiplyingBy:monthIncomeDec] decimalNumberBySubtracting:investAmountDec withBehavior:roundBanker];//总还款额 - 本金 = 总收益
    return [totalIncomeDec doubleValue] > 0 ? [totalIncomeDec doubleValue] : 0;
}

相关文章

  • 计算等额本息等

    计算公式调用 double hhh = [self calculatePrincipalAndInterestBi...

  • 贷款-专业名词注释

    等额本息 等额本息,是指一种贷款的还款方式。等额本息是在还款期内,每月偿还同等数额的贷款(包括本金和利息)。它和等...

  • 房贷利率计算公式推导

    等额本息 等额本息每个月月供一样, 还款本金逐渐上升, 还款利息主键下降,下面是计算公式: 假设以下几个符号:n:...

  • 2021-11-08

    每天一个金融知识点——等额本息&等额本金 等额本息和等额本金都是是贷款还款方式,选择等额本息这种方式需要每且偿还固...

  • 等额本息计算方式

  • 等额本息、等额本金 计算(java)

    记录一下 等额本息 等额本金

  • 等额本息与等金本息

    一、等额本息的含义 1、等额本息,是指一种贷款的还款方式。等额本息是在还款期内,每月偿还同等数额的贷款(包括本金和...

  • 2021-06-22

    iOS 等额本息的方式,计算月利率、日利率、年利率

  • 如期app:等额本金贷款怎么计算每月应还多少?

    前面小如已经给大家讲解了等额本息还款方式,这篇文章就给大家讲讲什么是等额本金还款以及等额本金还款的计算公式。 等额...

  • 2018-08-10

    米族金融:等额本息助力合规调整,突显P2P本质 等额本息的还款模式,是真正对出借人本金负责的模式。 所谓“等额本息...

网友评论

      本文标题:计算等额本息等

      本文链接:https://www.haomeiwen.com/subject/diyarxtx.html