\[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
Test:
Compound Interest
Bits:
128 bits
Bits error versus i
Bits error versus n
Time: 42.4 s
Input Error: 23.6
Output Error: 4.4
Log:
Profile: 🕒
\(\begin{cases} 100 \cdot \frac{{\left({\left(1 + \frac{i}{n}\right)}^{n}\right)}^{3} - {1}^{3}}{\frac{i}{n} \cdot \left({\left({\left(1 + \frac{i}{n}\right)}^{n}\right)}^2 + \left({1}^2 + {\left(1 + \frac{i}{n}\right)}^{n} \cdot 1\right)\right)} & \text{when } i \le -0.97743076f0 \\ \left(100 \cdot n\right) \cdot {\left(e^{i}\right)}^{\left(\frac{1}{24} \cdot i + \frac{1}{2}\right)} & \text{when } i \le 0.009737393f0 \\ 100 \cdot \left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right) & \text{otherwise} \end{cases}\)

    if i < -0.97743076f0

    1. Started with
      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
      9.8
    2. Using strategy rm
      9.8
    3. Applied flip3-- to get
      \[100 \cdot \frac{\color{red}{{\left(1 + \frac{i}{n}\right)}^{n} - 1}}{\frac{i}{n}} \leadsto 100 \cdot \frac{\color{blue}{\frac{{\left({\left(1 + \frac{i}{n}\right)}^{n}\right)}^{3} - {1}^{3}}{{\left({\left(1 + \frac{i}{n}\right)}^{n}\right)}^2 + \left({1}^2 + {\left(1 + \frac{i}{n}\right)}^{n} \cdot 1\right)}}}{\frac{i}{n}}\]
      9.8
    4. Applied associate-/l/ to get
      \[100 \cdot \color{red}{\frac{\frac{{\left({\left(1 + \frac{i}{n}\right)}^{n}\right)}^{3} - {1}^{3}}{{\left({\left(1 + \frac{i}{n}\right)}^{n}\right)}^2 + \left({1}^2 + {\left(1 + \frac{i}{n}\right)}^{n} \cdot 1\right)}}{\frac{i}{n}}} \leadsto 100 \cdot \color{blue}{\frac{{\left({\left(1 + \frac{i}{n}\right)}^{n}\right)}^{3} - {1}^{3}}{\frac{i}{n} \cdot \left({\left({\left(1 + \frac{i}{n}\right)}^{n}\right)}^2 + \left({1}^2 + {\left(1 + \frac{i}{n}\right)}^{n} \cdot 1\right)\right)}}\]
      9.8

    if -0.97743076f0 < i < 0.009737393f0

    1. Started with
      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
      29.6
    2. Using strategy rm
      29.6
    3. Applied add-exp-log to get
      \[\color{red}{100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}} \leadsto \color{blue}{e^{\log \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\right)}}\]
      29.7
    4. Applied taylor to get
      \[e^{\log \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\right)} \leadsto e^{\frac{1}{24} \cdot {i}^2 + \left(\log n + \left(\log 100 + \frac{1}{2} \cdot i\right)\right)}\]
      17.2
    5. Taylor expanded around 0 to get
      \[e^{\color{red}{\frac{1}{24} \cdot {i}^2 + \left(\log n + \left(\log 100 + \frac{1}{2} \cdot i\right)\right)}} \leadsto e^{\color{blue}{\frac{1}{24} \cdot {i}^2 + \left(\log n + \left(\log 100 + \frac{1}{2} \cdot i\right)\right)}}\]
      17.2
    6. Applied simplify to get
      \[e^{\frac{1}{24} \cdot {i}^2 + \left(\log n + \left(\log 100 + \frac{1}{2} \cdot i\right)\right)} \leadsto e^{\left(\log n + \left(i \cdot i\right) \cdot \frac{1}{24}\right) + \left(\frac{1}{2} \cdot i + \log 100\right)}\]
      17.2

    7. Applied final simplification
    8. Applied simplify to get
      \[\color{red}{e^{\left(\log n + \left(i \cdot i\right) \cdot \frac{1}{24}\right) + \left(\frac{1}{2} \cdot i + \log 100\right)}} \leadsto \color{blue}{\left(100 \cdot n\right) \cdot {\left(e^{i}\right)}^{\left(\frac{1}{24} \cdot i + \frac{1}{2}\right)}}\]
      0.1

    if 0.009737393f0 < i

    1. Started with
      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
      16.6
    2. Using strategy rm
      16.6
    3. Applied associate-/r/ to get
      \[100 \cdot \color{red}{\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}} \leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)}\]
      16.5

  1. Removed slow pow expressions

Original test:


(lambda ((i default) (n default))
  #:name "Compound Interest"
  (* 100 (/ (- (pow (+ 1 (/ i n)) n) 1) (/ i n)))
  #:target
  (* 100 (/ (- (exp (* n (if (= (+ 1 (/ i n)) 1) (/ i n) (/ (* (/ i n) (log (+ 1 (/ i n)))) (- (+ (/ i n) 1) 1))))) 1) (/ i n))))