\[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: 53.6 s
Input Error: 52.8
Output Error: 9.8
Log:
Profile: 🕒
\(\begin{cases} \frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{\frac{i}{n}} & \text{when } i \le -4174494385468.2944 \\ \left(\left(i \cdot \frac{1}{2}\right) \cdot n + \left(\left(i \cdot i\right) \cdot \left(n \cdot \frac{1}{6}\right) + n\right)\right) \cdot 100 & \text{when } i \le 2.8990758295946513 \cdot 10^{-08} \\ 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 7.9197159869026 \cdot 10^{+209} \\ \left(\frac{1}{2} \cdot i + 1\right) \cdot {\left(\frac{\sqrt{i \cdot 100}}{\sqrt{\frac{i}{n}}}\right)}^2 & \text{otherwise} \end{cases}\)

    if i < -4174494385468.2944

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

    if -4174494385468.2944 < i < 2.8990758295946513e-08

    1. Started with
      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
      61.7
    2. Using strategy rm
      61.7
    3. Applied div-sub 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}}{\frac{i}{n}} - \frac{1}{\frac{i}{n}}\right)}\]
      61.7
    4. Applied simplify to get
      \[100 \cdot \left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \color{red}{\frac{1}{\frac{i}{n}}}\right) \leadsto 100 \cdot \left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \color{blue}{\frac{n}{i}}\right)\]
      61.7
    5. Applied taylor to get
      \[100 \cdot \left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \frac{n}{i}\right) \leadsto 100 \cdot \left(n + \left(\frac{1}{6} \cdot \left(n \cdot {i}^2\right) + \frac{1}{2} \cdot \left(n \cdot i\right)\right)\right)\]
      0.0
    6. Taylor expanded around 0 to get
      \[100 \cdot \color{red}{\left(n + \left(\frac{1}{6} \cdot \left(n \cdot {i}^2\right) + \frac{1}{2} \cdot \left(n \cdot i\right)\right)\right)} \leadsto 100 \cdot \color{blue}{\left(n + \left(\frac{1}{6} \cdot \left(n \cdot {i}^2\right) + \frac{1}{2} \cdot \left(n \cdot i\right)\right)\right)}\]
      0.0
    7. Applied simplify to get
      \[100 \cdot \left(n + \left(\frac{1}{6} \cdot \left(n \cdot {i}^2\right) + \frac{1}{2} \cdot \left(n \cdot i\right)\right)\right) \leadsto \left(\left(i \cdot \frac{1}{2}\right) \cdot n + \left(\left(i \cdot i\right) \cdot \left(n \cdot \frac{1}{6}\right) + n\right)\right) \cdot 100\]
      0.0

    8. Applied final simplification

    if 2.8990758295946513e-08 < i < 7.9197159869026e+209

    1. Started with
      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
      36.1
    2. Using strategy rm
      36.1
    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}}\]
      36.1
    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)}}\]
      36.1

    if 7.9197159869026e+209 < i

    1. Started with
      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
      61.2
    2. Applied taylor to get
      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \leadsto 100 \cdot \frac{\left(\frac{1}{2} \cdot {i}^2 + \left(1 + i\right)\right) - 1}{\frac{i}{n}}\]
      60.9
    3. Taylor expanded around 0 to get
      \[100 \cdot \frac{\color{red}{\left(\frac{1}{2} \cdot {i}^2 + \left(1 + i\right)\right)} - 1}{\frac{i}{n}} \leadsto 100 \cdot \frac{\color{blue}{\left(\frac{1}{2} \cdot {i}^2 + \left(1 + i\right)\right)} - 1}{\frac{i}{n}}\]
      60.9
    4. Applied simplify to get
      \[\color{red}{100 \cdot \frac{\left(\frac{1}{2} \cdot {i}^2 + \left(1 + i\right)\right) - 1}{\frac{i}{n}}} \leadsto \color{blue}{\left(\frac{1}{2} \cdot i + 1\right) \cdot \frac{i \cdot 100}{\frac{i}{n}}}\]
      46.8
    5. Using strategy rm
      46.8
    6. Applied add-sqr-sqrt to get
      \[\left(\frac{1}{2} \cdot i + 1\right) \cdot \frac{i \cdot 100}{\color{red}{\frac{i}{n}}} \leadsto \left(\frac{1}{2} \cdot i + 1\right) \cdot \frac{i \cdot 100}{\color{blue}{{\left(\sqrt{\frac{i}{n}}\right)}^2}}\]
      46.9
    7. Applied add-sqr-sqrt to get
      \[\left(\frac{1}{2} \cdot i + 1\right) \cdot \frac{\color{red}{i \cdot 100}}{{\left(\sqrt{\frac{i}{n}}\right)}^2} \leadsto \left(\frac{1}{2} \cdot i + 1\right) \cdot \frac{\color{blue}{{\left(\sqrt{i \cdot 100}\right)}^2}}{{\left(\sqrt{\frac{i}{n}}\right)}^2}\]
      46.9
    8. Applied square-undiv to get
      \[\left(\frac{1}{2} \cdot i + 1\right) \cdot \color{red}{\frac{{\left(\sqrt{i \cdot 100}\right)}^2}{{\left(\sqrt{\frac{i}{n}}\right)}^2}} \leadsto \left(\frac{1}{2} \cdot i + 1\right) \cdot \color{blue}{{\left(\frac{\sqrt{i \cdot 100}}{\sqrt{\frac{i}{n}}}\right)}^2}\]
      46.9

  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))))