\[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: 14.5 s
Input Error: 22.9
Output Error: 2.3
Log:
Profile: 🕒
\(\begin{cases} 100 \cdot \frac{(e^{(e^{\log_* (1 + \log_* (1 + \frac{i}{n}))} - 1)^* \cdot n} - 1)^*}{\frac{i}{n}} & \text{when } i \le -2.06815f-20 \\ \left(100 \cdot n\right) \cdot \frac{(\left(i \cdot i\right) * \frac{1}{2} + \left((\left({i}^3\right) * \frac{1}{6} + i)_*\right))_*}{i} & \text{when } i \le 3.3716882f-22 \\ 100 \cdot \frac{(e^{(e^{\log_* (1 + \log_* (1 + \frac{i}{n}))} - 1)^* \cdot n} - 1)^*}{\frac{i}{n}} & \text{otherwise} \end{cases}\)

    if i < -2.06815f-20 or 3.3716882f-22 < i

    1. Started with
      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
      19.6
    2. Using strategy rm
      19.6
    3. Applied add-exp-log to get
      \[100 \cdot \frac{{\color{red}{\left(1 + \frac{i}{n}\right)}}^{n} - 1}{\frac{i}{n}} \leadsto 100 \cdot \frac{{\color{blue}{\left(e^{\log \left(1 + \frac{i}{n}\right)}\right)}}^{n} - 1}{\frac{i}{n}}\]
      19.6
    4. Applied pow-exp to get
      \[100 \cdot \frac{\color{red}{{\left(e^{\log \left(1 + \frac{i}{n}\right)}\right)}^{n}} - 1}{\frac{i}{n}} \leadsto 100 \cdot \frac{\color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}} - 1}{\frac{i}{n}}\]
      19.6
    5. Applied expm1-def to get
      \[100 \cdot \frac{\color{red}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n} - 1}}{\frac{i}{n}} \leadsto 100 \cdot \frac{\color{blue}{(e^{\log \left(1 + \frac{i}{n}\right) \cdot n} - 1)^*}}{\frac{i}{n}}\]
      15.8
    6. Using strategy rm
      15.8
    7. Applied expm1-log1p-u to get
      \[100 \cdot \frac{(e^{\color{red}{\log \left(1 + \frac{i}{n}\right)} \cdot n} - 1)^*}{\frac{i}{n}} \leadsto 100 \cdot \frac{(e^{\color{blue}{(e^{\log_* (1 + \log \left(1 + \frac{i}{n}\right))} - 1)^*} \cdot n} - 1)^*}{\frac{i}{n}}\]
      15.9
    8. Applied simplify to get
      \[100 \cdot \frac{(e^{(e^{\color{red}{\log_* (1 + \log \left(1 + \frac{i}{n}\right))}} - 1)^* \cdot n} - 1)^*}{\frac{i}{n}} \leadsto 100 \cdot \frac{(e^{(e^{\color{blue}{\log_* (1 + \log_* (1 + \frac{i}{n}))}} - 1)^* \cdot n} - 1)^*}{\frac{i}{n}}\]
      3.5

    if -2.06815f-20 < i < 3.3716882f-22

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

    7. Applied final simplification

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