
(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 20 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 -1e-158)
(/ (+ (* t_0 100.0) -100.0) (/ i n))
(if (<= t_1 2e-241)
(* n (/ (* 100.0 (expm1 (* n (log1p (/ i n))))) i))
(if (<= t_1 INFINITY)
(* n (/ (fma 100.0 t_0 -100.0) i))
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005)))))))))
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 <= -1e-158) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else if (t_1 <= 2e-241) {
tmp = n * ((100.0 * expm1((n * log1p((i / n))))) / i);
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (fma(100.0, t_0, -100.0) / i);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
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 <= -1e-158) tmp = Float64(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n)); elseif (t_1 <= 2e-241) tmp = Float64(n * Float64(Float64(100.0 * expm1(Float64(n * log1p(Float64(i / n))))) / i)); elseif (t_1 <= Inf) tmp = Float64(n * Float64(fma(100.0, t_0, -100.0) / i)); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); 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, -1e-158], N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-241], N[(n * N[(N[(100.0 * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(100.0 * t$95$0 + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $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 -1 \cdot 10^{-158}:\\
\;\;\;\;\frac{t\_0 \cdot 100 + -100}{\frac{i}{n}}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-241}:\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{\mathsf{fma}\left(100, t\_0, -100\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -1.00000000000000006e-158Initial program 99.6%
associate-*r/99.9%
sub-neg99.9%
distribute-rgt-in99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
if -1.00000000000000006e-158 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 1.9999999999999999e-241Initial program 18.6%
associate-/r/18.3%
associate-*r*18.3%
*-commutative18.3%
associate-*r/18.3%
sub-neg18.3%
distribute-lft-in18.3%
metadata-eval18.3%
metadata-eval18.3%
metadata-eval18.3%
fma-define18.3%
metadata-eval18.3%
Simplified18.3%
fma-undefine18.3%
metadata-eval18.3%
metadata-eval18.3%
distribute-lft-in18.3%
sub-neg18.3%
*-commutative18.3%
add-exp-log18.3%
expm1-define18.3%
log-pow27.1%
log1p-define97.7%
Applied egg-rr97.7%
if 1.9999999999999999e-241 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 96.6%
associate-/r/96.5%
associate-*r*96.6%
*-commutative96.6%
associate-*r/96.8%
sub-neg96.8%
distribute-lft-in96.6%
metadata-eval96.6%
metadata-eval96.6%
metadata-eval96.6%
fma-define96.8%
metadata-eval96.8%
Simplified96.8%
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-define77.6%
Simplified77.6%
*-commutative77.6%
*-commutative77.6%
associate-*r*77.6%
associate-/l*77.6%
*-commutative77.6%
clear-num77.5%
un-div-inv77.3%
*-un-lft-identity77.3%
times-frac77.5%
metadata-eval77.5%
Applied egg-rr77.5%
Taylor expanded in i around 0 99.8%
Final simplification98.1%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n))) (t_1 (* t_0 100.0)))
(if (<= t_0 -4e-294)
t_1
(if (<= t_0 0.0)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= t_0 INFINITY)
t_1
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005)))))))))
double code(double i, double n) {
double t_0 = (pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double t_1 = t_0 * 100.0;
double tmp;
if (t_0 <= -4e-294) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = (Math.pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double t_1 = t_0 * 100.0;
double tmp;
if (t_0 <= -4e-294) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = (math.pow((1.0 + (i / n)), n) + -1.0) / (i / n) t_1 = t_0 * 100.0 tmp = 0 if t_0 <= -4e-294: tmp = t_1 elif t_0 <= 0.0: tmp = 100.0 * (n * (math.expm1(i) / i)) elif t_0 <= math.inf: tmp = t_1 else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) return tmp
function code(i, n) t_0 = Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) t_1 = Float64(t_0 * 100.0) tmp = 0.0 if (t_0 <= -4e-294) tmp = t_1; elseif (t_0 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (t_0 <= Inf) tmp = t_1; else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * 100.0), $MachinePrecision]}, If[LessEqual[t$95$0, -4e-294], t$95$1, If[LessEqual[t$95$0, 0.0], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], t$95$1, N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
t_1 := t\_0 \cdot 100\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-294}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -4.00000000000000007e-294 or -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 96.7%
if -4.00000000000000007e-294 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 17.5%
Taylor expanded in n around inf 35.3%
*-commutative35.3%
associate-/l*35.3%
expm1-define84.0%
Simplified84.0%
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-define77.6%
Simplified77.6%
*-commutative77.6%
*-commutative77.6%
associate-*r*77.6%
associate-/l*77.6%
*-commutative77.6%
clear-num77.5%
un-div-inv77.3%
*-un-lft-identity77.3%
times-frac77.5%
metadata-eval77.5%
Applied egg-rr77.5%
Taylor expanded in i around 0 99.8%
Final simplification88.8%
(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 -4e-294)
(* t_1 100.0)
(if (<= t_1 0.0)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= t_1 INFINITY)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005)))))))))
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 <= -4e-294) {
tmp = t_1 * 100.0;
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
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 <= -4e-294) {
tmp = t_1 * 100.0;
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
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 <= -4e-294: tmp = t_1 * 100.0 elif t_1 <= 0.0: tmp = 100.0 * (n * (math.expm1(i) / i)) elif t_1 <= math.inf: tmp = n * (((t_0 * 100.0) + -100.0) / i) else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) 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 <= -4e-294) tmp = Float64(t_1 * 100.0); elseif (t_1 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); 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, -4e-294], N[(t$95$1 * 100.0), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $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 -4 \cdot 10^{-294}:\\
\;\;\;\;t\_1 \cdot 100\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{t\_0 \cdot 100 + -100}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -4.00000000000000007e-294Initial program 97.6%
if -4.00000000000000007e-294 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 17.5%
Taylor expanded in n around inf 35.3%
*-commutative35.3%
associate-/l*35.3%
expm1-define84.0%
Simplified84.0%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 96.0%
associate-/r/95.9%
associate-*r*96.0%
*-commutative96.0%
associate-*r/96.2%
sub-neg96.2%
distribute-lft-in96.1%
metadata-eval96.1%
metadata-eval96.1%
metadata-eval96.1%
fma-define96.2%
metadata-eval96.2%
Simplified96.2%
fma-undefine96.1%
*-commutative96.1%
Applied egg-rr96.1%
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-define77.6%
Simplified77.6%
*-commutative77.6%
*-commutative77.6%
associate-*r*77.6%
associate-/l*77.6%
*-commutative77.6%
clear-num77.5%
un-div-inv77.3%
*-un-lft-identity77.3%
times-frac77.5%
metadata-eval77.5%
Applied egg-rr77.5%
Taylor expanded in i around 0 99.8%
Final simplification88.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n))
(t_1 (/ (+ t_0 -1.0) (/ i n)))
(t_2 (+ (* t_0 100.0) -100.0)))
(if (<= t_1 -4e-294)
(/ t_2 (/ i n))
(if (<= t_1 0.0)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= t_1 INFINITY)
(* n (/ t_2 i))
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005)))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double t_2 = (t_0 * 100.0) + -100.0;
double tmp;
if (t_1 <= -4e-294) {
tmp = t_2 / (i / n);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (t_2 / i);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
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 t_2 = (t_0 * 100.0) + -100.0;
double tmp;
if (t_1 <= -4e-294) {
tmp = t_2 / (i / n);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * (t_2 / i);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) t_2 = (t_0 * 100.0) + -100.0 tmp = 0 if t_1 <= -4e-294: tmp = t_2 / (i / n) elif t_1 <= 0.0: tmp = 100.0 * (n * (math.expm1(i) / i)) elif t_1 <= math.inf: tmp = n * (t_2 / i) else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) t_2 = Float64(Float64(t_0 * 100.0) + -100.0) tmp = 0.0 if (t_1 <= -4e-294) tmp = Float64(t_2 / Float64(i / n)); elseif (t_1 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(t_2 / i)); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-294], N[(t$95$2 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(t$95$2 / i), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
t_2 := t\_0 \cdot 100 + -100\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-294}:\\
\;\;\;\;\frac{t\_2}{\frac{i}{n}}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{t\_2}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -4.00000000000000007e-294Initial program 97.6%
associate-*r/97.9%
sub-neg97.9%
distribute-rgt-in97.8%
metadata-eval97.8%
metadata-eval97.8%
Simplified97.8%
if -4.00000000000000007e-294 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 17.5%
Taylor expanded in n around inf 35.3%
*-commutative35.3%
associate-/l*35.3%
expm1-define84.0%
Simplified84.0%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 96.0%
associate-/r/95.9%
associate-*r*96.0%
*-commutative96.0%
associate-*r/96.2%
sub-neg96.2%
distribute-lft-in96.1%
metadata-eval96.1%
metadata-eval96.1%
metadata-eval96.1%
fma-define96.2%
metadata-eval96.2%
Simplified96.2%
fma-undefine96.1%
*-commutative96.1%
Applied egg-rr96.1%
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-define77.6%
Simplified77.6%
*-commutative77.6%
*-commutative77.6%
associate-*r*77.6%
associate-/l*77.6%
*-commutative77.6%
clear-num77.5%
un-div-inv77.3%
*-un-lft-identity77.3%
times-frac77.5%
metadata-eval77.5%
Applied egg-rr77.5%
Taylor expanded in i around 0 99.8%
Final simplification88.9%
(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 -1e-158)
(/ (+ (* t_0 100.0) -100.0) (/ i n))
(if (<= t_1 2e-241)
(* n (/ (* 100.0 (expm1 (* n (log1p (/ i n))))) i))
(if (<= t_1 INFINITY)
(* t_1 100.0)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005)))))))))
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 <= -1e-158) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else if (t_1 <= 2e-241) {
tmp = n * ((100.0 * expm1((n * log1p((i / n))))) / i);
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_1 * 100.0;
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
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 <= -1e-158) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else if (t_1 <= 2e-241) {
tmp = n * ((100.0 * Math.expm1((n * Math.log1p((i / n))))) / i);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1 * 100.0;
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
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 <= -1e-158: tmp = ((t_0 * 100.0) + -100.0) / (i / n) elif t_1 <= 2e-241: tmp = n * ((100.0 * math.expm1((n * math.log1p((i / n))))) / i) elif t_1 <= math.inf: tmp = t_1 * 100.0 else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) 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 <= -1e-158) tmp = Float64(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n)); elseif (t_1 <= 2e-241) tmp = Float64(n * Float64(Float64(100.0 * expm1(Float64(n * log1p(Float64(i / n))))) / i)); elseif (t_1 <= Inf) tmp = Float64(t_1 * 100.0); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); 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, -1e-158], N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-241], N[(n * N[(N[(100.0 * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(t$95$1 * 100.0), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $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 -1 \cdot 10^{-158}:\\
\;\;\;\;\frac{t\_0 \cdot 100 + -100}{\frac{i}{n}}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-241}:\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1 \cdot 100\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -1.00000000000000006e-158Initial program 99.6%
associate-*r/99.9%
sub-neg99.9%
distribute-rgt-in99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
if -1.00000000000000006e-158 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 1.9999999999999999e-241Initial program 18.6%
associate-/r/18.3%
associate-*r*18.3%
*-commutative18.3%
associate-*r/18.3%
sub-neg18.3%
distribute-lft-in18.3%
metadata-eval18.3%
metadata-eval18.3%
metadata-eval18.3%
fma-define18.3%
metadata-eval18.3%
Simplified18.3%
fma-undefine18.3%
metadata-eval18.3%
metadata-eval18.3%
distribute-lft-in18.3%
sub-neg18.3%
*-commutative18.3%
add-exp-log18.3%
expm1-define18.3%
log-pow27.1%
log1p-define97.7%
Applied egg-rr97.7%
if 1.9999999999999999e-241 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 96.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-define77.6%
Simplified77.6%
*-commutative77.6%
*-commutative77.6%
associate-*r*77.6%
associate-/l*77.6%
*-commutative77.6%
clear-num77.5%
un-div-inv77.3%
*-un-lft-identity77.3%
times-frac77.5%
metadata-eval77.5%
Applied egg-rr77.5%
Taylor expanded in i around 0 99.8%
Final simplification98.1%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ (expm1 i) (/ i n)))))
(if (<= i -2.5e-32)
t_0
(if (<= i 3.8e-34)
(+ (* i -50.0) (* n (+ 100.0 (* i 50.0))))
(if (<= i 2.35e+247)
t_0
(if (<= i 2.4e+295) (/ n (+ 0.01 (* i -0.005))) (* 50.0 (* i n))))))))
double code(double i, double n) {
double t_0 = 100.0 * (expm1(i) / (i / n));
double tmp;
if (i <= -2.5e-32) {
tmp = t_0;
} else if (i <= 3.8e-34) {
tmp = (i * -50.0) + (n * (100.0 + (i * 50.0)));
} else if (i <= 2.35e+247) {
tmp = t_0;
} else if (i <= 2.4e+295) {
tmp = n / (0.01 + (i * -0.005));
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (Math.expm1(i) / (i / n));
double tmp;
if (i <= -2.5e-32) {
tmp = t_0;
} else if (i <= 3.8e-34) {
tmp = (i * -50.0) + (n * (100.0 + (i * 50.0)));
} else if (i <= 2.35e+247) {
tmp = t_0;
} else if (i <= 2.4e+295) {
tmp = n / (0.01 + (i * -0.005));
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (math.expm1(i) / (i / n)) tmp = 0 if i <= -2.5e-32: tmp = t_0 elif i <= 3.8e-34: tmp = (i * -50.0) + (n * (100.0 + (i * 50.0))) elif i <= 2.35e+247: tmp = t_0 elif i <= 2.4e+295: tmp = n / (0.01 + (i * -0.005)) else: tmp = 50.0 * (i * n) return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(expm1(i) / Float64(i / n))) tmp = 0.0 if (i <= -2.5e-32) tmp = t_0; elseif (i <= 3.8e-34) tmp = Float64(Float64(i * -50.0) + Float64(n * Float64(100.0 + Float64(i * 50.0)))); elseif (i <= 2.35e+247) tmp = t_0; elseif (i <= 2.4e+295) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); else tmp = Float64(50.0 * Float64(i * n)); 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, -2.5e-32], t$95$0, If[LessEqual[i, 3.8e-34], N[(N[(i * -50.0), $MachinePrecision] + N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 2.35e+247], t$95$0, If[LessEqual[i, 2.4e+295], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{if}\;i \leq -2.5 \cdot 10^{-32}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;i \leq 3.8 \cdot 10^{-34}:\\
\;\;\;\;i \cdot -50 + n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{elif}\;i \leq 2.35 \cdot 10^{+247}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;i \leq 2.4 \cdot 10^{+295}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < -2.5e-32 or 3.8000000000000001e-34 < i < 2.3500000000000001e247Initial program 52.2%
Taylor expanded in n around inf 67.3%
expm1-define69.9%
Simplified69.9%
if -2.5e-32 < i < 3.8000000000000001e-34Initial program 6.8%
associate-/r/7.3%
associate-*r*7.3%
*-commutative7.3%
associate-*r/7.3%
sub-neg7.3%
distribute-lft-in7.3%
metadata-eval7.3%
metadata-eval7.3%
metadata-eval7.3%
fma-define7.3%
metadata-eval7.3%
Simplified7.3%
Taylor expanded in i around 0 90.3%
*-commutative90.3%
associate-*r/90.3%
metadata-eval90.3%
Simplified90.3%
Taylor expanded in n around 0 90.4%
if 2.3500000000000001e247 < i < 2.40000000000000005e295Initial program 30.0%
Taylor expanded in n around inf 21.2%
*-commutative21.2%
associate-/l*21.2%
expm1-define21.2%
Simplified21.2%
*-commutative21.2%
*-commutative21.2%
associate-*r*21.2%
associate-/l*21.2%
*-commutative21.2%
clear-num21.2%
un-div-inv21.2%
*-un-lft-identity21.2%
times-frac21.2%
metadata-eval21.2%
Applied egg-rr21.2%
Taylor expanded in i around 0 62.8%
*-commutative62.8%
Simplified62.8%
if 2.40000000000000005e295 < i Initial program 100.0%
Taylor expanded in n around inf 100.0%
*-commutative100.0%
associate-/l*100.0%
expm1-define100.0%
Simplified100.0%
*-commutative100.0%
associate-*r/100.0%
associate-*r/100.0%
Applied egg-rr100.0%
Taylor expanded in i around 0 100.0%
+-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in i around inf 100.0%
Final simplification80.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (/ (* 100.0 (expm1 i)) i))))
(if (<= n -4.4e-220)
t_0
(if (<= n 1e-227)
0.0
(if (<= n 1.95)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
t_0)))))
double code(double i, double n) {
double t_0 = n * ((100.0 * expm1(i)) / i);
double tmp;
if (n <= -4.4e-220) {
tmp = t_0;
} else if (n <= 1e-227) {
tmp = 0.0;
} else if (n <= 1.95) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = n * ((100.0 * Math.expm1(i)) / i);
double tmp;
if (n <= -4.4e-220) {
tmp = t_0;
} else if (n <= 1e-227) {
tmp = 0.0;
} else if (n <= 1.95) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * ((100.0 * math.expm1(i)) / i) tmp = 0 if n <= -4.4e-220: tmp = t_0 elif n <= 1e-227: tmp = 0.0 elif n <= 1.95: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)) tmp = 0.0 if (n <= -4.4e-220) tmp = t_0; elseif (n <= 1e-227) tmp = 0.0; elseif (n <= 1.95) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -4.4e-220], t$95$0, If[LessEqual[n, 1e-227], 0.0, If[LessEqual[n, 1.95], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{if}\;n \leq -4.4 \cdot 10^{-220}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 10^{-227}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 1.95:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -4.39999999999999973e-220 or 1.94999999999999996 < n Initial program 25.3%
associate-/r/25.3%
associate-*r*25.4%
*-commutative25.4%
associate-*r/25.4%
sub-neg25.4%
distribute-lft-in25.4%
metadata-eval25.4%
metadata-eval25.4%
metadata-eval25.4%
fma-define25.4%
metadata-eval25.4%
Simplified25.4%
Taylor expanded in n around inf 37.0%
sub-neg37.0%
metadata-eval37.0%
metadata-eval37.0%
distribute-lft-in37.0%
metadata-eval37.0%
sub-neg37.0%
expm1-define89.0%
Simplified89.0%
if -4.39999999999999973e-220 < n < 9.99999999999999945e-228Initial program 73.3%
associate-*r/73.3%
sub-neg73.3%
distribute-rgt-in73.3%
metadata-eval73.3%
metadata-eval73.3%
Simplified73.3%
Taylor expanded in i around 0 74.1%
+-commutative74.1%
Simplified74.1%
Taylor expanded in i around 0 82.4%
Taylor expanded in i around 0 82.4%
if 9.99999999999999945e-228 < n < 1.94999999999999996Initial program 15.3%
Taylor expanded in n around inf 3.4%
*-commutative3.4%
associate-/l*3.4%
expm1-define53.1%
Simplified53.1%
*-commutative53.1%
*-commutative53.1%
associate-*r*53.1%
associate-/l*53.0%
*-commutative53.0%
clear-num53.0%
un-div-inv52.9%
*-un-lft-identity52.9%
times-frac53.0%
metadata-eval53.0%
Applied egg-rr53.0%
Taylor expanded in i around 0 77.7%
Final simplification86.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (* n (/ (expm1 i) i)))))
(if (<= n -6e-222)
t_0
(if (<= n 5.8e-228)
0.0
(if (<= n 1.0)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (n * (expm1(i) / i));
double tmp;
if (n <= -6e-222) {
tmp = t_0;
} else if (n <= 5.8e-228) {
tmp = 0.0;
} else if (n <= 1.0) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (n * (Math.expm1(i) / i));
double tmp;
if (n <= -6e-222) {
tmp = t_0;
} else if (n <= 5.8e-228) {
tmp = 0.0;
} else if (n <= 1.0) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n * (math.expm1(i) / i)) tmp = 0 if n <= -6e-222: tmp = t_0 elif n <= 5.8e-228: tmp = 0.0 elif n <= 1.0: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n * Float64(expm1(i) / i))) tmp = 0.0 if (n <= -6e-222) tmp = t_0; elseif (n <= 5.8e-228) tmp = 0.0; elseif (n <= 1.0) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -6e-222], t$95$0, If[LessEqual[n, 5.8e-228], 0.0, If[LessEqual[n, 1.0], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{if}\;n \leq -6 \cdot 10^{-222}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 5.8 \cdot 10^{-228}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 1:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -6.00000000000000059e-222 or 1 < n Initial program 25.3%
Taylor expanded in n around inf 37.0%
*-commutative37.0%
associate-/l*36.9%
expm1-define89.1%
Simplified89.1%
if -6.00000000000000059e-222 < n < 5.8000000000000002e-228Initial program 73.3%
associate-*r/73.3%
sub-neg73.3%
distribute-rgt-in73.3%
metadata-eval73.3%
metadata-eval73.3%
Simplified73.3%
Taylor expanded in i around 0 74.1%
+-commutative74.1%
Simplified74.1%
Taylor expanded in i around 0 82.4%
Taylor expanded in i around 0 82.4%
if 5.8000000000000002e-228 < n < 1Initial program 15.3%
Taylor expanded in n around inf 3.4%
*-commutative3.4%
associate-/l*3.4%
expm1-define53.1%
Simplified53.1%
*-commutative53.1%
*-commutative53.1%
associate-*r*53.1%
associate-/l*53.0%
*-commutative53.0%
clear-num53.0%
un-div-inv52.9%
*-un-lft-identity52.9%
times-frac53.0%
metadata-eval53.0%
Applied egg-rr53.0%
Taylor expanded in i around 0 77.7%
Final simplification86.6%
(FPCore (i n)
:precision binary64
(if (<= n -2.75e+194)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n 1.0)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
(/
(*
i
(+
(* n 100.0)
(*
i
(+
(* n 50.0)
(* (* i n) (+ 16.666666666666668 (* i 4.166666666666667)))))))
i))))
double code(double i, double n) {
double tmp;
if (n <= -2.75e+194) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 1.0) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = (i * ((n * 100.0) + (i * ((n * 50.0) + ((i * n) * (16.666666666666668 + (i * 4.166666666666667))))))) / i;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.75d+194)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= 1.0d0) then
tmp = n / (0.01d0 + (i * ((i * 0.0008333333333333334d0) - 0.005d0)))
else
tmp = (i * ((n * 100.0d0) + (i * ((n * 50.0d0) + ((i * n) * (16.666666666666668d0 + (i * 4.166666666666667d0))))))) / i
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.75e+194) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 1.0) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = (i * ((n * 100.0) + (i * ((n * 50.0) + ((i * n) * (16.666666666666668 + (i * 4.166666666666667))))))) / i;
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.75e+194: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= 1.0: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = (i * ((n * 100.0) + (i * ((n * 50.0) + ((i * n) * (16.666666666666668 + (i * 4.166666666666667))))))) / i return tmp
function code(i, n) tmp = 0.0 if (n <= -2.75e+194) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= 1.0) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); else tmp = Float64(Float64(i * Float64(Float64(n * 100.0) + Float64(i * Float64(Float64(n * 50.0) + Float64(Float64(i * n) * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))) / i); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.75e+194) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= 1.0) tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))); else tmp = (i * ((n * 100.0) + (i * ((n * 50.0) + ((i * n) * (16.666666666666668 + (i * 4.166666666666667))))))) / i; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.75e+194], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.0], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(i * N[(N[(n * 100.0), $MachinePrecision] + N[(i * N[(N[(n * 50.0), $MachinePrecision] + N[(N[(i * n), $MachinePrecision] * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.75 \cdot 10^{+194}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq 1:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{i \cdot \left(n \cdot 100 + i \cdot \left(n \cdot 50 + \left(i \cdot n\right) \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)}{i}\\
\end{array}
\end{array}
if n < -2.75e194Initial program 8.9%
associate-/r/9.5%
associate-*r*9.6%
*-commutative9.6%
associate-*r/9.6%
sub-neg9.6%
distribute-lft-in9.6%
metadata-eval9.6%
metadata-eval9.6%
metadata-eval9.6%
fma-define9.6%
metadata-eval9.6%
Simplified9.6%
Taylor expanded in n around inf 48.0%
sub-neg48.0%
metadata-eval48.0%
metadata-eval48.0%
distribute-lft-in48.0%
metadata-eval48.0%
sub-neg48.0%
expm1-define99.7%
Simplified99.7%
Taylor expanded in i around 0 68.7%
*-commutative68.7%
Simplified68.7%
if -2.75e194 < n < 1Initial program 34.1%
Taylor expanded in n around inf 25.3%
*-commutative25.3%
associate-/l*25.3%
expm1-define66.0%
Simplified66.0%
*-commutative66.0%
*-commutative66.0%
associate-*r*66.0%
associate-/l*65.9%
*-commutative65.9%
clear-num65.9%
un-div-inv65.9%
*-un-lft-identity65.9%
times-frac66.0%
metadata-eval66.0%
Applied egg-rr66.0%
Taylor expanded in i around 0 67.0%
if 1 < n Initial program 25.0%
Taylor expanded in n around inf 43.8%
*-commutative43.8%
associate-/l*43.8%
expm1-define94.4%
Simplified94.4%
*-commutative94.4%
associate-*r/94.3%
associate-*r/94.2%
Applied egg-rr94.2%
Taylor expanded in i around 0 82.4%
Taylor expanded in n around 0 82.4%
associate-*r*82.4%
*-commutative82.4%
*-commutative82.4%
Simplified82.4%
Final simplification71.6%
(FPCore (i n)
:precision binary64
(if (<= n -2.45e+194)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n 1.0)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
(+
(* n 100.0)
(*
i
(+
(* n 50.0)
(* i (+ (* (* i n) 4.166666666666667) (* n 16.666666666666668)))))))))
double code(double i, double n) {
double tmp;
if (n <= -2.45e+194) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 1.0) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = (n * 100.0) + (i * ((n * 50.0) + (i * (((i * n) * 4.166666666666667) + (n * 16.666666666666668)))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.45d+194)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= 1.0d0) then
tmp = n / (0.01d0 + (i * ((i * 0.0008333333333333334d0) - 0.005d0)))
else
tmp = (n * 100.0d0) + (i * ((n * 50.0d0) + (i * (((i * n) * 4.166666666666667d0) + (n * 16.666666666666668d0)))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.45e+194) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 1.0) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = (n * 100.0) + (i * ((n * 50.0) + (i * (((i * n) * 4.166666666666667) + (n * 16.666666666666668)))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.45e+194: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= 1.0: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = (n * 100.0) + (i * ((n * 50.0) + (i * (((i * n) * 4.166666666666667) + (n * 16.666666666666668))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.45e+194) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= 1.0) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); else tmp = Float64(Float64(n * 100.0) + Float64(i * Float64(Float64(n * 50.0) + Float64(i * Float64(Float64(Float64(i * n) * 4.166666666666667) + Float64(n * 16.666666666666668)))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.45e+194) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= 1.0) tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))); else tmp = (n * 100.0) + (i * ((n * 50.0) + (i * (((i * n) * 4.166666666666667) + (n * 16.666666666666668))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.45e+194], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.0], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] + N[(i * N[(N[(n * 50.0), $MachinePrecision] + N[(i * N[(N[(N[(i * n), $MachinePrecision] * 4.166666666666667), $MachinePrecision] + N[(n * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.45 \cdot 10^{+194}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq 1:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100 + i \cdot \left(n \cdot 50 + i \cdot \left(\left(i \cdot n\right) \cdot 4.166666666666667 + n \cdot 16.666666666666668\right)\right)\\
\end{array}
\end{array}
if n < -2.45000000000000013e194Initial program 8.9%
associate-/r/9.5%
associate-*r*9.6%
*-commutative9.6%
associate-*r/9.6%
sub-neg9.6%
distribute-lft-in9.6%
metadata-eval9.6%
metadata-eval9.6%
metadata-eval9.6%
fma-define9.6%
metadata-eval9.6%
Simplified9.6%
Taylor expanded in n around inf 48.0%
sub-neg48.0%
metadata-eval48.0%
metadata-eval48.0%
distribute-lft-in48.0%
metadata-eval48.0%
sub-neg48.0%
expm1-define99.7%
Simplified99.7%
Taylor expanded in i around 0 68.7%
*-commutative68.7%
Simplified68.7%
if -2.45000000000000013e194 < n < 1Initial program 34.1%
Taylor expanded in n around inf 25.3%
*-commutative25.3%
associate-/l*25.3%
expm1-define66.0%
Simplified66.0%
*-commutative66.0%
*-commutative66.0%
associate-*r*66.0%
associate-/l*65.9%
*-commutative65.9%
clear-num65.9%
un-div-inv65.9%
*-un-lft-identity65.9%
times-frac66.0%
metadata-eval66.0%
Applied egg-rr66.0%
Taylor expanded in i around 0 67.0%
if 1 < n Initial program 25.0%
Taylor expanded in n around inf 43.8%
*-commutative43.8%
associate-/l*43.8%
expm1-define94.4%
Simplified94.4%
Taylor expanded in i around 0 81.2%
Final simplification71.2%
(FPCore (i n)
:precision binary64
(if (<= n -2.3e-220)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 3.9e-228)
0.0
(if (<= n 1.7)
(* 100.0 (/ i (/ i n)))
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))))))
double code(double i, double n) {
double tmp;
if (n <= -2.3e-220) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 3.9e-228) {
tmp = 0.0;
} else if (n <= 1.7) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.3d-220)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 3.9d-228) then
tmp = 0.0d0
else if (n <= 1.7d0) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.3e-220) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 3.9e-228) {
tmp = 0.0;
} else if (n <= 1.7) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.3e-220: tmp = n / (0.01 + (i * -0.005)) elif n <= 3.9e-228: tmp = 0.0 elif n <= 1.7: tmp = 100.0 * (i / (i / n)) else: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.3e-220) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 3.9e-228) tmp = 0.0; elseif (n <= 1.7) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.3e-220) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 3.9e-228) tmp = 0.0; elseif (n <= 1.7) tmp = 100.0 * (i / (i / n)); else tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.3e-220], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.9e-228], 0.0, If[LessEqual[n, 1.7], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.3 \cdot 10^{-220}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 3.9 \cdot 10^{-228}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 1.7:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\end{array}
\end{array}
if n < -2.29999999999999981e-220Initial program 25.5%
Taylor expanded in n around inf 32.8%
*-commutative32.8%
associate-/l*32.8%
expm1-define85.8%
Simplified85.8%
*-commutative85.8%
*-commutative85.8%
associate-*r*85.9%
associate-/l*85.8%
*-commutative85.8%
clear-num85.7%
un-div-inv85.7%
*-un-lft-identity85.7%
times-frac85.8%
metadata-eval85.8%
Applied egg-rr85.8%
Taylor expanded in i around 0 63.9%
*-commutative63.9%
Simplified63.9%
if -2.29999999999999981e-220 < n < 3.90000000000000029e-228Initial program 73.3%
associate-*r/73.3%
sub-neg73.3%
distribute-rgt-in73.3%
metadata-eval73.3%
metadata-eval73.3%
Simplified73.3%
Taylor expanded in i around 0 74.1%
+-commutative74.1%
Simplified74.1%
Taylor expanded in i around 0 82.4%
Taylor expanded in i around 0 82.4%
if 3.90000000000000029e-228 < n < 1.69999999999999996Initial program 15.3%
Taylor expanded in i around 0 72.5%
if 1.69999999999999996 < n Initial program 25.0%
associate-/r/25.3%
associate-*r*25.3%
*-commutative25.3%
associate-*r/25.3%
sub-neg25.3%
distribute-lft-in25.3%
metadata-eval25.3%
metadata-eval25.3%
metadata-eval25.3%
fma-define25.3%
metadata-eval25.3%
Simplified25.3%
Taylor expanded in n around inf 43.8%
sub-neg43.8%
metadata-eval43.8%
metadata-eval43.8%
distribute-lft-in43.8%
metadata-eval43.8%
sub-neg43.8%
expm1-define94.4%
Simplified94.4%
Taylor expanded in i around 0 73.5%
*-commutative73.5%
Simplified73.5%
Final simplification69.6%
(FPCore (i n)
:precision binary64
(if (<= n -9.6e-219)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 2e-230)
0.0
(if (<= n 1.55)
(* 100.0 (/ i (/ i n)))
(* n (/ (* i (+ 100.0 (* i 50.0))) i))))))
double code(double i, double n) {
double tmp;
if (n <= -9.6e-219) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 2e-230) {
tmp = 0.0;
} else if (n <= 1.55) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * ((i * (100.0 + (i * 50.0))) / i);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-9.6d-219)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 2d-230) then
tmp = 0.0d0
else if (n <= 1.55d0) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = n * ((i * (100.0d0 + (i * 50.0d0))) / i)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -9.6e-219) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 2e-230) {
tmp = 0.0;
} else if (n <= 1.55) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * ((i * (100.0 + (i * 50.0))) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -9.6e-219: tmp = n / (0.01 + (i * -0.005)) elif n <= 2e-230: tmp = 0.0 elif n <= 1.55: tmp = 100.0 * (i / (i / n)) else: tmp = n * ((i * (100.0 + (i * 50.0))) / i) return tmp
function code(i, n) tmp = 0.0 if (n <= -9.6e-219) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 2e-230) tmp = 0.0; elseif (n <= 1.55) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(n * Float64(Float64(i * Float64(100.0 + Float64(i * 50.0))) / i)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -9.6e-219) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 2e-230) tmp = 0.0; elseif (n <= 1.55) tmp = 100.0 * (i / (i / n)); else tmp = n * ((i * (100.0 + (i * 50.0))) / i); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -9.6e-219], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2e-230], 0.0, If[LessEqual[n, 1.55], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(N[(i * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -9.6 \cdot 10^{-219}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 2 \cdot 10^{-230}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 1.55:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{i \cdot \left(100 + i \cdot 50\right)}{i}\\
\end{array}
\end{array}
if n < -9.60000000000000056e-219Initial program 25.5%
Taylor expanded in n around inf 32.8%
*-commutative32.8%
associate-/l*32.8%
expm1-define85.8%
Simplified85.8%
*-commutative85.8%
*-commutative85.8%
associate-*r*85.9%
associate-/l*85.8%
*-commutative85.8%
clear-num85.7%
un-div-inv85.7%
*-un-lft-identity85.7%
times-frac85.8%
metadata-eval85.8%
Applied egg-rr85.8%
Taylor expanded in i around 0 63.9%
*-commutative63.9%
Simplified63.9%
if -9.60000000000000056e-219 < n < 2.00000000000000009e-230Initial program 73.3%
associate-*r/73.3%
sub-neg73.3%
distribute-rgt-in73.3%
metadata-eval73.3%
metadata-eval73.3%
Simplified73.3%
Taylor expanded in i around 0 74.1%
+-commutative74.1%
Simplified74.1%
Taylor expanded in i around 0 82.4%
Taylor expanded in i around 0 82.4%
if 2.00000000000000009e-230 < n < 1.55000000000000004Initial program 15.3%
Taylor expanded in i around 0 72.5%
if 1.55000000000000004 < n Initial program 25.0%
associate-/r/25.3%
associate-*r*25.3%
*-commutative25.3%
associate-*r/25.3%
sub-neg25.3%
distribute-lft-in25.3%
metadata-eval25.3%
metadata-eval25.3%
metadata-eval25.3%
fma-define25.3%
metadata-eval25.3%
Simplified25.3%
Taylor expanded in i around 0 74.4%
*-commutative74.4%
associate-*r/74.4%
metadata-eval74.4%
Simplified74.4%
Taylor expanded in n around inf 74.4%
*-commutative74.4%
Simplified74.4%
Final simplification69.9%
(FPCore (i n)
:precision binary64
(if (<= n -3.2e+194)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n 1.0)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
(*
n
(+
100.0
(* i (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667))))))))))
double code(double i, double n) {
double tmp;
if (n <= -3.2e+194) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 1.0) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-3.2d+194)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= 1.0d0) then
tmp = n / (0.01d0 + (i * ((i * 0.0008333333333333334d0) - 0.005d0)))
else
tmp = n * (100.0d0 + (i * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -3.2e+194) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 1.0) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -3.2e+194: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= 1.0: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -3.2e+194) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= 1.0) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); else tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -3.2e+194) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= 1.0) tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))); else tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -3.2e+194], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.0], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.2 \cdot 10^{+194}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq 1:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\end{array}
\end{array}
if n < -3.20000000000000021e194Initial program 8.9%
associate-/r/9.5%
associate-*r*9.6%
*-commutative9.6%
associate-*r/9.6%
sub-neg9.6%
distribute-lft-in9.6%
metadata-eval9.6%
metadata-eval9.6%
metadata-eval9.6%
fma-define9.6%
metadata-eval9.6%
Simplified9.6%
Taylor expanded in n around inf 48.0%
sub-neg48.0%
metadata-eval48.0%
metadata-eval48.0%
distribute-lft-in48.0%
metadata-eval48.0%
sub-neg48.0%
expm1-define99.7%
Simplified99.7%
Taylor expanded in i around 0 68.7%
*-commutative68.7%
Simplified68.7%
if -3.20000000000000021e194 < n < 1Initial program 34.1%
Taylor expanded in n around inf 25.3%
*-commutative25.3%
associate-/l*25.3%
expm1-define66.0%
Simplified66.0%
*-commutative66.0%
*-commutative66.0%
associate-*r*66.0%
associate-/l*65.9%
*-commutative65.9%
clear-num65.9%
un-div-inv65.9%
*-un-lft-identity65.9%
times-frac66.0%
metadata-eval66.0%
Applied egg-rr66.0%
Taylor expanded in i around 0 67.0%
if 1 < n Initial program 25.0%
associate-/r/25.3%
associate-*r*25.3%
*-commutative25.3%
associate-*r/25.3%
sub-neg25.3%
distribute-lft-in25.3%
metadata-eval25.3%
metadata-eval25.3%
metadata-eval25.3%
fma-define25.3%
metadata-eval25.3%
Simplified25.3%
Taylor expanded in n around inf 43.8%
sub-neg43.8%
metadata-eval43.8%
metadata-eval43.8%
distribute-lft-in43.8%
metadata-eval43.8%
sub-neg43.8%
expm1-define94.4%
Simplified94.4%
Taylor expanded in i around 0 81.2%
*-commutative81.2%
Simplified81.2%
Final simplification71.2%
(FPCore (i n)
:precision binary64
(if (<= n -2.7e-217)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 1.65e-229)
0.0
(if (<= n 1.5) (* 100.0 (/ i (/ i n))) (* 100.0 (+ n (* n (* i 0.5))))))))
double code(double i, double n) {
double tmp;
if (n <= -2.7e-217) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 1.65e-229) {
tmp = 0.0;
} else if (n <= 1.5) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = 100.0 * (n + (n * (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.7d-217)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 1.65d-229) then
tmp = 0.0d0
else if (n <= 1.5d0) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = 100.0d0 * (n + (n * (i * 0.5d0)))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.7e-217) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 1.65e-229) {
tmp = 0.0;
} else if (n <= 1.5) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = 100.0 * (n + (n * (i * 0.5)));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.7e-217: tmp = n / (0.01 + (i * -0.005)) elif n <= 1.65e-229: tmp = 0.0 elif n <= 1.5: tmp = 100.0 * (i / (i / n)) else: tmp = 100.0 * (n + (n * (i * 0.5))) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.7e-217) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 1.65e-229) tmp = 0.0; elseif (n <= 1.5) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(100.0 * Float64(n + Float64(n * Float64(i * 0.5)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.7e-217) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 1.65e-229) tmp = 0.0; elseif (n <= 1.5) tmp = 100.0 * (i / (i / n)); else tmp = 100.0 * (n + (n * (i * 0.5))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.7e-217], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.65e-229], 0.0, If[LessEqual[n, 1.5], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n + N[(n * N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.7 \cdot 10^{-217}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 1.65 \cdot 10^{-229}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 1.5:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n + n \cdot \left(i \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if n < -2.70000000000000016e-217Initial program 25.5%
Taylor expanded in n around inf 32.8%
*-commutative32.8%
associate-/l*32.8%
expm1-define85.8%
Simplified85.8%
*-commutative85.8%
*-commutative85.8%
associate-*r*85.9%
associate-/l*85.8%
*-commutative85.8%
clear-num85.7%
un-div-inv85.7%
*-un-lft-identity85.7%
times-frac85.8%
metadata-eval85.8%
Applied egg-rr85.8%
Taylor expanded in i around 0 63.9%
*-commutative63.9%
Simplified63.9%
if -2.70000000000000016e-217 < n < 1.65000000000000011e-229Initial program 73.3%
associate-*r/73.3%
sub-neg73.3%
distribute-rgt-in73.3%
metadata-eval73.3%
metadata-eval73.3%
Simplified73.3%
Taylor expanded in i around 0 74.1%
+-commutative74.1%
Simplified74.1%
Taylor expanded in i around 0 82.4%
Taylor expanded in i around 0 82.4%
if 1.65000000000000011e-229 < n < 1.5Initial program 15.3%
Taylor expanded in i around 0 72.5%
if 1.5 < n Initial program 25.0%
Taylor expanded in n around inf 43.8%
*-commutative43.8%
associate-/l*43.8%
expm1-define94.4%
Simplified94.4%
Taylor expanded in i around 0 69.5%
associate-*r*69.5%
Simplified69.5%
Final simplification68.5%
(FPCore (i n)
:precision binary64
(if (<= n -8e-223)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 7.5e-228)
0.0
(if (<= n 1.5) (* 100.0 (/ i (/ i n))) (* n (+ 100.0 (* i 50.0)))))))
double code(double i, double n) {
double tmp;
if (n <= -8e-223) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 7.5e-228) {
tmp = 0.0;
} else if (n <= 1.5) {
tmp = 100.0 * (i / (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 <= (-8d-223)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 7.5d-228) then
tmp = 0.0d0
else if (n <= 1.5d0) then
tmp = 100.0d0 * (i / (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 <= -8e-223) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 7.5e-228) {
tmp = 0.0;
} else if (n <= 1.5) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -8e-223: tmp = n / (0.01 + (i * -0.005)) elif n <= 7.5e-228: tmp = 0.0 elif n <= 1.5: tmp = 100.0 * (i / (i / n)) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -8e-223) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 7.5e-228) tmp = 0.0; elseif (n <= 1.5) tmp = Float64(100.0 * Float64(i / 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 <= -8e-223) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 7.5e-228) tmp = 0.0; elseif (n <= 1.5) tmp = 100.0 * (i / (i / n)); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -8e-223], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7.5e-228], 0.0, If[LessEqual[n, 1.5], N[(100.0 * N[(i / N[(i / n), $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 -8 \cdot 10^{-223}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 7.5 \cdot 10^{-228}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 1.5:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -7.9999999999999998e-223Initial program 25.5%
Taylor expanded in n around inf 32.8%
*-commutative32.8%
associate-/l*32.8%
expm1-define85.8%
Simplified85.8%
*-commutative85.8%
*-commutative85.8%
associate-*r*85.9%
associate-/l*85.8%
*-commutative85.8%
clear-num85.7%
un-div-inv85.7%
*-un-lft-identity85.7%
times-frac85.8%
metadata-eval85.8%
Applied egg-rr85.8%
Taylor expanded in i around 0 63.9%
*-commutative63.9%
Simplified63.9%
if -7.9999999999999998e-223 < n < 7.4999999999999999e-228Initial program 73.3%
associate-*r/73.3%
sub-neg73.3%
distribute-rgt-in73.3%
metadata-eval73.3%
metadata-eval73.3%
Simplified73.3%
Taylor expanded in i around 0 74.1%
+-commutative74.1%
Simplified74.1%
Taylor expanded in i around 0 82.4%
Taylor expanded in i around 0 82.4%
if 7.4999999999999999e-228 < n < 1.5Initial program 15.3%
Taylor expanded in i around 0 72.5%
if 1.5 < n Initial program 25.0%
Taylor expanded in n around inf 43.8%
*-commutative43.8%
associate-/l*43.8%
expm1-define94.4%
Simplified94.4%
Taylor expanded in i around 0 69.5%
+-commutative69.5%
associate-*r*69.5%
distribute-rgt-in69.4%
*-commutative69.4%
Simplified69.4%
Final simplification68.5%
(FPCore (i n)
:precision binary64
(if (<= n -2.8e+194)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n 0.7)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
(* n (/ (* i (+ 100.0 (* i 50.0))) i)))))
double code(double i, double n) {
double tmp;
if (n <= -2.8e+194) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 0.7) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = n * ((i * (100.0 + (i * 50.0))) / i);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.8d+194)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= 0.7d0) then
tmp = n / (0.01d0 + (i * ((i * 0.0008333333333333334d0) - 0.005d0)))
else
tmp = n * ((i * (100.0d0 + (i * 50.0d0))) / i)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.8e+194) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 0.7) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = n * ((i * (100.0 + (i * 50.0))) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.8e+194: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= 0.7: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = n * ((i * (100.0 + (i * 50.0))) / i) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.8e+194) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= 0.7) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); else tmp = Float64(n * Float64(Float64(i * Float64(100.0 + Float64(i * 50.0))) / i)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.8e+194) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= 0.7) tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))); else tmp = n * ((i * (100.0 + (i * 50.0))) / i); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.8e+194], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.7], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(N[(i * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.8 \cdot 10^{+194}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq 0.7:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{i \cdot \left(100 + i \cdot 50\right)}{i}\\
\end{array}
\end{array}
if n < -2.8000000000000001e194Initial program 8.9%
associate-/r/9.5%
associate-*r*9.6%
*-commutative9.6%
associate-*r/9.6%
sub-neg9.6%
distribute-lft-in9.6%
metadata-eval9.6%
metadata-eval9.6%
metadata-eval9.6%
fma-define9.6%
metadata-eval9.6%
Simplified9.6%
Taylor expanded in n around inf 48.0%
sub-neg48.0%
metadata-eval48.0%
metadata-eval48.0%
distribute-lft-in48.0%
metadata-eval48.0%
sub-neg48.0%
expm1-define99.7%
Simplified99.7%
Taylor expanded in i around 0 68.7%
*-commutative68.7%
Simplified68.7%
if -2.8000000000000001e194 < n < 0.69999999999999996Initial program 34.1%
Taylor expanded in n around inf 25.3%
*-commutative25.3%
associate-/l*25.3%
expm1-define66.0%
Simplified66.0%
*-commutative66.0%
*-commutative66.0%
associate-*r*66.0%
associate-/l*65.9%
*-commutative65.9%
clear-num65.9%
un-div-inv65.9%
*-un-lft-identity65.9%
times-frac66.0%
metadata-eval66.0%
Applied egg-rr66.0%
Taylor expanded in i around 0 67.0%
if 0.69999999999999996 < n Initial program 25.0%
associate-/r/25.3%
associate-*r*25.3%
*-commutative25.3%
associate-*r/25.3%
sub-neg25.3%
distribute-lft-in25.3%
metadata-eval25.3%
metadata-eval25.3%
metadata-eval25.3%
fma-define25.3%
metadata-eval25.3%
Simplified25.3%
Taylor expanded in i around 0 74.4%
*-commutative74.4%
associate-*r/74.4%
metadata-eval74.4%
Simplified74.4%
Taylor expanded in n around inf 74.4%
*-commutative74.4%
Simplified74.4%
Final simplification69.3%
(FPCore (i n)
:precision binary64
(if (<= n -2.8e+194)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n 0.9)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
(/ (* i (* n (+ 100.0 (* i 50.0)))) i))))
double code(double i, double n) {
double tmp;
if (n <= -2.8e+194) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 0.9) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = (i * (n * (100.0 + (i * 50.0)))) / i;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.8d+194)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= 0.9d0) then
tmp = n / (0.01d0 + (i * ((i * 0.0008333333333333334d0) - 0.005d0)))
else
tmp = (i * (n * (100.0d0 + (i * 50.0d0)))) / i
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.8e+194) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 0.9) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = (i * (n * (100.0 + (i * 50.0)))) / i;
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.8e+194: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= 0.9: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = (i * (n * (100.0 + (i * 50.0)))) / i return tmp
function code(i, n) tmp = 0.0 if (n <= -2.8e+194) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= 0.9) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); else tmp = Float64(Float64(i * Float64(n * Float64(100.0 + Float64(i * 50.0)))) / i); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.8e+194) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= 0.9) tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))); else tmp = (i * (n * (100.0 + (i * 50.0)))) / i; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.8e+194], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.9], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(i * N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.8 \cdot 10^{+194}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq 0.9:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{i \cdot \left(n \cdot \left(100 + i \cdot 50\right)\right)}{i}\\
\end{array}
\end{array}
if n < -2.8000000000000001e194Initial program 8.9%
associate-/r/9.5%
associate-*r*9.6%
*-commutative9.6%
associate-*r/9.6%
sub-neg9.6%
distribute-lft-in9.6%
metadata-eval9.6%
metadata-eval9.6%
metadata-eval9.6%
fma-define9.6%
metadata-eval9.6%
Simplified9.6%
Taylor expanded in n around inf 48.0%
sub-neg48.0%
metadata-eval48.0%
metadata-eval48.0%
distribute-lft-in48.0%
metadata-eval48.0%
sub-neg48.0%
expm1-define99.7%
Simplified99.7%
Taylor expanded in i around 0 68.7%
*-commutative68.7%
Simplified68.7%
if -2.8000000000000001e194 < n < 0.900000000000000022Initial program 34.1%
Taylor expanded in n around inf 25.3%
*-commutative25.3%
associate-/l*25.3%
expm1-define66.0%
Simplified66.0%
*-commutative66.0%
*-commutative66.0%
associate-*r*66.0%
associate-/l*65.9%
*-commutative65.9%
clear-num65.9%
un-div-inv65.9%
*-un-lft-identity65.9%
times-frac66.0%
metadata-eval66.0%
Applied egg-rr66.0%
Taylor expanded in i around 0 67.0%
if 0.900000000000000022 < n Initial program 25.0%
Taylor expanded in n around inf 43.8%
*-commutative43.8%
associate-/l*43.8%
expm1-define94.4%
Simplified94.4%
*-commutative94.4%
associate-*r/94.3%
associate-*r/94.2%
Applied egg-rr94.2%
Taylor expanded in i around 0 77.0%
+-commutative77.0%
associate-*r*77.0%
*-commutative77.0%
distribute-rgt-out77.0%
Simplified77.0%
Final simplification70.1%
(FPCore (i n) :precision binary64 (if (or (<= n -12000.0) (not (<= n 1.45))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -12000.0) || !(n <= 1.45)) {
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 <= (-12000.0d0)) .or. (.not. (n <= 1.45d0))) 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 <= -12000.0) || !(n <= 1.45)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -12000.0) or not (n <= 1.45): 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 <= -12000.0) || !(n <= 1.45)) 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 <= -12000.0) || ~((n <= 1.45))) 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, -12000.0], N[Not[LessEqual[n, 1.45]], $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 -12000 \lor \neg \left(n \leq 1.45\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -12000 or 1.44999999999999996 < n Initial program 25.7%
Taylor expanded in n around inf 41.0%
*-commutative41.0%
associate-/l*40.9%
expm1-define91.8%
Simplified91.8%
Taylor expanded in i around 0 63.4%
+-commutative63.4%
associate-*r*63.4%
distribute-rgt-in63.3%
*-commutative63.3%
Simplified63.3%
if -12000 < n < 1.44999999999999996Initial program 31.2%
Taylor expanded in i around 0 67.9%
Final simplification65.1%
(FPCore (i n) :precision binary64 (if (<= i -1.45e+36) 0.0 (if (<= i 3.5e-18) (* n 100.0) 0.0)))
double code(double i, double n) {
double tmp;
if (i <= -1.45e+36) {
tmp = 0.0;
} else if (i <= 3.5e-18) {
tmp = n * 100.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-1.45d+36)) then
tmp = 0.0d0
else if (i <= 3.5d-18) then
tmp = n * 100.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -1.45e+36) {
tmp = 0.0;
} else if (i <= 3.5e-18) {
tmp = n * 100.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -1.45e+36: tmp = 0.0 elif i <= 3.5e-18: tmp = n * 100.0 else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if (i <= -1.45e+36) tmp = 0.0; elseif (i <= 3.5e-18) tmp = Float64(n * 100.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -1.45e+36) tmp = 0.0; elseif (i <= 3.5e-18) tmp = n * 100.0; else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -1.45e+36], 0.0, If[LessEqual[i, 3.5e-18], N[(n * 100.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.45 \cdot 10^{+36}:\\
\;\;\;\;0\\
\mathbf{elif}\;i \leq 3.5 \cdot 10^{-18}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if i < -1.45e36 or 3.4999999999999999e-18 < i Initial program 57.1%
associate-*r/57.2%
sub-neg57.2%
distribute-rgt-in57.2%
metadata-eval57.2%
metadata-eval57.2%
Simplified57.2%
Taylor expanded in i around 0 26.0%
+-commutative26.0%
Simplified26.0%
Taylor expanded in i around 0 29.1%
Taylor expanded in i around 0 29.1%
if -1.45e36 < i < 3.4999999999999999e-18Initial program 7.7%
Taylor expanded in i around 0 84.2%
*-commutative84.2%
Simplified84.2%
Final simplification61.8%
(FPCore (i n) :precision binary64 0.0)
double code(double i, double n) {
return 0.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 0.0d0
end function
public static double code(double i, double n) {
return 0.0;
}
def code(i, n): return 0.0
function code(i, n) return 0.0 end
function tmp = code(i, n) tmp = 0.0; end
code[i_, n_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 27.8%
associate-*r/27.8%
sub-neg27.8%
distribute-rgt-in27.8%
metadata-eval27.8%
metadata-eval27.8%
Simplified27.8%
Taylor expanded in i around 0 15.0%
+-commutative15.0%
Simplified15.0%
Taylor expanded in i around 0 15.6%
Taylor expanded in i around 0 15.9%
Final simplification15.9%
(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 2024076
(FPCore (i n)
:name "Compound Interest"
:precision binary64
:alt
(* 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))))