\[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: 42.3 s
Input Error: 53.3
Output Error: 4.2
Log:
Profile: 🕒
\(\begin{cases} 100 \cdot \frac{e^{\log_* (1 + \frac{i}{n}) \cdot n} - 1}{\frac{i}{n}} & \text{when } i \le -1.494632866926099 \cdot 10^{-06} \\ \left((i * \left(\frac{1}{2} \cdot i\right) + i)_* \cdot \frac{100}{i}\right) \cdot n & \text{when } i \le 46118455070.99842 \\ 100 \cdot \frac{(e^{\log \left(1 + \frac{i}{n}\right) \cdot n} - 1)^*}{\frac{i}{n}} & \text{when } i \le 1.3433005449753994 \cdot 10^{+256} \\ \frac{(e^{\frac{\log n - \log i}{n}} - 1)^*}{\frac{\frac{i}{100}}{n}} & \text{when } i \le 5.9681760581064156 \cdot 10^{+289} \\ \frac{100}{i} \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{1}{n}} & \text{otherwise} \end{cases}\)

    if i < -1.494632866926099e-06

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

    if -1.494632866926099e-06 < i < 46118455070.99842

    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}}\]
      58.9
    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}}\]
      58.9
    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}}}\]
      15.4
    5. Using strategy rm
      15.4
    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)}\]
      15.5
    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.4

    if 46118455070.99842 < i < 1.3433005449753994e+256

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

    if 1.3433005449753994e+256 < i < 5.9681760581064156e+289

    1. Started with
      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
      62.8
    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}}\]
      29.2
    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}}\]
      29.2
    4. Applied simplify to get
      \[\color{red}{100 \cdot \frac{e^{\frac{\log n - \log i}{n}} - 1}{\frac{i}{n}}} \leadsto \color{blue}{\frac{(e^{\frac{\log n - \log i}{n}} - 1)^*}{\frac{\frac{i}{100}}{n}}}\]
      1.3

    if 5.9681760581064156e+289 < i

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

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