\[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: 25.5 s
Input Error: 52.4
Output Error: 6.2
Log:
Profile: 🕒
\(\begin{cases} 100 \cdot \frac{\left(\sqrt{{\left(1 + \frac{i}{n}\right)}^{n}} + 1\right) \cdot \left(\sqrt{{\left(1 + \frac{i}{n}\right)}^{n}} - 1\right)}{\frac{i}{n}} & \text{when } i \le -0.09197678863246804 \\ \left(i \cdot 50 + 100\right) \cdot n & \text{when } i \le 18073.65682704277 \\ 100 \cdot \frac{\left(\sqrt{{\left(1 + \frac{i}{n}\right)}^{n}} + 1\right) \cdot \left(\sqrt{{\left(1 + \frac{i}{n}\right)}^{n}} - 1\right)}{\frac{i}{n}} & \text{when } i \le 7.979289197910273 \cdot 10^{+111} \\ \left(1 + \frac{2}{i}\right) \cdot \left(\frac{n}{i} \cdot 50\right) & \text{otherwise} \end{cases}\)

    if i < -0.09197678863246804

    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 add-sqr-sqrt 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(\sqrt{{\left(1 + \frac{i}{n}\right)}^{n}}\right)}^2} - 1}{\frac{i}{n}}\]
      27.4
    4. Applied difference-of-sqr-1 to get
      \[100 \cdot \frac{\color{red}{{\left(\sqrt{{\left(1 + \frac{i}{n}\right)}^{n}}\right)}^2 - 1}}{\frac{i}{n}} \leadsto 100 \cdot \frac{\color{blue}{\left(\sqrt{{\left(1 + \frac{i}{n}\right)}^{n}} + 1\right) \cdot \left(\sqrt{{\left(1 + \frac{i}{n}\right)}^{n}} - 1\right)}}{\frac{i}{n}}\]
      27.4

    if -0.09197678863246804 < i < 18073.65682704277

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

    if 18073.65682704277 < i < 7.979289197910273e+111

    1. Started with
      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
      32.5
    2. Using strategy rm
      32.5
    3. Applied add-sqr-sqrt 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(\sqrt{{\left(1 + \frac{i}{n}\right)}^{n}}\right)}^2} - 1}{\frac{i}{n}}\]
      32.6
    4. Applied difference-of-sqr-1 to get
      \[100 \cdot \frac{\color{red}{{\left(\sqrt{{\left(1 + \frac{i}{n}\right)}^{n}}\right)}^2 - 1}}{\frac{i}{n}} \leadsto 100 \cdot \frac{\color{blue}{\left(\sqrt{{\left(1 + \frac{i}{n}\right)}^{n}} + 1\right) \cdot \left(\sqrt{{\left(1 + \frac{i}{n}\right)}^{n}} - 1\right)}}{\frac{i}{n}}\]
      32.6

    if 7.979289197910273e+111 < i

    1. Started with
      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
      51.4
    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.4
    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.4
    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}}}\]
      41.8
    5. Applied taylor to get
      \[\left(\frac{1}{2} \cdot i + 1\right) \cdot \frac{i \cdot 100}{\frac{i}{n}} \leadsto 100 \cdot n + 50 \cdot \left(n \cdot i\right)\]
      62.1
    6. Taylor expanded around 0 to get
      \[\color{red}{100 \cdot n + 50 \cdot \left(n \cdot i\right)} \leadsto \color{blue}{100 \cdot n + 50 \cdot \left(n \cdot i\right)}\]
      62.1
    7. Applied simplify to get
      \[\color{red}{100 \cdot n + 50 \cdot \left(n \cdot i\right)} \leadsto \color{blue}{\left(i \cdot 50 + 100\right) \cdot n}\]
      62.1
    8. Using strategy rm
      62.1
    9. Applied add-exp-log to get
      \[\color{red}{\left(i \cdot 50 + 100\right)} \cdot n \leadsto \color{blue}{e^{\log \left(i \cdot 50 + 100\right)}} \cdot n\]
      62.1
    10. Applied taylor to get
      \[e^{\log \left(i \cdot 50 + 100\right)} \cdot n \leadsto \left(e^{\log 50 - \log i} + 2 \cdot \frac{e^{\log 50 - \log i}}{i}\right) \cdot n\]
      4.5
    11. Taylor expanded around inf to get
      \[\color{red}{\left(e^{\log 50 - \log i} + 2 \cdot \frac{e^{\log 50 - \log i}}{i}\right)} \cdot n \leadsto \color{blue}{\left(e^{\log 50 - \log i} + 2 \cdot \frac{e^{\log 50 - \log i}}{i}\right)} \cdot n\]
      4.5
    12. Applied simplify to get
      \[\left(e^{\log 50 - \log i} + 2 \cdot \frac{e^{\log 50 - \log i}}{i}\right) \cdot n \leadsto \left(\frac{2 \cdot 50}{i \cdot i} + \frac{50}{i}\right) \cdot n\]
      0.2

    13. Applied final simplification
    14. Applied simplify to get
      \[\color{red}{\left(\frac{2 \cdot 50}{i \cdot i} + \frac{50}{i}\right) \cdot n} \leadsto \color{blue}{\left(1 + \frac{2}{i}\right) \cdot \left(\frac{n}{i} \cdot 50\right)}\]
      0.3

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