
(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) -1.0))
(t_1 (/ t_0 (/ i n)))
(t_2 (* 100.0 (* (/ n i) t_0))))
(if (<= t_1 (- INFINITY))
t_2
(if (<= t_1 0.0)
(/ (* 100.0 (expm1 (* n (log1p (/ i n))))) (/ i n))
(if (<= t_1 INFINITY)
t_2
(*
100.0
(/ n (+ (fma i -0.5 1.0) (* i (* i 0.08333333333333333))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double t_2 = 100.0 * ((n / i) * t_0);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = (100.0 * expm1((n * log1p((i / n))))) / (i / n);
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = 100.0 * (n / (fma(i, -0.5, 1.0) + (i * (i * 0.08333333333333333))));
}
return tmp;
}
function code(i, n) t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) t_1 = Float64(t_0 / Float64(i / n)) t_2 = Float64(100.0 * Float64(Float64(n / i) * t_0)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_2; elseif (t_1 <= 0.0) tmp = Float64(Float64(100.0 * expm1(Float64(n * log1p(Float64(i / n))))) / Float64(i / n)); elseif (t_1 <= Inf) tmp = t_2; else tmp = Float64(100.0 * Float64(n / Float64(fma(i, -0.5, 1.0) + Float64(i * Float64(i * 0.08333333333333333))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(100.0 * N[(N[(n / i), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$2, If[LessEqual[t$95$1, 0.0], N[(N[(100.0 * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(100.0 * N[(n / N[(N[(i * -0.5 + 1.0), $MachinePrecision] + N[(i * N[(i * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t_0}{\frac{i}{n}}\\
t_2 := 100 \cdot \left(\frac{n}{i} \cdot t_0\right)\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\frac{100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -inf.0 or -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.9%
div-sub99.9%
clear-num99.9%
sub-neg99.9%
div-inv99.9%
clear-num99.9%
Applied egg-rr99.9%
+-commutative99.9%
neg-mul-199.9%
distribute-rgt-out99.9%
Simplified99.9%
if -inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 25.3%
associate-*r/25.3%
*-commutative25.3%
pow-to-exp25.3%
expm1-def35.9%
add-log-exp25.3%
pow-to-exp25.3%
log-pow35.9%
log1p-udef99.6%
Applied egg-rr99.6%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in n around inf 1.8%
*-commutative1.8%
associate-/l*1.8%
expm1-def75.8%
Simplified75.8%
Taylor expanded in i around 0 100.0%
+-commutative100.0%
associate-+r+100.0%
+-commutative100.0%
*-commutative100.0%
fma-def100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Final simplification99.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0))
(t_1 (/ t_0 (/ i n)))
(t_2 (* 100.0 (* (/ n i) t_0))))
(if (<= t_1 -5e-17)
t_2
(if (<= t_1 0.0)
(* 100.0 (/ n (/ i (expm1 i))))
(if (<= t_1 INFINITY)
t_2
(*
100.0
(/ n (+ (fma i -0.5 1.0) (* i (* i 0.08333333333333333))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double t_2 = 100.0 * ((n / i) * t_0);
double tmp;
if (t_1 <= -5e-17) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n / (i / expm1(i)));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = 100.0 * (n / (fma(i, -0.5, 1.0) + (i * (i * 0.08333333333333333))));
}
return tmp;
}
function code(i, n) t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) t_1 = Float64(t_0 / Float64(i / n)) t_2 = Float64(100.0 * Float64(Float64(n / i) * t_0)) tmp = 0.0 if (t_1 <= -5e-17) tmp = t_2; elseif (t_1 <= 0.0) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); elseif (t_1 <= Inf) tmp = t_2; else tmp = Float64(100.0 * Float64(n / Float64(fma(i, -0.5, 1.0) + Float64(i * Float64(i * 0.08333333333333333))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(100.0 * N[(N[(n / i), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-17], t$95$2, If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(100.0 * N[(n / N[(N[(i * -0.5 + 1.0), $MachinePrecision] + N[(i * N[(i * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t_0}{\frac{i}{n}}\\
t_2 := 100 \cdot \left(\frac{n}{i} \cdot t_0\right)\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{-17}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -4.9999999999999999e-17 or -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 98.5%
div-sub98.4%
clear-num98.4%
sub-neg98.4%
div-inv98.4%
clear-num98.4%
Applied egg-rr98.4%
+-commutative98.4%
neg-mul-198.4%
distribute-rgt-out98.5%
Simplified98.5%
if -4.9999999999999999e-17 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 24.7%
Taylor expanded in n around inf 41.6%
*-commutative41.6%
associate-/l*41.6%
expm1-def79.7%
Simplified79.7%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in n around inf 1.8%
*-commutative1.8%
associate-/l*1.8%
expm1-def75.8%
Simplified75.8%
Taylor expanded in i around 0 100.0%
+-commutative100.0%
associate-+r+100.0%
+-commutative100.0%
*-commutative100.0%
fma-def100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Final simplification86.0%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0))
(t_1 (/ t_0 (/ i n)))
(t_2 (* 100.0 (* (/ n i) t_0))))
(if (<= t_1 (- INFINITY))
t_2
(if (<= t_1 0.0)
(* 100.0 (* (/ n i) (expm1 (* n (log1p (/ i n))))))
(if (<= t_1 INFINITY)
t_2
(*
100.0
(/ n (+ (fma i -0.5 1.0) (* i (* i 0.08333333333333333))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double t_2 = 100.0 * ((n / i) * t_0);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = 100.0 * ((n / i) * expm1((n * log1p((i / n)))));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = 100.0 * (n / (fma(i, -0.5, 1.0) + (i * (i * 0.08333333333333333))));
}
return tmp;
}
function code(i, n) t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) t_1 = Float64(t_0 / Float64(i / n)) t_2 = Float64(100.0 * Float64(Float64(n / i) * t_0)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_2; elseif (t_1 <= 0.0) tmp = Float64(100.0 * Float64(Float64(n / i) * expm1(Float64(n * log1p(Float64(i / n)))))); elseif (t_1 <= Inf) tmp = t_2; else tmp = Float64(100.0 * Float64(n / Float64(fma(i, -0.5, 1.0) + Float64(i * Float64(i * 0.08333333333333333))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(100.0 * N[(N[(n / i), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$2, If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(N[(n / i), $MachinePrecision] * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(100.0 * N[(n / N[(N[(i * -0.5 + 1.0), $MachinePrecision] + N[(i * N[(i * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t_0}{\frac{i}{n}}\\
t_2 := 100 \cdot \left(\frac{n}{i} \cdot t_0\right)\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;100 \cdot \left(\frac{n}{i} \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -inf.0 or -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.9%
div-sub99.9%
clear-num99.9%
sub-neg99.9%
div-inv99.9%
clear-num99.9%
Applied egg-rr99.9%
+-commutative99.9%
neg-mul-199.9%
distribute-rgt-out99.9%
Simplified99.9%
if -inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 25.3%
clear-num25.3%
associate-/r/25.2%
clear-num25.2%
pow-to-exp25.2%
expm1-def35.7%
add-log-exp25.2%
pow-to-exp25.2%
log-pow35.7%
log1p-udef95.4%
Applied egg-rr95.4%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in n around inf 1.8%
*-commutative1.8%
associate-/l*1.8%
expm1-def75.8%
Simplified75.8%
Taylor expanded in i around 0 100.0%
+-commutative100.0%
associate-+r+100.0%
+-commutative100.0%
*-commutative100.0%
fma-def100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Final simplification96.8%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0))
(t_1 (/ t_0 (/ i n)))
(t_2 (* 100.0 (* (/ n i) t_0))))
(if (<= t_1 (- INFINITY))
t_2
(if (<= t_1 0.0)
(* n (/ (expm1 (* n (log1p (/ i n)))) (/ i 100.0)))
(if (<= t_1 INFINITY)
t_2
(*
100.0
(/ n (+ (fma i -0.5 1.0) (* i (* i 0.08333333333333333))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double t_2 = 100.0 * ((n / i) * t_0);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = n * (expm1((n * log1p((i / n)))) / (i / 100.0));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = 100.0 * (n / (fma(i, -0.5, 1.0) + (i * (i * 0.08333333333333333))));
}
return tmp;
}
function code(i, n) t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) t_1 = Float64(t_0 / Float64(i / n)) t_2 = Float64(100.0 * Float64(Float64(n / i) * t_0)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_2; elseif (t_1 <= 0.0) tmp = Float64(n * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i / 100.0))); elseif (t_1 <= Inf) tmp = t_2; else tmp = Float64(100.0 * Float64(n / Float64(fma(i, -0.5, 1.0) + Float64(i * Float64(i * 0.08333333333333333))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(100.0 * N[(N[(n / i), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$2, 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[(i / 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(100.0 * N[(n / N[(N[(i * -0.5 + 1.0), $MachinePrecision] + N[(i * N[(i * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t_0}{\frac{i}{n}}\\
t_2 := 100 \cdot \left(\frac{n}{i} \cdot t_0\right)\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{100}}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -inf.0 or -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.9%
div-sub99.9%
clear-num99.9%
sub-neg99.9%
div-inv99.9%
clear-num99.9%
Applied egg-rr99.9%
+-commutative99.9%
neg-mul-199.9%
distribute-rgt-out99.9%
Simplified99.9%
if -inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 25.3%
associate-*r/25.3%
*-commutative25.3%
pow-to-exp25.3%
expm1-def35.9%
add-log-exp25.3%
pow-to-exp25.3%
log-pow35.9%
log1p-udef99.6%
Applied egg-rr99.6%
associate-/r/97.8%
Applied egg-rr97.8%
*-commutative97.8%
associate-/l*97.8%
Simplified97.8%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in n around inf 1.8%
*-commutative1.8%
associate-/l*1.8%
expm1-def75.8%
Simplified75.8%
Taylor expanded in i around 0 100.0%
+-commutative100.0%
associate-+r+100.0%
+-commutative100.0%
*-commutative100.0%
fma-def100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Final simplification98.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ (expm1 i) (/ i n)))))
(if (<= i -8.6e-32)
t_0
(if (<= i 6.8e-45)
(* n (+ 100.0 (/ (* i -50.0) n)))
(if (<= i 3.1e+155)
t_0
(if (<= i 7.8e+222)
(* 100.0 (/ n (+ 1.0 (* i -0.5))))
(* (/ (* i i) n) 33.333333333333336)))))))
double code(double i, double n) {
double t_0 = 100.0 * (expm1(i) / (i / n));
double tmp;
if (i <= -8.6e-32) {
tmp = t_0;
} else if (i <= 6.8e-45) {
tmp = n * (100.0 + ((i * -50.0) / n));
} else if (i <= 3.1e+155) {
tmp = t_0;
} else if (i <= 7.8e+222) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else {
tmp = ((i * i) / n) * 33.333333333333336;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (Math.expm1(i) / (i / n));
double tmp;
if (i <= -8.6e-32) {
tmp = t_0;
} else if (i <= 6.8e-45) {
tmp = n * (100.0 + ((i * -50.0) / n));
} else if (i <= 3.1e+155) {
tmp = t_0;
} else if (i <= 7.8e+222) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else {
tmp = ((i * i) / n) * 33.333333333333336;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (math.expm1(i) / (i / n)) tmp = 0 if i <= -8.6e-32: tmp = t_0 elif i <= 6.8e-45: tmp = n * (100.0 + ((i * -50.0) / n)) elif i <= 3.1e+155: tmp = t_0 elif i <= 7.8e+222: tmp = 100.0 * (n / (1.0 + (i * -0.5))) else: tmp = ((i * i) / n) * 33.333333333333336 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(expm1(i) / Float64(i / n))) tmp = 0.0 if (i <= -8.6e-32) tmp = t_0; elseif (i <= 6.8e-45) tmp = Float64(n * Float64(100.0 + Float64(Float64(i * -50.0) / n))); elseif (i <= 3.1e+155) tmp = t_0; elseif (i <= 7.8e+222) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); else tmp = Float64(Float64(Float64(i * i) / n) * 33.333333333333336); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -8.6e-32], t$95$0, If[LessEqual[i, 6.8e-45], N[(n * N[(100.0 + N[(N[(i * -50.0), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3.1e+155], t$95$0, If[LessEqual[i, 7.8e+222], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(i * i), $MachinePrecision] / n), $MachinePrecision] * 33.333333333333336), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{if}\;i \leq -8.6 \cdot 10^{-32}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;i \leq 6.8 \cdot 10^{-45}:\\
\;\;\;\;n \cdot \left(100 + \frac{i \cdot -50}{n}\right)\\
\mathbf{elif}\;i \leq 3.1 \cdot 10^{+155}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;i \leq 7.8 \cdot 10^{+222}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{i \cdot i}{n} \cdot 33.333333333333336\\
\end{array}
\end{array}
if i < -8.5999999999999998e-32 or 6.80000000000000008e-45 < i < 3.09999999999999989e155Initial program 45.9%
Taylor expanded in n around inf 65.1%
expm1-def68.3%
Simplified68.3%
if -8.5999999999999998e-32 < i < 6.80000000000000008e-45Initial program 5.7%
associate-/r/6.4%
associate-*r*6.4%
*-commutative6.4%
associate-*r/6.4%
sub-neg6.4%
distribute-lft-in6.4%
fma-def6.4%
metadata-eval6.4%
metadata-eval6.4%
Simplified6.4%
Taylor expanded in i around 0 92.2%
associate-*r*92.2%
*-commutative92.2%
associate-*r/92.2%
metadata-eval92.2%
Simplified92.2%
Taylor expanded in n around 0 92.2%
associate-*r/92.2%
*-commutative92.2%
Simplified92.2%
if 3.09999999999999989e155 < i < 7.7999999999999997e222Initial program 32.3%
Taylor expanded in n around inf 16.9%
*-commutative16.9%
associate-/l*16.9%
expm1-def16.9%
Simplified16.9%
Taylor expanded in i around 0 52.9%
*-commutative52.9%
Simplified52.9%
if 7.7999999999999997e222 < i Initial program 82.0%
associate-/r/82.0%
associate-*r*82.0%
*-commutative82.0%
associate-*r/82.0%
sub-neg82.0%
distribute-lft-in82.0%
fma-def82.0%
metadata-eval82.0%
metadata-eval82.0%
Simplified82.0%
Taylor expanded in i around 0 54.8%
+-commutative54.8%
distribute-lft-out54.8%
Simplified54.8%
Taylor expanded in n around 0 55.0%
*-commutative55.0%
unpow255.0%
Simplified55.0%
Final simplification77.8%
(FPCore (i n)
:precision binary64
(if (<= i -5.8e-18)
(* (expm1 i) (/ n (/ i 100.0)))
(if (<= i 7e-45)
(* n (+ 100.0 (/ (* i -50.0) n)))
(if (<= i 3.1e+155)
(* 100.0 (/ (expm1 i) (/ i n)))
(if (<= i 4.8e+223)
(* 100.0 (/ n (+ 1.0 (* i -0.5))))
(* (/ (* i i) n) 33.333333333333336))))))
double code(double i, double n) {
double tmp;
if (i <= -5.8e-18) {
tmp = expm1(i) * (n / (i / 100.0));
} else if (i <= 7e-45) {
tmp = n * (100.0 + ((i * -50.0) / n));
} else if (i <= 3.1e+155) {
tmp = 100.0 * (expm1(i) / (i / n));
} else if (i <= 4.8e+223) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else {
tmp = ((i * i) / n) * 33.333333333333336;
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (i <= -5.8e-18) {
tmp = Math.expm1(i) * (n / (i / 100.0));
} else if (i <= 7e-45) {
tmp = n * (100.0 + ((i * -50.0) / n));
} else if (i <= 3.1e+155) {
tmp = 100.0 * (Math.expm1(i) / (i / n));
} else if (i <= 4.8e+223) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else {
tmp = ((i * i) / n) * 33.333333333333336;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -5.8e-18: tmp = math.expm1(i) * (n / (i / 100.0)) elif i <= 7e-45: tmp = n * (100.0 + ((i * -50.0) / n)) elif i <= 3.1e+155: tmp = 100.0 * (math.expm1(i) / (i / n)) elif i <= 4.8e+223: tmp = 100.0 * (n / (1.0 + (i * -0.5))) else: tmp = ((i * i) / n) * 33.333333333333336 return tmp
function code(i, n) tmp = 0.0 if (i <= -5.8e-18) tmp = Float64(expm1(i) * Float64(n / Float64(i / 100.0))); elseif (i <= 7e-45) tmp = Float64(n * Float64(100.0 + Float64(Float64(i * -50.0) / n))); elseif (i <= 3.1e+155) tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n))); elseif (i <= 4.8e+223) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); else tmp = Float64(Float64(Float64(i * i) / n) * 33.333333333333336); end return tmp end
code[i_, n_] := If[LessEqual[i, -5.8e-18], N[(N[(Exp[i] - 1), $MachinePrecision] * N[(n / N[(i / 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 7e-45], N[(n * N[(100.0 + N[(N[(i * -50.0), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3.1e+155], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 4.8e+223], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(i * i), $MachinePrecision] / n), $MachinePrecision] * 33.333333333333336), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -5.8 \cdot 10^{-18}:\\
\;\;\;\;\mathsf{expm1}\left(i\right) \cdot \frac{n}{\frac{i}{100}}\\
\mathbf{elif}\;i \leq 7 \cdot 10^{-45}:\\
\;\;\;\;n \cdot \left(100 + \frac{i \cdot -50}{n}\right)\\
\mathbf{elif}\;i \leq 3.1 \cdot 10^{+155}:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 4.8 \cdot 10^{+223}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{i \cdot i}{n} \cdot 33.333333333333336\\
\end{array}
\end{array}
if i < -5.8e-18Initial program 61.7%
Taylor expanded in n around inf 72.4%
*-commutative72.4%
associate-/l*72.4%
expm1-def73.6%
Simplified73.6%
associate-*l/70.0%
Applied egg-rr70.0%
*-un-lft-identity70.0%
associate-/r/70.0%
Applied egg-rr70.0%
*-lft-identity70.0%
*-commutative70.0%
associate-/l*73.6%
Simplified73.6%
if -5.8e-18 < i < 7e-45Initial program 5.6%
associate-/r/6.2%
associate-*r*6.2%
*-commutative6.2%
associate-*r/6.2%
sub-neg6.2%
distribute-lft-in6.2%
fma-def6.2%
metadata-eval6.2%
metadata-eval6.2%
Simplified6.2%
Taylor expanded in i around 0 91.7%
associate-*r*91.7%
*-commutative91.7%
associate-*r/91.7%
metadata-eval91.7%
Simplified91.7%
Taylor expanded in n around 0 91.7%
associate-*r/91.7%
*-commutative91.7%
Simplified91.7%
if 7e-45 < i < 3.09999999999999989e155Initial program 32.4%
Taylor expanded in n around inf 63.4%
expm1-def61.1%
Simplified61.1%
if 3.09999999999999989e155 < i < 4.80000000000000022e223Initial program 32.3%
Taylor expanded in n around inf 16.9%
*-commutative16.9%
associate-/l*16.9%
expm1-def16.9%
Simplified16.9%
Taylor expanded in i around 0 52.9%
*-commutative52.9%
Simplified52.9%
if 4.80000000000000022e223 < i Initial program 82.0%
associate-/r/82.0%
associate-*r*82.0%
*-commutative82.0%
associate-*r/82.0%
sub-neg82.0%
distribute-lft-in82.0%
fma-def82.0%
metadata-eval82.0%
metadata-eval82.0%
Simplified82.0%
Taylor expanded in i around 0 54.8%
+-commutative54.8%
distribute-lft-out54.8%
Simplified54.8%
Taylor expanded in n around 0 55.0%
*-commutative55.0%
unpow255.0%
Simplified55.0%
Final simplification77.8%
(FPCore (i n) :precision binary64 (if (or (<= n -3.2e-268) (not (<= n 5.1e-28))) (* 100.0 (/ n (/ i (expm1 i)))) (/ (* n (* n -10000.0)) (- (* i (* n 50.0)) (* n 100.0)))))
double code(double i, double n) {
double tmp;
if ((n <= -3.2e-268) || !(n <= 5.1e-28)) {
tmp = 100.0 * (n / (i / expm1(i)));
} else {
tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -3.2e-268) || !(n <= 5.1e-28)) {
tmp = 100.0 * (n / (i / Math.expm1(i)));
} else {
tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -3.2e-268) or not (n <= 5.1e-28): tmp = 100.0 * (n / (i / math.expm1(i))) else: tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -3.2e-268) || !(n <= 5.1e-28)) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); else tmp = Float64(Float64(n * Float64(n * -10000.0)) / Float64(Float64(i * Float64(n * 50.0)) - Float64(n * 100.0))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -3.2e-268], N[Not[LessEqual[n, 5.1e-28]], $MachinePrecision]], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * N[(n * -10000.0), $MachinePrecision]), $MachinePrecision] / N[(N[(i * N[(n * 50.0), $MachinePrecision]), $MachinePrecision] - N[(n * 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.2 \cdot 10^{-268} \lor \neg \left(n \leq 5.1 \cdot 10^{-28}\right):\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot \left(n \cdot -10000\right)}{i \cdot \left(n \cdot 50\right) - n \cdot 100}\\
\end{array}
\end{array}
if n < -3.1999999999999999e-268 or 5.10000000000000009e-28 < n Initial program 26.8%
Taylor expanded in n around inf 36.2%
*-commutative36.2%
associate-/l*36.2%
expm1-def86.0%
Simplified86.0%
if -3.1999999999999999e-268 < n < 5.10000000000000009e-28Initial program 31.0%
Taylor expanded in n around inf 23.2%
*-commutative23.2%
associate-/l*23.2%
expm1-def30.6%
Simplified30.6%
Taylor expanded in i around 0 29.6%
flip-+49.2%
associate-*r*49.2%
associate-*r*49.2%
*-commutative49.2%
*-commutative49.2%
associate-*r*49.2%
*-commutative49.2%
Applied egg-rr49.2%
associate-*l*49.2%
*-commutative49.2%
*-commutative49.2%
*-commutative49.2%
swap-sqr48.9%
metadata-eval48.9%
*-commutative48.9%
*-commutative48.9%
*-commutative48.9%
Simplified48.9%
Taylor expanded in i around 0 73.7%
*-commutative73.7%
unpow273.7%
associate-*r*73.8%
Simplified73.8%
Final simplification83.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* i (* n 50.0))) (t_1 (- t_0 (* n 100.0))))
(if (<= n -2.35e-268)
(* 100.0 (/ n (+ 1.0 (* i -0.5))))
(if (<= n 1.55e-15)
(/ (* n (* n -10000.0)) t_1)
(if (<= n 1.5e+151)
(/ (- (* (* n 50.0) (* i t_0)) (* (* n n) 10000.0)) t_1)
(*
n
(+
100.0
(*
100.0
(+ (* i (* i 0.16666666666666666)) (* i (- 0.5 (/ 0.5 n))))))))))))
double code(double i, double n) {
double t_0 = i * (n * 50.0);
double t_1 = t_0 - (n * 100.0);
double tmp;
if (n <= -2.35e-268) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 1.55e-15) {
tmp = (n * (n * -10000.0)) / t_1;
} else if (n <= 1.5e+151) {
tmp = (((n * 50.0) * (i * t_0)) - ((n * n) * 10000.0)) / t_1;
} else {
tmp = n * (100.0 + (100.0 * ((i * (i * 0.16666666666666666)) + (i * (0.5 - (0.5 / n))))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = i * (n * 50.0d0)
t_1 = t_0 - (n * 100.0d0)
if (n <= (-2.35d-268)) then
tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
else if (n <= 1.55d-15) then
tmp = (n * (n * (-10000.0d0))) / t_1
else if (n <= 1.5d+151) then
tmp = (((n * 50.0d0) * (i * t_0)) - ((n * n) * 10000.0d0)) / t_1
else
tmp = n * (100.0d0 + (100.0d0 * ((i * (i * 0.16666666666666666d0)) + (i * (0.5d0 - (0.5d0 / n))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = i * (n * 50.0);
double t_1 = t_0 - (n * 100.0);
double tmp;
if (n <= -2.35e-268) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 1.55e-15) {
tmp = (n * (n * -10000.0)) / t_1;
} else if (n <= 1.5e+151) {
tmp = (((n * 50.0) * (i * t_0)) - ((n * n) * 10000.0)) / t_1;
} else {
tmp = n * (100.0 + (100.0 * ((i * (i * 0.16666666666666666)) + (i * (0.5 - (0.5 / n))))));
}
return tmp;
}
def code(i, n): t_0 = i * (n * 50.0) t_1 = t_0 - (n * 100.0) tmp = 0 if n <= -2.35e-268: tmp = 100.0 * (n / (1.0 + (i * -0.5))) elif n <= 1.55e-15: tmp = (n * (n * -10000.0)) / t_1 elif n <= 1.5e+151: tmp = (((n * 50.0) * (i * t_0)) - ((n * n) * 10000.0)) / t_1 else: tmp = n * (100.0 + (100.0 * ((i * (i * 0.16666666666666666)) + (i * (0.5 - (0.5 / n)))))) return tmp
function code(i, n) t_0 = Float64(i * Float64(n * 50.0)) t_1 = Float64(t_0 - Float64(n * 100.0)) tmp = 0.0 if (n <= -2.35e-268) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); elseif (n <= 1.55e-15) tmp = Float64(Float64(n * Float64(n * -10000.0)) / t_1); elseif (n <= 1.5e+151) tmp = Float64(Float64(Float64(Float64(n * 50.0) * Float64(i * t_0)) - Float64(Float64(n * n) * 10000.0)) / t_1); else tmp = Float64(n * Float64(100.0 + Float64(100.0 * Float64(Float64(i * Float64(i * 0.16666666666666666)) + Float64(i * Float64(0.5 - Float64(0.5 / n))))))); end return tmp end
function tmp_2 = code(i, n) t_0 = i * (n * 50.0); t_1 = t_0 - (n * 100.0); tmp = 0.0; if (n <= -2.35e-268) tmp = 100.0 * (n / (1.0 + (i * -0.5))); elseif (n <= 1.55e-15) tmp = (n * (n * -10000.0)) / t_1; elseif (n <= 1.5e+151) tmp = (((n * 50.0) * (i * t_0)) - ((n * n) * 10000.0)) / t_1; else tmp = n * (100.0 + (100.0 * ((i * (i * 0.16666666666666666)) + (i * (0.5 - (0.5 / n)))))); end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(i * N[(n * 50.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[(n * 100.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -2.35e-268], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.55e-15], N[(N[(n * N[(n * -10000.0), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[n, 1.5e+151], N[(N[(N[(N[(n * 50.0), $MachinePrecision] * N[(i * t$95$0), $MachinePrecision]), $MachinePrecision] - N[(N[(n * n), $MachinePrecision] * 10000.0), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(n * N[(100.0 + N[(100.0 * N[(N[(i * N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + N[(i * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := i \cdot \left(n \cdot 50\right)\\
t_1 := t_0 - n \cdot 100\\
\mathbf{if}\;n \leq -2.35 \cdot 10^{-268}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 1.55 \cdot 10^{-15}:\\
\;\;\;\;\frac{n \cdot \left(n \cdot -10000\right)}{t_1}\\
\mathbf{elif}\;n \leq 1.5 \cdot 10^{+151}:\\
\;\;\;\;\frac{\left(n \cdot 50\right) \cdot \left(i \cdot t_0\right) - \left(n \cdot n\right) \cdot 10000}{t_1}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + 100 \cdot \left(i \cdot \left(i \cdot 0.16666666666666666\right) + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)\\
\end{array}
\end{array}
if n < -2.34999999999999987e-268Initial program 30.1%
Taylor expanded in n around inf 33.5%
*-commutative33.5%
associate-/l*33.5%
expm1-def81.3%
Simplified81.3%
Taylor expanded in i around 0 63.0%
*-commutative63.0%
Simplified63.0%
if -2.34999999999999987e-268 < n < 1.5499999999999999e-15Initial program 30.5%
Taylor expanded in n around inf 22.8%
*-commutative22.8%
associate-/l*22.8%
expm1-def31.9%
Simplified31.9%
Taylor expanded in i around 0 31.0%
flip-+50.2%
associate-*r*50.2%
associate-*r*50.2%
*-commutative50.2%
*-commutative50.2%
associate-*r*50.2%
*-commutative50.2%
Applied egg-rr50.2%
associate-*l*50.2%
*-commutative50.2%
*-commutative50.2%
*-commutative50.2%
swap-sqr49.9%
metadata-eval49.9%
*-commutative49.9%
*-commutative49.9%
*-commutative49.9%
Simplified49.9%
Taylor expanded in i around 0 74.2%
*-commutative74.2%
unpow274.2%
associate-*r*74.3%
Simplified74.3%
if 1.5499999999999999e-15 < n < 1.5e151Initial program 27.6%
Taylor expanded in n around inf 33.1%
*-commutative33.1%
associate-/l*33.1%
expm1-def91.5%
Simplified91.5%
Taylor expanded in i around 0 62.0%
flip-+85.9%
associate-*r*85.9%
associate-*r*85.9%
*-commutative85.9%
*-commutative85.9%
associate-*r*85.9%
*-commutative85.9%
Applied egg-rr85.9%
associate-*l*85.9%
*-commutative85.9%
*-commutative85.9%
*-commutative85.9%
swap-sqr85.5%
metadata-eval85.5%
*-commutative85.5%
*-commutative85.5%
*-commutative85.5%
Simplified85.5%
if 1.5e151 < n Initial program 17.2%
associate-/r/17.8%
associate-*r*17.8%
*-commutative17.8%
associate-*r/17.8%
sub-neg17.8%
distribute-lft-in17.8%
fma-def17.8%
metadata-eval17.8%
metadata-eval17.8%
Simplified17.8%
Taylor expanded in i around 0 82.1%
+-commutative82.1%
distribute-lft-out82.1%
Simplified82.1%
Taylor expanded in n around inf 82.1%
*-commutative82.1%
unpow282.1%
associate-*l*82.1%
Simplified82.1%
Final simplification71.6%
(FPCore (i n)
:precision binary64
(if (<= n -4.1e-268)
(* 100.0 (/ n (+ 1.0 (* i -0.5))))
(if (<= n 3.45e-28)
(/ (* n (* n -10000.0)) (- (* i (* n 50.0)) (* n 100.0)))
(*
n
(+
100.0
(*
100.0
(+ (* i (* i 0.16666666666666666)) (* i (- 0.5 (/ 0.5 n))))))))))
double code(double i, double n) {
double tmp;
if (n <= -4.1e-268) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 3.45e-28) {
tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0));
} else {
tmp = n * (100.0 + (100.0 * ((i * (i * 0.16666666666666666)) + (i * (0.5 - (0.5 / n))))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-4.1d-268)) then
tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
else if (n <= 3.45d-28) then
tmp = (n * (n * (-10000.0d0))) / ((i * (n * 50.0d0)) - (n * 100.0d0))
else
tmp = n * (100.0d0 + (100.0d0 * ((i * (i * 0.16666666666666666d0)) + (i * (0.5d0 - (0.5d0 / n))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -4.1e-268) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 3.45e-28) {
tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0));
} else {
tmp = n * (100.0 + (100.0 * ((i * (i * 0.16666666666666666)) + (i * (0.5 - (0.5 / n))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -4.1e-268: tmp = 100.0 * (n / (1.0 + (i * -0.5))) elif n <= 3.45e-28: tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0)) else: tmp = n * (100.0 + (100.0 * ((i * (i * 0.16666666666666666)) + (i * (0.5 - (0.5 / n)))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -4.1e-268) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); elseif (n <= 3.45e-28) tmp = Float64(Float64(n * Float64(n * -10000.0)) / Float64(Float64(i * Float64(n * 50.0)) - Float64(n * 100.0))); else tmp = Float64(n * Float64(100.0 + Float64(100.0 * Float64(Float64(i * Float64(i * 0.16666666666666666)) + Float64(i * Float64(0.5 - Float64(0.5 / n))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -4.1e-268) tmp = 100.0 * (n / (1.0 + (i * -0.5))); elseif (n <= 3.45e-28) tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0)); else tmp = n * (100.0 + (100.0 * ((i * (i * 0.16666666666666666)) + (i * (0.5 - (0.5 / n)))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -4.1e-268], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.45e-28], N[(N[(n * N[(n * -10000.0), $MachinePrecision]), $MachinePrecision] / N[(N[(i * N[(n * 50.0), $MachinePrecision]), $MachinePrecision] - N[(n * 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(100.0 * N[(N[(i * N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + N[(i * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.1 \cdot 10^{-268}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 3.45 \cdot 10^{-28}:\\
\;\;\;\;\frac{n \cdot \left(n \cdot -10000\right)}{i \cdot \left(n \cdot 50\right) - n \cdot 100}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + 100 \cdot \left(i \cdot \left(i \cdot 0.16666666666666666\right) + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)\\
\end{array}
\end{array}
if n < -4.0999999999999999e-268Initial program 30.1%
Taylor expanded in n around inf 33.5%
*-commutative33.5%
associate-/l*33.5%
expm1-def81.3%
Simplified81.3%
Taylor expanded in i around 0 63.0%
*-commutative63.0%
Simplified63.0%
if -4.0999999999999999e-268 < n < 3.45000000000000001e-28Initial program 31.0%
Taylor expanded in n around inf 23.2%
*-commutative23.2%
associate-/l*23.2%
expm1-def30.6%
Simplified30.6%
Taylor expanded in i around 0 29.6%
flip-+49.2%
associate-*r*49.2%
associate-*r*49.2%
*-commutative49.2%
*-commutative49.2%
associate-*r*49.2%
*-commutative49.2%
Applied egg-rr49.2%
associate-*l*49.2%
*-commutative49.2%
*-commutative49.2%
*-commutative49.2%
swap-sqr48.9%
metadata-eval48.9%
*-commutative48.9%
*-commutative48.9%
*-commutative48.9%
Simplified48.9%
Taylor expanded in i around 0 73.7%
*-commutative73.7%
unpow273.7%
associate-*r*73.8%
Simplified73.8%
if 3.45000000000000001e-28 < n Initial program 21.6%
associate-/r/22.0%
associate-*r*22.0%
*-commutative22.0%
associate-*r/22.0%
sub-neg22.0%
distribute-lft-in22.0%
fma-def22.0%
metadata-eval22.0%
metadata-eval22.0%
Simplified22.0%
Taylor expanded in i around 0 78.2%
+-commutative78.2%
distribute-lft-out78.2%
Simplified78.2%
Taylor expanded in n around inf 78.2%
*-commutative78.2%
unpow278.2%
associate-*l*78.2%
Simplified78.2%
Final simplification69.8%
(FPCore (i n)
:precision binary64
(if (<= n -4.1e-268)
(* 100.0 (/ n (+ 1.0 (* i -0.5))))
(if (<= n 1.6e-23)
(/ (* n (* n -10000.0)) (- (* i (* n 50.0)) (* n 100.0)))
(* n (/ (* 100.0 (+ i (* (* i i) (- 0.5 (/ 0.5 n))))) i)))))
double code(double i, double n) {
double tmp;
if (n <= -4.1e-268) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 1.6e-23) {
tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0));
} else {
tmp = n * ((100.0 * (i + ((i * i) * (0.5 - (0.5 / n))))) / i);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-4.1d-268)) then
tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
else if (n <= 1.6d-23) then
tmp = (n * (n * (-10000.0d0))) / ((i * (n * 50.0d0)) - (n * 100.0d0))
else
tmp = n * ((100.0d0 * (i + ((i * i) * (0.5d0 - (0.5d0 / n))))) / i)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -4.1e-268) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 1.6e-23) {
tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0));
} else {
tmp = n * ((100.0 * (i + ((i * i) * (0.5 - (0.5 / n))))) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -4.1e-268: tmp = 100.0 * (n / (1.0 + (i * -0.5))) elif n <= 1.6e-23: tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0)) else: tmp = n * ((100.0 * (i + ((i * i) * (0.5 - (0.5 / n))))) / i) return tmp
function code(i, n) tmp = 0.0 if (n <= -4.1e-268) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); elseif (n <= 1.6e-23) tmp = Float64(Float64(n * Float64(n * -10000.0)) / Float64(Float64(i * Float64(n * 50.0)) - Float64(n * 100.0))); else tmp = Float64(n * Float64(Float64(100.0 * Float64(i + Float64(Float64(i * i) * Float64(0.5 - Float64(0.5 / n))))) / i)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -4.1e-268) tmp = 100.0 * (n / (1.0 + (i * -0.5))); elseif (n <= 1.6e-23) tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0)); else tmp = n * ((100.0 * (i + ((i * i) * (0.5 - (0.5 / n))))) / i); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -4.1e-268], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.6e-23], N[(N[(n * N[(n * -10000.0), $MachinePrecision]), $MachinePrecision] / N[(N[(i * N[(n * 50.0), $MachinePrecision]), $MachinePrecision] - N[(n * 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(N[(100.0 * N[(i + N[(N[(i * i), $MachinePrecision] * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.1 \cdot 10^{-268}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 1.6 \cdot 10^{-23}:\\
\;\;\;\;\frac{n \cdot \left(n \cdot -10000\right)}{i \cdot \left(n \cdot 50\right) - n \cdot 100}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{100 \cdot \left(i + \left(i \cdot i\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)}{i}\\
\end{array}
\end{array}
if n < -4.0999999999999999e-268Initial program 30.1%
Taylor expanded in n around inf 33.5%
*-commutative33.5%
associate-/l*33.5%
expm1-def81.3%
Simplified81.3%
Taylor expanded in i around 0 63.0%
*-commutative63.0%
Simplified63.0%
if -4.0999999999999999e-268 < n < 1.59999999999999988e-23Initial program 31.0%
Taylor expanded in n around inf 23.2%
*-commutative23.2%
associate-/l*23.2%
expm1-def30.6%
Simplified30.6%
Taylor expanded in i around 0 29.6%
flip-+49.2%
associate-*r*49.2%
associate-*r*49.2%
*-commutative49.2%
*-commutative49.2%
associate-*r*49.2%
*-commutative49.2%
Applied egg-rr49.2%
associate-*l*49.2%
*-commutative49.2%
*-commutative49.2%
*-commutative49.2%
swap-sqr48.9%
metadata-eval48.9%
*-commutative48.9%
*-commutative48.9%
*-commutative48.9%
Simplified48.9%
Taylor expanded in i around 0 73.7%
*-commutative73.7%
unpow273.7%
associate-*r*73.8%
Simplified73.8%
if 1.59999999999999988e-23 < n Initial program 21.6%
associate-/r/22.0%
associate-*r*22.0%
*-commutative22.0%
associate-*r/22.0%
sub-neg22.0%
distribute-lft-in22.0%
fma-def22.0%
metadata-eval22.0%
metadata-eval22.0%
Simplified22.0%
Taylor expanded in i around 0 75.5%
distribute-lft-out75.5%
unpow275.5%
associate-*r/75.5%
metadata-eval75.5%
Simplified75.5%
Final simplification69.0%
(FPCore (i n)
:precision binary64
(if (<= n -4e-268)
(* 100.0 (/ n (+ 1.0 (* i -0.5))))
(if (<= n 7.8e+45)
(/ (* n (* n -10000.0)) (- (* i (* n 50.0)) (* n 100.0)))
(* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -4e-268) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 7.8e+45) {
tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.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) :: tmp
if (n <= (-4d-268)) then
tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
else if (n <= 7.8d+45) then
tmp = (n * (n * (-10000.0d0))) / ((i * (n * 50.0d0)) - (n * 100.0d0))
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 <= -4e-268) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 7.8e+45) {
tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -4e-268: tmp = 100.0 * (n / (1.0 + (i * -0.5))) elif n <= 7.8e+45: tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0)) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -4e-268) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); elseif (n <= 7.8e+45) tmp = Float64(Float64(n * Float64(n * -10000.0)) / Float64(Float64(i * Float64(n * 50.0)) - Float64(n * 100.0))); 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 <= -4e-268) tmp = 100.0 * (n / (1.0 + (i * -0.5))); elseif (n <= 7.8e+45) tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0)); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -4e-268], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7.8e+45], N[(N[(n * N[(n * -10000.0), $MachinePrecision]), $MachinePrecision] / N[(N[(i * N[(n * 50.0), $MachinePrecision]), $MachinePrecision] - N[(n * 100.0), $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 -4 \cdot 10^{-268}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 7.8 \cdot 10^{+45}:\\
\;\;\;\;\frac{n \cdot \left(n \cdot -10000\right)}{i \cdot \left(n \cdot 50\right) - n \cdot 100}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -3.99999999999999983e-268Initial program 30.1%
Taylor expanded in n around inf 33.5%
*-commutative33.5%
associate-/l*33.5%
expm1-def81.3%
Simplified81.3%
Taylor expanded in i around 0 63.0%
*-commutative63.0%
Simplified63.0%
if -3.99999999999999983e-268 < n < 7.7999999999999999e45Initial program 33.0%
Taylor expanded in n around inf 24.0%
*-commutative24.0%
associate-/l*24.0%
expm1-def42.7%
Simplified42.7%
Taylor expanded in i around 0 36.4%
flip-+55.5%
associate-*r*55.5%
associate-*r*55.5%
*-commutative55.5%
*-commutative55.5%
associate-*r*55.5%
*-commutative55.5%
Applied egg-rr55.5%
associate-*l*55.5%
*-commutative55.5%
*-commutative55.5%
*-commutative55.5%
swap-sqr55.2%
metadata-eval55.2%
*-commutative55.2%
*-commutative55.2%
*-commutative55.2%
Simplified55.2%
Taylor expanded in i around 0 70.0%
*-commutative70.0%
unpow270.0%
associate-*r*70.1%
Simplified70.1%
if 7.7999999999999999e45 < n Initial program 17.1%
associate-/r/17.6%
associate-*r*17.6%
*-commutative17.6%
associate-*r/17.6%
sub-neg17.6%
distribute-lft-in17.6%
fma-def17.6%
metadata-eval17.6%
metadata-eval17.6%
Simplified17.6%
Taylor expanded in i around 0 77.2%
associate-*r*77.2%
*-commutative77.2%
associate-*r/77.2%
metadata-eval77.2%
Simplified77.2%
Taylor expanded in n around inf 77.2%
*-commutative77.2%
Simplified77.2%
Final simplification68.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* (/ n i) -200.0)))
(if (<= i -2.0)
t_0
(if (<= i 2.2e+49)
(* n 100.0)
(if (or (<= i 3.1e+155) (not (<= i 1.45e+238)))
(* 50.0 (* i n))
t_0)))))
double code(double i, double n) {
double t_0 = (n / i) * -200.0;
double tmp;
if (i <= -2.0) {
tmp = t_0;
} else if (i <= 2.2e+49) {
tmp = n * 100.0;
} else if ((i <= 3.1e+155) || !(i <= 1.45e+238)) {
tmp = 50.0 * (i * n);
} else {
tmp = t_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 = (n / i) * (-200.0d0)
if (i <= (-2.0d0)) then
tmp = t_0
else if (i <= 2.2d+49) then
tmp = n * 100.0d0
else if ((i <= 3.1d+155) .or. (.not. (i <= 1.45d+238))) then
tmp = 50.0d0 * (i * n)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = (n / i) * -200.0;
double tmp;
if (i <= -2.0) {
tmp = t_0;
} else if (i <= 2.2e+49) {
tmp = n * 100.0;
} else if ((i <= 3.1e+155) || !(i <= 1.45e+238)) {
tmp = 50.0 * (i * n);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = (n / i) * -200.0 tmp = 0 if i <= -2.0: tmp = t_0 elif i <= 2.2e+49: tmp = n * 100.0 elif (i <= 3.1e+155) or not (i <= 1.45e+238): tmp = 50.0 * (i * n) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(Float64(n / i) * -200.0) tmp = 0.0 if (i <= -2.0) tmp = t_0; elseif (i <= 2.2e+49) tmp = Float64(n * 100.0); elseif ((i <= 3.1e+155) || !(i <= 1.45e+238)) tmp = Float64(50.0 * Float64(i * n)); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = (n / i) * -200.0; tmp = 0.0; if (i <= -2.0) tmp = t_0; elseif (i <= 2.2e+49) tmp = n * 100.0; elseif ((i <= 3.1e+155) || ~((i <= 1.45e+238))) tmp = 50.0 * (i * n); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(N[(n / i), $MachinePrecision] * -200.0), $MachinePrecision]}, If[LessEqual[i, -2.0], t$95$0, If[LessEqual[i, 2.2e+49], N[(n * 100.0), $MachinePrecision], If[Or[LessEqual[i, 3.1e+155], N[Not[LessEqual[i, 1.45e+238]], $MachinePrecision]], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{n}{i} \cdot -200\\
\mathbf{if}\;i \leq -2:\\
\;\;\;\;t_0\\
\mathbf{elif}\;i \leq 2.2 \cdot 10^{+49}:\\
\;\;\;\;n \cdot 100\\
\mathbf{elif}\;i \leq 3.1 \cdot 10^{+155} \lor \neg \left(i \leq 1.45 \cdot 10^{+238}\right):\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if i < -2 or 3.09999999999999989e155 < i < 1.4500000000000001e238Initial program 56.6%
Taylor expanded in n around inf 59.4%
*-commutative59.4%
associate-/l*59.4%
expm1-def59.4%
Simplified59.4%
Taylor expanded in i around 0 36.3%
*-commutative36.3%
Simplified36.3%
Taylor expanded in i around inf 36.3%
if -2 < i < 2.2000000000000001e49Initial program 11.6%
Taylor expanded in i around 0 79.2%
*-commutative79.2%
Simplified79.2%
if 2.2000000000000001e49 < i < 3.09999999999999989e155 or 1.4500000000000001e238 < i Initial program 39.6%
Taylor expanded in n around inf 68.2%
*-commutative68.2%
associate-/l*68.2%
expm1-def68.2%
Simplified68.2%
Taylor expanded in i around 0 41.5%
Taylor expanded in i around inf 41.5%
Final simplification62.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i 50.0)))))
(if (<= n -1.55e+55)
t_0
(if (<= n -4.1e-268)
(* 100.0 (/ i (/ i n)))
(if (<= n 9.5e-136) (* 100.0 (/ 0.0 (/ i n))) t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -1.55e+55) {
tmp = t_0;
} else if (n <= -4.1e-268) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 9.5e-136) {
tmp = 100.0 * (0.0 / (i / n));
} else {
tmp = t_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 = n * (100.0d0 + (i * 50.0d0))
if (n <= (-1.55d+55)) then
tmp = t_0
else if (n <= (-4.1d-268)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 9.5d-136) then
tmp = 100.0d0 * (0.0d0 / (i / n))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -1.55e+55) {
tmp = t_0;
} else if (n <= -4.1e-268) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 9.5e-136) {
tmp = 100.0 * (0.0 / (i / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + (i * 50.0)) tmp = 0 if n <= -1.55e+55: tmp = t_0 elif n <= -4.1e-268: tmp = 100.0 * (i / (i / n)) elif n <= 9.5e-136: tmp = 100.0 * (0.0 / (i / n)) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 + Float64(i * 50.0))) tmp = 0.0 if (n <= -1.55e+55) tmp = t_0; elseif (n <= -4.1e-268) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 9.5e-136) tmp = Float64(100.0 * Float64(0.0 / Float64(i / n))); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = n * (100.0 + (i * 50.0)); tmp = 0.0; if (n <= -1.55e+55) tmp = t_0; elseif (n <= -4.1e-268) tmp = 100.0 * (i / (i / n)); elseif (n <= 9.5e-136) tmp = 100.0 * (0.0 / (i / n)); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.55e+55], t$95$0, If[LessEqual[n, -4.1e-268], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 9.5e-136], N[(100.0 * N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{if}\;n \leq -1.55 \cdot 10^{+55}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -4.1 \cdot 10^{-268}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 9.5 \cdot 10^{-136}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -1.54999999999999997e55 or 9.5000000000000007e-136 < n Initial program 21.9%
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%
Taylor expanded in i around 0 65.0%
associate-*r*65.0%
*-commutative65.0%
associate-*r/65.0%
metadata-eval65.0%
Simplified65.0%
Taylor expanded in n around inf 65.0%
*-commutative65.0%
Simplified65.0%
if -1.54999999999999997e55 < n < -4.0999999999999999e-268Initial program 36.4%
Taylor expanded in i around 0 66.8%
if -4.0999999999999999e-268 < n < 9.5000000000000007e-136Initial program 41.1%
Taylor expanded in i around 0 73.5%
Final simplification66.6%
(FPCore (i n) :precision binary64 (if (or (<= n -1.4e+55) (not (<= n 6e+45))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -1.4e+55) || !(n <= 6e+45)) {
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+55)) .or. (.not. (n <= 6d+45))) 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+55) || !(n <= 6e+45)) {
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+55) or not (n <= 6e+45): 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+55) || !(n <= 6e+45)) 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+55) || ~((n <= 6e+45))) 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+55], N[Not[LessEqual[n, 6e+45]], $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^{+55} \lor \neg \left(n \leq 6 \cdot 10^{+45}\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.4e55 or 6.00000000000000021e45 < n Initial program 21.6%
associate-/r/22.2%
associate-*r*22.2%
*-commutative22.2%
associate-*r/22.2%
sub-neg22.2%
distribute-lft-in22.2%
fma-def22.2%
metadata-eval22.2%
metadata-eval22.2%
Simplified22.2%
Taylor expanded in i around 0 66.5%
associate-*r*66.5%
*-commutative66.5%
associate-*r/66.5%
metadata-eval66.5%
Simplified66.5%
Taylor expanded in n around inf 66.5%
*-commutative66.5%
Simplified66.5%
if -1.4e55 < n < 6.00000000000000021e45Initial program 34.5%
Taylor expanded in i around 0 61.2%
Final simplification64.0%
(FPCore (i n) :precision binary64 (if (<= n -3.7e-268) (* 100.0 (/ n (+ 1.0 (* i -0.5)))) (if (<= n 7.6e-136) (* 100.0 (/ 0.0 (/ i n))) (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -3.7e-268) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 7.6e-136) {
tmp = 100.0 * (0.0 / (i / n));
} 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 <= (-3.7d-268)) then
tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
else if (n <= 7.6d-136) then
tmp = 100.0d0 * (0.0d0 / (i / n))
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 <= -3.7e-268) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 7.6e-136) {
tmp = 100.0 * (0.0 / (i / n));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -3.7e-268: tmp = 100.0 * (n / (1.0 + (i * -0.5))) elif n <= 7.6e-136: tmp = 100.0 * (0.0 / (i / n)) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -3.7e-268) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); elseif (n <= 7.6e-136) tmp = Float64(100.0 * Float64(0.0 / Float64(i / n))); 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 <= -3.7e-268) tmp = 100.0 * (n / (1.0 + (i * -0.5))); elseif (n <= 7.6e-136) tmp = 100.0 * (0.0 / (i / n)); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -3.7e-268], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7.6e-136], N[(100.0 * N[(0.0 / N[(i / n), $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 -3.7 \cdot 10^{-268}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 7.6 \cdot 10^{-136}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -3.70000000000000018e-268Initial program 30.1%
Taylor expanded in n around inf 33.5%
*-commutative33.5%
associate-/l*33.5%
expm1-def81.3%
Simplified81.3%
Taylor expanded in i around 0 63.0%
*-commutative63.0%
Simplified63.0%
if -3.70000000000000018e-268 < n < 7.6000000000000005e-136Initial program 41.1%
Taylor expanded in i around 0 73.5%
if 7.6000000000000005e-136 < n Initial program 19.0%
associate-/r/19.3%
associate-*r*19.3%
*-commutative19.3%
associate-*r/19.3%
sub-neg19.3%
distribute-lft-in19.3%
fma-def19.3%
metadata-eval19.3%
metadata-eval19.3%
Simplified19.3%
Taylor expanded in i around 0 71.0%
associate-*r*71.0%
*-commutative71.0%
associate-*r/71.0%
metadata-eval71.0%
Simplified71.0%
Taylor expanded in n around inf 71.1%
*-commutative71.1%
Simplified71.1%
Final simplification67.5%
(FPCore (i n) :precision binary64 (if (or (<= i -2.0) (not (<= i 1.3e+58))) (* (/ n i) -200.0) (* n 100.0)))
double code(double i, double n) {
double tmp;
if ((i <= -2.0) || !(i <= 1.3e+58)) {
tmp = (n / i) * -200.0;
} else {
tmp = n * 100.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((i <= (-2.0d0)) .or. (.not. (i <= 1.3d+58))) then
tmp = (n / i) * (-200.0d0)
else
tmp = n * 100.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((i <= -2.0) || !(i <= 1.3e+58)) {
tmp = (n / i) * -200.0;
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -2.0) or not (i <= 1.3e+58): tmp = (n / i) * -200.0 else: tmp = n * 100.0 return tmp
function code(i, n) tmp = 0.0 if ((i <= -2.0) || !(i <= 1.3e+58)) tmp = Float64(Float64(n / i) * -200.0); else tmp = Float64(n * 100.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((i <= -2.0) || ~((i <= 1.3e+58))) tmp = (n / i) * -200.0; else tmp = n * 100.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[i, -2.0], N[Not[LessEqual[i, 1.3e+58]], $MachinePrecision]], N[(N[(n / i), $MachinePrecision] * -200.0), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2 \lor \neg \left(i \leq 1.3 \cdot 10^{+58}\right):\\
\;\;\;\;\frac{n}{i} \cdot -200\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if i < -2 or 1.29999999999999994e58 < i Initial program 52.5%
Taylor expanded in n around inf 61.3%
*-commutative61.3%
associate-/l*61.3%
expm1-def61.3%
Simplified61.3%
Taylor expanded in i around 0 30.5%
*-commutative30.5%
Simplified30.5%
Taylor expanded in i around inf 30.5%
if -2 < i < 1.29999999999999994e58Initial program 11.4%
Taylor expanded in i around 0 78.3%
*-commutative78.3%
Simplified78.3%
Final simplification59.4%
(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 27.6%
associate-/r/28.0%
associate-*r*28.0%
*-commutative28.0%
associate-*r/28.0%
sub-neg28.0%
distribute-lft-in28.0%
fma-def28.0%
metadata-eval28.0%
metadata-eval28.0%
Simplified28.0%
Taylor expanded in i around 0 54.9%
associate-*r*54.9%
*-commutative54.9%
associate-*r/54.9%
metadata-eval54.9%
Simplified54.9%
Taylor expanded in n around 0 2.7%
*-commutative2.7%
Simplified2.7%
Final simplification2.7%
(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 27.6%
Taylor expanded in i around 0 49.4%
*-commutative49.4%
Simplified49.4%
Final simplification49.4%
(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 2023194
(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))))