
(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 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 5e-254)
(* n (/ 100.0 (/ i (expm1 (* n (log1p (/ i n)))))))
(if (<= t_1 INFINITY)
(/ (+ (* t_0 100.0) -100.0) (/ i n))
(*
100.0
(/ n (+ 1.0 (+ (* i -0.5) (* 0.08333333333333333 (pow i 2.0))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 5e-254) {
tmp = n * (100.0 / (i / expm1((n * log1p((i / n))))));
} else if (t_1 <= ((double) INFINITY)) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else {
tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * pow(i, 2.0)))));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 5e-254) {
tmp = n * (100.0 / (i / Math.expm1((n * Math.log1p((i / n))))));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else {
tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * Math.pow(i, 2.0)))));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 5e-254: tmp = n * (100.0 / (i / math.expm1((n * math.log1p((i / n)))))) elif t_1 <= math.inf: tmp = ((t_0 * 100.0) + -100.0) / (i / n) else: tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * math.pow(i, 2.0))))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 5e-254) tmp = Float64(n * Float64(100.0 / Float64(i / expm1(Float64(n * log1p(Float64(i / n))))))); elseif (t_1 <= Inf) tmp = Float64(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n)); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(Float64(i * -0.5) + Float64(0.08333333333333333 * (i ^ 2.0)))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-254], N[(n * N[(100.0 / N[(i / N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(N[(i * -0.5), $MachinePrecision] + N[(0.08333333333333333 * N[Power[i, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq 5 \cdot 10^{-254}:\\
\;\;\;\;n \cdot \frac{100}{\frac{i}{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\frac{t_0 \cdot 100 + -100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + \left(i \cdot -0.5 + 0.08333333333333333 \cdot {i}^{2}\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 5.0000000000000003e-254Initial program 30.8%
associate-*r/30.8%
sub-neg30.8%
distribute-lft-in30.8%
metadata-eval30.8%
metadata-eval30.8%
metadata-eval30.8%
fma-def30.8%
metadata-eval30.8%
Simplified30.8%
fma-udef30.8%
metadata-eval30.8%
distribute-lft-in30.8%
metadata-eval30.8%
sub-neg30.8%
associate-*r/30.8%
associate-/r/30.6%
sub-neg30.6%
metadata-eval30.6%
associate-*r*30.6%
Applied egg-rr98.4%
clear-num98.4%
un-div-inv98.5%
Applied egg-rr98.5%
if 5.0000000000000003e-254 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 97.3%
associate-*r/97.3%
sub-neg97.3%
distribute-lft-in97.6%
metadata-eval97.6%
metadata-eval97.6%
metadata-eval97.6%
fma-def97.3%
metadata-eval97.3%
Simplified97.3%
fma-udef97.6%
Applied egg-rr97.6%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-/r/1.8%
sub-neg1.8%
metadata-eval1.8%
Simplified1.8%
Taylor expanded in n around inf 1.8%
associate-/l*1.8%
expm1-def64.9%
Simplified64.9%
Taylor expanded in i around 0 99.9%
Final simplification98.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 5e-254)
(* 100.0 (* (expm1 (* n (log1p (/ i n)))) (/ n i)))
(if (<= t_1 INFINITY)
(/ (+ (* t_0 100.0) -100.0) (/ i n))
(*
100.0
(/ n (+ 1.0 (+ (* i -0.5) (* 0.08333333333333333 (pow i 2.0))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 5e-254) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) * (n / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else {
tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * pow(i, 2.0)))));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 5e-254) {
tmp = 100.0 * (Math.expm1((n * Math.log1p((i / n)))) * (n / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else {
tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * Math.pow(i, 2.0)))));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 5e-254: tmp = 100.0 * (math.expm1((n * math.log1p((i / n)))) * (n / i)) elif t_1 <= math.inf: tmp = ((t_0 * 100.0) + -100.0) / (i / n) else: tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * math.pow(i, 2.0))))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 5e-254) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(n / i))); elseif (t_1 <= Inf) tmp = Float64(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n)); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(Float64(i * -0.5) + Float64(0.08333333333333333 * (i ^ 2.0)))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-254], N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(N[(i * -0.5), $MachinePrecision] + N[(0.08333333333333333 * N[Power[i, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq 5 \cdot 10^{-254}:\\
\;\;\;\;100 \cdot \left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{n}{i}\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\frac{t_0 \cdot 100 + -100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + \left(i \cdot -0.5 + 0.08333333333333333 \cdot {i}^{2}\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 5.0000000000000003e-254Initial program 30.8%
clear-num30.8%
associate-/r/30.8%
clear-num30.6%
add-exp-log30.6%
expm1-def30.6%
log-pow40.8%
log1p-udef97.9%
Applied egg-rr97.9%
if 5.0000000000000003e-254 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 97.3%
associate-*r/97.3%
sub-neg97.3%
distribute-lft-in97.6%
metadata-eval97.6%
metadata-eval97.6%
metadata-eval97.6%
fma-def97.3%
metadata-eval97.3%
Simplified97.3%
fma-udef97.6%
Applied egg-rr97.6%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-/r/1.8%
sub-neg1.8%
metadata-eval1.8%
Simplified1.8%
Taylor expanded in n around inf 1.8%
associate-/l*1.8%
expm1-def64.9%
Simplified64.9%
Taylor expanded in i around 0 99.9%
Final simplification98.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 5e-254)
(* n (* 100.0 (/ (expm1 (* n (log1p (/ i n)))) i)))
(if (<= t_1 INFINITY)
(/ (+ (* t_0 100.0) -100.0) (/ i n))
(*
100.0
(/ n (+ 1.0 (+ (* i -0.5) (* 0.08333333333333333 (pow i 2.0))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 5e-254) {
tmp = n * (100.0 * (expm1((n * log1p((i / n)))) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else {
tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * pow(i, 2.0)))));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 5e-254) {
tmp = n * (100.0 * (Math.expm1((n * Math.log1p((i / n)))) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else {
tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * Math.pow(i, 2.0)))));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 5e-254: tmp = n * (100.0 * (math.expm1((n * math.log1p((i / n)))) / i)) elif t_1 <= math.inf: tmp = ((t_0 * 100.0) + -100.0) / (i / n) else: tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * math.pow(i, 2.0))))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 5e-254) tmp = Float64(n * Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i))); elseif (t_1 <= Inf) tmp = Float64(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n)); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(Float64(i * -0.5) + Float64(0.08333333333333333 * (i ^ 2.0)))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-254], N[(n * N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(N[(i * -0.5), $MachinePrecision] + N[(0.08333333333333333 * N[Power[i, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq 5 \cdot 10^{-254}:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\frac{t_0 \cdot 100 + -100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + \left(i \cdot -0.5 + 0.08333333333333333 \cdot {i}^{2}\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 5.0000000000000003e-254Initial program 30.8%
associate-*r/30.8%
sub-neg30.8%
distribute-lft-in30.8%
metadata-eval30.8%
metadata-eval30.8%
metadata-eval30.8%
fma-def30.8%
metadata-eval30.8%
Simplified30.8%
fma-udef30.8%
metadata-eval30.8%
distribute-lft-in30.8%
metadata-eval30.8%
sub-neg30.8%
associate-*r/30.8%
associate-/r/30.6%
sub-neg30.6%
metadata-eval30.6%
associate-*r*30.6%
Applied egg-rr98.4%
if 5.0000000000000003e-254 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 97.3%
associate-*r/97.3%
sub-neg97.3%
distribute-lft-in97.6%
metadata-eval97.6%
metadata-eval97.6%
metadata-eval97.6%
fma-def97.3%
metadata-eval97.3%
Simplified97.3%
fma-udef97.6%
Applied egg-rr97.6%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-/r/1.8%
sub-neg1.8%
metadata-eval1.8%
Simplified1.8%
Taylor expanded in n around inf 1.8%
associate-/l*1.8%
expm1-def64.9%
Simplified64.9%
Taylor expanded in i around 0 99.9%
Final simplification98.6%
(FPCore (i n) :precision binary64 (if (or (<= n -2.5e-5) (not (<= n 0.000155))) (* 100.0 (/ n (/ i (expm1 i)))) (/ n (+ 0.01 (* (* i 0.01) (+ -0.5 (/ 0.5 n)))))))
double code(double i, double n) {
double tmp;
if ((n <= -2.5e-5) || !(n <= 0.000155)) {
tmp = 100.0 * (n / (i / expm1(i)));
} else {
tmp = n / (0.01 + ((i * 0.01) * (-0.5 + (0.5 / n))));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -2.5e-5) || !(n <= 0.000155)) {
tmp = 100.0 * (n / (i / Math.expm1(i)));
} else {
tmp = n / (0.01 + ((i * 0.01) * (-0.5 + (0.5 / n))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.5e-5) or not (n <= 0.000155): tmp = 100.0 * (n / (i / math.expm1(i))) else: tmp = n / (0.01 + ((i * 0.01) * (-0.5 + (0.5 / n)))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.5e-5) || !(n <= 0.000155)) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); else tmp = Float64(n / Float64(0.01 + Float64(Float64(i * 0.01) * Float64(-0.5 + Float64(0.5 / n))))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -2.5e-5], N[Not[LessEqual[n, 0.000155]], $MachinePrecision]], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(N[(i * 0.01), $MachinePrecision] * N[(-0.5 + N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.5 \cdot 10^{-5} \lor \neg \left(n \leq 0.000155\right):\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + \left(i \cdot 0.01\right) \cdot \left(-0.5 + \frac{0.5}{n}\right)}\\
\end{array}
\end{array}
if n < -2.50000000000000012e-5 or 1.55e-4 < n Initial program 25.8%
associate-/r/26.2%
sub-neg26.2%
metadata-eval26.2%
Simplified26.2%
Taylor expanded in n around inf 44.9%
associate-/l*44.9%
expm1-def93.6%
Simplified93.6%
if -2.50000000000000012e-5 < n < 1.55e-4Initial program 34.1%
associate-/r/34.0%
associate-*r*34.0%
*-commutative34.0%
associate-*r/34.0%
sub-neg34.0%
distribute-lft-in34.1%
metadata-eval34.1%
metadata-eval34.1%
metadata-eval34.1%
fma-def34.0%
metadata-eval34.0%
Simplified34.0%
clear-num34.0%
un-div-inv34.0%
fma-udef34.1%
metadata-eval34.1%
distribute-lft-in34.0%
metadata-eval34.0%
sub-neg34.0%
add-exp-log34.0%
expm1-def34.0%
log-pow53.8%
log1p-udef85.5%
Applied egg-rr85.5%
Taylor expanded in i around 0 80.8%
associate-*r*80.8%
*-commutative80.8%
sub-neg80.8%
associate-*r/80.8%
metadata-eval80.8%
metadata-eval80.8%
Simplified80.8%
Final simplification87.9%
(FPCore (i n) :precision binary64 (if (or (<= n -6.4e-5) (not (<= n 0.000155))) (/ (* n 100.0) (/ i (expm1 i))) (/ n (+ 0.01 (* (* i 0.01) (+ -0.5 (/ 0.5 n)))))))
double code(double i, double n) {
double tmp;
if ((n <= -6.4e-5) || !(n <= 0.000155)) {
tmp = (n * 100.0) / (i / expm1(i));
} else {
tmp = n / (0.01 + ((i * 0.01) * (-0.5 + (0.5 / n))));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -6.4e-5) || !(n <= 0.000155)) {
tmp = (n * 100.0) / (i / Math.expm1(i));
} else {
tmp = n / (0.01 + ((i * 0.01) * (-0.5 + (0.5 / n))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -6.4e-5) or not (n <= 0.000155): tmp = (n * 100.0) / (i / math.expm1(i)) else: tmp = n / (0.01 + ((i * 0.01) * (-0.5 + (0.5 / n)))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -6.4e-5) || !(n <= 0.000155)) tmp = Float64(Float64(n * 100.0) / Float64(i / expm1(i))); else tmp = Float64(n / Float64(0.01 + Float64(Float64(i * 0.01) * Float64(-0.5 + Float64(0.5 / n))))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -6.4e-5], N[Not[LessEqual[n, 0.000155]], $MachinePrecision]], N[(N[(n * 100.0), $MachinePrecision] / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(N[(i * 0.01), $MachinePrecision] * N[(-0.5 + N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -6.4 \cdot 10^{-5} \lor \neg \left(n \leq 0.000155\right):\\
\;\;\;\;\frac{n \cdot 100}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + \left(i \cdot 0.01\right) \cdot \left(-0.5 + \frac{0.5}{n}\right)}\\
\end{array}
\end{array}
if n < -6.39999999999999971e-5 or 1.55e-4 < n Initial program 25.8%
associate-/r/26.2%
sub-neg26.2%
metadata-eval26.2%
Simplified26.2%
Taylor expanded in n around inf 44.9%
associate-/l*44.9%
expm1-def93.6%
Simplified93.6%
*-commutative93.6%
associate-*l/93.7%
Applied egg-rr93.7%
if -6.39999999999999971e-5 < n < 1.55e-4Initial program 34.1%
associate-/r/34.0%
associate-*r*34.0%
*-commutative34.0%
associate-*r/34.0%
sub-neg34.0%
distribute-lft-in34.1%
metadata-eval34.1%
metadata-eval34.1%
metadata-eval34.1%
fma-def34.0%
metadata-eval34.0%
Simplified34.0%
clear-num34.0%
un-div-inv34.0%
fma-udef34.1%
metadata-eval34.1%
distribute-lft-in34.0%
metadata-eval34.0%
sub-neg34.0%
add-exp-log34.0%
expm1-def34.0%
log-pow53.8%
log1p-udef85.5%
Applied egg-rr85.5%
Taylor expanded in i around 0 80.8%
associate-*r*80.8%
*-commutative80.8%
sub-neg80.8%
associate-*r/80.8%
metadata-eval80.8%
metadata-eval80.8%
Simplified80.8%
Final simplification88.0%
(FPCore (i n)
:precision binary64
(if (<= n -7.2e-5)
(* (* n 100.0) (/ (expm1 i) i))
(if (<= n 0.000155)
(/ n (+ 0.01 (* (* i 0.01) (+ -0.5 (/ 0.5 n)))))
(* 100.0 (/ n (/ i (expm1 i)))))))
double code(double i, double n) {
double tmp;
if (n <= -7.2e-5) {
tmp = (n * 100.0) * (expm1(i) / i);
} else if (n <= 0.000155) {
tmp = n / (0.01 + ((i * 0.01) * (-0.5 + (0.5 / n))));
} else {
tmp = 100.0 * (n / (i / expm1(i)));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -7.2e-5) {
tmp = (n * 100.0) * (Math.expm1(i) / i);
} else if (n <= 0.000155) {
tmp = n / (0.01 + ((i * 0.01) * (-0.5 + (0.5 / n))));
} else {
tmp = 100.0 * (n / (i / Math.expm1(i)));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -7.2e-5: tmp = (n * 100.0) * (math.expm1(i) / i) elif n <= 0.000155: tmp = n / (0.01 + ((i * 0.01) * (-0.5 + (0.5 / n)))) else: tmp = 100.0 * (n / (i / math.expm1(i))) return tmp
function code(i, n) tmp = 0.0 if (n <= -7.2e-5) tmp = Float64(Float64(n * 100.0) * Float64(expm1(i) / i)); elseif (n <= 0.000155) tmp = Float64(n / Float64(0.01 + Float64(Float64(i * 0.01) * Float64(-0.5 + Float64(0.5 / n))))); else tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); end return tmp end
code[i_, n_] := If[LessEqual[n, -7.2e-5], N[(N[(n * 100.0), $MachinePrecision] * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.000155], N[(n / N[(0.01 + N[(N[(i * 0.01), $MachinePrecision] * N[(-0.5 + N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -7.2 \cdot 10^{-5}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\\
\mathbf{elif}\;n \leq 0.000155:\\
\;\;\;\;\frac{n}{0.01 + \left(i \cdot 0.01\right) \cdot \left(-0.5 + \frac{0.5}{n}\right)}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\end{array}
\end{array}
if n < -7.20000000000000018e-5Initial program 34.2%
*-commutative34.2%
associate-/r/34.6%
associate-*l*34.5%
sub-neg34.5%
metadata-eval34.5%
Simplified34.5%
Taylor expanded in n around inf 48.7%
expm1-def90.4%
Simplified90.4%
if -7.20000000000000018e-5 < n < 1.55e-4Initial program 34.1%
associate-/r/34.0%
associate-*r*34.0%
*-commutative34.0%
associate-*r/34.0%
sub-neg34.0%
distribute-lft-in34.1%
metadata-eval34.1%
metadata-eval34.1%
metadata-eval34.1%
fma-def34.0%
metadata-eval34.0%
Simplified34.0%
clear-num34.0%
un-div-inv34.0%
fma-udef34.1%
metadata-eval34.1%
distribute-lft-in34.0%
metadata-eval34.0%
sub-neg34.0%
add-exp-log34.0%
expm1-def34.0%
log-pow53.8%
log1p-udef85.5%
Applied egg-rr85.5%
Taylor expanded in i around 0 80.8%
associate-*r*80.8%
*-commutative80.8%
sub-neg80.8%
associate-*r/80.8%
metadata-eval80.8%
metadata-eval80.8%
Simplified80.8%
if 1.55e-4 < n Initial program 17.2%
associate-/r/17.6%
sub-neg17.6%
metadata-eval17.6%
Simplified17.6%
Taylor expanded in n around inf 40.9%
associate-/l*40.9%
expm1-def97.1%
Simplified97.1%
Final simplification87.9%
(FPCore (i n) :precision binary64 (if (or (<= n -2.65e+231) (not (<= n 0.000155))) (* n (+ 100.0 (* i 50.0))) (/ n (+ 0.01 (* (* i 0.01) (+ -0.5 (/ 0.5 n)))))))
double code(double i, double n) {
double tmp;
if ((n <= -2.65e+231) || !(n <= 0.000155)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = n / (0.01 + ((i * 0.01) * (-0.5 + (0.5 / n))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-2.65d+231)) .or. (.not. (n <= 0.000155d0))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = n / (0.01d0 + ((i * 0.01d0) * ((-0.5d0) + (0.5d0 / n))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -2.65e+231) || !(n <= 0.000155)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = n / (0.01 + ((i * 0.01) * (-0.5 + (0.5 / n))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.65e+231) or not (n <= 0.000155): tmp = n * (100.0 + (i * 50.0)) else: tmp = n / (0.01 + ((i * 0.01) * (-0.5 + (0.5 / n)))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.65e+231) || !(n <= 0.000155)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(n / Float64(0.01 + Float64(Float64(i * 0.01) * Float64(-0.5 + Float64(0.5 / n))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -2.65e+231) || ~((n <= 0.000155))) tmp = n * (100.0 + (i * 50.0)); else tmp = n / (0.01 + ((i * 0.01) * (-0.5 + (0.5 / n)))); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -2.65e+231], N[Not[LessEqual[n, 0.000155]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(N[(i * 0.01), $MachinePrecision] * N[(-0.5 + N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.65 \cdot 10^{+231} \lor \neg \left(n \leq 0.000155\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + \left(i \cdot 0.01\right) \cdot \left(-0.5 + \frac{0.5}{n}\right)}\\
\end{array}
\end{array}
if n < -2.6499999999999999e231 or 1.55e-4 < n Initial program 15.7%
associate-*r/15.7%
sub-neg15.7%
distribute-lft-in15.7%
metadata-eval15.7%
metadata-eval15.7%
metadata-eval15.7%
fma-def15.7%
metadata-eval15.7%
Simplified15.7%
fma-udef15.7%
metadata-eval15.7%
distribute-lft-in15.7%
metadata-eval15.7%
sub-neg15.7%
associate-*r/15.7%
associate-/r/16.1%
sub-neg16.1%
metadata-eval16.1%
associate-*r*16.1%
Applied egg-rr76.4%
Taylor expanded in i around 0 69.7%
associate-*r/69.7%
metadata-eval69.7%
Simplified69.7%
Taylor expanded in n around inf 69.7%
*-commutative69.7%
Simplified69.7%
if -2.6499999999999999e231 < n < 1.55e-4Initial program 36.3%
associate-/r/36.3%
associate-*r*36.3%
*-commutative36.3%
associate-*r/36.4%
sub-neg36.4%
distribute-lft-in36.4%
metadata-eval36.4%
metadata-eval36.4%
metadata-eval36.4%
fma-def36.4%
metadata-eval36.4%
Simplified36.4%
clear-num36.3%
un-div-inv36.3%
fma-udef36.3%
metadata-eval36.3%
distribute-lft-in36.3%
metadata-eval36.3%
sub-neg36.3%
add-exp-log36.3%
expm1-def36.3%
log-pow46.0%
log1p-udef80.5%
Applied egg-rr80.5%
Taylor expanded in i around 0 72.9%
associate-*r*72.9%
*-commutative72.9%
sub-neg72.9%
associate-*r/72.9%
metadata-eval72.9%
metadata-eval72.9%
Simplified72.9%
Final simplification71.8%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i 50.0)))))
(if (<= n -1.8e+231)
t_0
(if (<= n -1.45e-221)
(* 100.0 (/ n (+ 1.0 (* i -0.5))))
(if (<= n 1.3e-178) (* (* n 100.0) (/ 0.0 i)) t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -1.8e+231) {
tmp = t_0;
} else if (n <= -1.45e-221) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 1.3e-178) {
tmp = (n * 100.0) * (0.0 / i);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = n * (100.0d0 + (i * 50.0d0))
if (n <= (-1.8d+231)) then
tmp = t_0
else if (n <= (-1.45d-221)) then
tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
else if (n <= 1.3d-178) then
tmp = (n * 100.0d0) * (0.0d0 / i)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -1.8e+231) {
tmp = t_0;
} else if (n <= -1.45e-221) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 1.3e-178) {
tmp = (n * 100.0) * (0.0 / i);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + (i * 50.0)) tmp = 0 if n <= -1.8e+231: tmp = t_0 elif n <= -1.45e-221: tmp = 100.0 * (n / (1.0 + (i * -0.5))) elif n <= 1.3e-178: tmp = (n * 100.0) * (0.0 / i) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 + Float64(i * 50.0))) tmp = 0.0 if (n <= -1.8e+231) tmp = t_0; elseif (n <= -1.45e-221) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); elseif (n <= 1.3e-178) tmp = Float64(Float64(n * 100.0) * Float64(0.0 / i)); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = n * (100.0 + (i * 50.0)); tmp = 0.0; if (n <= -1.8e+231) tmp = t_0; elseif (n <= -1.45e-221) tmp = 100.0 * (n / (1.0 + (i * -0.5))); elseif (n <= 1.3e-178) tmp = (n * 100.0) * (0.0 / i); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.8e+231], t$95$0, If[LessEqual[n, -1.45e-221], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.3e-178], N[(N[(n * 100.0), $MachinePrecision] * N[(0.0 / i), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{if}\;n \leq -1.8 \cdot 10^{+231}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -1.45 \cdot 10^{-221}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 1.3 \cdot 10^{-178}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{0}{i}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -1.8e231 or 1.29999999999999999e-178 < n Initial program 16.1%
associate-*r/16.1%
sub-neg16.1%
distribute-lft-in16.2%
metadata-eval16.2%
metadata-eval16.2%
metadata-eval16.2%
fma-def16.1%
metadata-eval16.1%
Simplified16.1%
fma-udef16.2%
metadata-eval16.2%
distribute-lft-in16.1%
metadata-eval16.1%
sub-neg16.1%
associate-*r/16.1%
associate-/r/16.5%
sub-neg16.5%
metadata-eval16.5%
associate-*r*16.5%
Applied egg-rr80.3%
Taylor expanded in i around 0 65.4%
associate-*r/65.4%
metadata-eval65.4%
Simplified65.4%
Taylor expanded in n around inf 65.6%
*-commutative65.6%
Simplified65.6%
if -1.8e231 < n < -1.44999999999999997e-221Initial program 35.1%
associate-/r/35.0%
sub-neg35.0%
metadata-eval35.0%
Simplified35.0%
Taylor expanded in n around inf 32.6%
associate-/l*32.6%
expm1-def78.5%
Simplified78.5%
Taylor expanded in i around 0 60.8%
*-commutative60.8%
Simplified60.8%
if -1.44999999999999997e-221 < n < 1.29999999999999999e-178Initial program 54.5%
*-commutative54.5%
associate-/r/55.0%
associate-*l*55.0%
sub-neg55.0%
metadata-eval55.0%
Simplified55.0%
Taylor expanded in i around 0 87.0%
Final simplification67.1%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i 50.0)))))
(if (<= n -1.5e+231)
t_0
(if (<= n -1.42e-223)
(/ 1.0 (* 0.01 (/ (+ 1.0 (* i -0.5)) n)))
(if (<= n 1.75e-177) (* (* n 100.0) (/ 0.0 i)) t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -1.5e+231) {
tmp = t_0;
} else if (n <= -1.42e-223) {
tmp = 1.0 / (0.01 * ((1.0 + (i * -0.5)) / n));
} else if (n <= 1.75e-177) {
tmp = (n * 100.0) * (0.0 / i);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = n * (100.0d0 + (i * 50.0d0))
if (n <= (-1.5d+231)) then
tmp = t_0
else if (n <= (-1.42d-223)) then
tmp = 1.0d0 / (0.01d0 * ((1.0d0 + (i * (-0.5d0))) / n))
else if (n <= 1.75d-177) then
tmp = (n * 100.0d0) * (0.0d0 / i)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -1.5e+231) {
tmp = t_0;
} else if (n <= -1.42e-223) {
tmp = 1.0 / (0.01 * ((1.0 + (i * -0.5)) / n));
} else if (n <= 1.75e-177) {
tmp = (n * 100.0) * (0.0 / i);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + (i * 50.0)) tmp = 0 if n <= -1.5e+231: tmp = t_0 elif n <= -1.42e-223: tmp = 1.0 / (0.01 * ((1.0 + (i * -0.5)) / n)) elif n <= 1.75e-177: tmp = (n * 100.0) * (0.0 / i) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 + Float64(i * 50.0))) tmp = 0.0 if (n <= -1.5e+231) tmp = t_0; elseif (n <= -1.42e-223) tmp = Float64(1.0 / Float64(0.01 * Float64(Float64(1.0 + Float64(i * -0.5)) / n))); elseif (n <= 1.75e-177) tmp = Float64(Float64(n * 100.0) * Float64(0.0 / i)); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = n * (100.0 + (i * 50.0)); tmp = 0.0; if (n <= -1.5e+231) tmp = t_0; elseif (n <= -1.42e-223) tmp = 1.0 / (0.01 * ((1.0 + (i * -0.5)) / n)); elseif (n <= 1.75e-177) tmp = (n * 100.0) * (0.0 / i); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.5e+231], t$95$0, If[LessEqual[n, -1.42e-223], N[(1.0 / N[(0.01 * N[(N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.75e-177], N[(N[(n * 100.0), $MachinePrecision] * N[(0.0 / i), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{if}\;n \leq -1.5 \cdot 10^{+231}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq -1.42 \cdot 10^{-223}:\\
\;\;\;\;\frac{1}{0.01 \cdot \frac{1 + i \cdot -0.5}{n}}\\
\mathbf{elif}\;n \leq 1.75 \cdot 10^{-177}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{0}{i}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -1.5000000000000001e231 or 1.7500000000000001e-177 < n Initial program 16.0%
associate-*r/16.0%
sub-neg16.0%
distribute-lft-in16.0%
metadata-eval16.0%
metadata-eval16.0%
metadata-eval16.0%
fma-def16.0%
metadata-eval16.0%
Simplified16.0%
fma-udef16.0%
metadata-eval16.0%
distribute-lft-in16.0%
metadata-eval16.0%
sub-neg16.0%
associate-*r/16.0%
associate-/r/16.3%
sub-neg16.3%
metadata-eval16.3%
associate-*r*16.3%
Applied egg-rr79.6%
Taylor expanded in i around 0 65.7%
associate-*r/65.7%
metadata-eval65.7%
Simplified65.7%
Taylor expanded in n around inf 65.9%
*-commutative65.9%
Simplified65.9%
if -1.5000000000000001e231 < n < -1.4199999999999999e-223Initial program 35.4%
associate-/r/35.3%
sub-neg35.3%
metadata-eval35.3%
Simplified35.3%
Taylor expanded in n around inf 32.9%
associate-/l*32.9%
expm1-def78.3%
Simplified78.3%
Taylor expanded in i around 0 60.4%
*-commutative60.4%
Simplified60.4%
associate-*r/60.4%
*-commutative60.4%
clear-num60.7%
+-commutative60.7%
fma-def60.7%
*-commutative60.7%
Applied egg-rr60.7%
Taylor expanded in n around 0 60.5%
if -1.4199999999999999e-223 < n < 1.7500000000000001e-177Initial program 54.5%
*-commutative54.5%
associate-/r/55.0%
associate-*l*55.0%
sub-neg55.0%
metadata-eval55.0%
Simplified55.0%
Taylor expanded in i around 0 87.0%
Final simplification67.1%
(FPCore (i n) :precision binary64 (if (or (<= n -2.05e+232) (not (<= n 4.2e-55))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ n (+ 1.0 (* i -0.5))))))
double code(double i, double n) {
double tmp;
if ((n <= -2.05e+232) || !(n <= 4.2e-55)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-2.05d+232)) .or. (.not. (n <= 4.2d-55))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -2.05e+232) || !(n <= 4.2e-55)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.05e+232) or not (n <= 4.2e-55): tmp = n * (100.0 + (i * 50.0)) else: tmp = 100.0 * (n / (1.0 + (i * -0.5))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.05e+232) || !(n <= 4.2e-55)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -2.05e+232) || ~((n <= 4.2e-55))) tmp = n * (100.0 + (i * 50.0)); else tmp = 100.0 * (n / (1.0 + (i * -0.5))); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -2.05e+232], N[Not[LessEqual[n, 4.2e-55]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.05 \cdot 10^{+232} \lor \neg \left(n \leq 4.2 \cdot 10^{-55}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\end{array}
\end{array}
if n < -2.05000000000000001e232 or 4.2000000000000003e-55 < n Initial program 15.9%
associate-*r/15.9%
sub-neg15.9%
distribute-lft-in15.9%
metadata-eval15.9%
metadata-eval15.9%
metadata-eval15.9%
fma-def15.9%
metadata-eval15.9%
Simplified15.9%
fma-udef15.9%
metadata-eval15.9%
distribute-lft-in15.9%
metadata-eval15.9%
sub-neg15.9%
associate-*r/15.9%
associate-/r/16.2%
sub-neg16.2%
metadata-eval16.2%
associate-*r*16.2%
Applied egg-rr78.4%
Taylor expanded in i around 0 69.1%
associate-*r/69.1%
metadata-eval69.1%
Simplified69.1%
Taylor expanded in n around inf 69.2%
*-commutative69.2%
Simplified69.2%
if -2.05000000000000001e232 < n < 4.2000000000000003e-55Initial program 37.2%
associate-/r/37.3%
sub-neg37.3%
metadata-eval37.3%
Simplified37.3%
Taylor expanded in n around inf 32.1%
associate-/l*32.2%
expm1-def61.1%
Simplified61.1%
Taylor expanded in i around 0 59.8%
*-commutative59.8%
Simplified59.8%
Final simplification63.2%
(FPCore (i n) :precision binary64 (if (or (<= n -6.2e+114) (not (<= n 1.25e-90))) (* n (+ 100.0 (* i 50.0))) (/ (* i 100.0) (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -6.2e+114) || !(n <= 1.25e-90)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = (i * 100.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 <= (-6.2d+114)) .or. (.not. (n <= 1.25d-90))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = (i * 100.0d0) / (i / n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -6.2e+114) || !(n <= 1.25e-90)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = (i * 100.0) / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -6.2e+114) or not (n <= 1.25e-90): tmp = n * (100.0 + (i * 50.0)) else: tmp = (i * 100.0) / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -6.2e+114) || !(n <= 1.25e-90)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(Float64(i * 100.0) / Float64(i / n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -6.2e+114) || ~((n <= 1.25e-90))) tmp = n * (100.0 + (i * 50.0)); else tmp = (i * 100.0) / (i / n); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -6.2e+114], N[Not[LessEqual[n, 1.25e-90]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(i * 100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -6.2 \cdot 10^{+114} \lor \neg \left(n \leq 1.25 \cdot 10^{-90}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{i \cdot 100}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -6.2000000000000001e114 or 1.25000000000000005e-90 < n Initial program 17.9%
associate-*r/17.9%
sub-neg17.9%
distribute-lft-in17.9%
metadata-eval17.9%
metadata-eval17.9%
metadata-eval17.9%
fma-def17.9%
metadata-eval17.9%
Simplified17.9%
fma-udef17.9%
metadata-eval17.9%
distribute-lft-in17.9%
metadata-eval17.9%
sub-neg17.9%
associate-*r/17.9%
associate-/r/18.4%
sub-neg18.4%
metadata-eval18.4%
associate-*r*18.3%
Applied egg-rr73.8%
Taylor expanded in i around 0 65.7%
associate-*r/65.7%
metadata-eval65.7%
Simplified65.7%
Taylor expanded in n around inf 65.8%
*-commutative65.8%
Simplified65.8%
if -6.2000000000000001e114 < n < 1.25000000000000005e-90Initial program 41.3%
associate-*r/41.3%
sub-neg41.3%
distribute-lft-in41.3%
metadata-eval41.3%
metadata-eval41.3%
metadata-eval41.3%
fma-def41.3%
metadata-eval41.3%
Simplified41.3%
Taylor expanded in i around 0 56.5%
Final simplification61.2%
(FPCore (i n) :precision binary64 (if (<= i -1.6) (/ -200.0 (/ i n)) (if (<= i 4.6e+218) (* n (+ 100.0 (* i 50.0))) (* (/ n i) -200.0))))
double code(double i, double n) {
double tmp;
if (i <= -1.6) {
tmp = -200.0 / (i / n);
} else if (i <= 4.6e+218) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = (n / i) * -200.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-1.6d0)) then
tmp = (-200.0d0) / (i / n)
else if (i <= 4.6d+218) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = (n / i) * (-200.0d0)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -1.6) {
tmp = -200.0 / (i / n);
} else if (i <= 4.6e+218) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = (n / i) * -200.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -1.6: tmp = -200.0 / (i / n) elif i <= 4.6e+218: tmp = n * (100.0 + (i * 50.0)) else: tmp = (n / i) * -200.0 return tmp
function code(i, n) tmp = 0.0 if (i <= -1.6) tmp = Float64(-200.0 / Float64(i / n)); elseif (i <= 4.6e+218) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(Float64(n / i) * -200.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -1.6) tmp = -200.0 / (i / n); elseif (i <= 4.6e+218) tmp = n * (100.0 + (i * 50.0)); else tmp = (n / i) * -200.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -1.6], N[(-200.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 4.6e+218], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n / i), $MachinePrecision] * -200.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.6:\\
\;\;\;\;\frac{-200}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 4.6 \cdot 10^{+218}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{i} \cdot -200\\
\end{array}
\end{array}
if i < -1.6000000000000001Initial program 65.9%
associate-/r/65.3%
sub-neg65.3%
metadata-eval65.3%
Simplified65.3%
Taylor expanded in n around inf 77.9%
associate-/l*77.9%
expm1-def77.9%
Simplified77.9%
Taylor expanded in i around 0 34.1%
*-commutative34.1%
Simplified34.1%
Taylor expanded in i around inf 34.1%
clear-num34.7%
un-div-inv34.7%
Applied egg-rr34.7%
if -1.6000000000000001 < i < 4.6000000000000002e218Initial program 16.9%
associate-*r/16.9%
sub-neg16.9%
distribute-lft-in16.9%
metadata-eval16.9%
metadata-eval16.9%
metadata-eval16.9%
fma-def16.9%
metadata-eval16.9%
Simplified16.9%
fma-udef16.9%
metadata-eval16.9%
distribute-lft-in16.9%
metadata-eval16.9%
sub-neg16.9%
associate-*r/16.9%
associate-/r/17.2%
sub-neg17.2%
metadata-eval17.2%
associate-*r*17.2%
Applied egg-rr79.6%
Taylor expanded in i around 0 68.9%
associate-*r/68.9%
metadata-eval68.9%
Simplified68.9%
Taylor expanded in n around inf 69.2%
*-commutative69.2%
Simplified69.2%
if 4.6000000000000002e218 < i Initial program 40.2%
associate-/r/40.9%
sub-neg40.9%
metadata-eval40.9%
Simplified40.9%
Taylor expanded in n around inf 22.2%
associate-/l*22.2%
expm1-def22.2%
Simplified22.2%
Taylor expanded in i around 0 57.1%
*-commutative57.1%
Simplified57.1%
Taylor expanded in i around inf 57.1%
Final simplification60.6%
(FPCore (i n) :precision binary64 (if (or (<= i -2.0) (not (<= i 5.8e+58))) (* (/ n i) -200.0) (* n 100.0)))
double code(double i, double n) {
double tmp;
if ((i <= -2.0) || !(i <= 5.8e+58)) {
tmp = (n / i) * -200.0;
} else {
tmp = n * 100.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((i <= (-2.0d0)) .or. (.not. (i <= 5.8d+58))) then
tmp = (n / i) * (-200.0d0)
else
tmp = n * 100.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((i <= -2.0) || !(i <= 5.8e+58)) {
tmp = (n / i) * -200.0;
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -2.0) or not (i <= 5.8e+58): tmp = (n / i) * -200.0 else: tmp = n * 100.0 return tmp
function code(i, n) tmp = 0.0 if ((i <= -2.0) || !(i <= 5.8e+58)) tmp = Float64(Float64(n / i) * -200.0); else tmp = Float64(n * 100.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((i <= -2.0) || ~((i <= 5.8e+58))) tmp = (n / i) * -200.0; else tmp = n * 100.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[i, -2.0], N[Not[LessEqual[i, 5.8e+58]], $MachinePrecision]], N[(N[(n / i), $MachinePrecision] * -200.0), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2 \lor \neg \left(i \leq 5.8 \cdot 10^{+58}\right):\\
\;\;\;\;\frac{n}{i} \cdot -200\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if i < -2 or 5.80000000000000004e58 < i Initial program 55.4%
associate-/r/55.4%
sub-neg55.4%
metadata-eval55.4%
Simplified55.4%
Taylor expanded in n around inf 59.3%
associate-/l*59.3%
expm1-def59.3%
Simplified59.3%
Taylor expanded in i around 0 36.2%
*-commutative36.2%
Simplified36.2%
Taylor expanded in i around inf 36.2%
if -2 < i < 5.80000000000000004e58Initial program 12.6%
associate-/r/13.0%
associate-*r*13.0%
*-commutative13.0%
associate-*r/13.0%
sub-neg13.0%
distribute-lft-in13.0%
metadata-eval13.0%
metadata-eval13.0%
metadata-eval13.0%
fma-def13.0%
metadata-eval13.0%
Simplified13.0%
Taylor expanded in i around 0 73.7%
Final simplification58.9%
(FPCore (i n) :precision binary64 (if (or (<= i -2.0) (not (<= i 1.9e+53))) (/ -200.0 (/ i n)) (* n 100.0)))
double code(double i, double n) {
double tmp;
if ((i <= -2.0) || !(i <= 1.9e+53)) {
tmp = -200.0 / (i / n);
} else {
tmp = n * 100.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((i <= (-2.0d0)) .or. (.not. (i <= 1.9d+53))) then
tmp = (-200.0d0) / (i / n)
else
tmp = n * 100.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((i <= -2.0) || !(i <= 1.9e+53)) {
tmp = -200.0 / (i / n);
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -2.0) or not (i <= 1.9e+53): tmp = -200.0 / (i / n) else: tmp = n * 100.0 return tmp
function code(i, n) tmp = 0.0 if ((i <= -2.0) || !(i <= 1.9e+53)) tmp = Float64(-200.0 / Float64(i / n)); else tmp = Float64(n * 100.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((i <= -2.0) || ~((i <= 1.9e+53))) tmp = -200.0 / (i / n); else tmp = n * 100.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[i, -2.0], N[Not[LessEqual[i, 1.9e+53]], $MachinePrecision]], N[(-200.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2 \lor \neg \left(i \leq 1.9 \cdot 10^{+53}\right):\\
\;\;\;\;\frac{-200}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if i < -2 or 1.89999999999999999e53 < i Initial program 55.4%
associate-/r/55.4%
sub-neg55.4%
metadata-eval55.4%
Simplified55.4%
Taylor expanded in n around inf 59.3%
associate-/l*59.3%
expm1-def59.3%
Simplified59.3%
Taylor expanded in i around 0 36.2%
*-commutative36.2%
Simplified36.2%
Taylor expanded in i around inf 36.2%
clear-num37.0%
un-div-inv37.0%
Applied egg-rr37.0%
if -2 < i < 1.89999999999999999e53Initial program 12.6%
associate-/r/13.0%
associate-*r*13.0%
*-commutative13.0%
associate-*r/13.0%
sub-neg13.0%
distribute-lft-in13.0%
metadata-eval13.0%
metadata-eval13.0%
metadata-eval13.0%
fma-def13.0%
metadata-eval13.0%
Simplified13.0%
Taylor expanded in i around 0 73.7%
Final simplification59.2%
(FPCore (i n) :precision binary64 (if (<= i -2.0) (* (/ n i) -200.0) (if (<= i 6e+57) (* n 100.0) (* n (/ -200.0 i)))))
double code(double i, double n) {
double tmp;
if (i <= -2.0) {
tmp = (n / i) * -200.0;
} else if (i <= 6e+57) {
tmp = n * 100.0;
} else {
tmp = n * (-200.0 / i);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-2.0d0)) then
tmp = (n / i) * (-200.0d0)
else if (i <= 6d+57) then
tmp = n * 100.0d0
else
tmp = n * ((-200.0d0) / i)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -2.0) {
tmp = (n / i) * -200.0;
} else if (i <= 6e+57) {
tmp = n * 100.0;
} else {
tmp = n * (-200.0 / i);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -2.0: tmp = (n / i) * -200.0 elif i <= 6e+57: tmp = n * 100.0 else: tmp = n * (-200.0 / i) return tmp
function code(i, n) tmp = 0.0 if (i <= -2.0) tmp = Float64(Float64(n / i) * -200.0); elseif (i <= 6e+57) tmp = Float64(n * 100.0); else tmp = Float64(n * Float64(-200.0 / i)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -2.0) tmp = (n / i) * -200.0; elseif (i <= 6e+57) tmp = n * 100.0; else tmp = n * (-200.0 / i); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -2.0], N[(N[(n / i), $MachinePrecision] * -200.0), $MachinePrecision], If[LessEqual[i, 6e+57], N[(n * 100.0), $MachinePrecision], N[(n * N[(-200.0 / i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2:\\
\;\;\;\;\frac{n}{i} \cdot -200\\
\mathbf{elif}\;i \leq 6 \cdot 10^{+57}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{-200}{i}\\
\end{array}
\end{array}
if i < -2Initial program 65.9%
associate-/r/65.3%
sub-neg65.3%
metadata-eval65.3%
Simplified65.3%
Taylor expanded in n around inf 77.9%
associate-/l*77.9%
expm1-def77.9%
Simplified77.9%
Taylor expanded in i around 0 34.1%
*-commutative34.1%
Simplified34.1%
Taylor expanded in i around inf 34.1%
if -2 < i < 5.9999999999999999e57Initial program 12.6%
associate-/r/13.0%
associate-*r*13.0%
*-commutative13.0%
associate-*r/13.0%
sub-neg13.0%
distribute-lft-in13.0%
metadata-eval13.0%
metadata-eval13.0%
metadata-eval13.0%
fma-def13.0%
metadata-eval13.0%
Simplified13.0%
Taylor expanded in i around 0 73.7%
if 5.9999999999999999e57 < i Initial program 41.9%
associate-/r/42.5%
sub-neg42.5%
metadata-eval42.5%
Simplified42.5%
Taylor expanded in n around inf 35.1%
associate-/l*35.1%
expm1-def35.1%
Simplified35.1%
Taylor expanded in i around 0 39.0%
*-commutative39.0%
Simplified39.0%
associate-*r/39.0%
*-commutative39.0%
clear-num40.0%
+-commutative40.0%
fma-def40.0%
*-commutative40.0%
Applied egg-rr40.0%
Taylor expanded in i around inf 39.0%
associate-*r/39.0%
associate-/l*40.0%
associate-/r/39.0%
Simplified39.0%
Final simplification58.9%
(FPCore (i n) :precision binary64 (* i -50.0))
double code(double i, double n) {
return i * -50.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = i * (-50.0d0)
end function
public static double code(double i, double n) {
return i * -50.0;
}
def code(i, n): return i * -50.0
function code(i, n) return Float64(i * -50.0) end
function tmp = code(i, n) tmp = i * -50.0; end
code[i_, n_] := N[(i * -50.0), $MachinePrecision]
\begin{array}{l}
\\
i \cdot -50
\end{array}
Initial program 29.5%
associate-/r/29.7%
sub-neg29.7%
metadata-eval29.7%
Simplified29.7%
Taylor expanded in i around 0 50.0%
associate-*r/50.0%
metadata-eval50.0%
Simplified50.0%
Taylor expanded in n around 0 2.9%
*-commutative2.9%
Simplified2.9%
Final simplification2.9%
(FPCore (i n) :precision binary64 (* n 100.0))
double code(double i, double n) {
return n * 100.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = n * 100.0d0
end function
public static double code(double i, double n) {
return n * 100.0;
}
def code(i, n): return n * 100.0
function code(i, n) return Float64(n * 100.0) end
function tmp = code(i, n) tmp = n * 100.0; end
code[i_, n_] := N[(n * 100.0), $MachinePrecision]
\begin{array}{l}
\\
n \cdot 100
\end{array}
Initial program 29.5%
associate-/r/29.7%
associate-*r*29.7%
*-commutative29.7%
associate-*r/29.7%
sub-neg29.7%
distribute-lft-in29.7%
metadata-eval29.7%
metadata-eval29.7%
metadata-eval29.7%
fma-def29.7%
metadata-eval29.7%
Simplified29.7%
Taylor expanded in i around 0 47.1%
Final simplification47.1%
(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 2024019
(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))))