
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 -1000.0)
(* 100.0 (+ (* (/ n i) 0.0) (- (* n (/ t_0 i)) (/ n i))))
(if (<= t_1 0.0)
(* n (/ (* 100.0 (expm1 (* n (log1p (/ i n))))) i))
(if (<= t_1 INFINITY)
(/ n (/ i (fma 100.0 t_0 -100.0)))
(/ n (+ 0.01 (fma -0.005 i (* (* i i) 0.0008333333333333334)))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -1000.0) {
tmp = 100.0 * (((n / i) * 0.0) + ((n * (t_0 / i)) - (n / i)));
} else if (t_1 <= 0.0) {
tmp = n * ((100.0 * expm1((n * log1p((i / n))))) / i);
} else if (t_1 <= ((double) INFINITY)) {
tmp = n / (i / fma(100.0, t_0, -100.0));
} else {
tmp = n / (0.01 + fma(-0.005, i, ((i * i) * 0.0008333333333333334)));
}
return tmp;
}
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= -1000.0) tmp = Float64(100.0 * Float64(Float64(Float64(n / i) * 0.0) + Float64(Float64(n * Float64(t_0 / i)) - Float64(n / i)))); elseif (t_1 <= 0.0) tmp = Float64(n * Float64(Float64(100.0 * expm1(Float64(n * log1p(Float64(i / n))))) / i)); elseif (t_1 <= Inf) tmp = Float64(n / Float64(i / fma(100.0, t_0, -100.0))); else tmp = Float64(n / Float64(0.01 + fma(-0.005, i, Float64(Float64(i * i) * 0.0008333333333333334)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1000.0], N[(100.0 * N[(N[(N[(n / i), $MachinePrecision] * 0.0), $MachinePrecision] + N[(N[(n * N[(t$95$0 / i), $MachinePrecision]), $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(n * N[(N[(100.0 * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n / N[(i / N[(100.0 * t$95$0 + -100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(-0.005 * i + N[(N[(i * i), $MachinePrecision] * 0.0008333333333333334), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq -1000:\\
\;\;\;\;100 \cdot \left(\frac{n}{i} \cdot 0 + \left(n \cdot \frac{t_0}{i} - \frac{n}{i}\right)\right)\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\frac{n}{\frac{i}{\mathsf{fma}\left(100, t_0, -100\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + \mathsf{fma}\left(-0.005, i, \left(i \cdot i\right) \cdot 0.0008333333333333334\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -1e3Initial program 99.7%
div-sub99.7%
associate-/r/99.7%
clear-num100.0%
*-un-lft-identity100.0%
prod-diff100.0%
Applied egg-rr100.0%
+-commutative100.0%
fma-udef100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
distribute-lft-out100.0%
metadata-eval100.0%
fma-udef100.0%
*-rgt-identity100.0%
unsub-neg100.0%
Simplified100.0%
if -1e3 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 28.7%
associate-/r/28.6%
associate-*r*28.6%
*-commutative28.6%
associate-*r/28.6%
sub-neg28.6%
distribute-lft-in28.6%
fma-def28.6%
metadata-eval28.6%
metadata-eval28.6%
Simplified28.6%
expm1-log1p-u28.6%
expm1-udef24.9%
Applied egg-rr72.5%
expm1-def98.1%
expm1-log1p98.8%
*-rgt-identity98.8%
associate-*r/98.7%
associate-*l*98.7%
associate-*r/98.8%
metadata-eval98.8%
Simplified98.8%
associate-*r/98.8%
Applied egg-rr98.8%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.7%
associate-/r/99.6%
associate-*r*99.4%
*-commutative99.4%
associate-*r/99.8%
sub-neg99.8%
distribute-lft-in99.8%
fma-def99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
fma-udef99.8%
*-commutative99.8%
Applied egg-rr99.8%
clear-num99.7%
un-div-inv99.9%
*-commutative99.9%
fma-def99.9%
+-commutative99.9%
Applied egg-rr99.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
fma-def1.9%
metadata-eval1.9%
metadata-eval1.9%
Simplified1.9%
fma-udef1.9%
*-commutative1.9%
Applied egg-rr1.9%
Taylor expanded in n around inf 1.9%
sub-neg1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
metadata-eval1.9%
sub-neg1.9%
expm1-def81.0%
Simplified81.0%
clear-num81.1%
un-div-inv81.0%
associate-/r*81.0%
div-inv81.1%
metadata-eval81.1%
Applied egg-rr81.1%
Taylor expanded in i around 0 99.9%
fma-def99.9%
*-commutative99.9%
unpow299.9%
Simplified99.9%
Final simplification99.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n))) (t_1 (* t_0 100.0)))
(if (<= t_0 -5e-253)
t_1
(if (<= t_0 0.0)
(* n (* 100.0 (/ (expm1 i) i)))
(if (<= t_0 INFINITY)
t_1
(/ n (+ 0.01 (fma -0.005 i (* (* i i) 0.0008333333333333334)))))))))
double code(double i, double n) {
double t_0 = (pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double t_1 = t_0 * 100.0;
double tmp;
if (t_0 <= -5e-253) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = n * (100.0 * (expm1(i) / i));
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = n / (0.01 + fma(-0.005, i, ((i * i) * 0.0008333333333333334)));
}
return tmp;
}
function code(i, n) t_0 = Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) t_1 = Float64(t_0 * 100.0) tmp = 0.0 if (t_0 <= -5e-253) tmp = t_1; elseif (t_0 <= 0.0) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); elseif (t_0 <= Inf) tmp = t_1; else tmp = Float64(n / Float64(0.01 + fma(-0.005, i, Float64(Float64(i * i) * 0.0008333333333333334)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * 100.0), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-253], t$95$1, If[LessEqual[t$95$0, 0.0], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], t$95$1, N[(n / N[(0.01 + N[(-0.005 * i + N[(N[(i * i), $MachinePrecision] * 0.0008333333333333334), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
t_1 := t_0 \cdot 100\\
\mathbf{if}\;t_0 \leq -5 \cdot 10^{-253}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t_0 \leq \infty:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + \mathsf{fma}\left(-0.005, i, \left(i \cdot i\right) \cdot 0.0008333333333333334\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -4.99999999999999971e-253 or 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 98.9%
if -4.99999999999999971e-253 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 25.9%
Taylor expanded in n around inf 37.6%
expm1-def73.2%
Simplified73.2%
clear-num73.1%
un-div-inv73.2%
Applied egg-rr73.2%
associate-/l*73.1%
associate-/r/74.1%
associate-*r/74.2%
Simplified74.2%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
fma-def1.9%
metadata-eval1.9%
metadata-eval1.9%
Simplified1.9%
fma-udef1.9%
*-commutative1.9%
Applied egg-rr1.9%
Taylor expanded in n around inf 1.9%
sub-neg1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
metadata-eval1.9%
sub-neg1.9%
expm1-def81.0%
Simplified81.0%
clear-num81.1%
un-div-inv81.0%
associate-/r*81.0%
div-inv81.1%
metadata-eval81.1%
Applied egg-rr81.1%
Taylor expanded in i around 0 99.9%
fma-def99.9%
*-commutative99.9%
unpow299.9%
Simplified99.9%
Final simplification82.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 -5e-253)
(* t_1 100.0)
(if (<= t_1 0.0)
(* n (* 100.0 (/ (expm1 i) i)))
(if (<= t_1 INFINITY)
(* n (/ (+ -100.0 (* t_0 100.0)) i))
(/ n (+ 0.01 (fma -0.005 i (* (* i i) 0.0008333333333333334)))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -5e-253) {
tmp = t_1 * 100.0;
} else if (t_1 <= 0.0) {
tmp = n * (100.0 * (expm1(i) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * ((-100.0 + (t_0 * 100.0)) / i);
} else {
tmp = n / (0.01 + fma(-0.005, i, ((i * i) * 0.0008333333333333334)));
}
return tmp;
}
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= -5e-253) tmp = Float64(t_1 * 100.0); elseif (t_1 <= 0.0) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(-100.0 + Float64(t_0 * 100.0)) / i)); else tmp = Float64(n / Float64(0.01 + fma(-0.005, i, Float64(Float64(i * i) * 0.0008333333333333334)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-253], N[(t$95$1 * 100.0), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(-0.005 * i + N[(N[(i * i), $MachinePrecision] * 0.0008333333333333334), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{-253}:\\
\;\;\;\;t_1 \cdot 100\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{-100 + t_0 \cdot 100}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + \mathsf{fma}\left(-0.005, i, \left(i \cdot i\right) \cdot 0.0008333333333333334\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -4.99999999999999971e-253Initial program 97.9%
if -4.99999999999999971e-253 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 25.9%
Taylor expanded in n around inf 37.6%
expm1-def73.2%
Simplified73.2%
clear-num73.1%
un-div-inv73.2%
Applied egg-rr73.2%
associate-/l*73.1%
associate-/r/74.1%
associate-*r/74.2%
Simplified74.2%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.7%
associate-/r/99.6%
associate-*r*99.4%
*-commutative99.4%
associate-*r/99.8%
sub-neg99.8%
distribute-lft-in99.8%
fma-def99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
fma-udef99.8%
*-commutative99.8%
Applied egg-rr99.8%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
fma-def1.9%
metadata-eval1.9%
metadata-eval1.9%
Simplified1.9%
fma-udef1.9%
*-commutative1.9%
Applied egg-rr1.9%
Taylor expanded in n around inf 1.9%
sub-neg1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
metadata-eval1.9%
sub-neg1.9%
expm1-def81.0%
Simplified81.0%
clear-num81.1%
un-div-inv81.0%
associate-/r*81.0%
div-inv81.1%
metadata-eval81.1%
Applied egg-rr81.1%
Taylor expanded in i around 0 99.9%
fma-def99.9%
*-commutative99.9%
unpow299.9%
Simplified99.9%
Final simplification82.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 -5e-253)
(* n (/ (- 1.0 t_0) (* i -0.01)))
(if (<= t_1 0.0)
(* n (* 100.0 (/ (expm1 i) i)))
(if (<= t_1 INFINITY)
(* n (/ (+ -100.0 (* t_0 100.0)) i))
(/ n (+ 0.01 (fma -0.005 i (* (* i i) 0.0008333333333333334)))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -5e-253) {
tmp = n * ((1.0 - t_0) / (i * -0.01));
} else if (t_1 <= 0.0) {
tmp = n * (100.0 * (expm1(i) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * ((-100.0 + (t_0 * 100.0)) / i);
} else {
tmp = n / (0.01 + fma(-0.005, i, ((i * i) * 0.0008333333333333334)));
}
return tmp;
}
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= -5e-253) tmp = Float64(n * Float64(Float64(1.0 - t_0) / Float64(i * -0.01))); elseif (t_1 <= 0.0) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(-100.0 + Float64(t_0 * 100.0)) / i)); else tmp = Float64(n / Float64(0.01 + fma(-0.005, i, Float64(Float64(i * i) * 0.0008333333333333334)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-253], N[(n * N[(N[(1.0 - t$95$0), $MachinePrecision] / N[(i * -0.01), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(-0.005 * i + N[(N[(i * i), $MachinePrecision] * 0.0008333333333333334), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{-253}:\\
\;\;\;\;n \cdot \frac{1 - t_0}{i \cdot -0.01}\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{-100 + t_0 \cdot 100}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + \mathsf{fma}\left(-0.005, i, \left(i \cdot i\right) \cdot 0.0008333333333333334\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -4.99999999999999971e-253Initial program 97.9%
associate-/r/97.9%
associate-*r*97.7%
*-commutative97.7%
associate-*r/97.8%
sub-neg97.8%
distribute-lft-in97.7%
fma-def97.8%
metadata-eval97.8%
metadata-eval97.8%
Simplified97.8%
expm1-log1p-u54.0%
expm1-udef6.1%
Applied egg-rr6.1%
expm1-def55.8%
expm1-log1p55.8%
*-rgt-identity55.8%
associate-*r/55.6%
associate-*l*55.6%
associate-*r/55.7%
metadata-eval55.7%
Simplified55.7%
associate-*r/55.8%
Applied egg-rr55.8%
associate-/l*55.8%
expm1-udef54.1%
div-sub54.1%
*-commutative54.1%
log1p-udef54.1%
exp-to-pow97.9%
+-commutative97.9%
div-inv97.9%
metadata-eval97.9%
div-inv97.9%
metadata-eval97.9%
Applied egg-rr97.9%
frac-2neg97.9%
frac-2neg97.9%
metadata-eval97.9%
sub-div97.9%
Applied egg-rr97.9%
sub-neg97.9%
+-commutative97.9%
metadata-eval97.9%
distribute-rgt-neg-in97.9%
metadata-eval97.9%
Simplified97.9%
if -4.99999999999999971e-253 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 25.9%
Taylor expanded in n around inf 37.6%
expm1-def73.2%
Simplified73.2%
clear-num73.1%
un-div-inv73.2%
Applied egg-rr73.2%
associate-/l*73.1%
associate-/r/74.1%
associate-*r/74.2%
Simplified74.2%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.7%
associate-/r/99.6%
associate-*r*99.4%
*-commutative99.4%
associate-*r/99.8%
sub-neg99.8%
distribute-lft-in99.8%
fma-def99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
fma-udef99.8%
*-commutative99.8%
Applied egg-rr99.8%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
fma-def1.9%
metadata-eval1.9%
metadata-eval1.9%
Simplified1.9%
fma-udef1.9%
*-commutative1.9%
Applied egg-rr1.9%
Taylor expanded in n around inf 1.9%
sub-neg1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
metadata-eval1.9%
sub-neg1.9%
expm1-def81.0%
Simplified81.0%
clear-num81.1%
un-div-inv81.0%
associate-/r*81.0%
div-inv81.1%
metadata-eval81.1%
Applied egg-rr81.1%
Taylor expanded in i around 0 99.9%
fma-def99.9%
*-commutative99.9%
unpow299.9%
Simplified99.9%
Final simplification82.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 -5e-253)
(* n (/ (+ (* (/ t_0 i) 0.01) (* 0.01 (/ -1.0 i))) 0.0001))
(if (<= t_1 0.0)
(* n (* 100.0 (/ (expm1 i) i)))
(if (<= t_1 INFINITY)
(* n (/ (+ -100.0 (* t_0 100.0)) i))
(/ n (+ 0.01 (fma -0.005 i (* (* i i) 0.0008333333333333334)))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -5e-253) {
tmp = n * ((((t_0 / i) * 0.01) + (0.01 * (-1.0 / i))) / 0.0001);
} else if (t_1 <= 0.0) {
tmp = n * (100.0 * (expm1(i) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * ((-100.0 + (t_0 * 100.0)) / i);
} else {
tmp = n / (0.01 + fma(-0.005, i, ((i * i) * 0.0008333333333333334)));
}
return tmp;
}
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= -5e-253) tmp = Float64(n * Float64(Float64(Float64(Float64(t_0 / i) * 0.01) + Float64(0.01 * Float64(-1.0 / i))) / 0.0001)); elseif (t_1 <= 0.0) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(-100.0 + Float64(t_0 * 100.0)) / i)); else tmp = Float64(n / Float64(0.01 + fma(-0.005, i, Float64(Float64(i * i) * 0.0008333333333333334)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-253], N[(n * N[(N[(N[(N[(t$95$0 / i), $MachinePrecision] * 0.01), $MachinePrecision] + N[(0.01 * N[(-1.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 0.0001), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(-0.005 * i + N[(N[(i * i), $MachinePrecision] * 0.0008333333333333334), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{-253}:\\
\;\;\;\;n \cdot \frac{\frac{t_0}{i} \cdot 0.01 + 0.01 \cdot \frac{-1}{i}}{0.0001}\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{-100 + t_0 \cdot 100}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + \mathsf{fma}\left(-0.005, i, \left(i \cdot i\right) \cdot 0.0008333333333333334\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -4.99999999999999971e-253Initial program 97.9%
associate-/r/97.9%
associate-*r*97.7%
*-commutative97.7%
associate-*r/97.8%
sub-neg97.8%
distribute-lft-in97.7%
fma-def97.8%
metadata-eval97.8%
metadata-eval97.8%
Simplified97.8%
expm1-log1p-u54.0%
expm1-udef6.1%
Applied egg-rr6.1%
expm1-def55.8%
expm1-log1p55.8%
*-rgt-identity55.8%
associate-*r/55.6%
associate-*l*55.6%
associate-*r/55.7%
metadata-eval55.7%
Simplified55.7%
associate-*r/55.8%
Applied egg-rr55.8%
associate-/l*55.8%
expm1-udef54.1%
div-sub54.1%
*-commutative54.1%
log1p-udef54.1%
exp-to-pow97.9%
+-commutative97.9%
div-inv97.9%
metadata-eval97.9%
div-inv97.9%
metadata-eval97.9%
Applied egg-rr97.9%
associate-/r*97.9%
associate-/r*97.9%
frac-sub98.1%
metadata-eval98.1%
Applied egg-rr98.1%
if -4.99999999999999971e-253 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 25.9%
Taylor expanded in n around inf 37.6%
expm1-def73.2%
Simplified73.2%
clear-num73.1%
un-div-inv73.2%
Applied egg-rr73.2%
associate-/l*73.1%
associate-/r/74.1%
associate-*r/74.2%
Simplified74.2%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.7%
associate-/r/99.6%
associate-*r*99.4%
*-commutative99.4%
associate-*r/99.8%
sub-neg99.8%
distribute-lft-in99.8%
fma-def99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
fma-udef99.8%
*-commutative99.8%
Applied egg-rr99.8%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
fma-def1.9%
metadata-eval1.9%
metadata-eval1.9%
Simplified1.9%
fma-udef1.9%
*-commutative1.9%
Applied egg-rr1.9%
Taylor expanded in n around inf 1.9%
sub-neg1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
metadata-eval1.9%
sub-neg1.9%
expm1-def81.0%
Simplified81.0%
clear-num81.1%
un-div-inv81.0%
associate-/r*81.0%
div-inv81.1%
metadata-eval81.1%
Applied egg-rr81.1%
Taylor expanded in i around 0 99.9%
fma-def99.9%
*-commutative99.9%
unpow299.9%
Simplified99.9%
Final simplification82.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 -1000.0)
(* 100.0 (+ (* (/ n i) 0.0) (- (* n (/ t_0 i)) (/ n i))))
(if (<= t_1 0.0)
(* n (* (expm1 (* n (log1p (/ i n)))) (/ 100.0 i)))
(if (<= t_1 INFINITY)
(* n (/ (+ -100.0 (* t_0 100.0)) i))
(/ n (+ 0.01 (fma -0.005 i (* (* i i) 0.0008333333333333334)))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -1000.0) {
tmp = 100.0 * (((n / i) * 0.0) + ((n * (t_0 / i)) - (n / i)));
} else if (t_1 <= 0.0) {
tmp = n * (expm1((n * log1p((i / n)))) * (100.0 / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * ((-100.0 + (t_0 * 100.0)) / i);
} else {
tmp = n / (0.01 + fma(-0.005, i, ((i * i) * 0.0008333333333333334)));
}
return tmp;
}
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= -1000.0) tmp = Float64(100.0 * Float64(Float64(Float64(n / i) * 0.0) + Float64(Float64(n * Float64(t_0 / i)) - Float64(n / i)))); elseif (t_1 <= 0.0) tmp = Float64(n * Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(100.0 / i))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(-100.0 + Float64(t_0 * 100.0)) / i)); else tmp = Float64(n / Float64(0.01 + fma(-0.005, i, Float64(Float64(i * i) * 0.0008333333333333334)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1000.0], N[(100.0 * N[(N[(N[(n / i), $MachinePrecision] * 0.0), $MachinePrecision] + N[(N[(n * N[(t$95$0 / i), $MachinePrecision]), $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(n * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(100.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(-0.005 * i + N[(N[(i * i), $MachinePrecision] * 0.0008333333333333334), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq -1000:\\
\;\;\;\;100 \cdot \left(\frac{n}{i} \cdot 0 + \left(n \cdot \frac{t_0}{i} - \frac{n}{i}\right)\right)\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;n \cdot \left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{100}{i}\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{-100 + t_0 \cdot 100}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + \mathsf{fma}\left(-0.005, i, \left(i \cdot i\right) \cdot 0.0008333333333333334\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -1e3Initial program 99.7%
div-sub99.7%
associate-/r/99.7%
clear-num100.0%
*-un-lft-identity100.0%
prod-diff100.0%
Applied egg-rr100.0%
+-commutative100.0%
fma-udef100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
distribute-lft-out100.0%
metadata-eval100.0%
fma-udef100.0%
*-rgt-identity100.0%
unsub-neg100.0%
Simplified100.0%
if -1e3 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 28.7%
associate-/r/28.6%
associate-*r*28.6%
*-commutative28.6%
associate-*r/28.6%
sub-neg28.6%
distribute-lft-in28.6%
fma-def28.6%
metadata-eval28.6%
metadata-eval28.6%
Simplified28.6%
expm1-log1p-u28.6%
expm1-udef24.9%
Applied egg-rr72.5%
expm1-def98.1%
expm1-log1p98.8%
*-rgt-identity98.8%
associate-*r/98.7%
associate-*l*98.7%
associate-*r/98.8%
metadata-eval98.8%
Simplified98.8%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.7%
associate-/r/99.6%
associate-*r*99.4%
*-commutative99.4%
associate-*r/99.8%
sub-neg99.8%
distribute-lft-in99.8%
fma-def99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
fma-udef99.8%
*-commutative99.8%
Applied egg-rr99.8%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
fma-def1.9%
metadata-eval1.9%
metadata-eval1.9%
Simplified1.9%
fma-udef1.9%
*-commutative1.9%
Applied egg-rr1.9%
Taylor expanded in n around inf 1.9%
sub-neg1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
metadata-eval1.9%
sub-neg1.9%
expm1-def81.0%
Simplified81.0%
clear-num81.1%
un-div-inv81.0%
associate-/r*81.0%
div-inv81.1%
metadata-eval81.1%
Applied egg-rr81.1%
Taylor expanded in i around 0 99.9%
fma-def99.9%
*-commutative99.9%
unpow299.9%
Simplified99.9%
Final simplification99.1%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 -1000.0)
(* 100.0 (+ (* (/ n i) 0.0) (- (* n (/ t_0 i)) (/ n i))))
(if (<= t_1 0.0)
(* n (/ (* 100.0 (expm1 (* n (log1p (/ i n))))) i))
(if (<= t_1 INFINITY)
(* n (/ (+ -100.0 (* t_0 100.0)) i))
(/ n (+ 0.01 (fma -0.005 i (* (* i i) 0.0008333333333333334)))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -1000.0) {
tmp = 100.0 * (((n / i) * 0.0) + ((n * (t_0 / i)) - (n / i)));
} else if (t_1 <= 0.0) {
tmp = n * ((100.0 * expm1((n * log1p((i / n))))) / i);
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * ((-100.0 + (t_0 * 100.0)) / i);
} else {
tmp = n / (0.01 + fma(-0.005, i, ((i * i) * 0.0008333333333333334)));
}
return tmp;
}
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= -1000.0) tmp = Float64(100.0 * Float64(Float64(Float64(n / i) * 0.0) + Float64(Float64(n * Float64(t_0 / i)) - Float64(n / i)))); elseif (t_1 <= 0.0) tmp = Float64(n * Float64(Float64(100.0 * expm1(Float64(n * log1p(Float64(i / n))))) / i)); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(-100.0 + Float64(t_0 * 100.0)) / i)); else tmp = Float64(n / Float64(0.01 + fma(-0.005, i, Float64(Float64(i * i) * 0.0008333333333333334)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1000.0], N[(100.0 * N[(N[(N[(n / i), $MachinePrecision] * 0.0), $MachinePrecision] + N[(N[(n * N[(t$95$0 / i), $MachinePrecision]), $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(n * N[(N[(100.0 * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(-0.005 * i + N[(N[(i * i), $MachinePrecision] * 0.0008333333333333334), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq -1000:\\
\;\;\;\;100 \cdot \left(\frac{n}{i} \cdot 0 + \left(n \cdot \frac{t_0}{i} - \frac{n}{i}\right)\right)\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{-100 + t_0 \cdot 100}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + \mathsf{fma}\left(-0.005, i, \left(i \cdot i\right) \cdot 0.0008333333333333334\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -1e3Initial program 99.7%
div-sub99.7%
associate-/r/99.7%
clear-num100.0%
*-un-lft-identity100.0%
prod-diff100.0%
Applied egg-rr100.0%
+-commutative100.0%
fma-udef100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
distribute-lft-out100.0%
metadata-eval100.0%
fma-udef100.0%
*-rgt-identity100.0%
unsub-neg100.0%
Simplified100.0%
if -1e3 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 28.7%
associate-/r/28.6%
associate-*r*28.6%
*-commutative28.6%
associate-*r/28.6%
sub-neg28.6%
distribute-lft-in28.6%
fma-def28.6%
metadata-eval28.6%
metadata-eval28.6%
Simplified28.6%
expm1-log1p-u28.6%
expm1-udef24.9%
Applied egg-rr72.5%
expm1-def98.1%
expm1-log1p98.8%
*-rgt-identity98.8%
associate-*r/98.7%
associate-*l*98.7%
associate-*r/98.8%
metadata-eval98.8%
Simplified98.8%
associate-*r/98.8%
Applied egg-rr98.8%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.7%
associate-/r/99.6%
associate-*r*99.4%
*-commutative99.4%
associate-*r/99.8%
sub-neg99.8%
distribute-lft-in99.8%
fma-def99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
fma-udef99.8%
*-commutative99.8%
Applied egg-rr99.8%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
fma-def1.9%
metadata-eval1.9%
metadata-eval1.9%
Simplified1.9%
fma-udef1.9%
*-commutative1.9%
Applied egg-rr1.9%
Taylor expanded in n around inf 1.9%
sub-neg1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
metadata-eval1.9%
sub-neg1.9%
expm1-def81.0%
Simplified81.0%
clear-num81.1%
un-div-inv81.0%
associate-/r*81.0%
div-inv81.1%
metadata-eval81.1%
Applied egg-rr81.1%
Taylor expanded in i around 0 99.9%
fma-def99.9%
*-commutative99.9%
unpow299.9%
Simplified99.9%
Final simplification99.1%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (* 100.0 (/ (expm1 i) i)))))
(if (<= n -1.6e-236)
t_0
(if (<= n 1.28e-197)
(* 100.0 (/ 0.0 (/ i n)))
(if (<= n 4.8e-18)
(/ n (+ 0.01 (fma -0.005 i (* (* i i) 0.0008333333333333334))))
(if (or (<= n 4e+52) (and (not (<= n 5e+109)) (<= n 5.1e+117)))
(* 100.0 (/ (+ i (* (* i i) (- 0.5 (/ 0.5 n)))) (/ i n)))
t_0))))))
double code(double i, double n) {
double t_0 = n * (100.0 * (expm1(i) / i));
double tmp;
if (n <= -1.6e-236) {
tmp = t_0;
} else if (n <= 1.28e-197) {
tmp = 100.0 * (0.0 / (i / n));
} else if (n <= 4.8e-18) {
tmp = n / (0.01 + fma(-0.005, i, ((i * i) * 0.0008333333333333334)));
} else if ((n <= 4e+52) || (!(n <= 5e+109) && (n <= 5.1e+117))) {
tmp = 100.0 * ((i + ((i * i) * (0.5 - (0.5 / n)))) / (i / n));
} else {
tmp = t_0;
}
return tmp;
}
function code(i, n) t_0 = Float64(n * Float64(100.0 * Float64(expm1(i) / i))) tmp = 0.0 if (n <= -1.6e-236) tmp = t_0; elseif (n <= 1.28e-197) tmp = Float64(100.0 * Float64(0.0 / Float64(i / n))); elseif (n <= 4.8e-18) tmp = Float64(n / Float64(0.01 + fma(-0.005, i, Float64(Float64(i * i) * 0.0008333333333333334)))); elseif ((n <= 4e+52) || (!(n <= 5e+109) && (n <= 5.1e+117))) tmp = Float64(100.0 * Float64(Float64(i + Float64(Float64(i * i) * Float64(0.5 - Float64(0.5 / n)))) / Float64(i / n))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.6e-236], t$95$0, If[LessEqual[n, 1.28e-197], N[(100.0 * N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.8e-18], N[(n / N[(0.01 + N[(-0.005 * i + N[(N[(i * i), $MachinePrecision] * 0.0008333333333333334), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[n, 4e+52], And[N[Not[LessEqual[n, 5e+109]], $MachinePrecision], LessEqual[n, 5.1e+117]]], N[(100.0 * N[(N[(i + N[(N[(i * i), $MachinePrecision] * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{if}\;n \leq -1.6 \cdot 10^{-236}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 1.28 \cdot 10^{-197}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 4.8 \cdot 10^{-18}:\\
\;\;\;\;\frac{n}{0.01 + \mathsf{fma}\left(-0.005, i, \left(i \cdot i\right) \cdot 0.0008333333333333334\right)}\\
\mathbf{elif}\;n \leq 4 \cdot 10^{+52} \lor \neg \left(n \leq 5 \cdot 10^{+109}\right) \land n \leq 5.1 \cdot 10^{+117}:\\
\;\;\;\;100 \cdot \frac{i + \left(i \cdot i\right) \cdot \left(0.5 - \frac{0.5}{n}\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -1.6e-236 or 4e52 < n < 5.0000000000000001e109 or 5.0999999999999996e117 < n Initial program 24.7%
Taylor expanded in n around inf 33.5%
expm1-def62.5%
Simplified62.5%
clear-num62.4%
un-div-inv62.4%
Applied egg-rr62.4%
associate-/l*62.4%
associate-/r/83.1%
associate-*r/83.2%
Simplified83.2%
if -1.6e-236 < n < 1.27999999999999998e-197Initial program 65.1%
Taylor expanded in i around 0 83.5%
if 1.27999999999999998e-197 < n < 4.79999999999999988e-18Initial program 19.5%
associate-/r/19.6%
associate-*r*19.6%
*-commutative19.6%
associate-*r/19.6%
sub-neg19.6%
distribute-lft-in19.6%
fma-def19.6%
metadata-eval19.6%
metadata-eval19.6%
Simplified19.6%
fma-udef19.6%
*-commutative19.6%
Applied egg-rr19.6%
Taylor expanded in n around inf 3.8%
sub-neg3.8%
metadata-eval3.8%
metadata-eval3.8%
distribute-lft-in3.8%
metadata-eval3.8%
sub-neg3.8%
expm1-def51.5%
Simplified51.5%
clear-num51.4%
un-div-inv51.3%
associate-/r*51.4%
div-inv51.4%
metadata-eval51.4%
Applied egg-rr51.4%
Taylor expanded in i around 0 66.7%
fma-def66.7%
*-commutative66.7%
unpow266.7%
Simplified66.7%
if 4.79999999999999988e-18 < n < 4e52 or 5.0000000000000001e109 < n < 5.0999999999999996e117Initial program 62.7%
Taylor expanded in i around 0 92.7%
unpow292.7%
associate-*r/92.7%
metadata-eval92.7%
Simplified92.7%
Final simplification81.8%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (/ (* 100.0 (expm1 i)) i))) (t_1 (* 100.0 (/ 0.0 (/ i n)))))
(if (<= n -1.25e-236)
t_0
(if (<= n 1.28e-197)
t_1
(if (<= n 2.9e-169)
(* 100.0 (/ i (/ i n)))
(if (<= n 1.1e-141) t_1 t_0))))))
double code(double i, double n) {
double t_0 = n * ((100.0 * expm1(i)) / i);
double t_1 = 100.0 * (0.0 / (i / n));
double tmp;
if (n <= -1.25e-236) {
tmp = t_0;
} else if (n <= 1.28e-197) {
tmp = t_1;
} else if (n <= 2.9e-169) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.1e-141) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = n * ((100.0 * Math.expm1(i)) / i);
double t_1 = 100.0 * (0.0 / (i / n));
double tmp;
if (n <= -1.25e-236) {
tmp = t_0;
} else if (n <= 1.28e-197) {
tmp = t_1;
} else if (n <= 2.9e-169) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.1e-141) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * ((100.0 * math.expm1(i)) / i) t_1 = 100.0 * (0.0 / (i / n)) tmp = 0 if n <= -1.25e-236: tmp = t_0 elif n <= 1.28e-197: tmp = t_1 elif n <= 2.9e-169: tmp = 100.0 * (i / (i / n)) elif n <= 1.1e-141: tmp = t_1 else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)) t_1 = Float64(100.0 * Float64(0.0 / Float64(i / n))) tmp = 0.0 if (n <= -1.25e-236) tmp = t_0; elseif (n <= 1.28e-197) tmp = t_1; elseif (n <= 2.9e-169) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 1.1e-141) tmp = t_1; else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(100.0 * N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.25e-236], t$95$0, If[LessEqual[n, 1.28e-197], t$95$1, If[LessEqual[n, 2.9e-169], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.1e-141], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
t_1 := 100 \cdot \frac{0}{\frac{i}{n}}\\
\mathbf{if}\;n \leq -1.25 \cdot 10^{-236}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 1.28 \cdot 10^{-197}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;n \leq 2.9 \cdot 10^{-169}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 1.1 \cdot 10^{-141}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -1.2499999999999999e-236 or 1.10000000000000005e-141 < n Initial program 25.9%
associate-/r/26.3%
associate-*r*26.2%
*-commutative26.2%
associate-*r/26.3%
sub-neg26.3%
distribute-lft-in26.3%
fma-def26.3%
metadata-eval26.3%
metadata-eval26.3%
Simplified26.3%
fma-udef26.3%
*-commutative26.3%
Applied egg-rr26.3%
Taylor expanded in n around inf 31.1%
sub-neg31.1%
metadata-eval31.1%
metadata-eval31.1%
distribute-lft-in31.1%
metadata-eval31.1%
sub-neg31.1%
expm1-def80.3%
Simplified80.3%
if -1.2499999999999999e-236 < n < 1.27999999999999998e-197 or 2.90000000000000019e-169 < n < 1.10000000000000005e-141Initial program 61.8%
Taylor expanded in i around 0 78.5%
if 1.27999999999999998e-197 < n < 2.90000000000000019e-169Initial program 5.6%
Taylor expanded in i around 0 76.4%
Final simplification79.8%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (* 100.0 (/ (expm1 i) i)))) (t_1 (* 100.0 (/ 0.0 (/ i n)))))
(if (<= n -1.8e-235)
t_0
(if (<= n 1.35e-197)
t_1
(if (<= n 2.9e-169)
(* 100.0 (/ i (/ i n)))
(if (<= n 1.6e-141) t_1 t_0))))))
double code(double i, double n) {
double t_0 = n * (100.0 * (expm1(i) / i));
double t_1 = 100.0 * (0.0 / (i / n));
double tmp;
if (n <= -1.8e-235) {
tmp = t_0;
} else if (n <= 1.35e-197) {
tmp = t_1;
} else if (n <= 2.9e-169) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.6e-141) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = n * (100.0 * (Math.expm1(i) / i));
double t_1 = 100.0 * (0.0 / (i / n));
double tmp;
if (n <= -1.8e-235) {
tmp = t_0;
} else if (n <= 1.35e-197) {
tmp = t_1;
} else if (n <= 2.9e-169) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.6e-141) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 * (math.expm1(i) / i)) t_1 = 100.0 * (0.0 / (i / n)) tmp = 0 if n <= -1.8e-235: tmp = t_0 elif n <= 1.35e-197: tmp = t_1 elif n <= 2.9e-169: tmp = 100.0 * (i / (i / n)) elif n <= 1.6e-141: tmp = t_1 else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 * Float64(expm1(i) / i))) t_1 = Float64(100.0 * Float64(0.0 / Float64(i / n))) tmp = 0.0 if (n <= -1.8e-235) tmp = t_0; elseif (n <= 1.35e-197) tmp = t_1; elseif (n <= 2.9e-169) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 1.6e-141) tmp = t_1; else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(100.0 * N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.8e-235], t$95$0, If[LessEqual[n, 1.35e-197], t$95$1, If[LessEqual[n, 2.9e-169], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.6e-141], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
t_1 := 100 \cdot \frac{0}{\frac{i}{n}}\\
\mathbf{if}\;n \leq -1.8 \cdot 10^{-235}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 1.35 \cdot 10^{-197}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;n \leq 2.9 \cdot 10^{-169}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 1.6 \cdot 10^{-141}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -1.79999999999999999e-235 or 1.6000000000000001e-141 < n Initial program 25.9%
Taylor expanded in n around inf 30.6%
expm1-def62.3%
Simplified62.3%
clear-num62.2%
un-div-inv62.2%
Applied egg-rr62.2%
associate-/l*62.2%
associate-/r/80.3%
associate-*r/80.4%
Simplified80.4%
if -1.79999999999999999e-235 < n < 1.35000000000000009e-197 or 2.90000000000000019e-169 < n < 1.6000000000000001e-141Initial program 61.8%
Taylor expanded in i around 0 78.5%
if 1.35000000000000009e-197 < n < 2.90000000000000019e-169Initial program 5.6%
Taylor expanded in i around 0 76.4%
Final simplification79.9%
(FPCore (i n) :precision binary64 (if (or (<= i -2e-25) (not (<= i 0.0009))) (* 100.0 (/ (expm1 i) (/ i n))) (* n 100.0)))
double code(double i, double n) {
double tmp;
if ((i <= -2e-25) || !(i <= 0.0009)) {
tmp = 100.0 * (expm1(i) / (i / n));
} else {
tmp = n * 100.0;
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((i <= -2e-25) || !(i <= 0.0009)) {
tmp = 100.0 * (Math.expm1(i) / (i / n));
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -2e-25) or not (i <= 0.0009): tmp = 100.0 * (math.expm1(i) / (i / n)) else: tmp = n * 100.0 return tmp
function code(i, n) tmp = 0.0 if ((i <= -2e-25) || !(i <= 0.0009)) tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n))); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := If[Or[LessEqual[i, -2e-25], N[Not[LessEqual[i, 0.0009]], $MachinePrecision]], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2 \cdot 10^{-25} \lor \neg \left(i \leq 0.0009\right):\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if i < -2.00000000000000008e-25 or 8.9999999999999998e-4 < i Initial program 55.9%
Taylor expanded in n around inf 54.3%
expm1-def53.8%
Simplified53.8%
if -2.00000000000000008e-25 < i < 8.9999999999999998e-4Initial program 9.5%
Taylor expanded in i around 0 86.1%
*-commutative86.1%
Simplified86.1%
Final simplification70.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ 0.0 (/ i n)))))
(if (<= n -6.2e-234)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 2e-197)
t_0
(if (<= n 2.9e-169)
(* 100.0 (/ i (/ i n)))
(if (<= n 1.1e-141) t_0 (* n (+ 100.0 (* i 50.0)))))))))
double code(double i, double n) {
double t_0 = 100.0 * (0.0 / (i / n));
double tmp;
if (n <= -6.2e-234) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 2e-197) {
tmp = t_0;
} else if (n <= 2.9e-169) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.1e-141) {
tmp = t_0;
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 100.0d0 * (0.0d0 / (i / n))
if (n <= (-6.2d-234)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 2d-197) then
tmp = t_0
else if (n <= 2.9d-169) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 1.1d-141) then
tmp = t_0
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = 100.0 * (0.0 / (i / n));
double tmp;
if (n <= -6.2e-234) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 2e-197) {
tmp = t_0;
} else if (n <= 2.9e-169) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.1e-141) {
tmp = t_0;
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (0.0 / (i / n)) tmp = 0 if n <= -6.2e-234: tmp = n / (0.01 + (i * -0.005)) elif n <= 2e-197: tmp = t_0 elif n <= 2.9e-169: tmp = 100.0 * (i / (i / n)) elif n <= 1.1e-141: tmp = t_0 else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(0.0 / Float64(i / n))) tmp = 0.0 if (n <= -6.2e-234) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 2e-197) tmp = t_0; elseif (n <= 2.9e-169) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 1.1e-141) tmp = t_0; else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) t_0 = 100.0 * (0.0 / (i / n)); tmp = 0.0; if (n <= -6.2e-234) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 2e-197) tmp = t_0; elseif (n <= 2.9e-169) tmp = 100.0 * (i / (i / n)); elseif (n <= 1.1e-141) tmp = t_0; else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -6.2e-234], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2e-197], t$95$0, If[LessEqual[n, 2.9e-169], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.1e-141], t$95$0, N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{0}{\frac{i}{n}}\\
\mathbf{if}\;n \leq -6.2 \cdot 10^{-234}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 2 \cdot 10^{-197}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 2.9 \cdot 10^{-169}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 1.1 \cdot 10^{-141}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -6.2000000000000003e-234Initial program 28.6%
associate-/r/28.8%
associate-*r*28.8%
*-commutative28.8%
associate-*r/28.9%
sub-neg28.9%
distribute-lft-in28.9%
fma-def28.9%
metadata-eval28.9%
metadata-eval28.9%
Simplified28.9%
fma-udef28.9%
*-commutative28.9%
Applied egg-rr28.9%
Taylor expanded in n around inf 32.9%
sub-neg32.9%
metadata-eval32.9%
metadata-eval32.9%
distribute-lft-in32.9%
metadata-eval32.9%
sub-neg32.9%
expm1-def76.5%
Simplified76.5%
clear-num76.5%
un-div-inv76.5%
associate-/r*76.5%
div-inv76.5%
metadata-eval76.5%
Applied egg-rr76.5%
Taylor expanded in i around 0 56.5%
*-commutative56.5%
Simplified56.5%
if -6.2000000000000003e-234 < n < 2e-197 or 2.90000000000000019e-169 < n < 1.10000000000000005e-141Initial program 61.8%
Taylor expanded in i around 0 78.5%
if 2e-197 < n < 2.90000000000000019e-169Initial program 5.6%
Taylor expanded in i around 0 76.4%
if 1.10000000000000005e-141 < n Initial program 21.8%
associate-/r/22.3%
associate-*r*22.3%
*-commutative22.3%
associate-*r/22.3%
sub-neg22.3%
distribute-lft-in22.3%
fma-def22.3%
metadata-eval22.3%
metadata-eval22.3%
Simplified22.3%
fma-udef22.3%
*-commutative22.3%
Applied egg-rr22.3%
Taylor expanded in n around inf 28.3%
sub-neg28.3%
metadata-eval28.3%
metadata-eval28.3%
distribute-lft-in28.3%
metadata-eval28.3%
sub-neg28.3%
expm1-def86.1%
Simplified86.1%
Taylor expanded in i around 0 73.2%
*-commutative73.2%
Simplified73.2%
Final simplification66.4%
(FPCore (i n) :precision binary64 (if (or (<= n -1.4e+33) (not (<= n 8e-14))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -1.4e+33) || !(n <= 8e-14)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-1.4d+33)) .or. (.not. (n <= 8d-14))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 100.0d0 * (i / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -1.4e+33) || !(n <= 8e-14)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.4e+33) or not (n <= 8e-14): tmp = n * (100.0 + (i * 50.0)) else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.4e+33) || !(n <= 8e-14)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(100.0 * Float64(i / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -1.4e+33) || ~((n <= 8e-14))) tmp = n * (100.0 + (i * 50.0)); else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1.4e+33], N[Not[LessEqual[n, 8e-14]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.4 \cdot 10^{+33} \lor \neg \left(n \leq 8 \cdot 10^{-14}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -1.4e33 or 7.99999999999999999e-14 < n Initial program 24.6%
associate-/r/25.1%
associate-*r*25.1%
*-commutative25.1%
associate-*r/25.1%
sub-neg25.1%
distribute-lft-in25.1%
fma-def25.1%
metadata-eval25.1%
metadata-eval25.1%
Simplified25.1%
fma-udef25.1%
*-commutative25.1%
Applied egg-rr25.1%
Taylor expanded in n around inf 39.0%
sub-neg39.0%
metadata-eval39.0%
metadata-eval39.0%
distribute-lft-in39.0%
metadata-eval39.0%
sub-neg39.0%
expm1-def87.4%
Simplified87.4%
Taylor expanded in i around 0 61.1%
*-commutative61.1%
Simplified61.1%
if -1.4e33 < n < 7.99999999999999999e-14Initial program 40.4%
Taylor expanded in i around 0 57.8%
Final simplification59.6%
(FPCore (i n) :precision binary64 (if (<= i -5e+57) (* 100.0 (/ i (/ i n))) (if (<= i 1.2e+64) (* n 100.0) (* 50.0 (* i n)))))
double code(double i, double n) {
double tmp;
if (i <= -5e+57) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 1.2e+64) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-5d+57)) then
tmp = 100.0d0 * (i / (i / n))
else if (i <= 1.2d+64) then
tmp = n * 100.0d0
else
tmp = 50.0d0 * (i * n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -5e+57) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 1.2e+64) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -5e+57: tmp = 100.0 * (i / (i / n)) elif i <= 1.2e+64: tmp = n * 100.0 else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= -5e+57) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (i <= 1.2e+64) tmp = Float64(n * 100.0); else tmp = Float64(50.0 * Float64(i * n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -5e+57) tmp = 100.0 * (i / (i / n)); elseif (i <= 1.2e+64) tmp = n * 100.0; else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -5e+57], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1.2e+64], N[(n * 100.0), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -5 \cdot 10^{+57}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 1.2 \cdot 10^{+64}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < -4.99999999999999972e57Initial program 61.3%
Taylor expanded in i around 0 26.2%
if -4.99999999999999972e57 < i < 1.2e64Initial program 16.6%
Taylor expanded in i around 0 71.8%
*-commutative71.8%
Simplified71.8%
if 1.2e64 < i Initial program 55.1%
associate-/r/55.4%
associate-*r*55.3%
*-commutative55.3%
associate-*r/55.5%
sub-neg55.5%
distribute-lft-in55.5%
fma-def55.5%
metadata-eval55.5%
metadata-eval55.5%
Simplified55.5%
fma-udef55.5%
*-commutative55.5%
Applied egg-rr55.5%
Taylor expanded in n around inf 41.2%
sub-neg41.2%
metadata-eval41.2%
metadata-eval41.2%
distribute-lft-in41.2%
metadata-eval41.2%
sub-neg41.2%
expm1-def41.2%
Simplified41.2%
Taylor expanded in i around 0 28.6%
Taylor expanded in i around inf 28.6%
Final simplification55.5%
(FPCore (i n) :precision binary64 (if (<= n 2.25e-130) (/ n (+ 0.01 (* i -0.005))) (* n (+ 100.0 (* i 50.0)))))
double code(double i, double n) {
double tmp;
if (n <= 2.25e-130) {
tmp = n / (0.01 + (i * -0.005));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= 2.25d-130) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= 2.25e-130) {
tmp = n / (0.01 + (i * -0.005));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= 2.25e-130: tmp = n / (0.01 + (i * -0.005)) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= 2.25e-130) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= 2.25e-130) tmp = n / (0.01 + (i * -0.005)); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, 2.25e-130], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 2.25 \cdot 10^{-130}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < 2.25e-130Initial program 36.6%
associate-/r/36.8%
associate-*r*36.8%
*-commutative36.8%
associate-*r/36.8%
sub-neg36.8%
distribute-lft-in36.8%
fma-def36.8%
metadata-eval36.8%
metadata-eval36.8%
Simplified36.8%
fma-udef36.8%
*-commutative36.8%
Applied egg-rr36.8%
Taylor expanded in n around inf 33.1%
sub-neg33.1%
metadata-eval33.1%
metadata-eval33.1%
distribute-lft-in33.1%
metadata-eval33.1%
sub-neg33.1%
expm1-def63.5%
Simplified63.5%
clear-num63.5%
un-div-inv63.4%
associate-/r*63.5%
div-inv63.5%
metadata-eval63.5%
Applied egg-rr63.5%
Taylor expanded in i around 0 54.8%
*-commutative54.8%
Simplified54.8%
if 2.25e-130 < n Initial program 21.8%
associate-/r/22.3%
associate-*r*22.3%
*-commutative22.3%
associate-*r/22.3%
sub-neg22.3%
distribute-lft-in22.3%
fma-def22.3%
metadata-eval22.3%
metadata-eval22.3%
Simplified22.3%
fma-udef22.3%
*-commutative22.3%
Applied egg-rr22.3%
Taylor expanded in n around inf 28.3%
sub-neg28.3%
metadata-eval28.3%
metadata-eval28.3%
distribute-lft-in28.3%
metadata-eval28.3%
sub-neg28.3%
expm1-def86.1%
Simplified86.1%
Taylor expanded in i around 0 73.2%
*-commutative73.2%
Simplified73.2%
Final simplification60.5%
(FPCore (i n) :precision binary64 (if (<= i 1.2e+64) (* n 100.0) (* 50.0 (* i n))))
double code(double i, double n) {
double tmp;
if (i <= 1.2e+64) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 1.2d+64) then
tmp = n * 100.0d0
else
tmp = 50.0d0 * (i * n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 1.2e+64) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 1.2e+64: tmp = n * 100.0 else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= 1.2e+64) tmp = Float64(n * 100.0); else tmp = Float64(50.0 * Float64(i * n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 1.2e+64) tmp = n * 100.0; else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 1.2e+64], N[(n * 100.0), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 1.2 \cdot 10^{+64}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < 1.2e64Initial program 27.5%
Taylor expanded in i around 0 55.5%
*-commutative55.5%
Simplified55.5%
if 1.2e64 < i Initial program 55.1%
associate-/r/55.4%
associate-*r*55.3%
*-commutative55.3%
associate-*r/55.5%
sub-neg55.5%
distribute-lft-in55.5%
fma-def55.5%
metadata-eval55.5%
metadata-eval55.5%
Simplified55.5%
fma-udef55.5%
*-commutative55.5%
Applied egg-rr55.5%
Taylor expanded in n around inf 41.2%
sub-neg41.2%
metadata-eval41.2%
metadata-eval41.2%
distribute-lft-in41.2%
metadata-eval41.2%
sub-neg41.2%
expm1-def41.2%
Simplified41.2%
Taylor expanded in i around 0 28.6%
Taylor expanded in i around inf 28.6%
Final simplification51.1%
(FPCore (i n) :precision binary64 (* i -50.0))
double code(double i, double n) {
return i * -50.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = i * (-50.0d0)
end function
public static double code(double i, double n) {
return i * -50.0;
}
def code(i, n): return i * -50.0
function code(i, n) return Float64(i * -50.0) end
function tmp = code(i, n) tmp = i * -50.0; end
code[i_, n_] := N[(i * -50.0), $MachinePrecision]
\begin{array}{l}
\\
i \cdot -50
\end{array}
Initial program 32.0%
Taylor expanded in i around 0 50.9%
associate-*r*51.1%
*-commutative51.1%
associate-*r/51.1%
metadata-eval51.1%
Simplified51.1%
Taylor expanded in n around 0 2.8%
*-commutative2.8%
Simplified2.8%
Final simplification2.8%
(FPCore (i n) :precision binary64 (* n 100.0))
double code(double i, double n) {
return n * 100.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = n * 100.0d0
end function
public static double code(double i, double n) {
return n * 100.0;
}
def code(i, n): return n * 100.0
function code(i, n) return Float64(n * 100.0) end
function tmp = code(i, n) tmp = n * 100.0; end
code[i_, n_] := N[(n * 100.0), $MachinePrecision]
\begin{array}{l}
\\
n \cdot 100
\end{array}
Initial program 32.0%
Taylor expanded in i around 0 47.2%
*-commutative47.2%
Simplified47.2%
Final simplification47.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ 1.0 (/ i n))))
(*
100.0
(/
(-
(exp
(*
n
(if (== t_0 1.0)
(/ i n)
(/ (* (/ i n) (log t_0)) (- (+ (/ i n) 1.0) 1.0)))))
1.0)
(/ i n)))))
double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (i / n)
if (t_0 == 1.0d0) then
tmp = i / n
else
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0d0) - 1.0d0)
end if
code = 100.0d0 * ((exp((n * tmp)) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * Math.log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((Math.exp((n * tmp)) - 1.0) / (i / n));
}
def code(i, n): t_0 = 1.0 + (i / n) tmp = 0 if t_0 == 1.0: tmp = i / n else: tmp = ((i / n) * math.log(t_0)) / (((i / n) + 1.0) - 1.0) return 100.0 * ((math.exp((n * tmp)) - 1.0) / (i / n))
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) tmp = 0.0 if (t_0 == 1.0) tmp = Float64(i / n); else tmp = Float64(Float64(Float64(i / n) * log(t_0)) / Float64(Float64(Float64(i / n) + 1.0) - 1.0)); end return Float64(100.0 * Float64(Float64(exp(Float64(n * tmp)) - 1.0) / Float64(i / n))) end
function tmp_2 = code(i, n) t_0 = 1.0 + (i / n); tmp = 0.0; if (t_0 == 1.0) tmp = i / n; else tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0); end tmp_2 = 100.0 * ((exp((n * tmp)) - 1.0) / (i / n)); end
code[i_, n_] := Block[{t$95$0 = N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision]}, N[(100.0 * N[(N[(N[Exp[N[(n * If[Equal[t$95$0, 1.0], N[(i / n), $MachinePrecision], N[(N[(N[(i / n), $MachinePrecision] * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(i / n), $MachinePrecision] + 1.0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{i}{n}\\
100 \cdot \frac{e^{n \cdot \begin{array}{l}
\mathbf{if}\;t_0 = 1:\\
\;\;\;\;\frac{i}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{i}{n} \cdot \log t_0}{\left(\frac{i}{n} + 1\right) - 1}\\
\end{array}} - 1}{\frac{i}{n}}
\end{array}
\end{array}
herbie shell --seed 2023257
(FPCore (i n)
:name "Compound Interest"
:precision binary64
:herbie-target
(* 100.0 (/ (- (exp (* n (if (== (+ 1.0 (/ i n)) 1.0) (/ i n) (/ (* (/ i n) (log (+ 1.0 (/ i n)))) (- (+ (/ i n) 1.0) 1.0))))) 1.0) (/ i n)))
(* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))