\[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: 24.2 s
Input Error: 52.6
Output Error: 10.3
Log:
Profile: 🕒
\(\begin{cases} 100 \cdot \left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \frac{n}{i}\right) & \text{when } i \le -0.6078118721761064 \\ \left(\frac{1}{2} \cdot i + 1\right) \cdot \left(100 \cdot n\right) & \text{when } i \le 1.001552520707554 \cdot 10^{-05} \\ 100 \cdot \frac{\frac{{\left({\left(1 + \frac{i}{n}\right)}^{n}\right)}^2 - {1}^2}{{\left(1 + \frac{i}{n}\right)}^{n} + 1}}{\frac{i}{n}} & \text{when } i \le 9.613916160983725 \cdot 10^{+206} \\ 100 \cdot \frac{e^{\frac{\log n - \log i}{n}} - 1}{\frac{i}{n}} & \text{otherwise} \end{cases}\)

    if i < -0.6078118721761064

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

    if -0.6078118721761064 < i < 1.001552520707554e-05

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

    if 1.001552520707554e-05 < i < 9.613916160983725e+206

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

    if 9.613916160983725e+206 < i

    1. Started with
      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
      62.5
    2. Applied taylor to get
      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \leadsto 100 \cdot \frac{e^{\frac{\log n - \log i}{n}} - 1}{\frac{i}{n}}\]
      31.6
    3. Taylor expanded around inf to get
      \[100 \cdot \frac{\color{red}{e^{\frac{\log n - \log i}{n}} - 1}}{\frac{i}{n}} \leadsto 100 \cdot \frac{\color{blue}{e^{\frac{\log n - \log i}{n}} - 1}}{\frac{i}{n}}\]
      31.6

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