\[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: 26.6 s
Input Error: 49.1
Output Error: 5.3
Log:
Profile: 🕒
\(\begin{cases} \frac{n \cdot 100}{i} \cdot (e^{\log_* (1 + \frac{i}{n}) \cdot n} - 1)^* & \text{when } i \le -1.180495039389048 \cdot 10^{-113} \\ \frac{(i * \left(i \cdot \frac{1}{2}\right) + i)_*}{\frac{i}{100}} \cdot n & \text{when } i \le 1.9365931721357208 \cdot 10^{-122} \\ \frac{n \cdot 100}{i} \cdot (e^{\log_* (1 + \frac{i}{n}) \cdot n} - 1)^* & \text{when } i \le 4.391919658518623 \cdot 10^{+156} \\ \frac{100}{i} \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{1}{n}} & \text{otherwise} \end{cases}\)

    if i < -1.180495039389048e-113 or 1.9365931721357208e-122 < i < 4.391919658518623e+156

    1. Started with
      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
      40.7
    2. Using strategy rm
      40.7
    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}}\]
      40.7
    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}}\]
      40.7
    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}}\]
      32.2
    6. Applied taylor to get
      \[100 \cdot \frac{(e^{\log \left(1 + \frac{i}{n}\right) \cdot n} - 1)^*}{\frac{i}{n}} \leadsto 100 \cdot \frac{n \cdot (e^{\log \left(\frac{i}{n} + 1\right) \cdot n} - 1)^*}{i}\]
      33.2
    7. Taylor expanded around 0 to get
      \[100 \cdot \color{red}{\frac{n \cdot (e^{\log \left(\frac{i}{n} + 1\right) \cdot n} - 1)^*}{i}} \leadsto 100 \cdot \color{blue}{\frac{n \cdot (e^{\log \left(\frac{i}{n} + 1\right) \cdot n} - 1)^*}{i}}\]
      33.2
    8. Applied simplify to get
      \[100 \cdot \frac{n \cdot (e^{\log \left(\frac{i}{n} + 1\right) \cdot n} - 1)^*}{i} \leadsto \frac{n \cdot 100}{i} \cdot (e^{\log_* (1 + \frac{i}{n}) \cdot n} - 1)^*\]
      5.5

    9. Applied final simplification

    if -1.180495039389048e-113 < i < 1.9365931721357208e-122

    1. Started with
      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
      61.6
    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.3
    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.3
    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}{(i * \left(\frac{1}{2} \cdot i\right) + i)_* \cdot \frac{100}{\frac{i}{n}}}\]
      20.8
    5. Using strategy rm
      20.8
    6. Applied associate-/r/ to get
      \[(i * \left(\frac{1}{2} \cdot i\right) + i)_* \cdot \color{red}{\frac{100}{\frac{i}{n}}} \leadsto (i * \left(\frac{1}{2} \cdot i\right) + i)_* \cdot \color{blue}{\left(\frac{100}{i} \cdot n\right)}\]
      21.1
    7. Applied associate-*r* to get
      \[\color{red}{(i * \left(\frac{1}{2} \cdot i\right) + i)_* \cdot \left(\frac{100}{i} \cdot n\right)} \leadsto \color{blue}{\left((i * \left(\frac{1}{2} \cdot i\right) + i)_* \cdot \frac{100}{i}\right) \cdot n}\]
      0.6
    8. Applied taylor to get
      \[\left((i * \left(\frac{1}{2} \cdot i\right) + i)_* \cdot \frac{100}{i}\right) \cdot n \leadsto \left(100 \cdot \frac{(i * \left(\frac{1}{2} \cdot i\right) + i)_*}{i}\right) \cdot n\]
      0.0
    9. Taylor expanded around 0 to get
      \[\color{red}{\left(100 \cdot \frac{(i * \left(\frac{1}{2} \cdot i\right) + i)_*}{i}\right)} \cdot n \leadsto \color{blue}{\left(100 \cdot \frac{(i * \left(\frac{1}{2} \cdot i\right) + i)_*}{i}\right)} \cdot n\]
      0.0
    10. Applied simplify to get
      \[\left(100 \cdot \frac{(i * \left(\frac{1}{2} \cdot i\right) + i)_*}{i}\right) \cdot n \leadsto \frac{(i * \left(i \cdot \frac{1}{2}\right) + i)_*}{\frac{i}{100}} \cdot n\]
      0.2

    11. Applied final simplification

    if 4.391919658518623e+156 < i

    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 div-inv to get
      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\color{red}{\frac{i}{n}}} \leadsto 100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\color{blue}{i \cdot \frac{1}{n}}}\]
      32.1
    4. Applied *-un-lft-identity to get
      \[100 \cdot \frac{\color{red}{{\left(1 + \frac{i}{n}\right)}^{n} - 1}}{i \cdot \frac{1}{n}} \leadsto 100 \cdot \frac{\color{blue}{1 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}}{i \cdot \frac{1}{n}}\]
      32.1
    5. Applied times-frac to get
      \[100 \cdot \color{red}{\frac{1 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i \cdot \frac{1}{n}}} \leadsto 100 \cdot \color{blue}{\left(\frac{1}{i} \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{1}{n}}\right)}\]
      32.1
    6. Applied associate-*r* to get
      \[\color{red}{100 \cdot \left(\frac{1}{i} \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{1}{n}}\right)} \leadsto \color{blue}{\left(100 \cdot \frac{1}{i}\right) \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{1}{n}}}\]
      32.1
    7. Applied simplify to get
      \[\color{red}{\left(100 \cdot \frac{1}{i}\right)} \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{1}{n}} \leadsto \color{blue}{\frac{100}{i}} \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{1}{n}}\]
      32.1

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