
(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 18 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 0.0)
(* 100.0 (/ (expm1 (* n (log1p (/ i n)))) (/ i n)))
(if (<= t_1 INFINITY) (* n (/ (+ (* t_0 100.0) -100.0) i)) (* n 100.0)))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) / (i / n));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = n * 100.0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = 100.0 * (Math.expm1((n * Math.log1p((i / n)))) / (i / n));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 0.0: tmp = 100.0 * (math.expm1((n * math.log1p((i / n)))) / (i / n)) elif t_1 <= math.inf: tmp = n * (((t_0 * 100.0) + -100.0) / i) else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i / n))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / N[(i / n), $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 * 100.0), $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 0:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{t\_0 \cdot 100 + -100}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -0.0Initial program 26.3%
sub-neg26.3%
metadata-eval26.3%
Applied egg-rr26.3%
metadata-eval26.3%
sub-neg26.3%
exp-to-pow25.8%
log1p-undefine47.7%
*-commutative47.7%
expm1-undefine99.2%
Simplified99.2%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 99.7%
associate-/r/99.7%
associate-*r*99.7%
*-commutative99.7%
associate-*r/99.8%
sub-neg99.8%
distribute-lft-in99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
fma-define99.8%
metadata-eval99.8%
Simplified99.8%
fma-undefine99.9%
*-commutative99.9%
Applied egg-rr99.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
Taylor expanded in i around 0 86.8%
*-commutative86.8%
Simplified86.8%
Final simplification97.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ (* n (expm1 i)) i))))
(if (<= n -1.6e-86)
t_0
(if (<= n -1.02e-178)
(* 100.0 (* (expm1 i) (/ n i)))
(if (<= n 1.32e-247)
(/ 0.0 (/ i n))
(if (<= n 1.5e-28) (* 100.0 (/ i (/ i n))) t_0))))))
double code(double i, double n) {
double t_0 = 100.0 * ((n * expm1(i)) / i);
double tmp;
if (n <= -1.6e-86) {
tmp = t_0;
} else if (n <= -1.02e-178) {
tmp = 100.0 * (expm1(i) * (n / i));
} else if (n <= 1.32e-247) {
tmp = 0.0 / (i / n);
} else if (n <= 1.5e-28) {
tmp = 100.0 * (i / (i / n));
} 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 <= -1.6e-86) {
tmp = t_0;
} else if (n <= -1.02e-178) {
tmp = 100.0 * (Math.expm1(i) * (n / i));
} else if (n <= 1.32e-247) {
tmp = 0.0 / (i / n);
} else if (n <= 1.5e-28) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * ((n * math.expm1(i)) / i) tmp = 0 if n <= -1.6e-86: tmp = t_0 elif n <= -1.02e-178: tmp = 100.0 * (math.expm1(i) * (n / i)) elif n <= 1.32e-247: tmp = 0.0 / (i / n) elif n <= 1.5e-28: tmp = 100.0 * (i / (i / n)) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(Float64(n * expm1(i)) / i)) tmp = 0.0 if (n <= -1.6e-86) tmp = t_0; elseif (n <= -1.02e-178) tmp = Float64(100.0 * Float64(expm1(i) * Float64(n / i))); elseif (n <= 1.32e-247) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 1.5e-28) tmp = Float64(100.0 * Float64(i / Float64(i / n))); 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]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.6e-86], t$95$0, If[LessEqual[n, -1.02e-178], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.32e-247], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.5e-28], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{if}\;n \leq -1.6 \cdot 10^{-86}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -1.02 \cdot 10^{-178}:\\
\;\;\;\;100 \cdot \left(\mathsf{expm1}\left(i\right) \cdot \frac{n}{i}\right)\\
\mathbf{elif}\;n \leq 1.32 \cdot 10^{-247}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 1.5 \cdot 10^{-28}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.60000000000000003e-86 or 1.50000000000000001e-28 < n Initial program 21.9%
div-sub21.8%
clear-num21.9%
sub-neg21.9%
div-inv21.9%
clear-num21.9%
Applied egg-rr21.9%
sub-neg21.9%
Simplified21.9%
associate-*r/21.8%
sub-div22.4%
+-commutative22.4%
Applied egg-rr22.4%
Taylor expanded in n around inf 42.0%
expm1-define92.0%
Simplified92.0%
if -1.60000000000000003e-86 < n < -1.02000000000000006e-178Initial program 28.6%
Taylor expanded in n around inf 23.8%
expm1-define76.5%
Simplified76.5%
div-inv76.3%
clear-num76.5%
Applied egg-rr76.5%
if -1.02000000000000006e-178 < n < 1.3200000000000001e-247Initial program 79.9%
associate-*r/79.9%
sub-neg79.9%
distribute-rgt-in79.9%
metadata-eval79.9%
metadata-eval79.9%
Simplified79.9%
Taylor expanded in i around 0 52.9%
*-commutative52.9%
Simplified52.9%
Taylor expanded in i around 0 84.1%
if 1.3200000000000001e-247 < n < 1.50000000000000001e-28Initial program 16.0%
Taylor expanded in i around 0 61.9%
Final simplification85.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (* (expm1 i) (/ n i)))))
(if (<= i -3.4e+32)
t_0
(if (<= i -2.35e-5)
(/ 0.0 (/ i n))
(if (<= i 0.37)
(* n (+ 100.0 (* 100.0 (* i (- 0.5 (/ 0.5 n))))))
t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (expm1(i) * (n / i));
double tmp;
if (i <= -3.4e+32) {
tmp = t_0;
} else if (i <= -2.35e-5) {
tmp = 0.0 / (i / n);
} else if (i <= 0.37) {
tmp = n * (100.0 + (100.0 * (i * (0.5 - (0.5 / n)))));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (Math.expm1(i) * (n / i));
double tmp;
if (i <= -3.4e+32) {
tmp = t_0;
} else if (i <= -2.35e-5) {
tmp = 0.0 / (i / n);
} else if (i <= 0.37) {
tmp = n * (100.0 + (100.0 * (i * (0.5 - (0.5 / n)))));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (math.expm1(i) * (n / i)) tmp = 0 if i <= -3.4e+32: tmp = t_0 elif i <= -2.35e-5: tmp = 0.0 / (i / n) elif i <= 0.37: tmp = n * (100.0 + (100.0 * (i * (0.5 - (0.5 / n))))) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(expm1(i) * Float64(n / i))) tmp = 0.0 if (i <= -3.4e+32) tmp = t_0; elseif (i <= -2.35e-5) tmp = Float64(0.0 / Float64(i / n)); elseif (i <= 0.37) tmp = Float64(n * Float64(100.0 + Float64(100.0 * Float64(i * Float64(0.5 - Float64(0.5 / n)))))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -3.4e+32], t$95$0, If[LessEqual[i, -2.35e-5], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 0.37], N[(n * N[(100.0 + N[(100.0 * N[(i * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \left(\mathsf{expm1}\left(i\right) \cdot \frac{n}{i}\right)\\
\mathbf{if}\;i \leq -3.4 \cdot 10^{+32}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;i \leq -2.35 \cdot 10^{-5}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 0.37:\\
\;\;\;\;n \cdot \left(100 + 100 \cdot \left(i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if i < -3.39999999999999979e32 or 0.37 < i Initial program 50.6%
Taylor expanded in n around inf 74.5%
expm1-define74.5%
Simplified74.5%
div-inv74.5%
clear-num74.5%
Applied egg-rr74.5%
if -3.39999999999999979e32 < i < -2.34999999999999986e-5Initial program 97.9%
associate-*r/97.9%
sub-neg97.9%
distribute-rgt-in97.8%
metadata-eval97.8%
metadata-eval97.8%
Simplified97.8%
Taylor expanded in i around 0 6.5%
*-commutative6.5%
Simplified6.5%
Taylor expanded in i around 0 83.9%
if -2.34999999999999986e-5 < i < 0.37Initial program 7.3%
associate-/r/7.8%
associate-*r*7.8%
*-commutative7.8%
associate-*r/7.8%
sub-neg7.8%
distribute-lft-in7.8%
metadata-eval7.8%
metadata-eval7.8%
metadata-eval7.8%
fma-define7.8%
metadata-eval7.8%
Simplified7.8%
Taylor expanded in i around 0 85.8%
*-commutative85.8%
associate-*r/85.8%
metadata-eval85.8%
Simplified85.8%
Final simplification81.2%
(FPCore (i n) :precision binary64 (if (or (<= n -1.02e-178) (not (<= n 1.06e-212))) (* n (/ (* 100.0 (expm1 i)) i)) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -1.02e-178) || !(n <= 1.06e-212)) {
tmp = n * ((100.0 * expm1(i)) / i);
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -1.02e-178) || !(n <= 1.06e-212)) {
tmp = n * ((100.0 * Math.expm1(i)) / i);
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.02e-178) or not (n <= 1.06e-212): tmp = n * ((100.0 * math.expm1(i)) / i) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.02e-178) || !(n <= 1.06e-212)) tmp = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -1.02e-178], N[Not[LessEqual[n, 1.06e-212]], $MachinePrecision]], N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.02 \cdot 10^{-178} \lor \neg \left(n \leq 1.06 \cdot 10^{-212}\right):\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -1.02000000000000006e-178 or 1.06000000000000004e-212 < n Initial program 21.6%
associate-/r/22.0%
associate-*r*22.0%
*-commutative22.0%
associate-*r/22.0%
sub-neg22.0%
distribute-lft-in22.0%
metadata-eval22.0%
metadata-eval22.0%
metadata-eval22.0%
fma-define22.0%
metadata-eval22.0%
Simplified22.0%
Taylor expanded in n around inf 35.2%
sub-neg35.2%
metadata-eval35.2%
metadata-eval35.2%
distribute-lft-in35.2%
metadata-eval35.2%
sub-neg35.2%
expm1-define84.9%
Simplified84.9%
if -1.02000000000000006e-178 < n < 1.06000000000000004e-212Initial program 67.7%
associate-*r/67.7%
sub-neg67.7%
distribute-rgt-in67.7%
metadata-eval67.7%
metadata-eval67.7%
Simplified67.7%
Taylor expanded in i around 0 52.9%
*-commutative52.9%
Simplified52.9%
Taylor expanded in i around 0 81.0%
Final simplification84.5%
(FPCore (i n) :precision binary64 (if (or (<= n -1.02e-178) (not (<= n 1.06e-212))) (* 100.0 (* n (/ (expm1 i) i))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -1.02e-178) || !(n <= 1.06e-212)) {
tmp = 100.0 * (n * (expm1(i) / i));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -1.02e-178) || !(n <= 1.06e-212)) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.02e-178) or not (n <= 1.06e-212): tmp = 100.0 * (n * (math.expm1(i) / i)) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.02e-178) || !(n <= 1.06e-212)) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -1.02e-178], N[Not[LessEqual[n, 1.06e-212]], $MachinePrecision]], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.02 \cdot 10^{-178} \lor \neg \left(n \leq 1.06 \cdot 10^{-212}\right):\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -1.02000000000000006e-178 or 1.06000000000000004e-212 < n Initial program 21.6%
Taylor expanded in n around inf 35.2%
*-commutative35.2%
associate-/l*35.2%
expm1-define85.0%
Simplified85.0%
if -1.02000000000000006e-178 < n < 1.06000000000000004e-212Initial program 67.7%
associate-*r/67.7%
sub-neg67.7%
distribute-rgt-in67.7%
metadata-eval67.7%
metadata-eval67.7%
Simplified67.7%
Taylor expanded in i around 0 52.9%
*-commutative52.9%
Simplified52.9%
Taylor expanded in i around 0 81.0%
Final simplification84.5%
(FPCore (i n)
:precision binary64
(let* ((t_0
(*
100.0
(/
(* i (+ n (* i (+ (* n 0.5) (* (* i n) 0.16666666666666666)))))
i)))
(t_1 (* 100.0 (/ i (/ i n)))))
(if (<= n -4e+64)
t_0
(if (<= n -1.02e-178)
t_1
(if (<= n 1.9e-243) (/ 0.0 (/ i n)) (if (<= n 1.5e-28) t_1 t_0))))))
double code(double i, double n) {
double t_0 = 100.0 * ((i * (n + (i * ((n * 0.5) + ((i * n) * 0.16666666666666666))))) / i);
double t_1 = 100.0 * (i / (i / n));
double tmp;
if (n <= -4e+64) {
tmp = t_0;
} else if (n <= -1.02e-178) {
tmp = t_1;
} else if (n <= 1.9e-243) {
tmp = 0.0 / (i / n);
} else if (n <= 1.5e-28) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 100.0d0 * ((i * (n + (i * ((n * 0.5d0) + ((i * n) * 0.16666666666666666d0))))) / i)
t_1 = 100.0d0 * (i / (i / n))
if (n <= (-4d+64)) then
tmp = t_0
else if (n <= (-1.02d-178)) then
tmp = t_1
else if (n <= 1.9d-243) then
tmp = 0.0d0 / (i / n)
else if (n <= 1.5d-28) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = 100.0 * ((i * (n + (i * ((n * 0.5) + ((i * n) * 0.16666666666666666))))) / i);
double t_1 = 100.0 * (i / (i / n));
double tmp;
if (n <= -4e+64) {
tmp = t_0;
} else if (n <= -1.02e-178) {
tmp = t_1;
} else if (n <= 1.9e-243) {
tmp = 0.0 / (i / n);
} else if (n <= 1.5e-28) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * ((i * (n + (i * ((n * 0.5) + ((i * n) * 0.16666666666666666))))) / i) t_1 = 100.0 * (i / (i / n)) tmp = 0 if n <= -4e+64: tmp = t_0 elif n <= -1.02e-178: tmp = t_1 elif n <= 1.9e-243: tmp = 0.0 / (i / n) elif n <= 1.5e-28: tmp = t_1 else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(Float64(i * Float64(n + Float64(i * Float64(Float64(n * 0.5) + Float64(Float64(i * n) * 0.16666666666666666))))) / i)) t_1 = Float64(100.0 * Float64(i / Float64(i / n))) tmp = 0.0 if (n <= -4e+64) tmp = t_0; elseif (n <= -1.02e-178) tmp = t_1; elseif (n <= 1.9e-243) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 1.5e-28) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = 100.0 * ((i * (n + (i * ((n * 0.5) + ((i * n) * 0.16666666666666666))))) / i); t_1 = 100.0 * (i / (i / n)); tmp = 0.0; if (n <= -4e+64) tmp = t_0; elseif (n <= -1.02e-178) tmp = t_1; elseif (n <= 1.9e-243) tmp = 0.0 / (i / n); elseif (n <= 1.5e-28) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(i * N[(n + N[(i * N[(N[(n * 0.5), $MachinePrecision] + N[(N[(i * n), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -4e+64], t$95$0, If[LessEqual[n, -1.02e-178], t$95$1, If[LessEqual[n, 1.9e-243], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.5e-28], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{i \cdot \left(n + i \cdot \left(n \cdot 0.5 + \left(i \cdot n\right) \cdot 0.16666666666666666\right)\right)}{i}\\
t_1 := 100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{if}\;n \leq -4 \cdot 10^{+64}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -1.02 \cdot 10^{-178}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;n \leq 1.9 \cdot 10^{-243}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 1.5 \cdot 10^{-28}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -4.00000000000000009e64 or 1.50000000000000001e-28 < n Initial program 19.9%
div-sub19.9%
clear-num20.0%
sub-neg20.0%
div-inv20.0%
clear-num19.9%
Applied egg-rr19.9%
sub-neg19.9%
Simplified19.9%
associate-*r/19.9%
sub-div20.4%
+-commutative20.4%
Applied egg-rr20.4%
Taylor expanded in n around inf 47.5%
expm1-define97.3%
Simplified97.3%
Taylor expanded in i around 0 74.2%
if -4.00000000000000009e64 < n < -1.02000000000000006e-178 or 1.8999999999999999e-243 < n < 1.50000000000000001e-28Initial program 24.2%
Taylor expanded in i around 0 62.7%
if -1.02000000000000006e-178 < n < 1.8999999999999999e-243Initial program 79.9%
associate-*r/79.9%
sub-neg79.9%
distribute-rgt-in79.9%
metadata-eval79.9%
metadata-eval79.9%
Simplified79.9%
Taylor expanded in i around 0 52.9%
*-commutative52.9%
Simplified52.9%
Taylor expanded in i around 0 84.1%
Final simplification71.2%
(FPCore (i n)
:precision binary64
(if (<= n -3.4e+64)
(*
100.0
(/ (* i (+ n (* i (+ (* n 0.5) (* (* i n) 0.16666666666666666))))) i))
(if (<= n -1.02e-178)
(* 100.0 (/ i (/ i n)))
(if (<= n 3.2e-213)
(/ 0.0 (/ i n))
(+
(* 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 <= -3.4e+64) {
tmp = 100.0 * ((i * (n + (i * ((n * 0.5) + ((i * n) * 0.16666666666666666))))) / i);
} else if (n <= -1.02e-178) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 3.2e-213) {
tmp = 0.0 / (i / n);
} 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 <= (-3.4d+64)) then
tmp = 100.0d0 * ((i * (n + (i * ((n * 0.5d0) + ((i * n) * 0.16666666666666666d0))))) / i)
else if (n <= (-1.02d-178)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 3.2d-213) then
tmp = 0.0d0 / (i / n)
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 <= -3.4e+64) {
tmp = 100.0 * ((i * (n + (i * ((n * 0.5) + ((i * n) * 0.16666666666666666))))) / i);
} else if (n <= -1.02e-178) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 3.2e-213) {
tmp = 0.0 / (i / n);
} 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 <= -3.4e+64: tmp = 100.0 * ((i * (n + (i * ((n * 0.5) + ((i * n) * 0.16666666666666666))))) / i) elif n <= -1.02e-178: tmp = 100.0 * (i / (i / n)) elif n <= 3.2e-213: tmp = 0.0 / (i / n) 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 <= -3.4e+64) tmp = Float64(100.0 * Float64(Float64(i * Float64(n + Float64(i * Float64(Float64(n * 0.5) + Float64(Float64(i * n) * 0.16666666666666666))))) / i)); elseif (n <= -1.02e-178) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 3.2e-213) tmp = Float64(0.0 / Float64(i / n)); 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 <= -3.4e+64) tmp = 100.0 * ((i * (n + (i * ((n * 0.5) + ((i * n) * 0.16666666666666666))))) / i); elseif (n <= -1.02e-178) tmp = 100.0 * (i / (i / n)); elseif (n <= 3.2e-213) tmp = 0.0 / (i / n); 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, -3.4e+64], N[(100.0 * N[(N[(i * N[(n + N[(i * N[(N[(n * 0.5), $MachinePrecision] + N[(N[(i * n), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -1.02e-178], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.2e-213], N[(0.0 / N[(i / n), $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 -3.4 \cdot 10^{+64}:\\
\;\;\;\;100 \cdot \frac{i \cdot \left(n + i \cdot \left(n \cdot 0.5 + \left(i \cdot n\right) \cdot 0.16666666666666666\right)\right)}{i}\\
\mathbf{elif}\;n \leq -1.02 \cdot 10^{-178}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 3.2 \cdot 10^{-213}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\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 < -3.4000000000000002e64Initial program 21.3%
div-sub21.3%
clear-num21.4%
sub-neg21.4%
div-inv21.4%
clear-num21.3%
Applied egg-rr21.3%
sub-neg21.3%
Simplified21.3%
associate-*r/21.3%
sub-div21.9%
+-commutative21.9%
Applied egg-rr21.9%
Taylor expanded in n around inf 50.3%
expm1-define96.7%
Simplified96.7%
Taylor expanded in i around 0 65.3%
if -3.4000000000000002e64 < n < -1.02000000000000006e-178Initial program 30.2%
Taylor expanded in i around 0 63.3%
if -1.02000000000000006e-178 < n < 3.19999999999999972e-213Initial program 67.7%
associate-*r/67.7%
sub-neg67.7%
distribute-rgt-in67.7%
metadata-eval67.7%
metadata-eval67.7%
Simplified67.7%
Taylor expanded in i around 0 52.9%
*-commutative52.9%
Simplified52.9%
Taylor expanded in i around 0 81.0%
if 3.19999999999999972e-213 < n Initial program 17.9%
Taylor expanded in n around inf 33.5%
expm1-define67.2%
Simplified67.2%
Taylor expanded in i around 0 73.5%
Final simplification70.3%
(FPCore (i n)
:precision binary64
(if (<= n -3.3e+65)
(*
100.0
(/
(*
i
(+
n
(*
i
(+
(* n 0.5)
(*
i
(+ (* 0.041666666666666664 (* i n)) (* n 0.16666666666666666)))))))
i))
(if (<= n -1.02e-178)
(* 100.0 (/ i (/ i n)))
(if (<= n 1.06e-212)
(/ 0.0 (/ i n))
(+
(* 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 <= -3.3e+65) {
tmp = 100.0 * ((i * (n + (i * ((n * 0.5) + (i * ((0.041666666666666664 * (i * n)) + (n * 0.16666666666666666))))))) / i);
} else if (n <= -1.02e-178) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.06e-212) {
tmp = 0.0 / (i / n);
} 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 <= (-3.3d+65)) then
tmp = 100.0d0 * ((i * (n + (i * ((n * 0.5d0) + (i * ((0.041666666666666664d0 * (i * n)) + (n * 0.16666666666666666d0))))))) / i)
else if (n <= (-1.02d-178)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 1.06d-212) then
tmp = 0.0d0 / (i / n)
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 <= -3.3e+65) {
tmp = 100.0 * ((i * (n + (i * ((n * 0.5) + (i * ((0.041666666666666664 * (i * n)) + (n * 0.16666666666666666))))))) / i);
} else if (n <= -1.02e-178) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.06e-212) {
tmp = 0.0 / (i / n);
} 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 <= -3.3e+65: tmp = 100.0 * ((i * (n + (i * ((n * 0.5) + (i * ((0.041666666666666664 * (i * n)) + (n * 0.16666666666666666))))))) / i) elif n <= -1.02e-178: tmp = 100.0 * (i / (i / n)) elif n <= 1.06e-212: tmp = 0.0 / (i / n) 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 <= -3.3e+65) tmp = Float64(100.0 * Float64(Float64(i * Float64(n + Float64(i * Float64(Float64(n * 0.5) + Float64(i * Float64(Float64(0.041666666666666664 * Float64(i * n)) + Float64(n * 0.16666666666666666))))))) / i)); elseif (n <= -1.02e-178) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 1.06e-212) tmp = Float64(0.0 / Float64(i / n)); 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 <= -3.3e+65) tmp = 100.0 * ((i * (n + (i * ((n * 0.5) + (i * ((0.041666666666666664 * (i * n)) + (n * 0.16666666666666666))))))) / i); elseif (n <= -1.02e-178) tmp = 100.0 * (i / (i / n)); elseif (n <= 1.06e-212) tmp = 0.0 / (i / n); 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, -3.3e+65], N[(100.0 * N[(N[(i * N[(n + N[(i * N[(N[(n * 0.5), $MachinePrecision] + N[(i * N[(N[(0.041666666666666664 * N[(i * n), $MachinePrecision]), $MachinePrecision] + N[(n * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -1.02e-178], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.06e-212], N[(0.0 / N[(i / n), $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 -3.3 \cdot 10^{+65}:\\
\;\;\;\;100 \cdot \frac{i \cdot \left(n + i \cdot \left(n \cdot 0.5 + i \cdot \left(0.041666666666666664 \cdot \left(i \cdot n\right) + n \cdot 0.16666666666666666\right)\right)\right)}{i}\\
\mathbf{elif}\;n \leq -1.02 \cdot 10^{-178}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 1.06 \cdot 10^{-212}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\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 < -3.30000000000000023e65Initial program 21.3%
div-sub21.3%
clear-num21.4%
sub-neg21.4%
div-inv21.4%
clear-num21.3%
Applied egg-rr21.3%
sub-neg21.3%
Simplified21.3%
associate-*r/21.3%
sub-div21.9%
+-commutative21.9%
Applied egg-rr21.9%
Taylor expanded in n around inf 50.3%
expm1-define96.7%
Simplified96.7%
Taylor expanded in i around 0 66.0%
if -3.30000000000000023e65 < n < -1.02000000000000006e-178Initial program 30.2%
Taylor expanded in i around 0 63.3%
if -1.02000000000000006e-178 < n < 1.06000000000000004e-212Initial program 67.7%
associate-*r/67.7%
sub-neg67.7%
distribute-rgt-in67.7%
metadata-eval67.7%
metadata-eval67.7%
Simplified67.7%
Taylor expanded in i around 0 52.9%
*-commutative52.9%
Simplified52.9%
Taylor expanded in i around 0 81.0%
if 1.06000000000000004e-212 < n Initial program 17.9%
Taylor expanded in n around inf 33.5%
expm1-define67.2%
Simplified67.2%
Taylor expanded in i around 0 73.5%
Final simplification70.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ i (/ i n))))
(t_1 (* 100.0 (/ (* i (+ n (* 0.5 (* i n)))) i))))
(if (<= n -3.4e+64)
t_1
(if (<= n -1.02e-178)
t_0
(if (<= n 1.5e-249) (/ 0.0 (/ i n)) (if (<= n 7.5e-52) t_0 t_1))))))
double code(double i, double n) {
double t_0 = 100.0 * (i / (i / n));
double t_1 = 100.0 * ((i * (n + (0.5 * (i * n)))) / i);
double tmp;
if (n <= -3.4e+64) {
tmp = t_1;
} else if (n <= -1.02e-178) {
tmp = t_0;
} else if (n <= 1.5e-249) {
tmp = 0.0 / (i / n);
} else if (n <= 7.5e-52) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 100.0d0 * (i / (i / n))
t_1 = 100.0d0 * ((i * (n + (0.5d0 * (i * n)))) / i)
if (n <= (-3.4d+64)) then
tmp = t_1
else if (n <= (-1.02d-178)) then
tmp = t_0
else if (n <= 1.5d-249) then
tmp = 0.0d0 / (i / n)
else if (n <= 7.5d-52) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = 100.0 * (i / (i / n));
double t_1 = 100.0 * ((i * (n + (0.5 * (i * n)))) / i);
double tmp;
if (n <= -3.4e+64) {
tmp = t_1;
} else if (n <= -1.02e-178) {
tmp = t_0;
} else if (n <= 1.5e-249) {
tmp = 0.0 / (i / n);
} else if (n <= 7.5e-52) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (i / (i / n)) t_1 = 100.0 * ((i * (n + (0.5 * (i * n)))) / i) tmp = 0 if n <= -3.4e+64: tmp = t_1 elif n <= -1.02e-178: tmp = t_0 elif n <= 1.5e-249: tmp = 0.0 / (i / n) elif n <= 7.5e-52: tmp = t_0 else: tmp = t_1 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(i / Float64(i / n))) t_1 = Float64(100.0 * Float64(Float64(i * Float64(n + Float64(0.5 * Float64(i * n)))) / i)) tmp = 0.0 if (n <= -3.4e+64) tmp = t_1; elseif (n <= -1.02e-178) tmp = t_0; elseif (n <= 1.5e-249) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 7.5e-52) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(i, n) t_0 = 100.0 * (i / (i / n)); t_1 = 100.0 * ((i * (n + (0.5 * (i * n)))) / i); tmp = 0.0; if (n <= -3.4e+64) tmp = t_1; elseif (n <= -1.02e-178) tmp = t_0; elseif (n <= 1.5e-249) tmp = 0.0 / (i / n); elseif (n <= 7.5e-52) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(100.0 * N[(N[(i * N[(n + N[(0.5 * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -3.4e+64], t$95$1, If[LessEqual[n, -1.02e-178], t$95$0, If[LessEqual[n, 1.5e-249], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7.5e-52], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{i}{\frac{i}{n}}\\
t_1 := 100 \cdot \frac{i \cdot \left(n + 0.5 \cdot \left(i \cdot n\right)\right)}{i}\\
\mathbf{if}\;n \leq -3.4 \cdot 10^{+64}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;n \leq -1.02 \cdot 10^{-178}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 1.5 \cdot 10^{-249}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 7.5 \cdot 10^{-52}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if n < -3.4000000000000002e64 or 7.50000000000000006e-52 < n Initial program 19.5%
div-sub19.4%
clear-num19.6%
sub-neg19.6%
div-inv19.6%
clear-num19.5%
Applied egg-rr19.5%
sub-neg19.5%
Simplified19.5%
associate-*r/19.5%
sub-div20.0%
+-commutative20.0%
Applied egg-rr20.0%
Taylor expanded in n around inf 46.3%
expm1-define96.0%
Simplified96.0%
Taylor expanded in i around 0 69.1%
if -3.4000000000000002e64 < n < -1.02000000000000006e-178 or 1.50000000000000002e-249 < n < 7.50000000000000006e-52Initial program 25.1%
Taylor expanded in i around 0 63.2%
if -1.02000000000000006e-178 < n < 1.50000000000000002e-249Initial program 79.9%
associate-*r/79.9%
sub-neg79.9%
distribute-rgt-in79.9%
metadata-eval79.9%
metadata-eval79.9%
Simplified79.9%
Taylor expanded in i around 0 52.9%
*-commutative52.9%
Simplified52.9%
Taylor expanded in i around 0 84.1%
Final simplification68.6%
(FPCore (i n) :precision binary64 (if (<= i -2.35e-5) (/ 0.0 (/ i n)) (+ (* n 100.0) (* i (+ (* n 50.0) (* (* i n) 16.666666666666668))))))
double code(double i, double n) {
double tmp;
if (i <= -2.35e-5) {
tmp = 0.0 / (i / n);
} else {
tmp = (n * 100.0) + (i * ((n * 50.0) + ((i * 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 (i <= (-2.35d-5)) then
tmp = 0.0d0 / (i / n)
else
tmp = (n * 100.0d0) + (i * ((n * 50.0d0) + ((i * n) * 16.666666666666668d0)))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -2.35e-5) {
tmp = 0.0 / (i / n);
} else {
tmp = (n * 100.0) + (i * ((n * 50.0) + ((i * n) * 16.666666666666668)));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -2.35e-5: tmp = 0.0 / (i / n) else: tmp = (n * 100.0) + (i * ((n * 50.0) + ((i * n) * 16.666666666666668))) return tmp
function code(i, n) tmp = 0.0 if (i <= -2.35e-5) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(Float64(n * 100.0) + Float64(i * Float64(Float64(n * 50.0) + Float64(Float64(i * n) * 16.666666666666668)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -2.35e-5) tmp = 0.0 / (i / n); else tmp = (n * 100.0) + (i * ((n * 50.0) + ((i * n) * 16.666666666666668))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -2.35e-5], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] + N[(i * N[(N[(n * 50.0), $MachinePrecision] + N[(N[(i * n), $MachinePrecision] * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2.35 \cdot 10^{-5}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100 + i \cdot \left(n \cdot 50 + \left(i \cdot n\right) \cdot 16.666666666666668\right)\\
\end{array}
\end{array}
if i < -2.34999999999999986e-5Initial program 58.7%
associate-*r/58.8%
sub-neg58.8%
distribute-rgt-in58.7%
metadata-eval58.7%
metadata-eval58.7%
Simplified58.7%
Taylor expanded in i around 0 21.5%
*-commutative21.5%
Simplified21.5%
Taylor expanded in i around 0 31.3%
if -2.34999999999999986e-5 < i Initial program 18.9%
Taylor expanded in n around inf 24.4%
expm1-define61.7%
Simplified61.7%
Taylor expanded in i around 0 73.4%
Final simplification64.8%
(FPCore (i n) :precision binary64 (if (or (<= n -50000.0) (not (<= n 7.5e-52))) (* 100.0 (/ (* i n) i)) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -50000.0) || !(n <= 7.5e-52)) {
tmp = 100.0 * ((i * n) / i);
} 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 <= (-50000.0d0)) .or. (.not. (n <= 7.5d-52))) then
tmp = 100.0d0 * ((i * n) / i)
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 <= -50000.0) || !(n <= 7.5e-52)) {
tmp = 100.0 * ((i * n) / i);
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -50000.0) or not (n <= 7.5e-52): tmp = 100.0 * ((i * n) / i) else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -50000.0) || !(n <= 7.5e-52)) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); 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 <= -50000.0) || ~((n <= 7.5e-52))) tmp = 100.0 * ((i * n) / i); else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -50000.0], N[Not[LessEqual[n, 7.5e-52]], $MachinePrecision]], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -50000 \lor \neg \left(n \leq 7.5 \cdot 10^{-52}\right):\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -5e4 or 7.50000000000000006e-52 < n Initial program 21.0%
div-sub21.0%
clear-num21.1%
sub-neg21.1%
div-inv21.1%
clear-num21.0%
Applied egg-rr21.0%
sub-neg21.0%
Simplified21.0%
associate-*r/21.0%
sub-div21.5%
+-commutative21.5%
Applied egg-rr21.5%
Taylor expanded in i around 0 64.3%
*-commutative64.3%
Simplified64.3%
if -5e4 < n < 7.50000000000000006e-52Initial program 37.3%
Taylor expanded in i around 0 57.2%
Final simplification61.7%
(FPCore (i n) :precision binary64 (if (or (<= n -3.4e+64) (not (<= n 2.15e-54))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -3.4e+64) || !(n <= 2.15e-54)) {
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 <= (-3.4d+64)) .or. (.not. (n <= 2.15d-54))) 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 <= -3.4e+64) || !(n <= 2.15e-54)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -3.4e+64) or not (n <= 2.15e-54): 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 <= -3.4e+64) || !(n <= 2.15e-54)) 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 <= -3.4e+64) || ~((n <= 2.15e-54))) 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, -3.4e+64], N[Not[LessEqual[n, 2.15e-54]], $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 -3.4 \cdot 10^{+64} \lor \neg \left(n \leq 2.15 \cdot 10^{-54}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -3.4000000000000002e64 or 2.15e-54 < n Initial program 19.5%
div-sub19.4%
clear-num19.6%
sub-neg19.6%
div-inv19.6%
clear-num19.5%
Applied egg-rr19.5%
sub-neg19.5%
Simplified19.5%
associate-*r/19.5%
sub-div20.0%
+-commutative20.0%
Applied egg-rr20.0%
Taylor expanded in n around inf 46.3%
expm1-define96.0%
Simplified96.0%
Taylor expanded in i around 0 65.4%
associate-*r*65.4%
distribute-rgt-out65.4%
*-commutative65.4%
+-commutative65.4%
Simplified65.4%
if -3.4000000000000002e64 < n < 2.15e-54Initial program 37.3%
Taylor expanded in i around 0 58.2%
Final simplification62.4%
(FPCore (i n) :precision binary64 (if (<= i -3.5e-50) (* 100.0 (/ i (/ i n))) (if (<= i 1.05) (* 100.0 (+ n (* i -0.5))) (* (* i n) 50.0))))
double code(double i, double n) {
double tmp;
if (i <= -3.5e-50) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 1.05) {
tmp = 100.0 * (n + (i * -0.5));
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-3.5d-50)) then
tmp = 100.0d0 * (i / (i / n))
else if (i <= 1.05d0) then
tmp = 100.0d0 * (n + (i * (-0.5d0)))
else
tmp = (i * n) * 50.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -3.5e-50) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 1.05) {
tmp = 100.0 * (n + (i * -0.5));
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -3.5e-50: tmp = 100.0 * (i / (i / n)) elif i <= 1.05: tmp = 100.0 * (n + (i * -0.5)) else: tmp = (i * n) * 50.0 return tmp
function code(i, n) tmp = 0.0 if (i <= -3.5e-50) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (i <= 1.05) tmp = Float64(100.0 * Float64(n + Float64(i * -0.5))); else tmp = Float64(Float64(i * n) * 50.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -3.5e-50) tmp = 100.0 * (i / (i / n)); elseif (i <= 1.05) tmp = 100.0 * (n + (i * -0.5)); else tmp = (i * n) * 50.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -3.5e-50], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1.05], N[(100.0 * N[(n + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(i * n), $MachinePrecision] * 50.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -3.5 \cdot 10^{-50}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 1.05:\\
\;\;\;\;100 \cdot \left(n + i \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot n\right) \cdot 50\\
\end{array}
\end{array}
if i < -3.49999999999999997e-50Initial program 49.8%
Taylor expanded in i around 0 26.9%
if -3.49999999999999997e-50 < i < 1.05000000000000004Initial program 6.9%
Taylor expanded in i around 0 87.8%
associate-*r*87.5%
associate-*r/87.5%
metadata-eval87.5%
Simplified87.5%
Taylor expanded in n around 0 87.5%
*-commutative87.5%
Simplified87.5%
if 1.05000000000000004 < i Initial program 49.0%
Taylor expanded in i around 0 30.8%
associate-*r*30.8%
associate-*r/30.8%
metadata-eval30.8%
Simplified30.8%
Taylor expanded in n around inf 31.3%
associate-*r*31.3%
*-commutative31.3%
*-commutative31.3%
Simplified31.3%
Taylor expanded in i around inf 31.3%
*-commutative31.3%
Simplified31.3%
Final simplification59.8%
(FPCore (i n) :precision binary64 (if (<= i -2.35e-5) (/ 0.0 (/ i n)) (* 100.0 (+ n (* i (- (* n 0.5) 0.5))))))
double code(double i, double n) {
double tmp;
if (i <= -2.35e-5) {
tmp = 0.0 / (i / n);
} else {
tmp = 100.0 * (n + (i * ((n * 0.5) - 0.5)));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-2.35d-5)) then
tmp = 0.0d0 / (i / n)
else
tmp = 100.0d0 * (n + (i * ((n * 0.5d0) - 0.5d0)))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -2.35e-5) {
tmp = 0.0 / (i / n);
} else {
tmp = 100.0 * (n + (i * ((n * 0.5) - 0.5)));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -2.35e-5: tmp = 0.0 / (i / n) else: tmp = 100.0 * (n + (i * ((n * 0.5) - 0.5))) return tmp
function code(i, n) tmp = 0.0 if (i <= -2.35e-5) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(100.0 * Float64(n + Float64(i * Float64(Float64(n * 0.5) - 0.5)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -2.35e-5) tmp = 0.0 / (i / n); else tmp = 100.0 * (n + (i * ((n * 0.5) - 0.5))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -2.35e-5], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n + N[(i * N[(N[(n * 0.5), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2.35 \cdot 10^{-5}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n + i \cdot \left(n \cdot 0.5 - 0.5\right)\right)\\
\end{array}
\end{array}
if i < -2.34999999999999986e-5Initial program 58.7%
associate-*r/58.8%
sub-neg58.8%
distribute-rgt-in58.7%
metadata-eval58.7%
metadata-eval58.7%
Simplified58.7%
Taylor expanded in i around 0 21.5%
*-commutative21.5%
Simplified21.5%
Taylor expanded in i around 0 31.3%
if -2.34999999999999986e-5 < i Initial program 18.9%
div-sub18.9%
clear-num16.8%
sub-neg16.8%
div-inv16.8%
clear-num18.9%
Applied egg-rr18.9%
sub-neg18.9%
Simplified18.9%
Taylor expanded in i around 0 16.4%
associate-*r*16.8%
*-commutative16.8%
associate-*r/16.8%
metadata-eval16.8%
Simplified16.8%
Taylor expanded in n around 0 12.8%
Taylor expanded in i around 0 70.1%
Final simplification62.2%
(FPCore (i n) :precision binary64 (if (<= i -2.35e-5) (/ 0.0 (/ i n)) (* n (+ 100.0 (* i 50.0)))))
double code(double i, double n) {
double tmp;
if (i <= -2.35e-5) {
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 (i <= (-2.35d-5)) 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 (i <= -2.35e-5) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -2.35e-5: tmp = 0.0 / (i / n) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (i <= -2.35e-5) 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 (i <= -2.35e-5) tmp = 0.0 / (i / n); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -2.35e-5], 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}\;i \leq -2.35 \cdot 10^{-5}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if i < -2.34999999999999986e-5Initial program 58.7%
associate-*r/58.8%
sub-neg58.8%
distribute-rgt-in58.7%
metadata-eval58.7%
metadata-eval58.7%
Simplified58.7%
Taylor expanded in i around 0 21.5%
*-commutative21.5%
Simplified21.5%
Taylor expanded in i around 0 31.3%
if -2.34999999999999986e-5 < i Initial program 18.9%
div-sub18.9%
clear-num16.8%
sub-neg16.8%
div-inv16.8%
clear-num18.9%
Applied egg-rr18.9%
sub-neg18.9%
Simplified18.9%
associate-*r/18.9%
sub-div19.3%
+-commutative19.3%
Applied egg-rr19.3%
Taylor expanded in n around inf 24.8%
expm1-define71.4%
Simplified71.4%
Taylor expanded in i around 0 70.0%
associate-*r*70.0%
distribute-rgt-out70.0%
*-commutative70.0%
+-commutative70.0%
Simplified70.0%
Final simplification62.1%
(FPCore (i n) :precision binary64 (if (<= i 28500000000000.0) (* n 100.0) (* (* i n) 50.0)))
double code(double i, double n) {
double tmp;
if (i <= 28500000000000.0) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 28500000000000.0d0) then
tmp = n * 100.0d0
else
tmp = (i * n) * 50.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 28500000000000.0) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 28500000000000.0: tmp = n * 100.0 else: tmp = (i * n) * 50.0 return tmp
function code(i, n) tmp = 0.0 if (i <= 28500000000000.0) tmp = Float64(n * 100.0); else tmp = Float64(Float64(i * n) * 50.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 28500000000000.0) tmp = n * 100.0; else tmp = (i * n) * 50.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 28500000000000.0], N[(n * 100.0), $MachinePrecision], N[(N[(i * n), $MachinePrecision] * 50.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 28500000000000:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot n\right) \cdot 50\\
\end{array}
\end{array}
if i < 2.85e13Initial program 21.4%
Taylor expanded in i around 0 62.6%
*-commutative62.6%
Simplified62.6%
if 2.85e13 < i Initial program 47.9%
Taylor expanded in i around 0 32.4%
associate-*r*32.4%
associate-*r/32.4%
metadata-eval32.4%
Simplified32.4%
Taylor expanded in n around inf 32.7%
associate-*r*32.7%
*-commutative32.7%
*-commutative32.7%
Simplified32.7%
Taylor expanded in i around inf 32.7%
*-commutative32.7%
Simplified32.7%
Final simplification56.3%
(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 27.0%
Taylor expanded in i around 0 56.5%
associate-*r*56.4%
associate-*r/56.4%
metadata-eval56.4%
Simplified56.4%
Taylor expanded in n around 0 2.8%
*-commutative2.8%
Simplified2.8%
Final simplification2.8%
(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 27.0%
Taylor expanded in i around 0 50.8%
*-commutative50.8%
Simplified50.8%
Final simplification50.8%
(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 2024077
(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))))