
(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) -1.0)) (t_1 (/ t_0 (/ i n))))
(if (<= t_1 -1e-169)
(/ (* (* n t_0) 100.0) i)
(if (<= t_1 0.0)
(/ (* n 100.0) (/ i (expm1 i)))
(if (<= t_1 INFINITY)
(* 100.0 (* n (/ t_0 i)))
(/ n (+ 0.01 (* i -0.005))))))))
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 tmp;
if (t_1 <= -1e-169) {
tmp = ((n * t_0) * 100.0) / i;
} else if (t_1 <= 0.0) {
tmp = (n * 100.0) / (i / expm1(i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (n * (t_0 / i));
} else {
tmp = n / (0.01 + (i * -0.005));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= -1e-169) {
tmp = ((n * t_0) * 100.0) / i;
} else if (t_1 <= 0.0) {
tmp = (n * 100.0) / (i / Math.expm1(i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (n * (t_0 / i));
} else {
tmp = n / (0.01 + (i * -0.005));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) + -1.0 t_1 = t_0 / (i / n) tmp = 0 if t_1 <= -1e-169: tmp = ((n * t_0) * 100.0) / i elif t_1 <= 0.0: tmp = (n * 100.0) / (i / math.expm1(i)) elif t_1 <= math.inf: tmp = 100.0 * (n * (t_0 / i)) else: tmp = n / (0.01 + (i * -0.005)) 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)) tmp = 0.0 if (t_1 <= -1e-169) tmp = Float64(Float64(Float64(n * t_0) * 100.0) / i); elseif (t_1 <= 0.0) tmp = Float64(Float64(n * 100.0) / Float64(i / expm1(i))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(n * Float64(t_0 / i))); else tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); 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]}, If[LessEqual[t$95$1, -1e-169], N[(N[(N[(n * t$95$0), $MachinePrecision] * 100.0), $MachinePrecision] / i), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(n * 100.0), $MachinePrecision] / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(n * N[(t$95$0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * -0.005), $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}}\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{-169}:\\
\;\;\;\;\frac{\left(n \cdot t_0\right) \cdot 100}{i}\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\frac{n \cdot 100}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{t_0}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -1.00000000000000002e-169Initial program 96.0%
associate-/r/95.8%
sub-neg95.8%
metadata-eval95.8%
Simplified95.8%
*-commutative95.8%
associate-*l/96.0%
associate-*l/96.2%
*-commutative96.2%
Applied egg-rr96.2%
if -1.00000000000000002e-169 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 15.6%
associate-*r/15.6%
associate-/r/15.6%
*-commutative15.6%
sub-neg15.6%
distribute-lft-in15.6%
fma-def15.6%
metadata-eval15.6%
metadata-eval15.6%
Simplified15.6%
Taylor expanded in n around inf 32.8%
associate-/l*32.9%
fma-neg32.8%
metadata-eval32.8%
Simplified32.8%
Taylor expanded in i around inf 32.9%
sub-neg32.9%
metadata-eval32.9%
metadata-eval32.9%
distribute-lft-in32.8%
metadata-eval32.8%
sub-neg32.8%
expm1-def77.2%
Simplified77.2%
frac-2neg77.2%
div-inv77.3%
metadata-eval77.3%
metadata-eval77.3%
distribute-neg-frac77.3%
frac-2neg77.3%
clear-num77.2%
associate-/l*77.3%
distribute-neg-frac77.3%
metadata-eval77.3%
Applied egg-rr77.3%
associate-*r/77.3%
distribute-lft-neg-out77.3%
distribute-rgt-neg-in77.3%
metadata-eval77.3%
*-commutative77.3%
Simplified77.3%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 95.0%
associate-/r/95.3%
sub-neg95.3%
metadata-eval95.3%
Simplified95.3%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-*r/0.0%
associate-/r/1.9%
*-commutative1.9%
sub-neg1.9%
distribute-lft-in1.9%
fma-def1.9%
metadata-eval1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in n around inf 1.9%
associate-/l*1.9%
fma-neg1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in i around 0 99.9%
*-commutative99.9%
Simplified99.9%
Final simplification84.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0)) (t_1 (/ t_0 (/ i n))))
(if (<= t_1 -1e-169)
(* t_1 100.0)
(if (<= t_1 0.0)
(/ (* n 100.0) (/ i (expm1 i)))
(if (<= t_1 INFINITY)
(* 100.0 (* n (/ t_0 i)))
(/ n (+ 0.01 (* i -0.005))))))))
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 tmp;
if (t_1 <= -1e-169) {
tmp = t_1 * 100.0;
} else if (t_1 <= 0.0) {
tmp = (n * 100.0) / (i / expm1(i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (n * (t_0 / i));
} else {
tmp = n / (0.01 + (i * -0.005));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= -1e-169) {
tmp = t_1 * 100.0;
} else if (t_1 <= 0.0) {
tmp = (n * 100.0) / (i / Math.expm1(i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (n * (t_0 / i));
} else {
tmp = n / (0.01 + (i * -0.005));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) + -1.0 t_1 = t_0 / (i / n) tmp = 0 if t_1 <= -1e-169: tmp = t_1 * 100.0 elif t_1 <= 0.0: tmp = (n * 100.0) / (i / math.expm1(i)) elif t_1 <= math.inf: tmp = 100.0 * (n * (t_0 / i)) else: tmp = n / (0.01 + (i * -0.005)) 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)) tmp = 0.0 if (t_1 <= -1e-169) tmp = Float64(t_1 * 100.0); elseif (t_1 <= 0.0) tmp = Float64(Float64(n * 100.0) / Float64(i / expm1(i))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(n * Float64(t_0 / i))); else tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); 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]}, If[LessEqual[t$95$1, -1e-169], N[(t$95$1 * 100.0), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(n * 100.0), $MachinePrecision] / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(n * N[(t$95$0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * -0.005), $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}}\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{-169}:\\
\;\;\;\;t_1 \cdot 100\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\frac{n \cdot 100}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{t_0}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -1.00000000000000002e-169Initial program 96.0%
if -1.00000000000000002e-169 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 15.6%
associate-*r/15.6%
associate-/r/15.6%
*-commutative15.6%
sub-neg15.6%
distribute-lft-in15.6%
fma-def15.6%
metadata-eval15.6%
metadata-eval15.6%
Simplified15.6%
Taylor expanded in n around inf 32.8%
associate-/l*32.9%
fma-neg32.8%
metadata-eval32.8%
Simplified32.8%
Taylor expanded in i around inf 32.9%
sub-neg32.9%
metadata-eval32.9%
metadata-eval32.9%
distribute-lft-in32.8%
metadata-eval32.8%
sub-neg32.8%
expm1-def77.2%
Simplified77.2%
frac-2neg77.2%
div-inv77.3%
metadata-eval77.3%
metadata-eval77.3%
distribute-neg-frac77.3%
frac-2neg77.3%
clear-num77.2%
associate-/l*77.3%
distribute-neg-frac77.3%
metadata-eval77.3%
Applied egg-rr77.3%
associate-*r/77.3%
distribute-lft-neg-out77.3%
distribute-rgt-neg-in77.3%
metadata-eval77.3%
*-commutative77.3%
Simplified77.3%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 95.0%
associate-/r/95.3%
sub-neg95.3%
metadata-eval95.3%
Simplified95.3%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-*r/0.0%
associate-/r/1.9%
*-commutative1.9%
sub-neg1.9%
distribute-lft-in1.9%
fma-def1.9%
metadata-eval1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in n around inf 1.9%
associate-/l*1.9%
fma-neg1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in i around 0 99.9%
*-commutative99.9%
Simplified99.9%
Final simplification84.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (* (expm1 i) (/ n i)))))
(if (<= i -2e-23)
t_0
(if (<= i -3.9e-166)
(/ (* n (* i (+ 100.0 (* i 50.0)))) i)
(if (<= i 9e-38) (* 100.0 (+ n (* i (* n (- 0.5 (/ 0.5 n)))))) t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (expm1(i) * (n / i));
double tmp;
if (i <= -2e-23) {
tmp = t_0;
} else if (i <= -3.9e-166) {
tmp = (n * (i * (100.0 + (i * 50.0)))) / i;
} else if (i <= 9e-38) {
tmp = 100.0 * (n + (i * (n * (0.5 - (0.5 / n)))));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (Math.expm1(i) * (n / i));
double tmp;
if (i <= -2e-23) {
tmp = t_0;
} else if (i <= -3.9e-166) {
tmp = (n * (i * (100.0 + (i * 50.0)))) / i;
} else if (i <= 9e-38) {
tmp = 100.0 * (n + (i * (n * (0.5 - (0.5 / n)))));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (math.expm1(i) * (n / i)) tmp = 0 if i <= -2e-23: tmp = t_0 elif i <= -3.9e-166: tmp = (n * (i * (100.0 + (i * 50.0)))) / i elif i <= 9e-38: tmp = 100.0 * (n + (i * (n * (0.5 - (0.5 / n))))) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(expm1(i) * Float64(n / i))) tmp = 0.0 if (i <= -2e-23) tmp = t_0; elseif (i <= -3.9e-166) tmp = Float64(Float64(n * Float64(i * Float64(100.0 + Float64(i * 50.0)))) / i); elseif (i <= 9e-38) tmp = Float64(100.0 * Float64(n + Float64(i * Float64(n * Float64(0.5 - Float64(0.5 / n)))))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -2e-23], t$95$0, If[LessEqual[i, -3.9e-166], N[(N[(n * N[(i * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], If[LessEqual[i, 9e-38], N[(100.0 * N[(n + N[(i * N[(n * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \left(\mathsf{expm1}\left(i\right) \cdot \frac{n}{i}\right)\\
\mathbf{if}\;i \leq -2 \cdot 10^{-23}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;i \leq -3.9 \cdot 10^{-166}:\\
\;\;\;\;\frac{n \cdot \left(i \cdot \left(100 + i \cdot 50\right)\right)}{i}\\
\mathbf{elif}\;i \leq 9 \cdot 10^{-38}:\\
\;\;\;\;100 \cdot \left(n + i \cdot \left(n \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if i < -1.99999999999999992e-23 or 9.00000000000000018e-38 < i Initial program 43.4%
associate-/r/43.6%
sub-neg43.6%
metadata-eval43.6%
Simplified43.6%
Taylor expanded in n around inf 54.6%
associate-/l*54.6%
expm1-def57.8%
Simplified57.8%
Taylor expanded in n around 0 54.6%
expm1-def57.8%
associate-/l*57.8%
associate-/r/57.6%
Simplified57.6%
if -1.99999999999999992e-23 < i < -3.89999999999999999e-166Initial program 15.7%
associate-*r/15.7%
associate-/r/16.1%
*-commutative16.1%
sub-neg16.1%
distribute-lft-in16.1%
fma-def16.1%
metadata-eval16.1%
metadata-eval16.1%
Simplified16.1%
Taylor expanded in i around 0 76.5%
distribute-lft-out76.5%
unpow276.5%
associate-*r/76.5%
metadata-eval76.5%
Simplified76.5%
Taylor expanded in n around inf 77.6%
*-commutative77.6%
unpow277.6%
associate-*r*77.6%
Simplified77.6%
associate-*r/89.4%
distribute-rgt-in89.4%
associate-*l*89.4%
distribute-lft-out89.4%
associate-*l*89.4%
metadata-eval89.4%
Applied egg-rr89.4%
if -3.89999999999999999e-166 < i < 9.00000000000000018e-38Initial program 4.6%
associate-/r/5.2%
sub-neg5.2%
metadata-eval5.2%
Simplified5.2%
Taylor expanded in i around 0 93.7%
distribute-lft-out93.7%
associate-*r/93.7%
metadata-eval93.7%
Simplified93.7%
Final simplification76.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (* n (/ (expm1 i) i)))))
(if (<= n -4.7e-198)
t_0
(if (<= n 1.75e-188)
(/ 0.0 (/ i n))
(if (<= n 0.19) (/ n (+ 0.01 (* i -0.005))) t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (n * (expm1(i) / i));
double tmp;
if (n <= -4.7e-198) {
tmp = t_0;
} else if (n <= 1.75e-188) {
tmp = 0.0 / (i / n);
} else if (n <= 0.19) {
tmp = n / (0.01 + (i * -0.005));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (n * (Math.expm1(i) / i));
double tmp;
if (n <= -4.7e-198) {
tmp = t_0;
} else if (n <= 1.75e-188) {
tmp = 0.0 / (i / n);
} else if (n <= 0.19) {
tmp = n / (0.01 + (i * -0.005));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n * (math.expm1(i) / i)) tmp = 0 if n <= -4.7e-198: tmp = t_0 elif n <= 1.75e-188: tmp = 0.0 / (i / n) elif n <= 0.19: tmp = n / (0.01 + (i * -0.005)) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n * Float64(expm1(i) / i))) tmp = 0.0 if (n <= -4.7e-198) tmp = t_0; elseif (n <= 1.75e-188) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 0.19) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -4.7e-198], t$95$0, If[LessEqual[n, 1.75e-188], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.19], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{if}\;n \leq -4.7 \cdot 10^{-198}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 1.75 \cdot 10^{-188}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 0.19:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -4.7e-198 or 0.19 < n Initial program 22.4%
associate-/r/22.9%
sub-neg22.9%
metadata-eval22.9%
Simplified22.9%
Taylor expanded in n around inf 34.2%
expm1-def86.4%
Simplified86.4%
if -4.7e-198 < n < 1.75e-188Initial program 55.5%
associate-*r/55.5%
sub-neg55.5%
distribute-lft-in55.5%
metadata-eval55.5%
metadata-eval55.5%
Simplified55.5%
Taylor expanded in i around 0 72.1%
if 1.75e-188 < n < 0.19Initial program 10.5%
associate-*r/10.5%
associate-/r/10.6%
*-commutative10.6%
sub-neg10.6%
distribute-lft-in10.6%
fma-def10.6%
metadata-eval10.6%
metadata-eval10.6%
Simplified10.6%
Taylor expanded in n around inf 3.3%
associate-/l*3.3%
fma-neg3.3%
metadata-eval3.3%
Simplified3.3%
Taylor expanded in i around 0 67.4%
*-commutative67.4%
Simplified67.4%
Final simplification81.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ n (/ i (expm1 i))))))
(if (<= n -4.8e-198)
t_0
(if (<= n 4.4e-186)
(/ 0.0 (/ i n))
(if (<= n 0.5) (/ n (+ 0.01 (* i -0.005))) t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (n / (i / expm1(i)));
double tmp;
if (n <= -4.8e-198) {
tmp = t_0;
} else if (n <= 4.4e-186) {
tmp = 0.0 / (i / n);
} else if (n <= 0.5) {
tmp = n / (0.01 + (i * -0.005));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (n / (i / Math.expm1(i)));
double tmp;
if (n <= -4.8e-198) {
tmp = t_0;
} else if (n <= 4.4e-186) {
tmp = 0.0 / (i / n);
} else if (n <= 0.5) {
tmp = n / (0.01 + (i * -0.005));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n / (i / math.expm1(i))) tmp = 0 if n <= -4.8e-198: tmp = t_0 elif n <= 4.4e-186: tmp = 0.0 / (i / n) elif n <= 0.5: tmp = n / (0.01 + (i * -0.005)) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n / Float64(i / expm1(i)))) tmp = 0.0 if (n <= -4.8e-198) tmp = t_0; elseif (n <= 4.4e-186) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 0.5) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -4.8e-198], t$95$0, If[LessEqual[n, 4.4e-186], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.5], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{if}\;n \leq -4.8 \cdot 10^{-198}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 4.4 \cdot 10^{-186}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 0.5:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -4.79999999999999973e-198 or 0.5 < n Initial program 22.4%
associate-/r/22.9%
sub-neg22.9%
metadata-eval22.9%
Simplified22.9%
Taylor expanded in n around inf 34.2%
associate-/l*34.2%
expm1-def86.4%
Simplified86.4%
if -4.79999999999999973e-198 < n < 4.40000000000000026e-186Initial program 55.5%
associate-*r/55.5%
sub-neg55.5%
distribute-lft-in55.5%
metadata-eval55.5%
metadata-eval55.5%
Simplified55.5%
Taylor expanded in i around 0 72.1%
if 4.40000000000000026e-186 < n < 0.5Initial program 10.5%
associate-*r/10.5%
associate-/r/10.6%
*-commutative10.6%
sub-neg10.6%
distribute-lft-in10.6%
fma-def10.6%
metadata-eval10.6%
metadata-eval10.6%
Simplified10.6%
Taylor expanded in n around inf 3.3%
associate-/l*3.3%
fma-neg3.3%
metadata-eval3.3%
Simplified3.3%
Taylor expanded in i around 0 67.4%
*-commutative67.4%
Simplified67.4%
Final simplification81.3%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ i (expm1 i))))
(if (<= n -5.9e-198)
(/ (* n 100.0) t_0)
(if (<= n 1.1e-183)
(/ 0.0 (/ i n))
(if (<= n 4.4e-5) (/ n (+ 0.01 (* i -0.005))) (* 100.0 (/ n t_0)))))))
double code(double i, double n) {
double t_0 = i / expm1(i);
double tmp;
if (n <= -5.9e-198) {
tmp = (n * 100.0) / t_0;
} else if (n <= 1.1e-183) {
tmp = 0.0 / (i / n);
} else if (n <= 4.4e-5) {
tmp = n / (0.01 + (i * -0.005));
} else {
tmp = 100.0 * (n / t_0);
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = i / Math.expm1(i);
double tmp;
if (n <= -5.9e-198) {
tmp = (n * 100.0) / t_0;
} else if (n <= 1.1e-183) {
tmp = 0.0 / (i / n);
} else if (n <= 4.4e-5) {
tmp = n / (0.01 + (i * -0.005));
} else {
tmp = 100.0 * (n / t_0);
}
return tmp;
}
def code(i, n): t_0 = i / math.expm1(i) tmp = 0 if n <= -5.9e-198: tmp = (n * 100.0) / t_0 elif n <= 1.1e-183: tmp = 0.0 / (i / n) elif n <= 4.4e-5: tmp = n / (0.01 + (i * -0.005)) else: tmp = 100.0 * (n / t_0) return tmp
function code(i, n) t_0 = Float64(i / expm1(i)) tmp = 0.0 if (n <= -5.9e-198) tmp = Float64(Float64(n * 100.0) / t_0); elseif (n <= 1.1e-183) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 4.4e-5) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); else tmp = Float64(100.0 * Float64(n / t_0)); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -5.9e-198], N[(N[(n * 100.0), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[n, 1.1e-183], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.4e-5], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{i}{\mathsf{expm1}\left(i\right)}\\
\mathbf{if}\;n \leq -5.9 \cdot 10^{-198}:\\
\;\;\;\;\frac{n \cdot 100}{t_0}\\
\mathbf{elif}\;n \leq 1.1 \cdot 10^{-183}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 4.4 \cdot 10^{-5}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{t_0}\\
\end{array}
\end{array}
if n < -5.89999999999999974e-198Initial program 22.4%
associate-*r/22.4%
associate-/r/22.8%
*-commutative22.8%
sub-neg22.8%
distribute-lft-in22.7%
fma-def22.8%
metadata-eval22.8%
metadata-eval22.8%
Simplified22.8%
Taylor expanded in n around inf 28.0%
associate-/l*28.0%
fma-neg28.0%
metadata-eval28.0%
Simplified28.0%
Taylor expanded in i around inf 28.0%
sub-neg28.0%
metadata-eval28.0%
metadata-eval28.0%
distribute-lft-in28.0%
metadata-eval28.0%
sub-neg28.0%
expm1-def82.2%
Simplified82.2%
frac-2neg82.2%
div-inv82.3%
metadata-eval82.3%
metadata-eval82.3%
distribute-neg-frac82.3%
frac-2neg82.3%
clear-num82.3%
associate-/l*82.3%
distribute-neg-frac82.3%
metadata-eval82.3%
Applied egg-rr82.3%
associate-*r/82.4%
distribute-lft-neg-out82.4%
distribute-rgt-neg-in82.4%
metadata-eval82.4%
*-commutative82.4%
Simplified82.4%
if -5.89999999999999974e-198 < n < 1.1e-183Initial program 55.5%
associate-*r/55.5%
sub-neg55.5%
distribute-lft-in55.5%
metadata-eval55.5%
metadata-eval55.5%
Simplified55.5%
Taylor expanded in i around 0 72.1%
if 1.1e-183 < n < 4.3999999999999999e-5Initial program 10.5%
associate-*r/10.5%
associate-/r/10.6%
*-commutative10.6%
sub-neg10.6%
distribute-lft-in10.6%
fma-def10.6%
metadata-eval10.6%
metadata-eval10.6%
Simplified10.6%
Taylor expanded in n around inf 3.3%
associate-/l*3.3%
fma-neg3.3%
metadata-eval3.3%
Simplified3.3%
Taylor expanded in i around 0 67.4%
*-commutative67.4%
Simplified67.4%
if 4.3999999999999999e-5 < n Initial program 22.4%
associate-/r/23.1%
sub-neg23.1%
metadata-eval23.1%
Simplified23.1%
Taylor expanded in n around inf 43.9%
associate-/l*43.9%
expm1-def92.8%
Simplified92.8%
Final simplification81.3%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ n (+ 0.01 (* i -0.005)))))
(if (<= n -3.5e+210)
(*
n
(+
100.0
(*
100.0
(+
(* i (- 0.5 (/ 0.5 n)))
(*
(* i i)
(+
0.16666666666666666
(- (/ 0.3333333333333333 (* n n)) (/ 0.5 n))))))))
(if (<= n -4.5e-198)
t_0
(if (<= n 1.75e-188)
(/ 0.0 (/ i n))
(if (<= n 3.3) t_0 (/ (* n (* i (+ 100.0 (* i 50.0)))) i)))))))
double code(double i, double n) {
double t_0 = n / (0.01 + (i * -0.005));
double tmp;
if (n <= -3.5e+210) {
tmp = n * (100.0 + (100.0 * ((i * (0.5 - (0.5 / n))) + ((i * i) * (0.16666666666666666 + ((0.3333333333333333 / (n * n)) - (0.5 / n)))))));
} else if (n <= -4.5e-198) {
tmp = t_0;
} else if (n <= 1.75e-188) {
tmp = 0.0 / (i / n);
} else if (n <= 3.3) {
tmp = t_0;
} else {
tmp = (n * (i * (100.0 + (i * 50.0)))) / i;
}
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 / (0.01d0 + (i * (-0.005d0)))
if (n <= (-3.5d+210)) then
tmp = n * (100.0d0 + (100.0d0 * ((i * (0.5d0 - (0.5d0 / n))) + ((i * i) * (0.16666666666666666d0 + ((0.3333333333333333d0 / (n * n)) - (0.5d0 / n)))))))
else if (n <= (-4.5d-198)) then
tmp = t_0
else if (n <= 1.75d-188) then
tmp = 0.0d0 / (i / n)
else if (n <= 3.3d0) then
tmp = t_0
else
tmp = (n * (i * (100.0d0 + (i * 50.0d0)))) / i
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = n / (0.01 + (i * -0.005));
double tmp;
if (n <= -3.5e+210) {
tmp = n * (100.0 + (100.0 * ((i * (0.5 - (0.5 / n))) + ((i * i) * (0.16666666666666666 + ((0.3333333333333333 / (n * n)) - (0.5 / n)))))));
} else if (n <= -4.5e-198) {
tmp = t_0;
} else if (n <= 1.75e-188) {
tmp = 0.0 / (i / n);
} else if (n <= 3.3) {
tmp = t_0;
} else {
tmp = (n * (i * (100.0 + (i * 50.0)))) / i;
}
return tmp;
}
def code(i, n): t_0 = n / (0.01 + (i * -0.005)) tmp = 0 if n <= -3.5e+210: tmp = n * (100.0 + (100.0 * ((i * (0.5 - (0.5 / n))) + ((i * i) * (0.16666666666666666 + ((0.3333333333333333 / (n * n)) - (0.5 / n))))))) elif n <= -4.5e-198: tmp = t_0 elif n <= 1.75e-188: tmp = 0.0 / (i / n) elif n <= 3.3: tmp = t_0 else: tmp = (n * (i * (100.0 + (i * 50.0)))) / i return tmp
function code(i, n) t_0 = Float64(n / Float64(0.01 + Float64(i * -0.005))) tmp = 0.0 if (n <= -3.5e+210) tmp = Float64(n * Float64(100.0 + Float64(100.0 * Float64(Float64(i * Float64(0.5 - Float64(0.5 / n))) + Float64(Float64(i * i) * Float64(0.16666666666666666 + Float64(Float64(0.3333333333333333 / Float64(n * n)) - Float64(0.5 / n)))))))); elseif (n <= -4.5e-198) tmp = t_0; elseif (n <= 1.75e-188) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 3.3) tmp = t_0; else tmp = Float64(Float64(n * Float64(i * Float64(100.0 + Float64(i * 50.0)))) / i); end return tmp end
function tmp_2 = code(i, n) t_0 = n / (0.01 + (i * -0.005)); tmp = 0.0; if (n <= -3.5e+210) tmp = n * (100.0 + (100.0 * ((i * (0.5 - (0.5 / n))) + ((i * i) * (0.16666666666666666 + ((0.3333333333333333 / (n * n)) - (0.5 / n))))))); elseif (n <= -4.5e-198) tmp = t_0; elseif (n <= 1.75e-188) tmp = 0.0 / (i / n); elseif (n <= 3.3) tmp = t_0; else tmp = (n * (i * (100.0 + (i * 50.0)))) / i; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -3.5e+210], N[(n * N[(100.0 + N[(100.0 * N[(N[(i * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(i * i), $MachinePrecision] * N[(0.16666666666666666 + N[(N[(0.3333333333333333 / N[(n * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -4.5e-198], t$95$0, If[LessEqual[n, 1.75e-188], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.3], t$95$0, N[(N[(n * N[(i * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{if}\;n \leq -3.5 \cdot 10^{+210}:\\
\;\;\;\;n \cdot \left(100 + 100 \cdot \left(i \cdot \left(0.5 - \frac{0.5}{n}\right) + \left(i \cdot i\right) \cdot \left(0.16666666666666666 + \left(\frac{0.3333333333333333}{n \cdot n} - \frac{0.5}{n}\right)\right)\right)\right)\\
\mathbf{elif}\;n \leq -4.5 \cdot 10^{-198}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 1.75 \cdot 10^{-188}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 3.3:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot \left(i \cdot \left(100 + i \cdot 50\right)\right)}{i}\\
\end{array}
\end{array}
if n < -3.5e210Initial program 15.5%
associate-*r/15.5%
associate-/r/16.3%
*-commutative16.3%
sub-neg16.3%
distribute-lft-in16.3%
fma-def16.3%
metadata-eval16.3%
metadata-eval16.3%
Simplified16.3%
Taylor expanded in i around 0 75.4%
distribute-lft-out75.4%
associate-*r/75.4%
metadata-eval75.4%
unpow275.4%
associate--l+75.4%
associate-*r/75.4%
metadata-eval75.4%
unpow275.4%
associate-*r/75.4%
metadata-eval75.4%
Simplified75.4%
if -3.5e210 < n < -4.4999999999999998e-198 or 1.75e-188 < n < 3.2999999999999998Initial program 19.4%
associate-*r/19.4%
associate-/r/19.5%
*-commutative19.5%
sub-neg19.5%
distribute-lft-in19.5%
fma-def19.5%
metadata-eval19.5%
metadata-eval19.5%
Simplified19.5%
Taylor expanded in n around inf 15.3%
associate-/l*15.3%
fma-neg15.3%
metadata-eval15.3%
Simplified15.3%
Taylor expanded in i around 0 67.0%
*-commutative67.0%
Simplified67.0%
if -4.4999999999999998e-198 < n < 1.75e-188Initial program 55.5%
associate-*r/55.5%
sub-neg55.5%
distribute-lft-in55.5%
metadata-eval55.5%
metadata-eval55.5%
Simplified55.5%
Taylor expanded in i around 0 72.1%
if 3.2999999999999998 < n Initial program 22.7%
associate-*r/22.8%
associate-/r/23.3%
*-commutative23.3%
sub-neg23.3%
distribute-lft-in23.3%
fma-def23.3%
metadata-eval23.3%
metadata-eval23.3%
Simplified23.3%
Taylor expanded in i around 0 74.5%
distribute-lft-out74.5%
unpow274.5%
associate-*r/74.5%
metadata-eval74.5%
Simplified74.5%
Taylor expanded in n around inf 74.5%
*-commutative74.5%
unpow274.5%
associate-*r*74.5%
Simplified74.5%
associate-*r/78.3%
distribute-rgt-in78.3%
associate-*l*78.3%
distribute-lft-out78.3%
associate-*l*78.3%
metadata-eval78.3%
Applied egg-rr78.3%
Final simplification71.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ n (+ 0.01 (* i -0.005))))
(t_1 (/ (* n (* i (+ 100.0 (* i 50.0)))) i)))
(if (<= n -3.6e+210)
t_1
(if (<= n -5.2e-198)
t_0
(if (<= n 2.25e-188) (/ 0.0 (/ i n)) (if (<= n 3.3) t_0 t_1))))))
double code(double i, double n) {
double t_0 = n / (0.01 + (i * -0.005));
double t_1 = (n * (i * (100.0 + (i * 50.0)))) / i;
double tmp;
if (n <= -3.6e+210) {
tmp = t_1;
} else if (n <= -5.2e-198) {
tmp = t_0;
} else if (n <= 2.25e-188) {
tmp = 0.0 / (i / n);
} else if (n <= 3.3) {
tmp = t_0;
} else {
tmp = t_1;
}
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 = n / (0.01d0 + (i * (-0.005d0)))
t_1 = (n * (i * (100.0d0 + (i * 50.0d0)))) / i
if (n <= (-3.6d+210)) then
tmp = t_1
else if (n <= (-5.2d-198)) then
tmp = t_0
else if (n <= 2.25d-188) then
tmp = 0.0d0 / (i / n)
else if (n <= 3.3d0) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = n / (0.01 + (i * -0.005));
double t_1 = (n * (i * (100.0 + (i * 50.0)))) / i;
double tmp;
if (n <= -3.6e+210) {
tmp = t_1;
} else if (n <= -5.2e-198) {
tmp = t_0;
} else if (n <= 2.25e-188) {
tmp = 0.0 / (i / n);
} else if (n <= 3.3) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(i, n): t_0 = n / (0.01 + (i * -0.005)) t_1 = (n * (i * (100.0 + (i * 50.0)))) / i tmp = 0 if n <= -3.6e+210: tmp = t_1 elif n <= -5.2e-198: tmp = t_0 elif n <= 2.25e-188: tmp = 0.0 / (i / n) elif n <= 3.3: tmp = t_0 else: tmp = t_1 return tmp
function code(i, n) t_0 = Float64(n / Float64(0.01 + Float64(i * -0.005))) t_1 = Float64(Float64(n * Float64(i * Float64(100.0 + Float64(i * 50.0)))) / i) tmp = 0.0 if (n <= -3.6e+210) tmp = t_1; elseif (n <= -5.2e-198) tmp = t_0; elseif (n <= 2.25e-188) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 3.3) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(i, n) t_0 = n / (0.01 + (i * -0.005)); t_1 = (n * (i * (100.0 + (i * 50.0)))) / i; tmp = 0.0; if (n <= -3.6e+210) tmp = t_1; elseif (n <= -5.2e-198) tmp = t_0; elseif (n <= 2.25e-188) tmp = 0.0 / (i / n); elseif (n <= 3.3) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(n * N[(i * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]}, If[LessEqual[n, -3.6e+210], t$95$1, If[LessEqual[n, -5.2e-198], t$95$0, If[LessEqual[n, 2.25e-188], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.3], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{n}{0.01 + i \cdot -0.005}\\
t_1 := \frac{n \cdot \left(i \cdot \left(100 + i \cdot 50\right)\right)}{i}\\
\mathbf{if}\;n \leq -3.6 \cdot 10^{+210}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;n \leq -5.2 \cdot 10^{-198}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 2.25 \cdot 10^{-188}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 3.3:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if n < -3.6000000000000003e210 or 3.2999999999999998 < n Initial program 20.7%
associate-*r/20.7%
associate-/r/21.4%
*-commutative21.4%
sub-neg21.4%
distribute-lft-in21.4%
fma-def21.4%
metadata-eval21.4%
metadata-eval21.4%
Simplified21.4%
Taylor expanded in i around 0 72.5%
distribute-lft-out72.5%
unpow272.5%
associate-*r/72.5%
metadata-eval72.5%
Simplified72.5%
Taylor expanded in n around inf 72.5%
*-commutative72.5%
unpow272.5%
associate-*r*72.5%
Simplified72.5%
associate-*r/77.1%
distribute-rgt-in77.1%
associate-*l*77.1%
distribute-lft-out77.1%
associate-*l*77.1%
metadata-eval77.1%
Applied egg-rr77.1%
if -3.6000000000000003e210 < n < -5.20000000000000014e-198 or 2.24999999999999997e-188 < n < 3.2999999999999998Initial program 19.4%
associate-*r/19.4%
associate-/r/19.5%
*-commutative19.5%
sub-neg19.5%
distribute-lft-in19.5%
fma-def19.5%
metadata-eval19.5%
metadata-eval19.5%
Simplified19.5%
Taylor expanded in n around inf 15.3%
associate-/l*15.3%
fma-neg15.3%
metadata-eval15.3%
Simplified15.3%
Taylor expanded in i around 0 67.0%
*-commutative67.0%
Simplified67.0%
if -5.20000000000000014e-198 < n < 2.24999999999999997e-188Initial program 55.5%
associate-*r/55.5%
sub-neg55.5%
distribute-lft-in55.5%
metadata-eval55.5%
metadata-eval55.5%
Simplified55.5%
Taylor expanded in i around 0 72.1%
Final simplification71.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ n (+ 0.01 (* i -0.005)))))
(if (<= n -4.5e-198)
t_0
(if (<= n 1.1e-187)
(/ 0.0 (/ i n))
(if (<= n 5.8e-6) t_0 (+ (* n 100.0) (* 50.0 (* i n))))))))
double code(double i, double n) {
double t_0 = n / (0.01 + (i * -0.005));
double tmp;
if (n <= -4.5e-198) {
tmp = t_0;
} else if (n <= 1.1e-187) {
tmp = 0.0 / (i / n);
} else if (n <= 5.8e-6) {
tmp = t_0;
} else {
tmp = (n * 100.0) + (50.0 * (i * 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) :: tmp
t_0 = n / (0.01d0 + (i * (-0.005d0)))
if (n <= (-4.5d-198)) then
tmp = t_0
else if (n <= 1.1d-187) then
tmp = 0.0d0 / (i / n)
else if (n <= 5.8d-6) then
tmp = t_0
else
tmp = (n * 100.0d0) + (50.0d0 * (i * n))
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = n / (0.01 + (i * -0.005));
double tmp;
if (n <= -4.5e-198) {
tmp = t_0;
} else if (n <= 1.1e-187) {
tmp = 0.0 / (i / n);
} else if (n <= 5.8e-6) {
tmp = t_0;
} else {
tmp = (n * 100.0) + (50.0 * (i * n));
}
return tmp;
}
def code(i, n): t_0 = n / (0.01 + (i * -0.005)) tmp = 0 if n <= -4.5e-198: tmp = t_0 elif n <= 1.1e-187: tmp = 0.0 / (i / n) elif n <= 5.8e-6: tmp = t_0 else: tmp = (n * 100.0) + (50.0 * (i * n)) return tmp
function code(i, n) t_0 = Float64(n / Float64(0.01 + Float64(i * -0.005))) tmp = 0.0 if (n <= -4.5e-198) tmp = t_0; elseif (n <= 1.1e-187) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 5.8e-6) tmp = t_0; else tmp = Float64(Float64(n * 100.0) + Float64(50.0 * Float64(i * n))); end return tmp end
function tmp_2 = code(i, n) t_0 = n / (0.01 + (i * -0.005)); tmp = 0.0; if (n <= -4.5e-198) tmp = t_0; elseif (n <= 1.1e-187) tmp = 0.0 / (i / n); elseif (n <= 5.8e-6) tmp = t_0; else tmp = (n * 100.0) + (50.0 * (i * n)); end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -4.5e-198], t$95$0, If[LessEqual[n, 1.1e-187], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.8e-6], t$95$0, N[(N[(n * 100.0), $MachinePrecision] + N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{if}\;n \leq -4.5 \cdot 10^{-198}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 1.1 \cdot 10^{-187}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 5.8 \cdot 10^{-6}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100 + 50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if n < -4.4999999999999998e-198 or 1.10000000000000004e-187 < n < 5.8000000000000004e-6Initial program 18.8%
associate-*r/18.8%
associate-/r/19.1%
*-commutative19.1%
sub-neg19.1%
distribute-lft-in19.1%
fma-def19.1%
metadata-eval19.1%
metadata-eval19.1%
Simplified19.1%
Taylor expanded in n around inf 20.6%
associate-/l*20.6%
fma-neg20.5%
metadata-eval20.5%
Simplified20.5%
Taylor expanded in i around 0 65.0%
*-commutative65.0%
Simplified65.0%
if -4.4999999999999998e-198 < n < 1.10000000000000004e-187Initial program 55.5%
associate-*r/55.5%
sub-neg55.5%
distribute-lft-in55.5%
metadata-eval55.5%
metadata-eval55.5%
Simplified55.5%
Taylor expanded in i around 0 72.1%
if 5.8000000000000004e-6 < n Initial program 22.4%
associate-/r/23.1%
sub-neg23.1%
metadata-eval23.1%
Simplified23.1%
Taylor expanded in n around inf 43.9%
associate-/l*43.9%
expm1-def92.8%
Simplified92.8%
Taylor expanded in i around 0 72.3%
Final simplification67.8%
(FPCore (i n) :precision binary64 (if (<= i 1.75) (/ n (+ 0.01 (* i -0.005))) (* n (/ (* 50.0 (* i i)) i))))
double code(double i, double n) {
double tmp;
if (i <= 1.75) {
tmp = n / (0.01 + (i * -0.005));
} else {
tmp = n * ((50.0 * (i * i)) / i);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 1.75d0) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else
tmp = n * ((50.0d0 * (i * i)) / i)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 1.75) {
tmp = n / (0.01 + (i * -0.005));
} else {
tmp = n * ((50.0 * (i * i)) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 1.75: tmp = n / (0.01 + (i * -0.005)) else: tmp = n * ((50.0 * (i * i)) / i) return tmp
function code(i, n) tmp = 0.0 if (i <= 1.75) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); else tmp = Float64(n * Float64(Float64(50.0 * Float64(i * i)) / i)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 1.75) tmp = n / (0.01 + (i * -0.005)); else tmp = n * ((50.0 * (i * i)) / i); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 1.75], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(N[(50.0 * N[(i * i), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 1.75:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{50 \cdot \left(i \cdot i\right)}{i}\\
\end{array}
\end{array}
if i < 1.75Initial program 17.4%
associate-*r/17.5%
associate-/r/17.9%
*-commutative17.9%
sub-neg17.9%
distribute-lft-in17.8%
fma-def17.9%
metadata-eval17.9%
metadata-eval17.9%
Simplified17.9%
Taylor expanded in n around inf 24.8%
associate-/l*24.8%
fma-neg24.8%
metadata-eval24.8%
Simplified24.8%
Taylor expanded in i around 0 72.5%
*-commutative72.5%
Simplified72.5%
if 1.75 < i Initial program 44.9%
associate-*r/44.9%
associate-/r/45.2%
*-commutative45.2%
sub-neg45.2%
distribute-lft-in45.1%
fma-def45.2%
metadata-eval45.2%
metadata-eval45.2%
Simplified45.2%
Taylor expanded in i around 0 32.3%
distribute-lft-out32.3%
unpow232.3%
associate-*r/32.3%
metadata-eval32.3%
Simplified32.3%
Taylor expanded in n around inf 32.8%
*-commutative32.8%
unpow232.8%
associate-*r*32.8%
Simplified32.8%
Taylor expanded in i around inf 32.8%
unpow232.8%
Simplified32.8%
Final simplification62.9%
(FPCore (i n) :precision binary64 (if (<= n 0.0082) (/ n (+ 0.01 (* i -0.005))) (+ (* n 100.0) (* 50.0 (* i n)))))
double code(double i, double n) {
double tmp;
if (n <= 0.0082) {
tmp = n / (0.01 + (i * -0.005));
} else {
tmp = (n * 100.0) + (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 (n <= 0.0082d0) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else
tmp = (n * 100.0d0) + (50.0d0 * (i * n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= 0.0082) {
tmp = n / (0.01 + (i * -0.005));
} else {
tmp = (n * 100.0) + (50.0 * (i * n));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= 0.0082: tmp = n / (0.01 + (i * -0.005)) else: tmp = (n * 100.0) + (50.0 * (i * n)) return tmp
function code(i, n) tmp = 0.0 if (n <= 0.0082) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); else tmp = Float64(Float64(n * 100.0) + Float64(50.0 * Float64(i * n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= 0.0082) tmp = n / (0.01 + (i * -0.005)); else tmp = (n * 100.0) + (50.0 * (i * n)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, 0.0082], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] + N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 0.0082:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100 + 50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if n < 0.00820000000000000069Initial program 24.7%
associate-*r/24.7%
associate-/r/25.0%
*-commutative25.0%
sub-neg25.0%
distribute-lft-in25.0%
fma-def25.0%
metadata-eval25.0%
metadata-eval25.0%
Simplified25.0%
Taylor expanded in n around inf 24.2%
associate-/l*24.2%
fma-neg24.1%
metadata-eval24.1%
Simplified24.1%
Taylor expanded in i around 0 62.0%
*-commutative62.0%
Simplified62.0%
if 0.00820000000000000069 < n Initial program 22.4%
associate-/r/23.1%
sub-neg23.1%
metadata-eval23.1%
Simplified23.1%
Taylor expanded in n around inf 43.9%
associate-/l*43.9%
expm1-def92.8%
Simplified92.8%
Taylor expanded in i around 0 72.3%
Final simplification64.8%
(FPCore (i n) :precision binary64 (if (<= i 1.75) (/ n (+ 0.01 (* i -0.005))) (* 50.0 (* i n))))
double code(double i, double n) {
double tmp;
if (i <= 1.75) {
tmp = n / (0.01 + (i * -0.005));
} 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.75d0) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
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.75) {
tmp = n / (0.01 + (i * -0.005));
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 1.75: tmp = n / (0.01 + (i * -0.005)) else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= 1.75) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); else tmp = Float64(50.0 * Float64(i * n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 1.75) tmp = n / (0.01 + (i * -0.005)); else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 1.75], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 1.75:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < 1.75Initial program 17.4%
associate-*r/17.5%
associate-/r/17.9%
*-commutative17.9%
sub-neg17.9%
distribute-lft-in17.8%
fma-def17.9%
metadata-eval17.9%
metadata-eval17.9%
Simplified17.9%
Taylor expanded in n around inf 24.8%
associate-/l*24.8%
fma-neg24.8%
metadata-eval24.8%
Simplified24.8%
Taylor expanded in i around 0 72.5%
*-commutative72.5%
Simplified72.5%
if 1.75 < i Initial program 44.9%
associate-*r/44.9%
associate-/r/45.2%
*-commutative45.2%
sub-neg45.2%
distribute-lft-in45.1%
fma-def45.2%
metadata-eval45.2%
metadata-eval45.2%
Simplified45.2%
Taylor expanded in i around 0 32.3%
distribute-lft-out32.3%
unpow232.3%
associate-*r/32.3%
metadata-eval32.3%
Simplified32.3%
Taylor expanded in n around inf 32.8%
*-commutative32.8%
unpow232.8%
associate-*r*32.8%
Simplified32.8%
Taylor expanded in i around inf 31.5%
*-commutative31.5%
Simplified31.5%
Final simplification62.6%
(FPCore (i n) :precision binary64 (if (<= i 5.2e+25) (* n 100.0) (* 50.0 (* i n))))
double code(double i, double n) {
double tmp;
if (i <= 5.2e+25) {
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 <= 5.2d+25) 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 <= 5.2e+25) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 5.2e+25: tmp = n * 100.0 else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= 5.2e+25) 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 <= 5.2e+25) tmp = n * 100.0; else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 5.2e+25], N[(n * 100.0), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 5.2 \cdot 10^{+25}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < 5.1999999999999997e25Initial program 17.6%
associate-/r/18.0%
sub-neg18.0%
metadata-eval18.0%
Simplified18.0%
Taylor expanded in i around 0 66.7%
*-commutative66.7%
Simplified66.7%
if 5.1999999999999997e25 < i Initial program 46.9%
associate-*r/46.9%
associate-/r/47.1%
*-commutative47.1%
sub-neg47.1%
distribute-lft-in47.1%
fma-def47.1%
metadata-eval47.1%
metadata-eval47.1%
Simplified47.1%
Taylor expanded in i around 0 34.8%
distribute-lft-out34.9%
unpow234.9%
associate-*r/34.9%
metadata-eval34.9%
Simplified34.9%
Taylor expanded in n around inf 35.2%
*-commutative35.2%
unpow235.2%
associate-*r*35.2%
Simplified35.2%
Taylor expanded in i around inf 33.8%
*-commutative33.8%
Simplified33.8%
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 24.1%
associate-*r/24.1%
associate-/r/24.5%
*-commutative24.5%
sub-neg24.5%
distribute-lft-in24.5%
fma-def24.5%
metadata-eval24.5%
metadata-eval24.5%
Simplified24.5%
Taylor expanded in i around 0 59.3%
distribute-lft-out59.3%
unpow259.3%
associate-*r/59.3%
metadata-eval59.3%
Simplified59.3%
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 24.1%
associate-/r/24.5%
sub-neg24.5%
metadata-eval24.5%
Simplified24.5%
Taylor expanded in i around 0 53.0%
*-commutative53.0%
Simplified53.0%
Final simplification53.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 2023297
(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))))