
(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 19 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 (+ (* 0.08333333333333333 (pow i 2.0)) (* i -0.5)))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 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 + ((0.08333333333333333 * pow(i, 2.0)) + (i * -0.5))));
}
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 + ((0.08333333333333333 * Math.pow(i, 2.0)) + (i * -0.5))));
}
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 + ((0.08333333333333333 * math.pow(i, 2.0)) + (i * -0.5)))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 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(0.08333333333333333 * (i ^ 2.0)) + Float64(i * -0.5))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 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[(0.08333333333333333 * N[Power[i, 2.0], $MachinePrecision]), $MachinePrecision] + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq 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(0.08333333333333333 \cdot {i}^{2} + i \cdot -0.5\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%
Simplified30.8%
metadata-eval30.8%
metadata-eval30.8%
distribute-lft-in30.8%
sub-neg30.8%
associate-*r/30.8%
associate-/r/30.6%
associate-*r*30.6%
add-exp-log30.6%
expm1-def30.6%
log-pow40.9%
log1p-udef98.4%
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%
Simplified97.6%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in n around inf 1.8%
*-commutative1.8%
associate-/l*1.8%
expm1-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 (+ (* 0.08333333333333333 (pow i 2.0)) (* i -0.5)))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 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 + ((0.08333333333333333 * pow(i, 2.0)) + (i * -0.5))));
}
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 + ((0.08333333333333333 * Math.pow(i, 2.0)) + (i * -0.5))));
}
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 + ((0.08333333333333333 * math.pow(i, 2.0)) + (i * -0.5)))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 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(0.08333333333333333 * (i ^ 2.0)) + Float64(i * -0.5))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 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[(0.08333333333333333 * N[Power[i, 2.0], $MachinePrecision]), $MachinePrecision] + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq 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(0.08333333333333333 \cdot {i}^{2} + i \cdot -0.5\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%
Simplified97.6%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in n around inf 1.8%
*-commutative1.8%
associate-/l*1.8%
expm1-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 (+ (* 0.08333333333333333 (pow i 2.0)) (* i -0.5)))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 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 + ((0.08333333333333333 * pow(i, 2.0)) + (i * -0.5))));
}
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 + ((0.08333333333333333 * Math.pow(i, 2.0)) + (i * -0.5))));
}
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 + ((0.08333333333333333 * math.pow(i, 2.0)) + (i * -0.5)))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 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(0.08333333333333333 * (i ^ 2.0)) + Float64(i * -0.5))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 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[(0.08333333333333333 * N[Power[i, 2.0], $MachinePrecision]), $MachinePrecision] + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq 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(0.08333333333333333 \cdot {i}^{2} + i \cdot -0.5\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%
Simplified30.8%
metadata-eval30.8%
metadata-eval30.8%
distribute-lft-in30.8%
sub-neg30.8%
associate-*r/30.8%
associate-/r/30.6%
associate-*r*30.6%
add-exp-log30.6%
expm1-def30.6%
log-pow40.9%
log1p-udef98.4%
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%
Simplified97.6%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
Taylor expanded in n around inf 1.8%
*-commutative1.8%
associate-/l*1.8%
expm1-def64.9%
Simplified64.9%
Taylor expanded in i around 0 99.9%
Final simplification98.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (* n 100.0) (/ i (expm1 i)))))
(if (<= n -1.3e-219)
t_0
(if (<= n 2.4e-208)
(/ 0.0 (/ i n))
(if (<= n 0.000155)
(*
100.0
(/ n (+ 1.0 (+ (* 0.08333333333333333 (pow i 2.0)) (* i -0.5)))))
t_0)))))
double code(double i, double n) {
double t_0 = (n * 100.0) / (i / expm1(i));
double tmp;
if (n <= -1.3e-219) {
tmp = t_0;
} else if (n <= 2.4e-208) {
tmp = 0.0 / (i / n);
} else if (n <= 0.000155) {
tmp = 100.0 * (n / (1.0 + ((0.08333333333333333 * pow(i, 2.0)) + (i * -0.5))));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = (n * 100.0) / (i / Math.expm1(i));
double tmp;
if (n <= -1.3e-219) {
tmp = t_0;
} else if (n <= 2.4e-208) {
tmp = 0.0 / (i / n);
} else if (n <= 0.000155) {
tmp = 100.0 * (n / (1.0 + ((0.08333333333333333 * Math.pow(i, 2.0)) + (i * -0.5))));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = (n * 100.0) / (i / math.expm1(i)) tmp = 0 if n <= -1.3e-219: tmp = t_0 elif n <= 2.4e-208: tmp = 0.0 / (i / n) elif n <= 0.000155: tmp = 100.0 * (n / (1.0 + ((0.08333333333333333 * math.pow(i, 2.0)) + (i * -0.5)))) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(Float64(n * 100.0) / Float64(i / expm1(i))) tmp = 0.0 if (n <= -1.3e-219) tmp = t_0; elseif (n <= 2.4e-208) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 0.000155) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(Float64(0.08333333333333333 * (i ^ 2.0)) + Float64(i * -0.5))))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(n * 100.0), $MachinePrecision] / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.3e-219], t$95$0, If[LessEqual[n, 2.4e-208], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.000155], N[(100.0 * N[(n / N[(1.0 + N[(N[(0.08333333333333333 * N[Power[i, 2.0], $MachinePrecision]), $MachinePrecision] + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{n \cdot 100}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{if}\;n \leq -1.3 \cdot 10^{-219}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 2.4 \cdot 10^{-208}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 0.000155:\\
\;\;\;\;100 \cdot \frac{n}{1 + \left(0.08333333333333333 \cdot {i}^{2} + i \cdot -0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -1.30000000000000001e-219 or 1.55e-4 < n Initial program 26.2%
Taylor expanded in n around inf 39.3%
*-commutative39.3%
associate-/l*39.3%
expm1-def87.2%
Simplified87.2%
associate-*l/87.3%
Applied egg-rr87.3%
if -1.30000000000000001e-219 < n < 2.3999999999999999e-208Initial program 59.3%
associate-*r/59.3%
sub-neg59.3%
distribute-lft-in59.3%
metadata-eval59.3%
metadata-eval59.3%
Simplified59.3%
Taylor expanded in i around 0 79.9%
*-commutative79.9%
Simplified79.9%
Taylor expanded in i around 0 87.9%
if 2.3999999999999999e-208 < n < 1.55e-4Initial program 17.6%
Taylor expanded in n around inf 6.0%
*-commutative6.0%
associate-/l*6.0%
expm1-def50.1%
Simplified50.1%
Taylor expanded in i around 0 74.1%
Final simplification85.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (* n 100.0) (/ i (expm1 i)))))
(if (<= n -1.35e-219)
t_0
(if (<= n 5.2e-179)
(/ 0.0 (/ i n))
(if (<= n 0.000155)
(/ n (+ 0.01 (+ (* i -0.005) (* (pow i 2.0) 0.0008333333333333334))))
t_0)))))
double code(double i, double n) {
double t_0 = (n * 100.0) / (i / expm1(i));
double tmp;
if (n <= -1.35e-219) {
tmp = t_0;
} else if (n <= 5.2e-179) {
tmp = 0.0 / (i / n);
} else if (n <= 0.000155) {
tmp = n / (0.01 + ((i * -0.005) + (pow(i, 2.0) * 0.0008333333333333334)));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = (n * 100.0) / (i / Math.expm1(i));
double tmp;
if (n <= -1.35e-219) {
tmp = t_0;
} else if (n <= 5.2e-179) {
tmp = 0.0 / (i / n);
} else if (n <= 0.000155) {
tmp = n / (0.01 + ((i * -0.005) + (Math.pow(i, 2.0) * 0.0008333333333333334)));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = (n * 100.0) / (i / math.expm1(i)) tmp = 0 if n <= -1.35e-219: tmp = t_0 elif n <= 5.2e-179: tmp = 0.0 / (i / n) elif n <= 0.000155: tmp = n / (0.01 + ((i * -0.005) + (math.pow(i, 2.0) * 0.0008333333333333334))) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(Float64(n * 100.0) / Float64(i / expm1(i))) tmp = 0.0 if (n <= -1.35e-219) tmp = t_0; elseif (n <= 5.2e-179) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 0.000155) tmp = Float64(n / Float64(0.01 + Float64(Float64(i * -0.005) + Float64((i ^ 2.0) * 0.0008333333333333334)))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(n * 100.0), $MachinePrecision] / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.35e-219], t$95$0, If[LessEqual[n, 5.2e-179], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.000155], N[(n / N[(0.01 + N[(N[(i * -0.005), $MachinePrecision] + N[(N[Power[i, 2.0], $MachinePrecision] * 0.0008333333333333334), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{n \cdot 100}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{if}\;n \leq -1.35 \cdot 10^{-219}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 5.2 \cdot 10^{-179}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 0.000155:\\
\;\;\;\;\frac{n}{0.01 + \left(i \cdot -0.005 + {i}^{2} \cdot 0.0008333333333333334\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -1.35e-219 or 1.55e-4 < n Initial program 26.2%
Taylor expanded in n around inf 39.3%
*-commutative39.3%
associate-/l*39.3%
expm1-def87.2%
Simplified87.2%
associate-*l/87.3%
Applied egg-rr87.3%
if -1.35e-219 < n < 5.20000000000000011e-179Initial program 54.5%
associate-*r/54.5%
sub-neg54.5%
distribute-lft-in54.5%
metadata-eval54.5%
metadata-eval54.5%
Simplified54.5%
Taylor expanded in i around 0 80.0%
*-commutative80.0%
Simplified80.0%
Taylor expanded in i around 0 87.0%
if 5.20000000000000011e-179 < n < 1.55e-4Initial program 17.2%
Taylor expanded in n around inf 3.6%
*-commutative3.6%
associate-/l*3.6%
expm1-def54.4%
Simplified54.4%
associate-*l/54.4%
associate-/l*54.2%
Applied egg-rr54.2%
Taylor expanded in i around 0 72.8%
Final simplification85.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ (expm1 i) (/ i n)))))
(if (<= i -3.1e-63)
t_0
(if (<= i 7.6e-55)
(* 100.0 (+ n (* i -0.5)))
(if (<= i 1.38e+68)
t_0
(if (<= i 8.5e+125)
(/ 0.0 (/ i n))
(if (<= i 3.6e+182) t_0 (* (/ n i) -200.0))))))))
double code(double i, double n) {
double t_0 = 100.0 * (expm1(i) / (i / n));
double tmp;
if (i <= -3.1e-63) {
tmp = t_0;
} else if (i <= 7.6e-55) {
tmp = 100.0 * (n + (i * -0.5));
} else if (i <= 1.38e+68) {
tmp = t_0;
} else if (i <= 8.5e+125) {
tmp = 0.0 / (i / n);
} else if (i <= 3.6e+182) {
tmp = t_0;
} else {
tmp = (n / i) * -200.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 <= -3.1e-63) {
tmp = t_0;
} else if (i <= 7.6e-55) {
tmp = 100.0 * (n + (i * -0.5));
} else if (i <= 1.38e+68) {
tmp = t_0;
} else if (i <= 8.5e+125) {
tmp = 0.0 / (i / n);
} else if (i <= 3.6e+182) {
tmp = t_0;
} else {
tmp = (n / i) * -200.0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (math.expm1(i) / (i / n)) tmp = 0 if i <= -3.1e-63: tmp = t_0 elif i <= 7.6e-55: tmp = 100.0 * (n + (i * -0.5)) elif i <= 1.38e+68: tmp = t_0 elif i <= 8.5e+125: tmp = 0.0 / (i / n) elif i <= 3.6e+182: tmp = t_0 else: tmp = (n / i) * -200.0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(expm1(i) / Float64(i / n))) tmp = 0.0 if (i <= -3.1e-63) tmp = t_0; elseif (i <= 7.6e-55) tmp = Float64(100.0 * Float64(n + Float64(i * -0.5))); elseif (i <= 1.38e+68) tmp = t_0; elseif (i <= 8.5e+125) tmp = Float64(0.0 / Float64(i / n)); elseif (i <= 3.6e+182) tmp = t_0; else tmp = Float64(Float64(n / i) * -200.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, -3.1e-63], t$95$0, If[LessEqual[i, 7.6e-55], N[(100.0 * N[(n + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1.38e+68], t$95$0, If[LessEqual[i, 8.5e+125], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3.6e+182], t$95$0, N[(N[(n / i), $MachinePrecision] * -200.0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{if}\;i \leq -3.1 \cdot 10^{-63}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;i \leq 7.6 \cdot 10^{-55}:\\
\;\;\;\;100 \cdot \left(n + i \cdot -0.5\right)\\
\mathbf{elif}\;i \leq 1.38 \cdot 10^{+68}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;i \leq 8.5 \cdot 10^{+125}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 3.6 \cdot 10^{+182}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{i} \cdot -200\\
\end{array}
\end{array}
if i < -3.09999999999999984e-63 or 7.5999999999999993e-55 < i < 1.38000000000000003e68 or 8.49999999999999974e125 < i < 3.6e182Initial program 44.9%
Taylor expanded in n around inf 66.7%
expm1-def74.0%
Simplified74.0%
if -3.09999999999999984e-63 < i < 7.5999999999999993e-55Initial program 10.1%
Taylor expanded in i around 0 88.0%
associate-*r*87.9%
associate-*r/87.9%
metadata-eval87.9%
Simplified87.9%
Taylor expanded in n around 0 88.0%
*-commutative88.0%
Simplified88.0%
if 1.38000000000000003e68 < i < 8.49999999999999974e125Initial program 47.8%
associate-*r/47.8%
sub-neg47.8%
distribute-lft-in48.2%
metadata-eval48.2%
metadata-eval48.2%
Simplified48.2%
Taylor expanded in i around 0 28.4%
*-commutative28.4%
Simplified28.4%
Taylor expanded in i around 0 52.2%
if 3.6e182 < i Initial program 41.9%
Taylor expanded in n around inf 27.2%
*-commutative27.2%
associate-/l*27.2%
expm1-def27.2%
Simplified27.2%
associate-*l/27.2%
associate-/l*27.2%
Applied egg-rr27.2%
Taylor expanded in i around 0 55.9%
*-commutative55.9%
Simplified55.9%
Taylor expanded in i around inf 55.9%
Final simplification77.5%
(FPCore (i n) :precision binary64 (if (or (<= n -4.2e-222) (not (<= n 4.3e-176))) (* 100.0 (/ n (/ i (expm1 i)))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -4.2e-222) || !(n <= 4.3e-176)) {
tmp = 100.0 * (n / (i / expm1(i)));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -4.2e-222) || !(n <= 4.3e-176)) {
tmp = 100.0 * (n / (i / Math.expm1(i)));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -4.2e-222) or not (n <= 4.3e-176): tmp = 100.0 * (n / (i / math.expm1(i))) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -4.2e-222) || !(n <= 4.3e-176)) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -4.2e-222], N[Not[LessEqual[n, 4.3e-176]], $MachinePrecision]], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.2 \cdot 10^{-222} \lor \neg \left(n \leq 4.3 \cdot 10^{-176}\right):\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -4.1999999999999998e-222 or 4.30000000000000012e-176 < n Initial program 24.9%
Taylor expanded in n around inf 34.0%
*-commutative34.0%
associate-/l*34.0%
expm1-def82.4%
Simplified82.4%
if -4.1999999999999998e-222 < n < 4.30000000000000012e-176Initial program 54.5%
associate-*r/54.5%
sub-neg54.5%
distribute-lft-in54.5%
metadata-eval54.5%
metadata-eval54.5%
Simplified54.5%
Taylor expanded in i around 0 80.0%
*-commutative80.0%
Simplified80.0%
Taylor expanded in i around 0 87.0%
Final simplification83.1%
(FPCore (i n) :precision binary64 (if (or (<= n -2.7e-221) (not (<= n 2.4e-176))) (/ (* n 100.0) (/ i (expm1 i))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -2.7e-221) || !(n <= 2.4e-176)) {
tmp = (n * 100.0) / (i / expm1(i));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -2.7e-221) || !(n <= 2.4e-176)) {
tmp = (n * 100.0) / (i / Math.expm1(i));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.7e-221) or not (n <= 2.4e-176): tmp = (n * 100.0) / (i / math.expm1(i)) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.7e-221) || !(n <= 2.4e-176)) tmp = Float64(Float64(n * 100.0) / Float64(i / expm1(i))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -2.7e-221], N[Not[LessEqual[n, 2.4e-176]], $MachinePrecision]], N[(N[(n * 100.0), $MachinePrecision] / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.7 \cdot 10^{-221} \lor \neg \left(n \leq 2.4 \cdot 10^{-176}\right):\\
\;\;\;\;\frac{n \cdot 100}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -2.7e-221 or 2.40000000000000006e-176 < n Initial program 24.9%
Taylor expanded in n around inf 34.0%
*-commutative34.0%
associate-/l*34.0%
expm1-def82.4%
Simplified82.4%
associate-*l/82.4%
Applied egg-rr82.4%
if -2.7e-221 < n < 2.40000000000000006e-176Initial program 54.5%
associate-*r/54.5%
sub-neg54.5%
distribute-lft-in54.5%
metadata-eval54.5%
metadata-eval54.5%
Simplified54.5%
Taylor expanded in i around 0 80.0%
*-commutative80.0%
Simplified80.0%
Taylor expanded in i around 0 87.0%
Final simplification83.1%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ n (+ 1.0 (* i -0.5)))))
(t_1 (* i (* 100.0 (* n (+ 0.5 (/ -0.5 n)))))))
(if (<= n -1.22e+232)
(/ 1.0 (/ i (* 100.0 (* i n))))
(if (<= n -4.1e-220)
t_0
(if (<= n 1.15e-208)
(/ 0.0 (/ i n))
(if (<= n 5.7e-9)
t_0
(if (<= n 2.95e+116)
(/
(- (* (* n 100.0) (* n 100.0)) (* t_1 t_1))
(- (* n 100.0) t_1))
(* 100.0 (+ n (* (* i n) 0.5))))))))))
double code(double i, double n) {
double t_0 = 100.0 * (n / (1.0 + (i * -0.5)));
double t_1 = i * (100.0 * (n * (0.5 + (-0.5 / n))));
double tmp;
if (n <= -1.22e+232) {
tmp = 1.0 / (i / (100.0 * (i * n)));
} else if (n <= -4.1e-220) {
tmp = t_0;
} else if (n <= 1.15e-208) {
tmp = 0.0 / (i / n);
} else if (n <= 5.7e-9) {
tmp = t_0;
} else if (n <= 2.95e+116) {
tmp = (((n * 100.0) * (n * 100.0)) - (t_1 * t_1)) / ((n * 100.0) - t_1);
} else {
tmp = 100.0 * (n + ((i * n) * 0.5));
}
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 / (1.0d0 + (i * (-0.5d0))))
t_1 = i * (100.0d0 * (n * (0.5d0 + ((-0.5d0) / n))))
if (n <= (-1.22d+232)) then
tmp = 1.0d0 / (i / (100.0d0 * (i * n)))
else if (n <= (-4.1d-220)) then
tmp = t_0
else if (n <= 1.15d-208) then
tmp = 0.0d0 / (i / n)
else if (n <= 5.7d-9) then
tmp = t_0
else if (n <= 2.95d+116) then
tmp = (((n * 100.0d0) * (n * 100.0d0)) - (t_1 * t_1)) / ((n * 100.0d0) - t_1)
else
tmp = 100.0d0 * (n + ((i * n) * 0.5d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = 100.0 * (n / (1.0 + (i * -0.5)));
double t_1 = i * (100.0 * (n * (0.5 + (-0.5 / n))));
double tmp;
if (n <= -1.22e+232) {
tmp = 1.0 / (i / (100.0 * (i * n)));
} else if (n <= -4.1e-220) {
tmp = t_0;
} else if (n <= 1.15e-208) {
tmp = 0.0 / (i / n);
} else if (n <= 5.7e-9) {
tmp = t_0;
} else if (n <= 2.95e+116) {
tmp = (((n * 100.0) * (n * 100.0)) - (t_1 * t_1)) / ((n * 100.0) - t_1);
} else {
tmp = 100.0 * (n + ((i * n) * 0.5));
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n / (1.0 + (i * -0.5))) t_1 = i * (100.0 * (n * (0.5 + (-0.5 / n)))) tmp = 0 if n <= -1.22e+232: tmp = 1.0 / (i / (100.0 * (i * n))) elif n <= -4.1e-220: tmp = t_0 elif n <= 1.15e-208: tmp = 0.0 / (i / n) elif n <= 5.7e-9: tmp = t_0 elif n <= 2.95e+116: tmp = (((n * 100.0) * (n * 100.0)) - (t_1 * t_1)) / ((n * 100.0) - t_1) else: tmp = 100.0 * (n + ((i * n) * 0.5)) return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))) t_1 = Float64(i * Float64(100.0 * Float64(n * Float64(0.5 + Float64(-0.5 / n))))) tmp = 0.0 if (n <= -1.22e+232) tmp = Float64(1.0 / Float64(i / Float64(100.0 * Float64(i * n)))); elseif (n <= -4.1e-220) tmp = t_0; elseif (n <= 1.15e-208) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 5.7e-9) tmp = t_0; elseif (n <= 2.95e+116) tmp = Float64(Float64(Float64(Float64(n * 100.0) * Float64(n * 100.0)) - Float64(t_1 * t_1)) / Float64(Float64(n * 100.0) - t_1)); else tmp = Float64(100.0 * Float64(n + Float64(Float64(i * n) * 0.5))); end return tmp end
function tmp_2 = code(i, n) t_0 = 100.0 * (n / (1.0 + (i * -0.5))); t_1 = i * (100.0 * (n * (0.5 + (-0.5 / n)))); tmp = 0.0; if (n <= -1.22e+232) tmp = 1.0 / (i / (100.0 * (i * n))); elseif (n <= -4.1e-220) tmp = t_0; elseif (n <= 1.15e-208) tmp = 0.0 / (i / n); elseif (n <= 5.7e-9) tmp = t_0; elseif (n <= 2.95e+116) tmp = (((n * 100.0) * (n * 100.0)) - (t_1 * t_1)) / ((n * 100.0) - t_1); else tmp = 100.0 * (n + ((i * n) * 0.5)); end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(i * N[(100.0 * N[(n * N[(0.5 + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.22e+232], N[(1.0 / N[(i / N[(100.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -4.1e-220], t$95$0, If[LessEqual[n, 1.15e-208], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.7e-9], t$95$0, If[LessEqual[n, 2.95e+116], N[(N[(N[(N[(n * 100.0), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(N[(n * 100.0), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n + N[(N[(i * n), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n}{1 + i \cdot -0.5}\\
t_1 := i \cdot \left(100 \cdot \left(n \cdot \left(0.5 + \frac{-0.5}{n}\right)\right)\right)\\
\mathbf{if}\;n \leq -1.22 \cdot 10^{+232}:\\
\;\;\;\;\frac{1}{\frac{i}{100 \cdot \left(i \cdot n\right)}}\\
\mathbf{elif}\;n \leq -4.1 \cdot 10^{-220}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 1.15 \cdot 10^{-208}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 5.7 \cdot 10^{-9}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 2.95 \cdot 10^{+116}:\\
\;\;\;\;\frac{\left(n \cdot 100\right) \cdot \left(n \cdot 100\right) - t_1 \cdot t_1}{n \cdot 100 - t_1}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n + \left(i \cdot n\right) \cdot 0.5\right)\\
\end{array}
\end{array}
if n < -1.21999999999999994e232Initial program 8.3%
associate-*r/8.4%
sub-neg8.4%
distribute-lft-in8.4%
metadata-eval8.4%
metadata-eval8.4%
Simplified8.4%
Taylor expanded in i around 0 12.2%
*-commutative12.2%
Simplified12.2%
clear-num12.2%
inv-pow12.2%
+-commutative12.2%
associate-+l+20.6%
metadata-eval20.6%
Applied egg-rr20.6%
unpow-120.6%
associate-/l/59.9%
+-rgt-identity59.9%
*-commutative59.9%
associate-*r*59.9%
*-commutative59.9%
Simplified59.9%
if -1.21999999999999994e232 < n < -4.09999999999999991e-220 or 1.14999999999999998e-208 < n < 5.6999999999999998e-9Initial program 30.4%
Taylor expanded in n around inf 25.4%
*-commutative25.4%
associate-/l*25.4%
expm1-def70.8%
Simplified70.8%
Taylor expanded in i around 0 62.4%
*-commutative62.4%
Simplified62.4%
if -4.09999999999999991e-220 < n < 1.14999999999999998e-208Initial program 59.3%
associate-*r/59.3%
sub-neg59.3%
distribute-lft-in59.3%
metadata-eval59.3%
metadata-eval59.3%
Simplified59.3%
Taylor expanded in i around 0 79.9%
*-commutative79.9%
Simplified79.9%
Taylor expanded in i around 0 87.9%
if 5.6999999999999998e-9 < n < 2.95e116Initial program 27.5%
Taylor expanded in i around 0 69.4%
associate-*r*69.4%
associate-*r/69.4%
metadata-eval69.4%
Simplified69.4%
distribute-lft-in69.4%
flip-+78.1%
Applied egg-rr78.1%
if 2.95e116 < n Initial program 9.0%
Taylor expanded in n around inf 47.6%
*-commutative47.6%
associate-/l*47.6%
expm1-def99.9%
Simplified99.9%
Taylor expanded in i around 0 73.8%
Final simplification69.4%
(FPCore (i n)
:precision binary64
(if (<= n -2.9e+231)
(/ (* 100.0 (* i n)) i)
(if (<= n -3.5e-220)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 6.5e-177) (/ 0.0 (/ i n)) (* n (+ 100.0 (* i 50.0)))))))
double code(double i, double n) {
double tmp;
if (n <= -2.9e+231) {
tmp = (100.0 * (i * n)) / i;
} else if (n <= -3.5e-220) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 6.5e-177) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.9d+231)) then
tmp = (100.0d0 * (i * n)) / i
else if (n <= (-3.5d-220)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 6.5d-177) then
tmp = 0.0d0 / (i / n)
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.9e+231) {
tmp = (100.0 * (i * n)) / i;
} else if (n <= -3.5e-220) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 6.5e-177) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.9e+231: tmp = (100.0 * (i * n)) / i elif n <= -3.5e-220: tmp = n / (0.01 + (i * -0.005)) elif n <= 6.5e-177: tmp = 0.0 / (i / n) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.9e+231) tmp = Float64(Float64(100.0 * Float64(i * n)) / i); elseif (n <= -3.5e-220) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 6.5e-177) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.9e+231) tmp = (100.0 * (i * n)) / i; elseif (n <= -3.5e-220) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 6.5e-177) tmp = 0.0 / (i / n); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.9e+231], N[(N[(100.0 * N[(i * n), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], If[LessEqual[n, -3.5e-220], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 6.5e-177], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.9 \cdot 10^{+231}:\\
\;\;\;\;\frac{100 \cdot \left(i \cdot n\right)}{i}\\
\mathbf{elif}\;n \leq -3.5 \cdot 10^{-220}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 6.5 \cdot 10^{-177}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -2.9000000000000001e231Initial program 8.3%
associate-*r/8.4%
sub-neg8.4%
distribute-lft-in8.4%
metadata-eval8.4%
metadata-eval8.4%
Simplified8.4%
metadata-eval8.4%
metadata-eval8.4%
distribute-lft-in8.4%
sub-neg8.4%
associate-*r/8.3%
associate-/r/8.8%
associate-*r*8.8%
add-exp-log8.8%
expm1-def8.8%
log-pow8.8%
log1p-udef78.8%
Applied egg-rr78.8%
clear-num78.8%
un-div-inv78.9%
Applied egg-rr78.9%
Taylor expanded in n around inf 78.7%
associate-*r/78.8%
expm1-def99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in i around 0 59.7%
*-commutative59.7%
Simplified59.7%
if -2.9000000000000001e231 < n < -3.49999999999999988e-220Initial program 35.1%
Taylor expanded in n around inf 32.6%
*-commutative32.6%
associate-/l*32.6%
expm1-def78.5%
Simplified78.5%
associate-*l/78.6%
associate-/l*78.5%
Applied egg-rr78.5%
Taylor expanded in i around 0 60.8%
*-commutative60.8%
Simplified60.8%
if -3.49999999999999988e-220 < n < 6.4999999999999998e-177Initial program 54.5%
associate-*r/54.5%
sub-neg54.5%
distribute-lft-in54.5%
metadata-eval54.5%
metadata-eval54.5%
Simplified54.5%
Taylor expanded in i around 0 80.0%
*-commutative80.0%
Simplified80.0%
Taylor expanded in i around 0 87.0%
if 6.4999999999999998e-177 < n Initial program 17.2%
Taylor expanded in n around inf 29.2%
*-commutative29.2%
associate-/l*29.2%
expm1-def83.7%
Simplified83.7%
Taylor expanded in i around 0 65.6%
associate-*r*65.6%
distribute-rgt-out66.6%
Simplified66.6%
Final simplification67.1%
(FPCore (i n)
:precision binary64
(if (<= n -2.65e+231)
(/ (* 100.0 (* i n)) i)
(if (<= n -3.8e-222)
(* 100.0 (/ n (+ 1.0 (* i -0.5))))
(if (<= n 2.4e-176) (/ 0.0 (/ i n)) (* n (+ 100.0 (* i 50.0)))))))
double code(double i, double n) {
double tmp;
if (n <= -2.65e+231) {
tmp = (100.0 * (i * n)) / i;
} else if (n <= -3.8e-222) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 2.4e-176) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.65d+231)) then
tmp = (100.0d0 * (i * n)) / i
else if (n <= (-3.8d-222)) then
tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
else if (n <= 2.4d-176) then
tmp = 0.0d0 / (i / n)
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.65e+231) {
tmp = (100.0 * (i * n)) / i;
} else if (n <= -3.8e-222) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 2.4e-176) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.65e+231: tmp = (100.0 * (i * n)) / i elif n <= -3.8e-222: tmp = 100.0 * (n / (1.0 + (i * -0.5))) elif n <= 2.4e-176: tmp = 0.0 / (i / n) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.65e+231) tmp = Float64(Float64(100.0 * Float64(i * n)) / i); elseif (n <= -3.8e-222) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); elseif (n <= 2.4e-176) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.65e+231) tmp = (100.0 * (i * n)) / i; elseif (n <= -3.8e-222) tmp = 100.0 * (n / (1.0 + (i * -0.5))); elseif (n <= 2.4e-176) tmp = 0.0 / (i / n); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.65e+231], N[(N[(100.0 * N[(i * n), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], If[LessEqual[n, -3.8e-222], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.4e-176], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.65 \cdot 10^{+231}:\\
\;\;\;\;\frac{100 \cdot \left(i \cdot n\right)}{i}\\
\mathbf{elif}\;n \leq -3.8 \cdot 10^{-222}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 2.4 \cdot 10^{-176}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -2.6499999999999999e231Initial program 8.3%
associate-*r/8.4%
sub-neg8.4%
distribute-lft-in8.4%
metadata-eval8.4%
metadata-eval8.4%
Simplified8.4%
metadata-eval8.4%
metadata-eval8.4%
distribute-lft-in8.4%
sub-neg8.4%
associate-*r/8.3%
associate-/r/8.8%
associate-*r*8.8%
add-exp-log8.8%
expm1-def8.8%
log-pow8.8%
log1p-udef78.8%
Applied egg-rr78.8%
clear-num78.8%
un-div-inv78.9%
Applied egg-rr78.9%
Taylor expanded in n around inf 78.7%
associate-*r/78.8%
expm1-def99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in i around 0 59.7%
*-commutative59.7%
Simplified59.7%
if -2.6499999999999999e231 < n < -3.79999999999999997e-222Initial program 35.1%
Taylor expanded in n around inf 32.6%
*-commutative32.6%
associate-/l*32.6%
expm1-def78.5%
Simplified78.5%
Taylor expanded in i around 0 60.8%
*-commutative60.8%
Simplified60.8%
if -3.79999999999999997e-222 < n < 2.40000000000000006e-176Initial program 54.5%
associate-*r/54.5%
sub-neg54.5%
distribute-lft-in54.5%
metadata-eval54.5%
metadata-eval54.5%
Simplified54.5%
Taylor expanded in i around 0 80.0%
*-commutative80.0%
Simplified80.0%
Taylor expanded in i around 0 87.0%
if 2.40000000000000006e-176 < n Initial program 17.2%
Taylor expanded in n around inf 29.2%
*-commutative29.2%
associate-/l*29.2%
expm1-def83.7%
Simplified83.7%
Taylor expanded in i around 0 65.6%
associate-*r*65.6%
distribute-rgt-out66.6%
Simplified66.6%
Final simplification67.1%
(FPCore (i n)
:precision binary64
(if (<= n -7.2e+231)
(/ 1.0 (/ i (* 100.0 (* i n))))
(if (<= n -4.3e-222)
(* 100.0 (/ n (+ 1.0 (* i -0.5))))
(if (<= n 9.2e-177) (/ 0.0 (/ i n)) (* n (+ 100.0 (* i 50.0)))))))
double code(double i, double n) {
double tmp;
if (n <= -7.2e+231) {
tmp = 1.0 / (i / (100.0 * (i * n)));
} else if (n <= -4.3e-222) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 9.2e-177) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-7.2d+231)) then
tmp = 1.0d0 / (i / (100.0d0 * (i * n)))
else if (n <= (-4.3d-222)) then
tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
else if (n <= 9.2d-177) then
tmp = 0.0d0 / (i / n)
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -7.2e+231) {
tmp = 1.0 / (i / (100.0 * (i * n)));
} else if (n <= -4.3e-222) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 9.2e-177) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -7.2e+231: tmp = 1.0 / (i / (100.0 * (i * n))) elif n <= -4.3e-222: tmp = 100.0 * (n / (1.0 + (i * -0.5))) elif n <= 9.2e-177: tmp = 0.0 / (i / n) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -7.2e+231) tmp = Float64(1.0 / Float64(i / Float64(100.0 * Float64(i * n)))); elseif (n <= -4.3e-222) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); elseif (n <= 9.2e-177) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -7.2e+231) tmp = 1.0 / (i / (100.0 * (i * n))); elseif (n <= -4.3e-222) tmp = 100.0 * (n / (1.0 + (i * -0.5))); elseif (n <= 9.2e-177) tmp = 0.0 / (i / n); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -7.2e+231], N[(1.0 / N[(i / N[(100.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -4.3e-222], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 9.2e-177], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -7.2 \cdot 10^{+231}:\\
\;\;\;\;\frac{1}{\frac{i}{100 \cdot \left(i \cdot n\right)}}\\
\mathbf{elif}\;n \leq -4.3 \cdot 10^{-222}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 9.2 \cdot 10^{-177}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -7.1999999999999999e231Initial program 8.3%
associate-*r/8.4%
sub-neg8.4%
distribute-lft-in8.4%
metadata-eval8.4%
metadata-eval8.4%
Simplified8.4%
Taylor expanded in i around 0 12.2%
*-commutative12.2%
Simplified12.2%
clear-num12.2%
inv-pow12.2%
+-commutative12.2%
associate-+l+20.6%
metadata-eval20.6%
Applied egg-rr20.6%
unpow-120.6%
associate-/l/59.9%
+-rgt-identity59.9%
*-commutative59.9%
associate-*r*59.9%
*-commutative59.9%
Simplified59.9%
if -7.1999999999999999e231 < n < -4.29999999999999991e-222Initial program 35.1%
Taylor expanded in n around inf 32.6%
*-commutative32.6%
associate-/l*32.6%
expm1-def78.5%
Simplified78.5%
Taylor expanded in i around 0 60.8%
*-commutative60.8%
Simplified60.8%
if -4.29999999999999991e-222 < n < 9.20000000000000087e-177Initial program 54.5%
associate-*r/54.5%
sub-neg54.5%
distribute-lft-in54.5%
metadata-eval54.5%
metadata-eval54.5%
Simplified54.5%
Taylor expanded in i around 0 80.0%
*-commutative80.0%
Simplified80.0%
Taylor expanded in i around 0 87.0%
if 9.20000000000000087e-177 < n Initial program 17.2%
Taylor expanded in n around inf 29.2%
*-commutative29.2%
associate-/l*29.2%
expm1-def83.7%
Simplified83.7%
Taylor expanded in i around 0 65.6%
associate-*r*65.6%
distribute-rgt-out66.6%
Simplified66.6%
Final simplification67.1%
(FPCore (i n) :precision binary64 (if (or (<= n -6.2e+114) (not (<= n 5.5e-5))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -6.2e+114) || !(n <= 5.5e-5)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-6.2d+114)) .or. (.not. (n <= 5.5d-5))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 100.0d0 * (i / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -6.2e+114) || !(n <= 5.5e-5)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -6.2e+114) or not (n <= 5.5e-5): tmp = n * (100.0 + (i * 50.0)) else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -6.2e+114) || !(n <= 5.5e-5)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(100.0 * Float64(i / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -6.2e+114) || ~((n <= 5.5e-5))) tmp = n * (100.0 + (i * 50.0)); else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -6.2e+114], N[Not[LessEqual[n, 5.5e-5]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -6.2 \cdot 10^{+114} \lor \neg \left(n \leq 5.5 \cdot 10^{-5}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -6.2000000000000001e114 or 5.5000000000000002e-5 < n Initial program 18.6%
Taylor expanded in n around inf 44.3%
*-commutative44.3%
associate-/l*44.3%
expm1-def96.4%
Simplified96.4%
Taylor expanded in i around 0 65.8%
associate-*r*65.8%
distribute-rgt-out66.7%
Simplified66.7%
if -6.2000000000000001e114 < n < 5.5000000000000002e-5Initial program 38.4%
Taylor expanded in i around 0 57.5%
Final simplification61.6%
(FPCore (i n) :precision binary64 (if (or (<= n -7.5e+231) (not (<= n 2.4e-55))) (* n (+ 100.0 (* i 50.0))) (/ n (+ 0.01 (* i -0.005)))))
double code(double i, double n) {
double tmp;
if ((n <= -7.5e+231) || !(n <= 2.4e-55)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = n / (0.01 + (i * -0.005));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-7.5d+231)) .or. (.not. (n <= 2.4d-55))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = n / (0.01d0 + (i * (-0.005d0)))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -7.5e+231) || !(n <= 2.4e-55)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = n / (0.01 + (i * -0.005));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -7.5e+231) or not (n <= 2.4e-55): tmp = n * (100.0 + (i * 50.0)) else: tmp = n / (0.01 + (i * -0.005)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -7.5e+231) || !(n <= 2.4e-55)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -7.5e+231) || ~((n <= 2.4e-55))) tmp = n * (100.0 + (i * 50.0)); else tmp = n / (0.01 + (i * -0.005)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -7.5e+231], N[Not[LessEqual[n, 2.4e-55]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -7.5 \cdot 10^{+231} \lor \neg \left(n \leq 2.4 \cdot 10^{-55}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\end{array}
\end{array}
if n < -7.50000000000000008e231 or 2.39999999999999991e-55 < n Initial program 15.9%
Taylor expanded in n around inf 43.4%
*-commutative43.4%
associate-/l*43.4%
expm1-def94.6%
Simplified94.6%
Taylor expanded in i around 0 68.1%
associate-*r*68.1%
distribute-rgt-out69.2%
Simplified69.2%
if -7.50000000000000008e231 < n < 2.39999999999999991e-55Initial program 37.2%
Taylor expanded in n around inf 32.1%
*-commutative32.1%
associate-/l*32.2%
expm1-def61.1%
Simplified61.1%
associate-*l/61.2%
associate-/l*61.0%
Applied egg-rr61.0%
Taylor expanded in i around 0 59.7%
*-commutative59.7%
Simplified59.7%
Final simplification63.1%
(FPCore (i n) :precision binary64 (if (<= i -2.0) (* (/ n i) -200.0) (if (<= i 2e-8) (* n 100.0) (* 100.0 (/ i (/ i n))))))
double code(double i, double n) {
double tmp;
if (i <= -2.0) {
tmp = (n / i) * -200.0;
} else if (i <= 2e-8) {
tmp = n * 100.0;
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-2.0d0)) then
tmp = (n / i) * (-200.0d0)
else if (i <= 2d-8) then
tmp = n * 100.0d0
else
tmp = 100.0d0 * (i / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -2.0) {
tmp = (n / i) * -200.0;
} else if (i <= 2e-8) {
tmp = n * 100.0;
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -2.0: tmp = (n / i) * -200.0 elif i <= 2e-8: tmp = n * 100.0 else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if (i <= -2.0) tmp = Float64(Float64(n / i) * -200.0); elseif (i <= 2e-8) tmp = Float64(n * 100.0); else tmp = Float64(100.0 * Float64(i / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -2.0) tmp = (n / i) * -200.0; elseif (i <= 2e-8) tmp = n * 100.0; else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -2.0], N[(N[(n / i), $MachinePrecision] * -200.0), $MachinePrecision], If[LessEqual[i, 2e-8], N[(n * 100.0), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2:\\
\;\;\;\;\frac{n}{i} \cdot -200\\
\mathbf{elif}\;i \leq 2 \cdot 10^{-8}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if i < -2Initial program 65.9%
Taylor expanded in n around inf 77.9%
*-commutative77.9%
associate-/l*77.9%
expm1-def77.9%
Simplified77.9%
associate-*l/78.1%
associate-/l*78.0%
Applied egg-rr78.0%
Taylor expanded in i around 0 34.1%
*-commutative34.1%
Simplified34.1%
Taylor expanded in i around inf 34.1%
if -2 < i < 2e-8Initial program 12.2%
Taylor expanded in i around 0 80.4%
*-commutative80.4%
Simplified80.4%
if 2e-8 < i Initial program 35.9%
Taylor expanded in i around 0 32.9%
Final simplification59.3%
(FPCore (i n) :precision binary64 (if (<= n -1.2e+232) (/ (* 100.0 (* i n)) i) (if (<= n 2.2e-55) (/ n (+ 0.01 (* i -0.005))) (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -1.2e+232) {
tmp = (100.0 * (i * n)) / i;
} else if (n <= 2.2e-55) {
tmp = n / (0.01 + (i * -0.005));
} 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 <= (-1.2d+232)) then
tmp = (100.0d0 * (i * n)) / i
else if (n <= 2.2d-55) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
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 <= -1.2e+232) {
tmp = (100.0 * (i * n)) / i;
} else if (n <= 2.2e-55) {
tmp = n / (0.01 + (i * -0.005));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.2e+232: tmp = (100.0 * (i * n)) / i elif n <= 2.2e-55: tmp = n / (0.01 + (i * -0.005)) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.2e+232) tmp = Float64(Float64(100.0 * Float64(i * n)) / i); elseif (n <= 2.2e-55) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); 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 <= -1.2e+232) tmp = (100.0 * (i * n)) / i; elseif (n <= 2.2e-55) tmp = n / (0.01 + (i * -0.005)); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.2e+232], N[(N[(100.0 * N[(i * n), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], If[LessEqual[n, 2.2e-55], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.2 \cdot 10^{+232}:\\
\;\;\;\;\frac{100 \cdot \left(i \cdot n\right)}{i}\\
\mathbf{elif}\;n \leq 2.2 \cdot 10^{-55}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -1.2000000000000001e232Initial program 8.3%
associate-*r/8.4%
sub-neg8.4%
distribute-lft-in8.4%
metadata-eval8.4%
metadata-eval8.4%
Simplified8.4%
metadata-eval8.4%
metadata-eval8.4%
distribute-lft-in8.4%
sub-neg8.4%
associate-*r/8.3%
associate-/r/8.8%
associate-*r*8.8%
add-exp-log8.8%
expm1-def8.8%
log-pow8.8%
log1p-udef78.8%
Applied egg-rr78.8%
clear-num78.8%
un-div-inv78.9%
Applied egg-rr78.9%
Taylor expanded in n around inf 78.7%
associate-*r/78.8%
expm1-def99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in i around 0 59.7%
*-commutative59.7%
Simplified59.7%
if -1.2000000000000001e232 < n < 2.2e-55Initial program 37.2%
Taylor expanded in n around inf 32.1%
*-commutative32.1%
associate-/l*32.2%
expm1-def61.1%
Simplified61.1%
associate-*l/61.2%
associate-/l*61.0%
Applied egg-rr61.0%
Taylor expanded in i around 0 59.7%
*-commutative59.7%
Simplified59.7%
if 2.2e-55 < n Initial program 17.2%
Taylor expanded in n around inf 37.0%
*-commutative37.0%
associate-/l*37.0%
expm1-def93.6%
Simplified93.6%
Taylor expanded in i around 0 69.7%
associate-*r*69.7%
distribute-rgt-out71.0%
Simplified71.0%
Final simplification63.2%
(FPCore (i n) :precision binary64 (if (or (<= i -2.0) (not (<= i 1.05e+58))) (* (/ n i) -200.0) (* n 100.0)))
double code(double i, double n) {
double tmp;
if ((i <= -2.0) || !(i <= 1.05e+58)) {
tmp = (n / i) * -200.0;
} else {
tmp = n * 100.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((i <= (-2.0d0)) .or. (.not. (i <= 1.05d+58))) then
tmp = (n / i) * (-200.0d0)
else
tmp = n * 100.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((i <= -2.0) || !(i <= 1.05e+58)) {
tmp = (n / i) * -200.0;
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -2.0) or not (i <= 1.05e+58): tmp = (n / i) * -200.0 else: tmp = n * 100.0 return tmp
function code(i, n) tmp = 0.0 if ((i <= -2.0) || !(i <= 1.05e+58)) tmp = Float64(Float64(n / i) * -200.0); else tmp = Float64(n * 100.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((i <= -2.0) || ~((i <= 1.05e+58))) tmp = (n / i) * -200.0; else tmp = n * 100.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[i, -2.0], N[Not[LessEqual[i, 1.05e+58]], $MachinePrecision]], N[(N[(n / i), $MachinePrecision] * -200.0), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2 \lor \neg \left(i \leq 1.05 \cdot 10^{+58}\right):\\
\;\;\;\;\frac{n}{i} \cdot -200\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if i < -2 or 1.05000000000000006e58 < i Initial program 55.4%
Taylor expanded in n around inf 59.3%
*-commutative59.3%
associate-/l*59.3%
expm1-def59.3%
Simplified59.3%
associate-*l/59.4%
associate-/l*59.3%
Applied egg-rr59.3%
Taylor expanded in i around 0 36.2%
*-commutative36.2%
Simplified36.2%
Taylor expanded in i around inf 36.2%
if -2 < i < 1.05000000000000006e58Initial program 12.6%
Taylor expanded in i around 0 73.7%
*-commutative73.7%
Simplified73.7%
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%
Taylor expanded in i around 0 50.1%
associate-*r*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%
Taylor expanded in i around 0 47.1%
*-commutative47.1%
Simplified47.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))))