
(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 16 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)))
(t_2 (/ t_0 i)))
(if (<= t_1 -2e-205)
(* 100.0 (+ (- (/ n i) (/ n i)) (- (* n t_2) (/ n i))))
(if (<= t_1 0.0)
(* (/ (expm1 (* n (log1p (/ i n)))) i) (* n 100.0))
(if (<= t_1 INFINITY)
(* (* n 100.0) (+ t_2 (/ -1.0 i)))
(*
100.0
(/ n (+ (fma i -0.5 1.0) (* i (* i 0.08333333333333333))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double t_2 = t_0 / i;
double tmp;
if (t_1 <= -2e-205) {
tmp = 100.0 * (((n / i) - (n / i)) + ((n * t_2) - (n / i)));
} else if (t_1 <= 0.0) {
tmp = (expm1((n * log1p((i / n)))) / i) * (n * 100.0);
} else if (t_1 <= ((double) INFINITY)) {
tmp = (n * 100.0) * (t_2 + (-1.0 / i));
} else {
tmp = 100.0 * (n / (fma(i, -0.5, 1.0) + (i * (i * 0.08333333333333333))));
}
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)) t_2 = Float64(t_0 / i) tmp = 0.0 if (t_1 <= -2e-205) tmp = Float64(100.0 * Float64(Float64(Float64(n / i) - Float64(n / i)) + Float64(Float64(n * t_2) - Float64(n / i)))); elseif (t_1 <= 0.0) tmp = Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i) * Float64(n * 100.0)); elseif (t_1 <= Inf) tmp = Float64(Float64(n * 100.0) * Float64(t_2 + Float64(-1.0 / i))); else tmp = Float64(100.0 * Float64(n / Float64(fma(i, -0.5, 1.0) + Float64(i * Float64(i * 0.08333333333333333))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[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]}, Block[{t$95$2 = N[(t$95$0 / i), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-205], N[(100.0 * N[(N[(N[(n / i), $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision] + N[(N[(n * t$95$2), $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(n * 100.0), $MachinePrecision] * N[(t$95$2 + N[(-1.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(N[(i * -0.5 + 1.0), $MachinePrecision] + N[(i * N[(i * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
t_2 := \frac{t_0}{i}\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{-205}:\\
\;\;\;\;100 \cdot \left(\left(\frac{n}{i} - \frac{n}{i}\right) + \left(n \cdot t_2 - \frac{n}{i}\right)\right)\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i} \cdot \left(n \cdot 100\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \left(t_2 + \frac{-1}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -2e-205Initial program 99.6%
div-sub99.6%
associate-/r/99.6%
clear-num100.0%
*-un-lft-identity100.0%
prod-diff100.0%
Applied egg-rr100.0%
+-commutative100.0%
fma-udef100.0%
*-rgt-identity100.0%
distribute-neg-frac100.0%
*-rgt-identity100.0%
fma-udef100.0%
*-rgt-identity100.0%
unsub-neg100.0%
Simplified100.0%
if -2e-205 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 23.2%
*-commutative23.2%
associate-/r/23.2%
sub-neg23.2%
metadata-eval23.2%
associate-*r*23.2%
metadata-eval23.2%
sub-neg23.2%
associate-*l/23.2%
associate-/l*23.2%
pow-to-exp23.2%
expm1-def33.6%
*-commutative33.6%
log1p-udef99.4%
Applied egg-rr99.4%
associate-/r/99.6%
Simplified99.6%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 97.1%
*-commutative97.1%
associate-/r/97.0%
associate-*l*97.1%
sub-neg97.1%
metadata-eval97.1%
Simplified97.1%
metadata-eval97.1%
sub-neg97.1%
div-sub97.3%
Applied egg-rr97.3%
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.9%
*-commutative1.9%
associate-/l*1.9%
expm1-def85.1%
Simplified85.1%
Taylor expanded in i around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
*-commutative100.0%
fma-def100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Final simplification99.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n))
(t_1 (/ (+ t_0 -1.0) (/ i n)))
(t_2 (/ t_0 i)))
(if (<= t_1 -2e-137)
(* 100.0 (+ (- (/ n i) (/ n i)) (- (* n t_2) (/ n i))))
(if (<= t_1 0.0)
(* (expm1 (* n (log1p (/ i n)))) (/ 100.0 (/ i n)))
(if (<= t_1 INFINITY)
(* (* n 100.0) (+ t_2 (/ -1.0 i)))
(*
100.0
(/ n (+ (fma i -0.5 1.0) (* i (* i 0.08333333333333333))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double t_2 = t_0 / i;
double tmp;
if (t_1 <= -2e-137) {
tmp = 100.0 * (((n / i) - (n / i)) + ((n * t_2) - (n / i)));
} else if (t_1 <= 0.0) {
tmp = expm1((n * log1p((i / n)))) * (100.0 / (i / n));
} else if (t_1 <= ((double) INFINITY)) {
tmp = (n * 100.0) * (t_2 + (-1.0 / i));
} else {
tmp = 100.0 * (n / (fma(i, -0.5, 1.0) + (i * (i * 0.08333333333333333))));
}
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)) t_2 = Float64(t_0 / i) tmp = 0.0 if (t_1 <= -2e-137) tmp = Float64(100.0 * Float64(Float64(Float64(n / i) - Float64(n / i)) + Float64(Float64(n * t_2) - Float64(n / i)))); elseif (t_1 <= 0.0) tmp = Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(100.0 / Float64(i / n))); elseif (t_1 <= Inf) tmp = Float64(Float64(n * 100.0) * Float64(t_2 + Float64(-1.0 / i))); else tmp = Float64(100.0 * Float64(n / Float64(fma(i, -0.5, 1.0) + Float64(i * Float64(i * 0.08333333333333333))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[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]}, Block[{t$95$2 = N[(t$95$0 / i), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-137], N[(100.0 * N[(N[(N[(n / i), $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision] + N[(N[(n * t$95$2), $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(100.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(n * 100.0), $MachinePrecision] * N[(t$95$2 + N[(-1.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(N[(i * -0.5 + 1.0), $MachinePrecision] + N[(i * N[(i * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
t_2 := \frac{t_0}{i}\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{-137}:\\
\;\;\;\;100 \cdot \left(\left(\frac{n}{i} - \frac{n}{i}\right) + \left(n \cdot t_2 - \frac{n}{i}\right)\right)\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{100}{\frac{i}{n}}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \left(t_2 + \frac{-1}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -1.99999999999999996e-137Initial program 99.5%
div-sub99.5%
associate-/r/99.5%
clear-num100.0%
*-un-lft-identity100.0%
prod-diff100.0%
Applied egg-rr100.0%
+-commutative100.0%
fma-udef100.0%
*-rgt-identity100.0%
distribute-neg-frac100.0%
*-rgt-identity100.0%
fma-udef100.0%
*-rgt-identity100.0%
unsub-neg100.0%
Simplified100.0%
if -1.99999999999999996e-137 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 25.1%
clear-num25.1%
un-div-inv25.1%
pow-to-exp25.1%
expm1-def33.3%
*-commutative33.3%
log1p-udef97.7%
Applied egg-rr97.7%
associate-/r/97.9%
Simplified97.9%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 97.1%
*-commutative97.1%
associate-/r/97.0%
associate-*l*97.1%
sub-neg97.1%
metadata-eval97.1%
Simplified97.1%
metadata-eval97.1%
sub-neg97.1%
div-sub97.3%
Applied egg-rr97.3%
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.9%
*-commutative1.9%
associate-/l*1.9%
expm1-def85.1%
Simplified85.1%
Taylor expanded in i around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
*-commutative100.0%
fma-def100.0%
*-commutative100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Final simplification98.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ n (/ i (expm1 i))))))
(if (<= n -1.02e-176)
t_0
(if (<= n 2.9e-231)
0.0
(if (<= n 1.2)
(* 100.0 (/ n (+ (fma i -0.5 1.0) (* i (* i 0.08333333333333333)))))
t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (n / (i / expm1(i)));
double tmp;
if (n <= -1.02e-176) {
tmp = t_0;
} else if (n <= 2.9e-231) {
tmp = 0.0;
} else if (n <= 1.2) {
tmp = 100.0 * (n / (fma(i, -0.5, 1.0) + (i * (i * 0.08333333333333333))));
} 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 <= -1.02e-176) tmp = t_0; elseif (n <= 2.9e-231) tmp = 0.0; elseif (n <= 1.2) tmp = Float64(100.0 * Float64(n / Float64(fma(i, -0.5, 1.0) + Float64(i * Float64(i * 0.08333333333333333))))); 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, -1.02e-176], t$95$0, If[LessEqual[n, 2.9e-231], 0.0, If[LessEqual[n, 1.2], N[(100.0 * N[(n / N[(N[(i * -0.5 + 1.0), $MachinePrecision] + N[(i * N[(i * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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 -1.02 \cdot 10^{-176}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 2.9 \cdot 10^{-231}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 1.2:\\
\;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -1.02000000000000002e-176 or 1.19999999999999996 < n Initial program 25.5%
Taylor expanded in n around inf 42.3%
*-commutative42.3%
associate-/l*42.3%
expm1-def90.1%
Simplified90.1%
if -1.02000000000000002e-176 < n < 2.9000000000000001e-231Initial program 76.3%
*-commutative76.3%
associate-/r/76.4%
associate-*l*76.4%
sub-neg76.4%
metadata-eval76.4%
Simplified76.4%
Taylor expanded in i around 0 87.0%
Taylor expanded in i around 0 87.0%
if 2.9000000000000001e-231 < n < 1.19999999999999996Initial program 21.0%
Taylor expanded in n around inf 6.3%
*-commutative6.3%
associate-/l*6.3%
expm1-def40.1%
Simplified40.1%
Taylor expanded in i around 0 63.2%
associate-+r+63.2%
+-commutative63.2%
*-commutative63.2%
fma-def63.2%
*-commutative63.2%
unpow263.2%
associate-*l*63.2%
Simplified63.2%
Final simplification86.1%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (* (expm1 i) (/ 100.0 i))))
(t_1 (* i (* n (+ 0.5 (/ -0.5 n))))))
(if (<= n -1.2e-180)
t_0
(if (<= n 1.05e-170)
0.0
(if (<= n 190000000.0)
(* 100.0 (/ i (/ i n)))
(if (<= n 2.05e+94)
(* 100.0 (/ (- (* n n) (* t_1 t_1)) (- n t_1)))
t_0))))))
double code(double i, double n) {
double t_0 = n * (expm1(i) * (100.0 / i));
double t_1 = i * (n * (0.5 + (-0.5 / n)));
double tmp;
if (n <= -1.2e-180) {
tmp = t_0;
} else if (n <= 1.05e-170) {
tmp = 0.0;
} else if (n <= 190000000.0) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 2.05e+94) {
tmp = 100.0 * (((n * n) - (t_1 * t_1)) / (n - t_1));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = n * (Math.expm1(i) * (100.0 / i));
double t_1 = i * (n * (0.5 + (-0.5 / n)));
double tmp;
if (n <= -1.2e-180) {
tmp = t_0;
} else if (n <= 1.05e-170) {
tmp = 0.0;
} else if (n <= 190000000.0) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 2.05e+94) {
tmp = 100.0 * (((n * n) - (t_1 * t_1)) / (n - t_1));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (math.expm1(i) * (100.0 / i)) t_1 = i * (n * (0.5 + (-0.5 / n))) tmp = 0 if n <= -1.2e-180: tmp = t_0 elif n <= 1.05e-170: tmp = 0.0 elif n <= 190000000.0: tmp = 100.0 * (i / (i / n)) elif n <= 2.05e+94: tmp = 100.0 * (((n * n) - (t_1 * t_1)) / (n - t_1)) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(expm1(i) * Float64(100.0 / i))) t_1 = Float64(i * Float64(n * Float64(0.5 + Float64(-0.5 / n)))) tmp = 0.0 if (n <= -1.2e-180) tmp = t_0; elseif (n <= 1.05e-170) tmp = 0.0; elseif (n <= 190000000.0) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 2.05e+94) tmp = Float64(100.0 * Float64(Float64(Float64(n * n) - Float64(t_1 * t_1)) / Float64(n - t_1))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] * N[(100.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(i * N[(n * N[(0.5 + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.2e-180], t$95$0, If[LessEqual[n, 1.05e-170], 0.0, If[LessEqual[n, 190000000.0], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.05e+94], N[(100.0 * N[(N[(N[(n * n), $MachinePrecision] - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(n - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(\mathsf{expm1}\left(i\right) \cdot \frac{100}{i}\right)\\
t_1 := i \cdot \left(n \cdot \left(0.5 + \frac{-0.5}{n}\right)\right)\\
\mathbf{if}\;n \leq -1.2 \cdot 10^{-180}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 1.05 \cdot 10^{-170}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 190000000:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 2.05 \cdot 10^{+94}:\\
\;\;\;\;100 \cdot \frac{n \cdot n - t_1 \cdot t_1}{n - t_1}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -1.1999999999999999e-180 or 2.05000000000000015e94 < n Initial program 23.5%
Taylor expanded in n around inf 43.3%
*-commutative43.3%
associate-/l*43.3%
expm1-def90.7%
Simplified90.7%
associate-*l/90.6%
Applied egg-rr90.6%
Taylor expanded in n around 0 43.3%
expm1-def89.5%
associate-/l*90.7%
associate-*r/90.6%
associate-*l/90.6%
*-commutative90.6%
associate-/r/90.1%
Simplified90.1%
if -1.1999999999999999e-180 < n < 1.05e-170Initial program 71.2%
*-commutative71.2%
associate-/r/71.3%
associate-*l*71.3%
sub-neg71.3%
metadata-eval71.3%
Simplified71.3%
Taylor expanded in i around 0 79.5%
Taylor expanded in i around 0 79.5%
if 1.05e-170 < n < 1.9e8Initial program 16.2%
Taylor expanded in i around 0 59.5%
if 1.9e8 < n < 2.05000000000000015e94Initial program 44.2%
Taylor expanded in i around 0 53.0%
sub-neg53.0%
associate-*r/53.0%
metadata-eval53.0%
distribute-neg-frac53.0%
metadata-eval53.0%
Simplified53.0%
flip-+93.1%
Applied egg-rr93.1%
Final simplification84.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ n (/ i (expm1 i)))))
(t_1 (* i (* n (+ 0.5 (/ -0.5 n))))))
(if (<= n -1.35e-178)
t_0
(if (<= n 3.5e-170)
0.0
(if (<= n 190000000.0)
(* 100.0 (/ i (/ i n)))
(if (<= n 3e+82)
(* 100.0 (/ (- (* n n) (* t_1 t_1)) (- n t_1)))
t_0))))))
double code(double i, double n) {
double t_0 = 100.0 * (n / (i / expm1(i)));
double t_1 = i * (n * (0.5 + (-0.5 / n)));
double tmp;
if (n <= -1.35e-178) {
tmp = t_0;
} else if (n <= 3.5e-170) {
tmp = 0.0;
} else if (n <= 190000000.0) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 3e+82) {
tmp = 100.0 * (((n * n) - (t_1 * t_1)) / (n - t_1));
} 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 t_1 = i * (n * (0.5 + (-0.5 / n)));
double tmp;
if (n <= -1.35e-178) {
tmp = t_0;
} else if (n <= 3.5e-170) {
tmp = 0.0;
} else if (n <= 190000000.0) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 3e+82) {
tmp = 100.0 * (((n * n) - (t_1 * t_1)) / (n - t_1));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n / (i / math.expm1(i))) t_1 = i * (n * (0.5 + (-0.5 / n))) tmp = 0 if n <= -1.35e-178: tmp = t_0 elif n <= 3.5e-170: tmp = 0.0 elif n <= 190000000.0: tmp = 100.0 * (i / (i / n)) elif n <= 3e+82: tmp = 100.0 * (((n * n) - (t_1 * t_1)) / (n - t_1)) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n / Float64(i / expm1(i)))) t_1 = Float64(i * Float64(n * Float64(0.5 + Float64(-0.5 / n)))) tmp = 0.0 if (n <= -1.35e-178) tmp = t_0; elseif (n <= 3.5e-170) tmp = 0.0; elseif (n <= 190000000.0) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 3e+82) tmp = Float64(100.0 * Float64(Float64(Float64(n * n) - Float64(t_1 * t_1)) / Float64(n - t_1))); 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]}, Block[{t$95$1 = N[(i * N[(n * N[(0.5 + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.35e-178], t$95$0, If[LessEqual[n, 3.5e-170], 0.0, If[LessEqual[n, 190000000.0], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3e+82], N[(100.0 * N[(N[(N[(n * n), $MachinePrecision] - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(n - t$95$1), $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)}}\\
t_1 := i \cdot \left(n \cdot \left(0.5 + \frac{-0.5}{n}\right)\right)\\
\mathbf{if}\;n \leq -1.35 \cdot 10^{-178}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 3.5 \cdot 10^{-170}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 190000000:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 3 \cdot 10^{+82}:\\
\;\;\;\;100 \cdot \frac{n \cdot n - t_1 \cdot t_1}{n - t_1}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -1.35000000000000004e-178 or 2.99999999999999989e82 < n Initial program 23.7%
Taylor expanded in n around inf 43.1%
*-commutative43.1%
associate-/l*43.1%
expm1-def90.9%
Simplified90.9%
if -1.35000000000000004e-178 < n < 3.49999999999999985e-170Initial program 71.2%
*-commutative71.2%
associate-/r/71.3%
associate-*l*71.3%
sub-neg71.3%
metadata-eval71.3%
Simplified71.3%
Taylor expanded in i around 0 79.5%
Taylor expanded in i around 0 79.5%
if 3.49999999999999985e-170 < n < 1.9e8Initial program 16.2%
Taylor expanded in i around 0 59.5%
if 1.9e8 < n < 2.99999999999999989e82Initial program 46.9%
Taylor expanded in i around 0 48.6%
sub-neg48.6%
associate-*r/48.6%
metadata-eval48.6%
distribute-neg-frac48.6%
metadata-eval48.6%
Simplified48.6%
flip-+91.3%
Applied egg-rr91.3%
Final simplification85.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ (expm1 i) (/ i n)))))
(if (<= i -8.8e-66)
t_0
(if (<= i 2.25e-237)
(* 100.0 (+ n (* i (* n (+ 0.5 (/ -0.5 n))))))
(if (<= i 1.65e-53) (* 100.0 (/ (* i n) i)) t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (expm1(i) / (i / n));
double tmp;
if (i <= -8.8e-66) {
tmp = t_0;
} else if (i <= 2.25e-237) {
tmp = 100.0 * (n + (i * (n * (0.5 + (-0.5 / n)))));
} else if (i <= 1.65e-53) {
tmp = 100.0 * ((i * n) / i);
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (Math.expm1(i) / (i / n));
double tmp;
if (i <= -8.8e-66) {
tmp = t_0;
} else if (i <= 2.25e-237) {
tmp = 100.0 * (n + (i * (n * (0.5 + (-0.5 / n)))));
} else if (i <= 1.65e-53) {
tmp = 100.0 * ((i * n) / i);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (math.expm1(i) / (i / n)) tmp = 0 if i <= -8.8e-66: tmp = t_0 elif i <= 2.25e-237: tmp = 100.0 * (n + (i * (n * (0.5 + (-0.5 / n))))) elif i <= 1.65e-53: tmp = 100.0 * ((i * n) / i) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(expm1(i) / Float64(i / n))) tmp = 0.0 if (i <= -8.8e-66) tmp = t_0; elseif (i <= 2.25e-237) tmp = Float64(100.0 * Float64(n + Float64(i * Float64(n * Float64(0.5 + Float64(-0.5 / n)))))); elseif (i <= 1.65e-53) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); 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[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -8.8e-66], t$95$0, If[LessEqual[i, 2.25e-237], N[(100.0 * N[(n + N[(i * N[(n * N[(0.5 + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1.65e-53], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{if}\;i \leq -8.8 \cdot 10^{-66}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;i \leq 2.25 \cdot 10^{-237}:\\
\;\;\;\;100 \cdot \left(n + i \cdot \left(n \cdot \left(0.5 + \frac{-0.5}{n}\right)\right)\right)\\
\mathbf{elif}\;i \leq 1.65 \cdot 10^{-53}:\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if i < -8.8000000000000004e-66 or 1.65000000000000002e-53 < i Initial program 46.7%
Taylor expanded in n around inf 63.2%
expm1-def69.4%
Simplified69.4%
if -8.8000000000000004e-66 < i < 2.25000000000000005e-237Initial program 3.9%
Taylor expanded in i around 0 92.6%
sub-neg92.6%
associate-*r/92.6%
metadata-eval92.6%
distribute-neg-frac92.6%
metadata-eval92.6%
Simplified92.6%
if 2.25000000000000005e-237 < i < 1.65000000000000002e-53Initial program 15.6%
*-commutative15.6%
associate-/r/16.1%
associate-*l*16.1%
sub-neg16.1%
metadata-eval16.1%
Simplified16.1%
Taylor expanded in i around 0 7.0%
unpow27.0%
associate-*r/7.0%
metadata-eval7.0%
Simplified7.0%
Taylor expanded in n around inf 90.1%
Taylor expanded in i around 0 90.1%
*-commutative90.1%
Simplified90.1%
Final simplification78.8%
(FPCore (i n)
:precision binary64
(let* ((t_0
(* 100.0 (+ n (* n (+ (* i 0.5) (* i (* i 0.16666666666666666)))))))
(t_1 (* i (* n (+ 0.5 (/ -0.5 n))))))
(if (<= n -1.25e+194)
t_0
(if (<= n -1.52e-180)
(/ (* n 100.0) (+ 1.0 (* i -0.5)))
(if (<= n 1.5e-169)
0.0
(if (<= n 190000000.0)
(* 100.0 (/ i (/ i n)))
(if (<= n 7.5e+82)
(* 100.0 (/ (- (* n n) (* t_1 t_1)) (- n t_1)))
t_0)))))))
double code(double i, double n) {
double t_0 = 100.0 * (n + (n * ((i * 0.5) + (i * (i * 0.16666666666666666)))));
double t_1 = i * (n * (0.5 + (-0.5 / n)));
double tmp;
if (n <= -1.25e+194) {
tmp = t_0;
} else if (n <= -1.52e-180) {
tmp = (n * 100.0) / (1.0 + (i * -0.5));
} else if (n <= 1.5e-169) {
tmp = 0.0;
} else if (n <= 190000000.0) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 7.5e+82) {
tmp = 100.0 * (((n * n) - (t_1 * t_1)) / (n - t_1));
} 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) :: t_1
real(8) :: tmp
t_0 = 100.0d0 * (n + (n * ((i * 0.5d0) + (i * (i * 0.16666666666666666d0)))))
t_1 = i * (n * (0.5d0 + ((-0.5d0) / n)))
if (n <= (-1.25d+194)) then
tmp = t_0
else if (n <= (-1.52d-180)) then
tmp = (n * 100.0d0) / (1.0d0 + (i * (-0.5d0)))
else if (n <= 1.5d-169) then
tmp = 0.0d0
else if (n <= 190000000.0d0) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 7.5d+82) then
tmp = 100.0d0 * (((n * n) - (t_1 * t_1)) / (n - t_1))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = 100.0 * (n + (n * ((i * 0.5) + (i * (i * 0.16666666666666666)))));
double t_1 = i * (n * (0.5 + (-0.5 / n)));
double tmp;
if (n <= -1.25e+194) {
tmp = t_0;
} else if (n <= -1.52e-180) {
tmp = (n * 100.0) / (1.0 + (i * -0.5));
} else if (n <= 1.5e-169) {
tmp = 0.0;
} else if (n <= 190000000.0) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 7.5e+82) {
tmp = 100.0 * (((n * n) - (t_1 * t_1)) / (n - t_1));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n + (n * ((i * 0.5) + (i * (i * 0.16666666666666666))))) t_1 = i * (n * (0.5 + (-0.5 / n))) tmp = 0 if n <= -1.25e+194: tmp = t_0 elif n <= -1.52e-180: tmp = (n * 100.0) / (1.0 + (i * -0.5)) elif n <= 1.5e-169: tmp = 0.0 elif n <= 190000000.0: tmp = 100.0 * (i / (i / n)) elif n <= 7.5e+82: tmp = 100.0 * (((n * n) - (t_1 * t_1)) / (n - t_1)) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n + Float64(n * Float64(Float64(i * 0.5) + Float64(i * Float64(i * 0.16666666666666666)))))) t_1 = Float64(i * Float64(n * Float64(0.5 + Float64(-0.5 / n)))) tmp = 0.0 if (n <= -1.25e+194) tmp = t_0; elseif (n <= -1.52e-180) tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * -0.5))); elseif (n <= 1.5e-169) tmp = 0.0; elseif (n <= 190000000.0) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 7.5e+82) tmp = Float64(100.0 * Float64(Float64(Float64(n * n) - Float64(t_1 * t_1)) / Float64(n - t_1))); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = 100.0 * (n + (n * ((i * 0.5) + (i * (i * 0.16666666666666666))))); t_1 = i * (n * (0.5 + (-0.5 / n))); tmp = 0.0; if (n <= -1.25e+194) tmp = t_0; elseif (n <= -1.52e-180) tmp = (n * 100.0) / (1.0 + (i * -0.5)); elseif (n <= 1.5e-169) tmp = 0.0; elseif (n <= 190000000.0) tmp = 100.0 * (i / (i / n)); elseif (n <= 7.5e+82) tmp = 100.0 * (((n * n) - (t_1 * t_1)) / (n - t_1)); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n + N[(n * N[(N[(i * 0.5), $MachinePrecision] + N[(i * N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(i * N[(n * N[(0.5 + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.25e+194], t$95$0, If[LessEqual[n, -1.52e-180], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.5e-169], 0.0, If[LessEqual[n, 190000000.0], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7.5e+82], N[(100.0 * N[(N[(N[(n * n), $MachinePrecision] - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(n - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \left(n + n \cdot \left(i \cdot 0.5 + i \cdot \left(i \cdot 0.16666666666666666\right)\right)\right)\\
t_1 := i \cdot \left(n \cdot \left(0.5 + \frac{-0.5}{n}\right)\right)\\
\mathbf{if}\;n \leq -1.25 \cdot 10^{+194}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -1.52 \cdot 10^{-180}:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 1.5 \cdot 10^{-169}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 190000000:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 7.5 \cdot 10^{+82}:\\
\;\;\;\;100 \cdot \frac{n \cdot n - t_1 \cdot t_1}{n - t_1}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -1.24999999999999997e194 or 7.4999999999999999e82 < n Initial program 10.0%
Taylor expanded in n around inf 45.9%
*-commutative45.9%
associate-/l*45.9%
expm1-def99.0%
Simplified99.0%
Taylor expanded in i around 0 78.1%
+-commutative78.1%
associate-*r*78.1%
associate-*r*78.1%
distribute-rgt-out78.7%
*-commutative78.7%
unpow278.7%
associate-*r*78.7%
Simplified78.7%
if -1.24999999999999997e194 < n < -1.5199999999999999e-180Initial program 42.3%
Taylor expanded in n around inf 39.3%
*-commutative39.3%
associate-/l*39.3%
expm1-def79.9%
Simplified79.9%
associate-*l/79.8%
Applied egg-rr79.8%
Taylor expanded in i around 0 54.3%
*-commutative54.3%
Simplified54.3%
if -1.5199999999999999e-180 < n < 1.5e-169Initial program 71.2%
*-commutative71.2%
associate-/r/71.3%
associate-*l*71.3%
sub-neg71.3%
metadata-eval71.3%
Simplified71.3%
Taylor expanded in i around 0 79.5%
Taylor expanded in i around 0 79.5%
if 1.5e-169 < n < 1.9e8Initial program 16.2%
Taylor expanded in i around 0 59.5%
if 1.9e8 < n < 7.4999999999999999e82Initial program 46.9%
Taylor expanded in i around 0 48.6%
sub-neg48.6%
associate-*r/48.6%
metadata-eval48.6%
distribute-neg-frac48.6%
metadata-eval48.6%
Simplified48.6%
flip-+91.3%
Applied egg-rr91.3%
Final simplification69.8%
(FPCore (i n)
:precision binary64
(let* ((t_0
(* 100.0 (+ n (* n (+ (* i 0.5) (* i (* i 0.16666666666666666))))))))
(if (<= n -1.3e+194)
t_0
(if (<= n -5.5e-178)
(/ (* n 100.0) (+ 1.0 (* i -0.5)))
(if (<= n 9.5e-93) 0.0 t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (n + (n * ((i * 0.5) + (i * (i * 0.16666666666666666)))));
double tmp;
if (n <= -1.3e+194) {
tmp = t_0;
} else if (n <= -5.5e-178) {
tmp = (n * 100.0) / (1.0 + (i * -0.5));
} else if (n <= 9.5e-93) {
tmp = 0.0;
} 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 = 100.0d0 * (n + (n * ((i * 0.5d0) + (i * (i * 0.16666666666666666d0)))))
if (n <= (-1.3d+194)) then
tmp = t_0
else if (n <= (-5.5d-178)) then
tmp = (n * 100.0d0) / (1.0d0 + (i * (-0.5d0)))
else if (n <= 9.5d-93) then
tmp = 0.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = 100.0 * (n + (n * ((i * 0.5) + (i * (i * 0.16666666666666666)))));
double tmp;
if (n <= -1.3e+194) {
tmp = t_0;
} else if (n <= -5.5e-178) {
tmp = (n * 100.0) / (1.0 + (i * -0.5));
} else if (n <= 9.5e-93) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n + (n * ((i * 0.5) + (i * (i * 0.16666666666666666))))) tmp = 0 if n <= -1.3e+194: tmp = t_0 elif n <= -5.5e-178: tmp = (n * 100.0) / (1.0 + (i * -0.5)) elif n <= 9.5e-93: tmp = 0.0 else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n + Float64(n * Float64(Float64(i * 0.5) + Float64(i * Float64(i * 0.16666666666666666)))))) tmp = 0.0 if (n <= -1.3e+194) tmp = t_0; elseif (n <= -5.5e-178) tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * -0.5))); elseif (n <= 9.5e-93) tmp = 0.0; else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = 100.0 * (n + (n * ((i * 0.5) + (i * (i * 0.16666666666666666))))); tmp = 0.0; if (n <= -1.3e+194) tmp = t_0; elseif (n <= -5.5e-178) tmp = (n * 100.0) / (1.0 + (i * -0.5)); elseif (n <= 9.5e-93) tmp = 0.0; else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n + N[(n * N[(N[(i * 0.5), $MachinePrecision] + N[(i * N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.3e+194], t$95$0, If[LessEqual[n, -5.5e-178], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 9.5e-93], 0.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \left(n + n \cdot \left(i \cdot 0.5 + i \cdot \left(i \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{if}\;n \leq -1.3 \cdot 10^{+194}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -5.5 \cdot 10^{-178}:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 9.5 \cdot 10^{-93}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -1.2999999999999999e194 or 9.5000000000000001e-93 < n Initial program 14.3%
Taylor expanded in n around inf 40.1%
*-commutative40.1%
associate-/l*40.1%
expm1-def91.7%
Simplified91.7%
Taylor expanded in i around 0 74.1%
+-commutative74.1%
associate-*r*74.1%
associate-*r*74.1%
distribute-rgt-out74.5%
*-commutative74.5%
unpow274.5%
associate-*r*74.5%
Simplified74.5%
if -1.2999999999999999e194 < n < -5.50000000000000028e-178Initial program 42.3%
Taylor expanded in n around inf 39.3%
*-commutative39.3%
associate-/l*39.3%
expm1-def79.9%
Simplified79.9%
associate-*l/79.8%
Applied egg-rr79.8%
Taylor expanded in i around 0 54.3%
*-commutative54.3%
Simplified54.3%
if -5.50000000000000028e-178 < n < 9.5000000000000001e-93Initial program 54.8%
*-commutative54.8%
associate-/r/55.0%
associate-*l*55.0%
sub-neg55.0%
metadata-eval55.0%
Simplified55.0%
Taylor expanded in i around 0 68.8%
Taylor expanded in i around 0 68.8%
Final simplification67.5%
(FPCore (i n) :precision binary64 (if (<= n -2.5e-180) (/ (* n 100.0) (+ 1.0 (* i -0.5))) (if (<= n 1.15e-92) 0.0 (* 100.0 (/ n (/ i (+ i (* 0.5 (* i i)))))))))
double code(double i, double n) {
double tmp;
if (n <= -2.5e-180) {
tmp = (n * 100.0) / (1.0 + (i * -0.5));
} else if (n <= 1.15e-92) {
tmp = 0.0;
} else {
tmp = 100.0 * (n / (i / (i + (0.5 * (i * i)))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.5d-180)) then
tmp = (n * 100.0d0) / (1.0d0 + (i * (-0.5d0)))
else if (n <= 1.15d-92) then
tmp = 0.0d0
else
tmp = 100.0d0 * (n / (i / (i + (0.5d0 * (i * i)))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.5e-180) {
tmp = (n * 100.0) / (1.0 + (i * -0.5));
} else if (n <= 1.15e-92) {
tmp = 0.0;
} else {
tmp = 100.0 * (n / (i / (i + (0.5 * (i * i)))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.5e-180: tmp = (n * 100.0) / (1.0 + (i * -0.5)) elif n <= 1.15e-92: tmp = 0.0 else: tmp = 100.0 * (n / (i / (i + (0.5 * (i * i))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.5e-180) tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * -0.5))); elseif (n <= 1.15e-92) tmp = 0.0; else tmp = Float64(100.0 * Float64(n / Float64(i / Float64(i + Float64(0.5 * Float64(i * i)))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.5e-180) tmp = (n * 100.0) / (1.0 + (i * -0.5)); elseif (n <= 1.15e-92) tmp = 0.0; else tmp = 100.0 * (n / (i / (i + (0.5 * (i * i))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.5e-180], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.15e-92], 0.0, N[(100.0 * N[(n / N[(i / N[(i + N[(0.5 * N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.5 \cdot 10^{-180}:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 1.15 \cdot 10^{-92}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{i + 0.5 \cdot \left(i \cdot i\right)}}\\
\end{array}
\end{array}
if n < -2.5000000000000001e-180Initial program 29.0%
Taylor expanded in n around inf 44.4%
*-commutative44.4%
associate-/l*44.4%
expm1-def86.4%
Simplified86.4%
associate-*l/86.3%
Applied egg-rr86.3%
Taylor expanded in i around 0 54.6%
*-commutative54.6%
Simplified54.6%
if -2.5000000000000001e-180 < n < 1.15000000000000008e-92Initial program 54.8%
*-commutative54.8%
associate-/r/55.0%
associate-*l*55.0%
sub-neg55.0%
metadata-eval55.0%
Simplified55.0%
Taylor expanded in i around 0 68.8%
Taylor expanded in i around 0 68.8%
if 1.15000000000000008e-92 < n Initial program 19.2%
Taylor expanded in n around inf 34.4%
*-commutative34.4%
associate-/l*34.4%
expm1-def88.6%
Simplified88.6%
Taylor expanded in i around 0 73.8%
*-commutative73.8%
unpow273.8%
Simplified73.8%
Final simplification64.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ (* i n) i))))
(if (<= n -2.8e-115)
t_0
(if (<= n 1.5e-169) 0.0 (if (<= n 30.0) (* 100.0 (/ i (/ i n))) t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * ((i * n) / i);
double tmp;
if (n <= -2.8e-115) {
tmp = t_0;
} else if (n <= 1.5e-169) {
tmp = 0.0;
} else if (n <= 30.0) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 100.0d0 * ((i * n) / i)
if (n <= (-2.8d-115)) then
tmp = t_0
else if (n <= 1.5d-169) then
tmp = 0.0d0
else if (n <= 30.0d0) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = 100.0 * ((i * n) / i);
double tmp;
if (n <= -2.8e-115) {
tmp = t_0;
} else if (n <= 1.5e-169) {
tmp = 0.0;
} else if (n <= 30.0) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * ((i * n) / i) tmp = 0 if n <= -2.8e-115: tmp = t_0 elif n <= 1.5e-169: tmp = 0.0 elif n <= 30.0: tmp = 100.0 * (i / (i / n)) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(Float64(i * n) / i)) tmp = 0.0 if (n <= -2.8e-115) tmp = t_0; elseif (n <= 1.5e-169) tmp = 0.0; elseif (n <= 30.0) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = 100.0 * ((i * n) / i); tmp = 0.0; if (n <= -2.8e-115) tmp = t_0; elseif (n <= 1.5e-169) tmp = 0.0; elseif (n <= 30.0) tmp = 100.0 * (i / (i / n)); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -2.8e-115], t$95$0, If[LessEqual[n, 1.5e-169], 0.0, If[LessEqual[n, 30.0], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{i \cdot n}{i}\\
\mathbf{if}\;n \leq -2.8 \cdot 10^{-115}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 1.5 \cdot 10^{-169}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 30:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -2.79999999999999987e-115 or 30 < n Initial program 24.7%
*-commutative24.7%
associate-/r/25.2%
associate-*l*25.2%
sub-neg25.2%
metadata-eval25.2%
Simplified25.2%
Taylor expanded in i around 0 15.3%
unpow215.3%
associate-*r/15.3%
metadata-eval15.3%
Simplified15.3%
Taylor expanded in n around inf 65.5%
Taylor expanded in i around 0 61.7%
*-commutative61.7%
Simplified61.7%
if -2.79999999999999987e-115 < n < 1.5e-169Initial program 66.0%
*-commutative66.0%
associate-/r/66.1%
associate-*l*66.0%
sub-neg66.0%
metadata-eval66.0%
Simplified66.0%
Taylor expanded in i around 0 72.6%
Taylor expanded in i around 0 72.6%
if 1.5e-169 < n < 30Initial program 10.9%
Taylor expanded in i around 0 62.0%
Final simplification63.7%
(FPCore (i n) :precision binary64 (if (or (<= n -1.6e-118) (not (<= n 9.5e-93))) (* n (+ 100.0 (* i 50.0))) 0.0))
double code(double i, double n) {
double tmp;
if ((n <= -1.6e-118) || !(n <= 9.5e-93)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 0.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.6d-118)) .or. (.not. (n <= 9.5d-93))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -1.6e-118) || !(n <= 9.5e-93)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.6e-118) or not (n <= 9.5e-93): tmp = n * (100.0 + (i * 50.0)) else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.6e-118) || !(n <= 9.5e-93)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -1.6e-118) || ~((n <= 9.5e-93))) tmp = n * (100.0 + (i * 50.0)); else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1.6e-118], N[Not[LessEqual[n, 9.5e-93]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.6 \cdot 10^{-118} \lor \neg \left(n \leq 9.5 \cdot 10^{-93}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if n < -1.60000000000000002e-118 or 9.5000000000000001e-93 < n Initial program 23.6%
Taylor expanded in n around inf 39.9%
*-commutative39.9%
associate-/l*39.9%
expm1-def89.2%
Simplified89.2%
Taylor expanded in i around 0 62.0%
associate-*r*62.0%
distribute-rgt-out62.0%
Simplified62.0%
if -1.60000000000000002e-118 < n < 9.5000000000000001e-93Initial program 53.3%
*-commutative53.3%
associate-/r/53.5%
associate-*l*53.5%
sub-neg53.5%
metadata-eval53.5%
Simplified53.5%
Taylor expanded in i around 0 65.2%
Taylor expanded in i around 0 65.2%
Final simplification62.7%
(FPCore (i n) :precision binary64 (if (<= n -4.7e-179) (* 100.0 (/ n (+ 1.0 (* i -0.5)))) (if (<= n 9.5e-93) 0.0 (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -4.7e-179) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 9.5e-93) {
tmp = 0.0;
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-4.7d-179)) then
tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
else if (n <= 9.5d-93) then
tmp = 0.0d0
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -4.7e-179) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 9.5e-93) {
tmp = 0.0;
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -4.7e-179: tmp = 100.0 * (n / (1.0 + (i * -0.5))) elif n <= 9.5e-93: tmp = 0.0 else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -4.7e-179) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); elseif (n <= 9.5e-93) tmp = 0.0; else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -4.7e-179) tmp = 100.0 * (n / (1.0 + (i * -0.5))); elseif (n <= 9.5e-93) tmp = 0.0; else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -4.7e-179], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 9.5e-93], 0.0, N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.7 \cdot 10^{-179}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 9.5 \cdot 10^{-93}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -4.7000000000000003e-179Initial program 29.0%
Taylor expanded in n around inf 44.4%
*-commutative44.4%
associate-/l*44.4%
expm1-def86.4%
Simplified86.4%
Taylor expanded in i around 0 54.6%
*-commutative54.6%
Simplified54.6%
if -4.7000000000000003e-179 < n < 9.5000000000000001e-93Initial program 54.8%
*-commutative54.8%
associate-/r/55.0%
associate-*l*55.0%
sub-neg55.0%
metadata-eval55.0%
Simplified55.0%
Taylor expanded in i around 0 68.8%
Taylor expanded in i around 0 68.8%
if 9.5000000000000001e-93 < n Initial program 19.2%
Taylor expanded in n around inf 34.4%
*-commutative34.4%
associate-/l*34.4%
expm1-def88.6%
Simplified88.6%
Taylor expanded in i around 0 71.0%
associate-*r*71.0%
distribute-rgt-out71.0%
Simplified71.0%
Final simplification63.5%
(FPCore (i n) :precision binary64 (if (<= n -5.8e-180) (/ (* n 100.0) (+ 1.0 (* i -0.5))) (if (<= n 9.5e-93) 0.0 (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -5.8e-180) {
tmp = (n * 100.0) / (1.0 + (i * -0.5));
} else if (n <= 9.5e-93) {
tmp = 0.0;
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-5.8d-180)) then
tmp = (n * 100.0d0) / (1.0d0 + (i * (-0.5d0)))
else if (n <= 9.5d-93) then
tmp = 0.0d0
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -5.8e-180) {
tmp = (n * 100.0) / (1.0 + (i * -0.5));
} else if (n <= 9.5e-93) {
tmp = 0.0;
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -5.8e-180: tmp = (n * 100.0) / (1.0 + (i * -0.5)) elif n <= 9.5e-93: tmp = 0.0 else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -5.8e-180) tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * -0.5))); elseif (n <= 9.5e-93) tmp = 0.0; else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -5.8e-180) tmp = (n * 100.0) / (1.0 + (i * -0.5)); elseif (n <= 9.5e-93) tmp = 0.0; else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -5.8e-180], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 9.5e-93], 0.0, N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -5.8 \cdot 10^{-180}:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 9.5 \cdot 10^{-93}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -5.79999999999999961e-180Initial program 29.0%
Taylor expanded in n around inf 44.4%
*-commutative44.4%
associate-/l*44.4%
expm1-def86.4%
Simplified86.4%
associate-*l/86.3%
Applied egg-rr86.3%
Taylor expanded in i around 0 54.6%
*-commutative54.6%
Simplified54.6%
if -5.79999999999999961e-180 < n < 9.5000000000000001e-93Initial program 54.8%
*-commutative54.8%
associate-/r/55.0%
associate-*l*55.0%
sub-neg55.0%
metadata-eval55.0%
Simplified55.0%
Taylor expanded in i around 0 68.8%
Taylor expanded in i around 0 68.8%
if 9.5000000000000001e-93 < n Initial program 19.2%
Taylor expanded in n around inf 34.4%
*-commutative34.4%
associate-/l*34.4%
expm1-def88.6%
Simplified88.6%
Taylor expanded in i around 0 71.0%
associate-*r*71.0%
distribute-rgt-out71.0%
Simplified71.0%
Final simplification63.5%
(FPCore (i n) :precision binary64 (if (<= i -6.3) 0.0 (if (<= i 170.0) (* n 100.0) (* (* i n) 50.0))))
double code(double i, double n) {
double tmp;
if (i <= -6.3) {
tmp = 0.0;
} else if (i <= 170.0) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-6.3d0)) then
tmp = 0.0d0
else if (i <= 170.0d0) then
tmp = n * 100.0d0
else
tmp = (i * n) * 50.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -6.3) {
tmp = 0.0;
} else if (i <= 170.0) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -6.3: tmp = 0.0 elif i <= 170.0: tmp = n * 100.0 else: tmp = (i * n) * 50.0 return tmp
function code(i, n) tmp = 0.0 if (i <= -6.3) tmp = 0.0; elseif (i <= 170.0) tmp = Float64(n * 100.0); else tmp = Float64(Float64(i * n) * 50.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -6.3) tmp = 0.0; elseif (i <= 170.0) tmp = n * 100.0; else tmp = (i * n) * 50.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -6.3], 0.0, If[LessEqual[i, 170.0], N[(n * 100.0), $MachinePrecision], N[(N[(i * n), $MachinePrecision] * 50.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -6.3:\\
\;\;\;\;0\\
\mathbf{elif}\;i \leq 170:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot n\right) \cdot 50\\
\end{array}
\end{array}
if i < -6.29999999999999982Initial program 61.9%
*-commutative61.9%
associate-/r/61.9%
associate-*l*61.8%
sub-neg61.8%
metadata-eval61.8%
Simplified61.8%
Taylor expanded in i around 0 25.0%
Taylor expanded in i around 0 25.0%
if -6.29999999999999982 < i < 170Initial program 12.0%
Taylor expanded in i around 0 80.4%
*-commutative80.4%
Simplified80.4%
if 170 < i Initial program 44.4%
*-commutative44.4%
associate-/r/44.5%
associate-*l*44.5%
sub-neg44.5%
metadata-eval44.5%
Simplified44.5%
Taylor expanded in i around 0 34.7%
unpow234.7%
associate-*r/34.7%
metadata-eval34.7%
Simplified34.7%
Taylor expanded in n around inf 41.5%
Taylor expanded in i around inf 32.0%
*-commutative32.0%
Simplified32.0%
Final simplification57.1%
(FPCore (i n) :precision binary64 (if (<= n -6.2e-123) (* n 100.0) (if (<= n 9.5e-93) 0.0 (* n 100.0))))
double code(double i, double n) {
double tmp;
if (n <= -6.2e-123) {
tmp = n * 100.0;
} else if (n <= 9.5e-93) {
tmp = 0.0;
} else {
tmp = n * 100.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-6.2d-123)) then
tmp = n * 100.0d0
else if (n <= 9.5d-93) then
tmp = 0.0d0
else
tmp = n * 100.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -6.2e-123) {
tmp = n * 100.0;
} else if (n <= 9.5e-93) {
tmp = 0.0;
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -6.2e-123: tmp = n * 100.0 elif n <= 9.5e-93: tmp = 0.0 else: tmp = n * 100.0 return tmp
function code(i, n) tmp = 0.0 if (n <= -6.2e-123) tmp = Float64(n * 100.0); elseif (n <= 9.5e-93) tmp = 0.0; else tmp = Float64(n * 100.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -6.2e-123) tmp = n * 100.0; elseif (n <= 9.5e-93) tmp = 0.0; else tmp = n * 100.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -6.2e-123], N[(n * 100.0), $MachinePrecision], If[LessEqual[n, 9.5e-93], 0.0, N[(n * 100.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -6.2 \cdot 10^{-123}:\\
\;\;\;\;n \cdot 100\\
\mathbf{elif}\;n \leq 9.5 \cdot 10^{-93}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if n < -6.19999999999999996e-123 or 9.5000000000000001e-93 < n Initial program 23.6%
Taylor expanded in i around 0 54.3%
*-commutative54.3%
Simplified54.3%
if -6.19999999999999996e-123 < n < 9.5000000000000001e-93Initial program 53.3%
*-commutative53.3%
associate-/r/53.5%
associate-*l*53.5%
sub-neg53.5%
metadata-eval53.5%
Simplified53.5%
Taylor expanded in i around 0 65.2%
Taylor expanded in i around 0 65.2%
Final simplification56.8%
(FPCore (i n) :precision binary64 0.0)
double code(double i, double n) {
return 0.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 0.0d0
end function
public static double code(double i, double n) {
return 0.0;
}
def code(i, n): return 0.0
function code(i, n) return 0.0 end
function tmp = code(i, n) tmp = 0.0; end
code[i_, n_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 30.4%
*-commutative30.4%
associate-/r/30.8%
associate-*l*30.8%
sub-neg30.8%
metadata-eval30.8%
Simplified30.8%
Taylor expanded in i around 0 17.9%
Taylor expanded in i around 0 18.0%
Final simplification18.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 2023272
(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))))