\[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: 16.1 s
Input Error: 50.5
Output Error: 11.0
Log:
Profile: 🕒
\(\begin{cases} \frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{\frac{i}{n}} & \text{when } i \le -1.4682278751935193 \cdot 10^{-20} \\ \left(\frac{1}{2} \cdot i + 1\right) \cdot \left(100 \cdot n\right) & \text{when } i \le 1.4009310261885236 \cdot 10^{-06} \\ \frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{\frac{i}{n}} & \text{otherwise} \end{cases}\)

    if i < -1.4682278751935193e-20 or 1.4009310261885236e-06 < i

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

    if -1.4682278751935193e-20 < i < 1.4009310261885236e-06

    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}}\]
      61.0
    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}}\]
      61.0
    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}}}\]
      14.4
    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

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