
(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 15 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 0.0)
(* 100.0 (/ (expm1 (* n (log1p (/ i n)))) (/ i n)))
(if (<= t_1 INFINITY)
(* n (/ (fma 100.0 t_0 -100.0) i))
(* 100.0 (/ n (+ 1.0 (fma 0.08333333333333333 (* i i) (* i -0.5)))))))))
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 <= 0.0) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) / (i / n));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (fma(100.0, t_0, -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + fma(0.08333333333333333, (i * i), (i * -0.5))));
}
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 <= 0.0) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i / n))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(fma(100.0, t_0, -100.0) / i)); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + fma(0.08333333333333333, Float64(i * i), Float64(i * -0.5))))); 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, 0.0], N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(100.0 * t$95$0 + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(0.08333333333333333 * N[(i * i), $MachinePrecision] + N[(i * -0.5), $MachinePrecision]), $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 0:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{\mathsf{fma}\left(100, t_0, -100\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + \mathsf{fma}\left(0.08333333333333333, i \cdot i, i \cdot -0.5\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 26.1%
*-un-lft-identity26.1%
pow-to-exp25.1%
expm1-def35.6%
*-commutative35.6%
log1p-udef98.6%
Applied egg-rr98.6%
*-lft-identity98.6%
Simplified98.6%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.9%
associate-/r/99.8%
associate-*r*99.9%
*-commutative99.9%
associate-*r/99.9%
sub-neg99.9%
distribute-lft-in99.9%
fma-def99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
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-def78.3%
Simplified78.3%
Taylor expanded in i around 0 99.9%
fma-def99.9%
unpow299.9%
*-commutative99.9%
Simplified99.9%
Final simplification99.0%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n))))
(if (<= t_0 0.0)
(* 100.0 (/ (expm1 (* n (log1p (/ i n)))) (/ i n)))
(if (<= t_0 INFINITY)
(* t_0 100.0)
(* 100.0 (/ n (+ 1.0 (fma 0.08333333333333333 (* i i) (* i -0.5)))))))))
double code(double i, double n) {
double t_0 = (pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= 0.0) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) / (i / n));
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_0 * 100.0;
} else {
tmp = 100.0 * (n / (1.0 + fma(0.08333333333333333, (i * i), (i * -0.5))));
}
return tmp;
}
function code(i, n) t_0 = Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i / n))); elseif (t_0 <= Inf) tmp = Float64(t_0 * 100.0); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + fma(0.08333333333333333, Float64(i * i), Float64(i * -0.5))))); 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]}, If[LessEqual[t$95$0, 0.0], N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(t$95$0 * 100.0), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(0.08333333333333333 * N[(i * i), $MachinePrecision] + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t_0 \leq \infty:\\
\;\;\;\;t_0 \cdot 100\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + \mathsf{fma}\left(0.08333333333333333, i \cdot i, i \cdot -0.5\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 26.1%
*-un-lft-identity26.1%
pow-to-exp25.1%
expm1-def35.6%
*-commutative35.6%
log1p-udef98.6%
Applied egg-rr98.6%
*-lft-identity98.6%
Simplified98.6%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.9%
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-def78.3%
Simplified78.3%
Taylor expanded in i around 0 99.9%
fma-def99.9%
unpow299.9%
*-commutative99.9%
Simplified99.9%
Final simplification99.0%
(FPCore (i n)
:precision binary64
(if (<= n -4.9e-42)
(* 100.0 (/ n (/ i (expm1 i))))
(if (<= n -1.7e-58)
(/ (* 100.0 (* n n)) (/ i (log (/ i n))))
(if (<= n -1.05e-202)
(* 100.0 (/ n (+ 1.0 (fma 0.08333333333333333 (* i i) (* i -0.5)))))
(if (<= n 4.9e-31)
(/
(* n (* n 10000.0))
(- (* n 100.0) (* n (* i (+ 50.0 (* 100.0 (/ -0.5 n)))))))
(* 100.0 (* n (/ (expm1 i) i))))))))
double code(double i, double n) {
double tmp;
if (n <= -4.9e-42) {
tmp = 100.0 * (n / (i / expm1(i)));
} else if (n <= -1.7e-58) {
tmp = (100.0 * (n * n)) / (i / log((i / n)));
} else if (n <= -1.05e-202) {
tmp = 100.0 * (n / (1.0 + fma(0.08333333333333333, (i * i), (i * -0.5))));
} else if (n <= 4.9e-31) {
tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n))))));
} else {
tmp = 100.0 * (n * (expm1(i) / i));
}
return tmp;
}
function code(i, n) tmp = 0.0 if (n <= -4.9e-42) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); elseif (n <= -1.7e-58) tmp = Float64(Float64(100.0 * Float64(n * n)) / Float64(i / log(Float64(i / n)))); elseif (n <= -1.05e-202) tmp = Float64(100.0 * Float64(n / Float64(1.0 + fma(0.08333333333333333, Float64(i * i), Float64(i * -0.5))))); elseif (n <= 4.9e-31) tmp = Float64(Float64(n * Float64(n * 10000.0)) / Float64(Float64(n * 100.0) - Float64(n * Float64(i * Float64(50.0 + Float64(100.0 * Float64(-0.5 / n))))))); else tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); end return tmp end
code[i_, n_] := If[LessEqual[n, -4.9e-42], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -1.7e-58], N[(N[(100.0 * N[(n * n), $MachinePrecision]), $MachinePrecision] / N[(i / N[Log[N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -1.05e-202], N[(100.0 * N[(n / N[(1.0 + N[(0.08333333333333333 * N[(i * i), $MachinePrecision] + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.9e-31], N[(N[(n * N[(n * 10000.0), $MachinePrecision]), $MachinePrecision] / N[(N[(n * 100.0), $MachinePrecision] - N[(n * N[(i * N[(50.0 + N[(100.0 * N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.9 \cdot 10^{-42}:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{elif}\;n \leq -1.7 \cdot 10^{-58}:\\
\;\;\;\;\frac{100 \cdot \left(n \cdot n\right)}{\frac{i}{\log \left(\frac{i}{n}\right)}}\\
\mathbf{elif}\;n \leq -1.05 \cdot 10^{-202}:\\
\;\;\;\;100 \cdot \frac{n}{1 + \mathsf{fma}\left(0.08333333333333333, i \cdot i, i \cdot -0.5\right)}\\
\mathbf{elif}\;n \leq 4.9 \cdot 10^{-31}:\\
\;\;\;\;\frac{n \cdot \left(n \cdot 10000\right)}{n \cdot 100 - n \cdot \left(i \cdot \left(50 + 100 \cdot \frac{-0.5}{n}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\end{array}
\end{array}
if n < -4.9e-42Initial program 34.0%
*-un-lft-identity34.0%
pow-to-exp17.8%
expm1-def18.6%
*-commutative18.6%
log1p-udef66.0%
Applied egg-rr66.0%
*-lft-identity66.0%
Simplified66.0%
*-commutative66.0%
div-inv64.6%
clear-num64.7%
associate-*r*64.7%
associate-/r/64.6%
clear-num64.5%
un-div-inv64.8%
div-inv64.8%
metadata-eval64.8%
Applied egg-rr64.8%
associate-/l*64.9%
Simplified64.9%
Taylor expanded in n around inf 41.7%
associate-/l*41.7%
expm1-def83.9%
Simplified83.9%
if -4.9e-42 < n < -1.69999999999999987e-58Initial program 25.0%
*-un-lft-identity25.0%
pow-to-exp25.0%
expm1-def99.1%
*-commutative99.1%
log1p-udef99.1%
Applied egg-rr99.1%
*-lft-identity99.1%
Simplified99.1%
*-commutative99.1%
div-inv99.1%
clear-num99.1%
associate-*r*99.1%
associate-/r/99.4%
clear-num99.4%
un-div-inv99.4%
div-inv99.4%
metadata-eval99.4%
Applied egg-rr99.4%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in n around 0 0.0%
associate-/l*0.0%
associate-*r/0.0%
unpow20.0%
mul-1-neg0.0%
log-rec0.0%
+-commutative0.0%
log-rec0.0%
unsub-neg0.0%
log-div99.4%
Simplified99.4%
if -1.69999999999999987e-58 < n < -1.04999999999999993e-202Initial program 21.3%
Taylor expanded in n around inf 13.1%
*-commutative13.1%
associate-/l*13.1%
expm1-def78.0%
Simplified78.0%
Taylor expanded in i around 0 86.2%
fma-def86.2%
unpow286.2%
*-commutative86.2%
Simplified86.2%
if -1.04999999999999993e-202 < n < 4.90000000000000023e-31Initial program 42.0%
associate-/r/42.2%
associate-*r*42.2%
*-commutative42.2%
associate-*r/42.2%
sub-neg42.2%
distribute-lft-in42.2%
fma-def42.2%
metadata-eval42.2%
metadata-eval42.2%
Simplified42.2%
Taylor expanded in i around 0 27.4%
associate-*r*27.4%
*-commutative27.4%
associate-*r/27.4%
metadata-eval27.4%
Simplified27.4%
distribute-lft-in27.4%
flip-+23.4%
Applied egg-rr23.4%
Taylor expanded in i around 0 76.1%
*-commutative76.1%
unpow276.1%
associate-*l*76.1%
Simplified76.1%
if 4.90000000000000023e-31 < n Initial program 19.3%
Taylor expanded in n around inf 40.6%
*-commutative40.6%
associate-/l*40.6%
expm1-def98.7%
Simplified98.7%
div-inv98.7%
clear-num98.8%
Applied egg-rr98.8%
Final simplification87.6%
(FPCore (i n)
:precision binary64
(if (or (<= n -8e-6) (not (<= n 4.9e-31)))
(* 100.0 (/ n (/ i (expm1 i))))
(/
(* n (* n 10000.0))
(- (* n 100.0) (* n (* i (+ 50.0 (* 100.0 (/ -0.5 n)))))))))
double code(double i, double n) {
double tmp;
if ((n <= -8e-6) || !(n <= 4.9e-31)) {
tmp = 100.0 * (n / (i / expm1(i)));
} else {
tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n))))));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -8e-6) || !(n <= 4.9e-31)) {
tmp = 100.0 * (n / (i / Math.expm1(i)));
} else {
tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n))))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -8e-6) or not (n <= 4.9e-31): tmp = 100.0 * (n / (i / math.expm1(i))) else: tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n)))))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -8e-6) || !(n <= 4.9e-31)) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); else tmp = Float64(Float64(n * Float64(n * 10000.0)) / Float64(Float64(n * 100.0) - Float64(n * Float64(i * Float64(50.0 + Float64(100.0 * Float64(-0.5 / n))))))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -8e-6], N[Not[LessEqual[n, 4.9e-31]], $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[(n * 100.0), $MachinePrecision] - N[(n * N[(i * N[(50.0 + N[(100.0 * N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -8 \cdot 10^{-6} \lor \neg \left(n \leq 4.9 \cdot 10^{-31}\right):\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot \left(n \cdot 10000\right)}{n \cdot 100 - n \cdot \left(i \cdot \left(50 + 100 \cdot \frac{-0.5}{n}\right)\right)}\\
\end{array}
\end{array}
if n < -7.99999999999999964e-6 or 4.90000000000000023e-31 < n Initial program 26.5%
*-un-lft-identity26.5%
pow-to-exp18.1%
expm1-def18.1%
*-commutative18.1%
log1p-udef70.6%
Applied egg-rr70.6%
*-lft-identity70.6%
Simplified70.6%
*-commutative70.6%
div-inv68.0%
clear-num68.1%
associate-*r*68.1%
associate-/r/68.1%
clear-num68.0%
un-div-inv69.8%
div-inv69.8%
metadata-eval69.8%
Applied egg-rr69.8%
associate-/l*69.8%
Simplified69.8%
Taylor expanded in n around inf 42.0%
associate-/l*42.0%
expm1-def92.2%
Simplified92.2%
if -7.99999999999999964e-6 < n < 4.90000000000000023e-31Initial program 33.1%
associate-/r/33.2%
associate-*r*33.2%
*-commutative33.2%
associate-*r/33.2%
sub-neg33.2%
distribute-lft-in33.2%
fma-def33.2%
metadata-eval33.2%
metadata-eval33.2%
Simplified33.2%
Taylor expanded in i around 0 41.9%
associate-*r*41.9%
*-commutative41.9%
associate-*r/41.9%
metadata-eval41.9%
Simplified41.9%
distribute-lft-in41.9%
flip-+38.0%
Applied egg-rr38.0%
Taylor expanded in i around 0 75.9%
*-commutative75.9%
unpow275.9%
associate-*l*76.3%
Simplified76.3%
Final simplification85.8%
(FPCore (i n)
:precision binary64
(if (<= n -0.00032)
(* 100.0 (/ n (/ i (expm1 i))))
(if (<= n 4.9e-31)
(/
(* n (* n 10000.0))
(- (* n 100.0) (* n (* i (+ 50.0 (* 100.0 (/ -0.5 n)))))))
(* 100.0 (* n (/ (expm1 i) i))))))
double code(double i, double n) {
double tmp;
if (n <= -0.00032) {
tmp = 100.0 * (n / (i / expm1(i)));
} else if (n <= 4.9e-31) {
tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n))))));
} else {
tmp = 100.0 * (n * (expm1(i) / i));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -0.00032) {
tmp = 100.0 * (n / (i / Math.expm1(i)));
} else if (n <= 4.9e-31) {
tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n))))));
} else {
tmp = 100.0 * (n * (Math.expm1(i) / i));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -0.00032: tmp = 100.0 * (n / (i / math.expm1(i))) elif n <= 4.9e-31: tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n)))))) else: tmp = 100.0 * (n * (math.expm1(i) / i)) return tmp
function code(i, n) tmp = 0.0 if (n <= -0.00032) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); elseif (n <= 4.9e-31) tmp = Float64(Float64(n * Float64(n * 10000.0)) / Float64(Float64(n * 100.0) - Float64(n * Float64(i * Float64(50.0 + Float64(100.0 * Float64(-0.5 / n))))))); else tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); end return tmp end
code[i_, n_] := If[LessEqual[n, -0.00032], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.9e-31], N[(N[(n * N[(n * 10000.0), $MachinePrecision]), $MachinePrecision] / N[(N[(n * 100.0), $MachinePrecision] - N[(n * N[(i * N[(50.0 + N[(100.0 * N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -0.00032:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{elif}\;n \leq 4.9 \cdot 10^{-31}:\\
\;\;\;\;\frac{n \cdot \left(n \cdot 10000\right)}{n \cdot 100 - n \cdot \left(i \cdot \left(50 + 100 \cdot \frac{-0.5}{n}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\end{array}
\end{array}
if n < -3.20000000000000026e-4Initial program 35.2%
*-un-lft-identity35.2%
pow-to-exp18.1%
expm1-def18.1%
*-commutative18.1%
log1p-udef64.0%
Applied egg-rr64.0%
*-lft-identity64.0%
Simplified64.0%
*-commutative64.0%
div-inv62.6%
clear-num62.7%
associate-*r*62.7%
associate-/r/62.7%
clear-num62.6%
un-div-inv62.9%
div-inv62.9%
metadata-eval62.9%
Applied egg-rr62.9%
associate-/l*62.9%
Simplified62.9%
Taylor expanded in n around inf 43.8%
associate-/l*43.8%
expm1-def84.3%
Simplified84.3%
if -3.20000000000000026e-4 < n < 4.90000000000000023e-31Initial program 33.1%
associate-/r/33.2%
associate-*r*33.2%
*-commutative33.2%
associate-*r/33.2%
sub-neg33.2%
distribute-lft-in33.2%
fma-def33.2%
metadata-eval33.2%
metadata-eval33.2%
Simplified33.2%
Taylor expanded in i around 0 41.9%
associate-*r*41.9%
*-commutative41.9%
associate-*r/41.9%
metadata-eval41.9%
Simplified41.9%
distribute-lft-in41.9%
flip-+38.0%
Applied egg-rr38.0%
Taylor expanded in i around 0 75.9%
*-commutative75.9%
unpow275.9%
associate-*l*76.3%
Simplified76.3%
if 4.90000000000000023e-31 < n Initial program 19.3%
Taylor expanded in n around inf 40.6%
*-commutative40.6%
associate-/l*40.6%
expm1-def98.7%
Simplified98.7%
div-inv98.7%
clear-num98.8%
Applied egg-rr98.8%
Final simplification85.8%
(FPCore (i n)
:precision binary64
(if (or (<= n -8e+129) (not (<= n 4.9e-31)))
(*
100.0
(+
n
(*
n
(+
(*
(* i i)
(+ (/ 0.3333333333333333 (* n n)) (- 0.16666666666666666 (/ 0.5 n))))
(* i (- 0.5 (/ 0.5 n)))))))
(/
(* n (* n 10000.0))
(- (* n 100.0) (* n (* i (+ 50.0 (* 100.0 (/ -0.5 n)))))))))
double code(double i, double n) {
double tmp;
if ((n <= -8e+129) || !(n <= 4.9e-31)) {
tmp = 100.0 * (n + (n * (((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 - (0.5 / n)))) + (i * (0.5 - (0.5 / n))))));
} else {
tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-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 <= (-8d+129)) .or. (.not. (n <= 4.9d-31))) then
tmp = 100.0d0 * (n + (n * (((i * i) * ((0.3333333333333333d0 / (n * n)) + (0.16666666666666666d0 - (0.5d0 / n)))) + (i * (0.5d0 - (0.5d0 / n))))))
else
tmp = (n * (n * 10000.0d0)) / ((n * 100.0d0) - (n * (i * (50.0d0 + (100.0d0 * ((-0.5d0) / n))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -8e+129) || !(n <= 4.9e-31)) {
tmp = 100.0 * (n + (n * (((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 - (0.5 / n)))) + (i * (0.5 - (0.5 / n))))));
} else {
tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n))))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -8e+129) or not (n <= 4.9e-31): tmp = 100.0 * (n + (n * (((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 - (0.5 / n)))) + (i * (0.5 - (0.5 / n)))))) else: tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n)))))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -8e+129) || !(n <= 4.9e-31)) tmp = Float64(100.0 * Float64(n + Float64(n * Float64(Float64(Float64(i * i) * Float64(Float64(0.3333333333333333 / Float64(n * n)) + Float64(0.16666666666666666 - Float64(0.5 / n)))) + Float64(i * Float64(0.5 - Float64(0.5 / n))))))); else tmp = Float64(Float64(n * Float64(n * 10000.0)) / Float64(Float64(n * 100.0) - Float64(n * Float64(i * Float64(50.0 + Float64(100.0 * Float64(-0.5 / n))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -8e+129) || ~((n <= 4.9e-31))) tmp = 100.0 * (n + (n * (((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 - (0.5 / n)))) + (i * (0.5 - (0.5 / n)))))); else tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n)))))); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -8e+129], N[Not[LessEqual[n, 4.9e-31]], $MachinePrecision]], N[(100.0 * N[(n + N[(n * N[(N[(N[(i * i), $MachinePrecision] * N[(N[(0.3333333333333333 / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(i * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * N[(n * 10000.0), $MachinePrecision]), $MachinePrecision] / N[(N[(n * 100.0), $MachinePrecision] - N[(n * N[(i * N[(50.0 + N[(100.0 * N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -8 \cdot 10^{+129} \lor \neg \left(n \leq 4.9 \cdot 10^{-31}\right):\\
\;\;\;\;100 \cdot \left(n + n \cdot \left(\left(i \cdot i\right) \cdot \left(\frac{0.3333333333333333}{n \cdot n} + \left(0.16666666666666666 - \frac{0.5}{n}\right)\right) + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot \left(n \cdot 10000\right)}{n \cdot 100 - n \cdot \left(i \cdot \left(50 + 100 \cdot \frac{-0.5}{n}\right)\right)}\\
\end{array}
\end{array}
if n < -8e129 or 4.90000000000000023e-31 < n Initial program 20.1%
Taylor expanded in i around 0 75.9%
distribute-lft-out76.1%
unpow276.1%
associate--l+76.1%
associate-*r/76.1%
metadata-eval76.1%
unpow276.1%
associate-*r/76.1%
metadata-eval76.1%
associate-*r/76.1%
metadata-eval76.1%
Simplified76.1%
if -8e129 < n < 4.90000000000000023e-31Initial program 37.4%
associate-/r/37.5%
associate-*r*37.5%
*-commutative37.5%
associate-*r/37.5%
sub-neg37.5%
distribute-lft-in37.5%
fma-def37.5%
metadata-eval37.5%
metadata-eval37.5%
Simplified37.5%
Taylor expanded in i around 0 42.5%
associate-*r*42.5%
*-commutative42.5%
associate-*r/42.5%
metadata-eval42.5%
Simplified42.5%
distribute-lft-in42.5%
flip-+39.5%
Applied egg-rr39.5%
Taylor expanded in i around 0 70.4%
*-commutative70.4%
unpow270.4%
associate-*l*70.7%
Simplified70.7%
Final simplification73.3%
(FPCore (i n)
:precision binary64
(if (<= n -9e+151)
(* n (+ 100.0 (* i 50.0)))
(if (<= n 4.9e-31)
(/
(* n (* n 10000.0))
(- (* n 100.0) (* n (* i (+ 50.0 (* 100.0 (/ -0.5 n)))))))
(/ n (/ (- 100.0 (* i 50.0)) (+ 10000.0 (* (* i i) -2500.0)))))))
double code(double i, double n) {
double tmp;
if (n <= -9e+151) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= 4.9e-31) {
tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n))))));
} else {
tmp = n / ((100.0 - (i * 50.0)) / (10000.0 + ((i * i) * -2500.0)));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-9d+151)) then
tmp = n * (100.0d0 + (i * 50.0d0))
else if (n <= 4.9d-31) then
tmp = (n * (n * 10000.0d0)) / ((n * 100.0d0) - (n * (i * (50.0d0 + (100.0d0 * ((-0.5d0) / n))))))
else
tmp = n / ((100.0d0 - (i * 50.0d0)) / (10000.0d0 + ((i * i) * (-2500.0d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -9e+151) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= 4.9e-31) {
tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n))))));
} else {
tmp = n / ((100.0 - (i * 50.0)) / (10000.0 + ((i * i) * -2500.0)));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -9e+151: tmp = n * (100.0 + (i * 50.0)) elif n <= 4.9e-31: tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n)))))) else: tmp = n / ((100.0 - (i * 50.0)) / (10000.0 + ((i * i) * -2500.0))) return tmp
function code(i, n) tmp = 0.0 if (n <= -9e+151) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); elseif (n <= 4.9e-31) tmp = Float64(Float64(n * Float64(n * 10000.0)) / Float64(Float64(n * 100.0) - Float64(n * Float64(i * Float64(50.0 + Float64(100.0 * Float64(-0.5 / n))))))); else tmp = Float64(n / Float64(Float64(100.0 - Float64(i * 50.0)) / Float64(10000.0 + Float64(Float64(i * i) * -2500.0)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -9e+151) tmp = n * (100.0 + (i * 50.0)); elseif (n <= 4.9e-31) tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n)))))); else tmp = n / ((100.0 - (i * 50.0)) / (10000.0 + ((i * i) * -2500.0))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -9e+151], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.9e-31], N[(N[(n * N[(n * 10000.0), $MachinePrecision]), $MachinePrecision] / N[(N[(n * 100.0), $MachinePrecision] - N[(n * N[(i * N[(50.0 + N[(100.0 * N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(N[(100.0 - N[(i * 50.0), $MachinePrecision]), $MachinePrecision] / N[(10000.0 + N[(N[(i * i), $MachinePrecision] * -2500.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -9 \cdot 10^{+151}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{elif}\;n \leq 4.9 \cdot 10^{-31}:\\
\;\;\;\;\frac{n \cdot \left(n \cdot 10000\right)}{n \cdot 100 - n \cdot \left(i \cdot \left(50 + 100 \cdot \frac{-0.5}{n}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{\frac{100 - i \cdot 50}{10000 + \left(i \cdot i\right) \cdot -2500}}\\
\end{array}
\end{array}
if n < -8.9999999999999997e151Initial program 21.4%
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 59.9%
associate-*r*59.9%
*-commutative59.9%
associate-*r/59.9%
metadata-eval59.9%
Simplified59.9%
Taylor expanded in n around inf 59.9%
*-commutative59.9%
Simplified59.9%
if -8.9999999999999997e151 < n < 4.90000000000000023e-31Initial program 37.0%
associate-/r/37.2%
associate-*r*37.2%
*-commutative37.2%
associate-*r/37.2%
sub-neg37.2%
distribute-lft-in37.2%
fma-def37.2%
metadata-eval37.2%
metadata-eval37.2%
Simplified37.2%
Taylor expanded in i around 0 42.3%
associate-*r*42.3%
*-commutative42.3%
associate-*r/42.3%
metadata-eval42.3%
Simplified42.3%
distribute-lft-in42.3%
flip-+40.0%
Applied egg-rr40.0%
Taylor expanded in i around 0 69.4%
*-commutative69.4%
unpow269.4%
associate-*l*69.7%
Simplified69.7%
if 4.90000000000000023e-31 < n Initial program 19.3%
associate-/r/19.7%
associate-*r*19.7%
*-commutative19.7%
associate-*r/19.7%
sub-neg19.7%
distribute-lft-in19.7%
fma-def19.7%
metadata-eval19.7%
metadata-eval19.7%
Simplified19.7%
Taylor expanded in i around 0 76.1%
associate-*r*76.1%
*-commutative76.1%
associate-*r/76.1%
metadata-eval76.1%
Simplified76.1%
distribute-lft-in76.1%
flip-+43.2%
Applied egg-rr43.2%
Taylor expanded in n around inf 81.2%
associate-/l*79.2%
*-commutative79.2%
cancel-sign-sub-inv79.2%
metadata-eval79.2%
*-commutative79.2%
unpow279.2%
Simplified79.2%
Final simplification71.5%
(FPCore (i n)
:precision binary64
(if (<= n -1.4e+210)
(* n (+ 100.0 (* i 50.0)))
(if (<= n -6.8e-204)
(* 100.0 (/ n (+ 1.0 (* i -0.5))))
(if (<= n 5e-123)
(* (* n 100.0) (/ 0.0 i))
(/ n (/ (- 100.0 (* i 50.0)) (+ 10000.0 (* (* i i) -2500.0))))))))
double code(double i, double n) {
double tmp;
if (n <= -1.4e+210) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= -6.8e-204) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 5e-123) {
tmp = (n * 100.0) * (0.0 / i);
} else {
tmp = n / ((100.0 - (i * 50.0)) / (10000.0 + ((i * i) * -2500.0)));
}
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+210)) then
tmp = n * (100.0d0 + (i * 50.0d0))
else if (n <= (-6.8d-204)) then
tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
else if (n <= 5d-123) then
tmp = (n * 100.0d0) * (0.0d0 / i)
else
tmp = n / ((100.0d0 - (i * 50.0d0)) / (10000.0d0 + ((i * i) * (-2500.0d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.4e+210) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= -6.8e-204) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 5e-123) {
tmp = (n * 100.0) * (0.0 / i);
} else {
tmp = n / ((100.0 - (i * 50.0)) / (10000.0 + ((i * i) * -2500.0)));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.4e+210: tmp = n * (100.0 + (i * 50.0)) elif n <= -6.8e-204: tmp = 100.0 * (n / (1.0 + (i * -0.5))) elif n <= 5e-123: tmp = (n * 100.0) * (0.0 / i) else: tmp = n / ((100.0 - (i * 50.0)) / (10000.0 + ((i * i) * -2500.0))) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.4e+210) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); elseif (n <= -6.8e-204) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); elseif (n <= 5e-123) tmp = Float64(Float64(n * 100.0) * Float64(0.0 / i)); else tmp = Float64(n / Float64(Float64(100.0 - Float64(i * 50.0)) / Float64(10000.0 + Float64(Float64(i * i) * -2500.0)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.4e+210) tmp = n * (100.0 + (i * 50.0)); elseif (n <= -6.8e-204) tmp = 100.0 * (n / (1.0 + (i * -0.5))); elseif (n <= 5e-123) tmp = (n * 100.0) * (0.0 / i); else tmp = n / ((100.0 - (i * 50.0)) / (10000.0 + ((i * i) * -2500.0))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.4e+210], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -6.8e-204], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5e-123], N[(N[(n * 100.0), $MachinePrecision] * N[(0.0 / i), $MachinePrecision]), $MachinePrecision], N[(n / N[(N[(100.0 - N[(i * 50.0), $MachinePrecision]), $MachinePrecision] / N[(10000.0 + N[(N[(i * i), $MachinePrecision] * -2500.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.4 \cdot 10^{+210}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{elif}\;n \leq -6.8 \cdot 10^{-204}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 5 \cdot 10^{-123}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{0}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{\frac{100 - i \cdot 50}{10000 + \left(i \cdot i\right) \cdot -2500}}\\
\end{array}
\end{array}
if n < -1.4000000000000001e210Initial program 15.7%
associate-/r/16.4%
associate-*r*16.4%
*-commutative16.4%
associate-*r/16.4%
sub-neg16.4%
distribute-lft-in16.4%
fma-def16.4%
metadata-eval16.4%
metadata-eval16.4%
Simplified16.4%
Taylor expanded in i around 0 70.8%
associate-*r*70.8%
*-commutative70.8%
associate-*r/70.8%
metadata-eval70.8%
Simplified70.8%
Taylor expanded in n around inf 70.8%
*-commutative70.8%
Simplified70.8%
if -1.4000000000000001e210 < n < -6.8000000000000004e-204Initial program 32.8%
Taylor expanded in n around inf 28.5%
*-commutative28.5%
associate-/l*28.5%
expm1-def77.4%
Simplified77.4%
Taylor expanded in i around 0 60.1%
*-commutative60.1%
Simplified60.1%
if -6.8000000000000004e-204 < n < 5.0000000000000003e-123Initial program 51.8%
*-commutative51.8%
associate-/r/52.1%
associate-*l*52.1%
sub-neg52.1%
metadata-eval52.1%
Simplified52.1%
Taylor expanded in i around 0 75.4%
if 5.0000000000000003e-123 < n Initial program 20.3%
associate-/r/20.6%
associate-*r*20.6%
*-commutative20.6%
associate-*r/20.6%
sub-neg20.6%
distribute-lft-in20.6%
fma-def20.6%
metadata-eval20.6%
metadata-eval20.6%
Simplified20.6%
Taylor expanded in i around 0 69.7%
associate-*r*69.7%
*-commutative69.7%
associate-*r/69.7%
metadata-eval69.7%
Simplified69.7%
distribute-lft-in69.7%
flip-+43.3%
Applied egg-rr43.3%
Taylor expanded in n around inf 73.9%
associate-/l*72.4%
*-commutative72.4%
cancel-sign-sub-inv72.4%
metadata-eval72.4%
*-commutative72.4%
unpow272.4%
Simplified72.4%
Final simplification68.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i 50.0)))))
(if (<= n -6e+208)
t_0
(if (<= n -1.95e-200)
(* 100.0 (/ n (+ 1.0 (* i -0.5))))
(if (<= n 1.75e-122) (* (* n 100.0) (/ 0.0 i)) t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -6e+208) {
tmp = t_0;
} else if (n <= -1.95e-200) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 1.75e-122) {
tmp = (n * 100.0) * (0.0 / i);
} 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 <= (-6d+208)) then
tmp = t_0
else if (n <= (-1.95d-200)) then
tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
else if (n <= 1.75d-122) then
tmp = (n * 100.0d0) * (0.0d0 / i)
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 <= -6e+208) {
tmp = t_0;
} else if (n <= -1.95e-200) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 1.75e-122) {
tmp = (n * 100.0) * (0.0 / i);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + (i * 50.0)) tmp = 0 if n <= -6e+208: tmp = t_0 elif n <= -1.95e-200: tmp = 100.0 * (n / (1.0 + (i * -0.5))) elif n <= 1.75e-122: tmp = (n * 100.0) * (0.0 / i) 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 <= -6e+208) tmp = t_0; elseif (n <= -1.95e-200) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); elseif (n <= 1.75e-122) tmp = Float64(Float64(n * 100.0) * Float64(0.0 / i)); 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 <= -6e+208) tmp = t_0; elseif (n <= -1.95e-200) tmp = 100.0 * (n / (1.0 + (i * -0.5))); elseif (n <= 1.75e-122) tmp = (n * 100.0) * (0.0 / i); 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, -6e+208], t$95$0, If[LessEqual[n, -1.95e-200], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.75e-122], N[(N[(n * 100.0), $MachinePrecision] * N[(0.0 / i), $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 -6 \cdot 10^{+208}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -1.95 \cdot 10^{-200}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 1.75 \cdot 10^{-122}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{0}{i}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -5.99999999999999989e208 or 1.7500000000000001e-122 < n Initial program 19.5%
associate-/r/19.9%
associate-*r*19.9%
*-commutative19.9%
associate-*r/19.9%
sub-neg19.9%
distribute-lft-in19.9%
fma-def19.9%
metadata-eval19.9%
metadata-eval19.9%
Simplified19.9%
Taylor expanded in i around 0 69.9%
associate-*r*69.9%
*-commutative69.9%
associate-*r/69.9%
metadata-eval69.9%
Simplified69.9%
Taylor expanded in n around inf 70.1%
*-commutative70.1%
Simplified70.1%
if -5.99999999999999989e208 < n < -1.94999999999999999e-200Initial program 32.8%
Taylor expanded in n around inf 28.5%
*-commutative28.5%
associate-/l*28.5%
expm1-def77.4%
Simplified77.4%
Taylor expanded in i around 0 60.1%
*-commutative60.1%
Simplified60.1%
if -1.94999999999999999e-200 < n < 1.7500000000000001e-122Initial program 51.8%
*-commutative51.8%
associate-/r/52.1%
associate-*l*52.1%
sub-neg52.1%
metadata-eval52.1%
Simplified52.1%
Taylor expanded in i around 0 75.4%
Final simplification67.2%
(FPCore (i n) :precision binary64 (if (or (<= n -2.95e+209) (not (<= n 4.9e-31))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ n (+ 1.0 (* i -0.5))))))
double code(double i, double n) {
double tmp;
if ((n <= -2.95e+209) || !(n <= 4.9e-31)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-2.95d+209)) .or. (.not. (n <= 4.9d-31))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -2.95e+209) || !(n <= 4.9e-31)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.95e+209) or not (n <= 4.9e-31): tmp = n * (100.0 + (i * 50.0)) else: tmp = 100.0 * (n / (1.0 + (i * -0.5))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.95e+209) || !(n <= 4.9e-31)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -2.95e+209) || ~((n <= 4.9e-31))) tmp = n * (100.0 + (i * 50.0)); else tmp = 100.0 * (n / (1.0 + (i * -0.5))); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -2.95e+209], N[Not[LessEqual[n, 4.9e-31]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.95 \cdot 10^{+209} \lor \neg \left(n \leq 4.9 \cdot 10^{-31}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\end{array}
\end{array}
if n < -2.9499999999999999e209 or 4.90000000000000023e-31 < n Initial program 18.6%
associate-/r/19.1%
associate-*r*19.1%
*-commutative19.1%
associate-*r/19.1%
sub-neg19.1%
distribute-lft-in19.1%
fma-def19.1%
metadata-eval19.1%
metadata-eval19.1%
Simplified19.1%
Taylor expanded in i around 0 75.1%
associate-*r*75.1%
*-commutative75.1%
associate-*r/75.1%
metadata-eval75.1%
Simplified75.1%
Taylor expanded in n around inf 75.1%
*-commutative75.1%
Simplified75.1%
if -2.9499999999999999e209 < n < 4.90000000000000023e-31Initial program 36.3%
Taylor expanded in n around inf 25.8%
*-commutative25.8%
associate-/l*25.8%
expm1-def60.9%
Simplified60.9%
Taylor expanded in i around 0 56.1%
*-commutative56.1%
Simplified56.1%
Final simplification63.8%
(FPCore (i n) :precision binary64 (if (or (<= n -1.4e+104) (not (<= n 1.92e-31))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -1.4e+104) || !(n <= 1.92e-31)) {
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+104)) .or. (.not. (n <= 1.92d-31))) 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+104) || !(n <= 1.92e-31)) {
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+104) or not (n <= 1.92e-31): 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+104) || !(n <= 1.92e-31)) 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+104) || ~((n <= 1.92e-31))) 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+104], N[Not[LessEqual[n, 1.92e-31]], $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^{+104} \lor \neg \left(n \leq 1.92 \cdot 10^{-31}\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.4e104 or 1.9200000000000001e-31 < n Initial program 20.6%
associate-/r/21.1%
associate-*r*21.1%
*-commutative21.1%
associate-*r/21.1%
sub-neg21.1%
distribute-lft-in21.1%
fma-def21.1%
metadata-eval21.1%
metadata-eval21.1%
Simplified21.1%
Taylor expanded in i around 0 69.6%
associate-*r*69.6%
*-commutative69.6%
associate-*r/69.6%
metadata-eval69.6%
Simplified69.6%
Taylor expanded in n around inf 69.6%
*-commutative69.6%
Simplified69.6%
if -1.4e104 < n < 1.9200000000000001e-31Initial program 37.8%
Taylor expanded in i around 0 55.2%
Final simplification62.4%
(FPCore (i n) :precision binary64 (if (<= i -2e+30) (* 100.0 (/ i (/ i n))) (if (<= i 1.5e-27) (* n 100.0) (* 50.0 (* i n)))))
double code(double i, double n) {
double tmp;
if (i <= -2e+30) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 1.5e-27) {
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 <= (-2d+30)) then
tmp = 100.0d0 * (i / (i / n))
else if (i <= 1.5d-27) 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 <= -2e+30) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 1.5e-27) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -2e+30: tmp = 100.0 * (i / (i / n)) elif i <= 1.5e-27: tmp = n * 100.0 else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= -2e+30) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (i <= 1.5e-27) 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 <= -2e+30) tmp = 100.0 * (i / (i / n)); elseif (i <= 1.5e-27) tmp = n * 100.0; else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -2e+30], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1.5e-27], N[(n * 100.0), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2 \cdot 10^{+30}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 1.5 \cdot 10^{-27}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < -2e30Initial program 66.3%
Taylor expanded in i around 0 21.8%
if -2e30 < i < 1.5000000000000001e-27Initial program 7.5%
Taylor expanded in i around 0 85.6%
*-commutative85.6%
Simplified85.6%
if 1.5000000000000001e-27 < i Initial program 51.3%
associate-/r/51.5%
associate-*r*51.5%
*-commutative51.5%
associate-*r/51.5%
sub-neg51.5%
distribute-lft-in51.5%
fma-def51.5%
metadata-eval51.5%
metadata-eval51.5%
Simplified51.5%
Taylor expanded in i around 0 25.7%
associate-*r*25.7%
*-commutative25.7%
associate-*r/25.7%
metadata-eval25.7%
Simplified25.7%
Taylor expanded in i around inf 25.7%
*-commutative25.7%
associate-*l*25.7%
*-commutative25.7%
associate-*r*25.7%
*-commutative25.7%
sub-neg25.7%
associate-*r/25.7%
metadata-eval25.7%
distribute-neg-frac25.7%
metadata-eval25.7%
distribute-lft-out25.7%
associate-*l*25.7%
metadata-eval25.7%
associate-*l*25.7%
*-commutative25.7%
distribute-lft-in25.7%
*-commutative25.7%
associate-*r*25.8%
*-commutative25.8%
Simplified25.8%
Taylor expanded in n around inf 26.5%
Final simplification58.8%
(FPCore (i n) :precision binary64 (if (<= i 1.5e-27) (* n 100.0) (* 50.0 (* i n))))
double code(double i, double n) {
double tmp;
if (i <= 1.5e-27) {
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.5d-27) 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.5e-27) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 1.5e-27: tmp = n * 100.0 else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= 1.5e-27) 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.5e-27) tmp = n * 100.0; else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 1.5e-27], N[(n * 100.0), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 1.5 \cdot 10^{-27}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < 1.5000000000000001e-27Initial program 20.1%
Taylor expanded in i around 0 68.4%
*-commutative68.4%
Simplified68.4%
if 1.5000000000000001e-27 < i Initial program 51.3%
associate-/r/51.5%
associate-*r*51.5%
*-commutative51.5%
associate-*r/51.5%
sub-neg51.5%
distribute-lft-in51.5%
fma-def51.5%
metadata-eval51.5%
metadata-eval51.5%
Simplified51.5%
Taylor expanded in i around 0 25.7%
associate-*r*25.7%
*-commutative25.7%
associate-*r/25.7%
metadata-eval25.7%
Simplified25.7%
Taylor expanded in i around inf 25.7%
*-commutative25.7%
associate-*l*25.7%
*-commutative25.7%
associate-*r*25.7%
*-commutative25.7%
sub-neg25.7%
associate-*r/25.7%
metadata-eval25.7%
distribute-neg-frac25.7%
metadata-eval25.7%
distribute-lft-out25.7%
associate-*l*25.7%
metadata-eval25.7%
associate-*l*25.7%
*-commutative25.7%
distribute-lft-in25.7%
*-commutative25.7%
associate-*r*25.8%
*-commutative25.8%
Simplified25.8%
Taylor expanded in n around inf 26.5%
Final simplification56.2%
(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 29.1%
associate-/r/29.4%
associate-*r*29.4%
*-commutative29.4%
associate-*r/29.4%
sub-neg29.4%
distribute-lft-in29.4%
fma-def29.4%
metadata-eval29.4%
metadata-eval29.4%
Simplified29.4%
Taylor expanded in i around 0 55.7%
associate-*r*55.7%
*-commutative55.7%
associate-*r/55.7%
metadata-eval55.7%
Simplified55.7%
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 29.1%
Taylor expanded in i around 0 50.0%
*-commutative50.0%
Simplified50.0%
Final simplification50.0%
(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 2023274
(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))))