
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 -5e-36)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(if (<= t_1 2e-256)
(* 100.0 (/ (expm1 (* n (log1p (/ i n)))) (/ i n)))
(if (<= t_1 INFINITY) (* t_1 100.0) (* 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 <= -5e-36) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else if (t_1 <= 2e-256) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) / (i / n));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_1 * 100.0;
} 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 <= -5e-36) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else if (t_1 <= 2e-256) {
tmp = 100.0 * (Math.expm1((n * Math.log1p((i / n)))) / (i / n));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1 * 100.0;
} 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 <= -5e-36: tmp = n * (((t_0 * 100.0) + -100.0) / i) elif t_1 <= 2e-256: tmp = 100.0 * (math.expm1((n * math.log1p((i / n)))) / (i / n)) elif t_1 <= math.inf: tmp = t_1 * 100.0 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 <= -5e-36) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); elseif (t_1 <= 2e-256) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i / n))); elseif (t_1 <= Inf) tmp = Float64(t_1 * 100.0); 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, -5e-36], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-256], 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[(t$95$1 * 100.0), $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 -5 \cdot 10^{-36}:\\
\;\;\;\;n \cdot \frac{t\_0 \cdot 100 + -100}{i}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-256}:\\
\;\;\;\;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:\\
\;\;\;\;t\_1 \cdot 100\\
\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)) < -5.00000000000000004e-36Initial program 99.6%
associate-/r/99.6%
associate-*r*99.7%
*-commutative99.7%
associate-*r/99.9%
sub-neg99.9%
distribute-lft-in99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
fma-define99.9%
metadata-eval99.9%
Simplified99.9%
fma-undefine99.9%
*-commutative99.9%
Applied egg-rr99.9%
if -5.00000000000000004e-36 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 1.99999999999999995e-256Initial program 21.3%
sub-neg21.3%
metadata-eval21.3%
Applied egg-rr21.3%
metadata-eval21.3%
sub-neg21.3%
exp-to-pow21.3%
log1p-undefine44.1%
*-commutative44.1%
expm1-undefine99.7%
Simplified99.7%
if 1.99999999999999995e-256 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 98.3%
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 87.0%
*-commutative87.0%
Simplified87.0%
Final simplification97.8%
(FPCore (i n) :precision binary64 (if (or (<= n -2.9e-201) (not (<= n 1.3e-234))) (* n (* 100.0 (/ (expm1 i) i))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -2.9e-201) || !(n <= 1.3e-234)) {
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 <= -2.9e-201) || !(n <= 1.3e-234)) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.9e-201) or not (n <= 1.3e-234): 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 <= -2.9e-201) || !(n <= 1.3e-234)) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -2.9e-201], N[Not[LessEqual[n, 1.3e-234]], $MachinePrecision]], N[(n * N[(100.0 * 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 -2.9 \cdot 10^{-201} \lor \neg \left(n \leq 1.3 \cdot 10^{-234}\right):\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -2.9000000000000002e-201Initial 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 36.1%
div-sub36.1%
associate-*r/36.1%
metadata-eval36.1%
associate-*r/36.1%
distribute-lft-out--36.1%
div-sub36.1%
*-commutative36.1%
expm1-define81.9%
Simplified81.9%
if -2.9000000000000002e-201 < n < 1.29999999999999995e-234Initial program 71.0%
associate-*r/71.0%
sub-neg71.0%
distribute-rgt-in71.0%
metadata-eval71.0%
metadata-eval71.0%
Simplified71.0%
Taylor expanded in i around 0 84.0%
if 1.29999999999999995e-234 < n Initial program 23.8%
sub-neg23.8%
metadata-eval23.8%
Applied egg-rr23.8%
metadata-eval23.8%
sub-neg23.8%
exp-to-pow19.7%
log1p-undefine38.9%
*-commutative38.9%
expm1-undefine83.4%
Simplified83.4%
associate-*r/83.2%
Applied egg-rr83.2%
associate-/r/82.9%
Simplified82.9%
Taylor expanded in n around inf 34.7%
expm1-define83.1%
Simplified83.1%
Final simplification82.6%
(FPCore (i n) :precision binary64 (if (or (<= n -3.2e-204) (not (<= n 2e-231))) (* n (* 100.0 (/ (expm1 i) i))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -3.2e-204) || !(n <= 2e-231)) {
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 <= -3.2e-204) || !(n <= 2e-231)) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -3.2e-204) or not (n <= 2e-231): 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 <= -3.2e-204) || !(n <= 2e-231)) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -3.2e-204], N[Not[LessEqual[n, 2e-231]], $MachinePrecision]], N[(n * N[(100.0 * 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 -3.2 \cdot 10^{-204} \lor \neg \left(n \leq 2 \cdot 10^{-231}\right):\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -3.2e-204 or 2e-231 < n Initial program 24.4%
associate-/r/24.6%
associate-*r*24.6%
*-commutative24.6%
associate-*r/24.7%
sub-neg24.7%
distribute-lft-in24.6%
metadata-eval24.6%
metadata-eval24.6%
metadata-eval24.6%
fma-define24.7%
metadata-eval24.7%
Simplified24.7%
Taylor expanded in n around inf 35.4%
div-sub35.4%
associate-*r/35.4%
metadata-eval35.4%
associate-*r/35.3%
distribute-lft-out--35.3%
div-sub35.4%
*-commutative35.4%
expm1-define82.5%
Simplified82.5%
if -3.2e-204 < n < 2e-231Initial program 71.0%
associate-*r/71.0%
sub-neg71.0%
distribute-rgt-in71.0%
metadata-eval71.0%
metadata-eval71.0%
Simplified71.0%
Taylor expanded in i around 0 84.0%
Final simplification82.6%
(FPCore (i n)
:precision binary64
(if (<= n -2050000000.0)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n -1.7e-201)
(* 100.0 (/ i (/ i n)))
(if (<= n 2.25e-231)
(/ 0.0 (/ i n))
(+
(* n 100.0)
(*
i
(+
(* n 50.0)
(*
i
(+ (* 4.166666666666667 (* i n)) (* n 16.666666666666668))))))))))
double code(double i, double n) {
double tmp;
if (n <= -2050000000.0) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= -1.7e-201) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 2.25e-231) {
tmp = 0.0 / (i / n);
} else {
tmp = (n * 100.0) + (i * ((n * 50.0) + (i * ((4.166666666666667 * (i * n)) + (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 <= (-2050000000.0d0)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= (-1.7d-201)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 2.25d-231) then
tmp = 0.0d0 / (i / n)
else
tmp = (n * 100.0d0) + (i * ((n * 50.0d0) + (i * ((4.166666666666667d0 * (i * n)) + (n * 16.666666666666668d0)))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2050000000.0) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= -1.7e-201) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 2.25e-231) {
tmp = 0.0 / (i / n);
} else {
tmp = (n * 100.0) + (i * ((n * 50.0) + (i * ((4.166666666666667 * (i * n)) + (n * 16.666666666666668)))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2050000000.0: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= -1.7e-201: tmp = 100.0 * (i / (i / n)) elif n <= 2.25e-231: tmp = 0.0 / (i / n) else: tmp = (n * 100.0) + (i * ((n * 50.0) + (i * ((4.166666666666667 * (i * n)) + (n * 16.666666666666668))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -2050000000.0) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= -1.7e-201) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 2.25e-231) 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(4.166666666666667 * Float64(i * n)) + Float64(n * 16.666666666666668)))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2050000000.0) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= -1.7e-201) tmp = 100.0 * (i / (i / n)); elseif (n <= 2.25e-231) tmp = 0.0 / (i / n); else tmp = (n * 100.0) + (i * ((n * 50.0) + (i * ((4.166666666666667 * (i * n)) + (n * 16.666666666666668))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2050000000.0], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -1.7e-201], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.25e-231], 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[(4.166666666666667 * N[(i * n), $MachinePrecision]), $MachinePrecision] + N[(n * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2050000000:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq -1.7 \cdot 10^{-201}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 2.25 \cdot 10^{-231}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100 + i \cdot \left(n \cdot 50 + i \cdot \left(4.166666666666667 \cdot \left(i \cdot n\right) + n \cdot 16.666666666666668\right)\right)\\
\end{array}
\end{array}
if n < -2.05e9Initial program 27.3%
associate-/r/27.8%
associate-*r*27.9%
*-commutative27.9%
associate-*r/27.9%
sub-neg27.9%
distribute-lft-in27.9%
metadata-eval27.9%
metadata-eval27.9%
metadata-eval27.9%
fma-define27.9%
metadata-eval27.9%
Simplified27.9%
Taylor expanded in n around inf 47.3%
sub-neg47.3%
metadata-eval47.3%
metadata-eval47.3%
distribute-lft-in47.3%
metadata-eval47.3%
sub-neg47.3%
expm1-define91.0%
Simplified91.0%
Taylor expanded in i around 0 58.8%
*-commutative58.8%
Simplified58.8%
if -2.05e9 < n < -1.69999999999999993e-201Initial program 21.3%
Taylor expanded in i around 0 64.3%
if -1.69999999999999993e-201 < n < 2.2499999999999999e-231Initial program 71.0%
associate-*r/71.0%
sub-neg71.0%
distribute-rgt-in71.0%
metadata-eval71.0%
metadata-eval71.0%
Simplified71.0%
Taylor expanded in i around 0 84.0%
if 2.2499999999999999e-231 < n Initial program 23.8%
associate-/r/24.0%
associate-*r*24.0%
*-commutative24.0%
associate-*r/24.0%
sub-neg24.0%
distribute-lft-in24.0%
metadata-eval24.0%
metadata-eval24.0%
metadata-eval24.0%
fma-define24.0%
metadata-eval24.0%
Simplified24.0%
Taylor expanded in n around inf 34.7%
sub-neg34.7%
metadata-eval34.7%
metadata-eval34.7%
distribute-lft-in34.7%
metadata-eval34.7%
sub-neg34.7%
expm1-define83.0%
Simplified83.0%
Taylor expanded in i around 0 74.3%
Final simplification69.4%
(FPCore (i n)
:precision binary64
(if (<= n -165000000.0)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n -9e-204)
(* 100.0 (/ i (/ i n)))
(if (<= n 1.55e-231)
(/ 0.0 (/ i n))
(*
n
(+
100.0
(*
i
(+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))))))
double code(double i, double n) {
double tmp;
if (n <= -165000000.0) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= -9e-204) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.55e-231) {
tmp = 0.0 / (i / n);
} 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 <= (-165000000.0d0)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= (-9d-204)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 1.55d-231) then
tmp = 0.0d0 / (i / n)
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 <= -165000000.0) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= -9e-204) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.55e-231) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -165000000.0: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= -9e-204: tmp = 100.0 * (i / (i / n)) elif n <= 1.55e-231: tmp = 0.0 / (i / n) 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 <= -165000000.0) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= -9e-204) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 1.55e-231) tmp = Float64(0.0 / Float64(i / n)); 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 <= -165000000.0) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= -9e-204) tmp = 100.0 * (i / (i / n)); elseif (n <= 1.55e-231) tmp = 0.0 / (i / n); 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, -165000000.0], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -9e-204], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.55e-231], N[(0.0 / N[(i / n), $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 -165000000:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq -9 \cdot 10^{-204}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 1.55 \cdot 10^{-231}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\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 < -1.65e8Initial program 27.3%
associate-/r/27.8%
associate-*r*27.9%
*-commutative27.9%
associate-*r/27.9%
sub-neg27.9%
distribute-lft-in27.9%
metadata-eval27.9%
metadata-eval27.9%
metadata-eval27.9%
fma-define27.9%
metadata-eval27.9%
Simplified27.9%
Taylor expanded in n around inf 47.3%
sub-neg47.3%
metadata-eval47.3%
metadata-eval47.3%
distribute-lft-in47.3%
metadata-eval47.3%
sub-neg47.3%
expm1-define91.0%
Simplified91.0%
Taylor expanded in i around 0 58.8%
*-commutative58.8%
Simplified58.8%
if -1.65e8 < n < -8.99999999999999948e-204Initial program 21.3%
Taylor expanded in i around 0 64.3%
if -8.99999999999999948e-204 < n < 1.54999999999999994e-231Initial program 71.0%
associate-*r/71.0%
sub-neg71.0%
distribute-rgt-in71.0%
metadata-eval71.0%
metadata-eval71.0%
Simplified71.0%
Taylor expanded in i around 0 84.0%
if 1.54999999999999994e-231 < n Initial program 23.8%
sub-neg23.8%
metadata-eval23.8%
Applied egg-rr23.8%
metadata-eval23.8%
sub-neg23.8%
exp-to-pow19.7%
log1p-undefine38.9%
*-commutative38.9%
expm1-undefine83.4%
Simplified83.4%
associate-*r/83.2%
Applied egg-rr83.2%
associate-/r/82.9%
Simplified82.9%
Taylor expanded in n around inf 34.7%
expm1-define83.1%
Simplified83.1%
Taylor expanded in i around 0 74.3%
*-commutative74.3%
Simplified74.3%
Final simplification69.4%
(FPCore (i n)
:precision binary64
(if (<= n -6400000.0)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n -1.5e-203)
(* 100.0 (/ i (/ i n)))
(if (<= n 1.05e-231)
(/ 0.0 (/ i n))
(*
n
(+
100.0
(*
i
(+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))))))
double code(double i, double n) {
double tmp;
if (n <= -6400000.0) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= -1.5e-203) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.05e-231) {
tmp = 0.0 / (i / n);
} 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 <= (-6400000.0d0)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= (-1.5d-203)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 1.05d-231) then
tmp = 0.0d0 / (i / n)
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 <= -6400000.0) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= -1.5e-203) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.05e-231) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -6400000.0: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= -1.5e-203: tmp = 100.0 * (i / (i / n)) elif n <= 1.05e-231: tmp = 0.0 / (i / n) 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 <= -6400000.0) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= -1.5e-203) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 1.05e-231) tmp = Float64(0.0 / Float64(i / n)); 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 <= -6400000.0) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= -1.5e-203) tmp = 100.0 * (i / (i / n)); elseif (n <= 1.05e-231) tmp = 0.0 / (i / n); 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, -6400000.0], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -1.5e-203], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.05e-231], N[(0.0 / N[(i / n), $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 -6400000:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq -1.5 \cdot 10^{-203}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 1.05 \cdot 10^{-231}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\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 < -6.4e6Initial program 27.3%
associate-/r/27.8%
associate-*r*27.9%
*-commutative27.9%
associate-*r/27.9%
sub-neg27.9%
distribute-lft-in27.9%
metadata-eval27.9%
metadata-eval27.9%
metadata-eval27.9%
fma-define27.9%
metadata-eval27.9%
Simplified27.9%
Taylor expanded in n around inf 47.3%
sub-neg47.3%
metadata-eval47.3%
metadata-eval47.3%
distribute-lft-in47.3%
metadata-eval47.3%
sub-neg47.3%
expm1-define91.0%
Simplified91.0%
Taylor expanded in i around 0 58.8%
*-commutative58.8%
Simplified58.8%
if -6.4e6 < n < -1.5000000000000001e-203Initial program 21.3%
Taylor expanded in i around 0 64.3%
if -1.5000000000000001e-203 < n < 1.04999999999999995e-231Initial program 71.0%
associate-*r/71.0%
sub-neg71.0%
distribute-rgt-in71.0%
metadata-eval71.0%
metadata-eval71.0%
Simplified71.0%
Taylor expanded in i around 0 84.0%
if 1.04999999999999995e-231 < n Initial program 23.8%
associate-/r/24.0%
associate-*r*24.0%
*-commutative24.0%
associate-*r/24.0%
sub-neg24.0%
distribute-lft-in24.0%
metadata-eval24.0%
metadata-eval24.0%
metadata-eval24.0%
fma-define24.0%
metadata-eval24.0%
Simplified24.0%
Taylor expanded in n around inf 34.7%
sub-neg34.7%
metadata-eval34.7%
metadata-eval34.7%
distribute-lft-in34.7%
metadata-eval34.7%
sub-neg34.7%
expm1-define83.0%
Simplified83.0%
Taylor expanded in i around 0 74.3%
*-commutative74.3%
Simplified74.3%
Final simplification69.4%
(FPCore (i n)
:precision binary64
(if (<= n -6000000.0)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n -1.6e-199)
(* 100.0 (/ i (/ i n)))
(if (<= n 1.05e-241)
(/ 0.0 (/ i n))
(* n (/ (* i (+ 100.0 (* i 50.0))) i))))))
double code(double i, double n) {
double tmp;
if (n <= -6000000.0) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= -1.6e-199) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.05e-241) {
tmp = 0.0 / (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 <= (-6000000.0d0)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= (-1.6d-199)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 1.05d-241) then
tmp = 0.0d0 / (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 <= -6000000.0) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= -1.6e-199) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.05e-241) {
tmp = 0.0 / (i / n);
} else {
tmp = n * ((i * (100.0 + (i * 50.0))) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -6000000.0: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= -1.6e-199: tmp = 100.0 * (i / (i / n)) elif n <= 1.05e-241: tmp = 0.0 / (i / n) else: tmp = n * ((i * (100.0 + (i * 50.0))) / i) return tmp
function code(i, n) tmp = 0.0 if (n <= -6000000.0) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= -1.6e-199) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 1.05e-241) tmp = Float64(0.0 / 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 <= -6000000.0) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= -1.6e-199) tmp = 100.0 * (i / (i / n)); elseif (n <= 1.05e-241) tmp = 0.0 / (i / n); else tmp = n * ((i * (100.0 + (i * 50.0))) / i); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -6000000.0], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -1.6e-199], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.05e-241], N[(0.0 / N[(i / n), $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 -6000000:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq -1.6 \cdot 10^{-199}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 1.05 \cdot 10^{-241}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{i \cdot \left(100 + i \cdot 50\right)}{i}\\
\end{array}
\end{array}
if n < -6e6Initial program 27.3%
associate-/r/27.8%
associate-*r*27.9%
*-commutative27.9%
associate-*r/27.9%
sub-neg27.9%
distribute-lft-in27.9%
metadata-eval27.9%
metadata-eval27.9%
metadata-eval27.9%
fma-define27.9%
metadata-eval27.9%
Simplified27.9%
Taylor expanded in n around inf 47.3%
sub-neg47.3%
metadata-eval47.3%
metadata-eval47.3%
distribute-lft-in47.3%
metadata-eval47.3%
sub-neg47.3%
expm1-define91.0%
Simplified91.0%
Taylor expanded in i around 0 58.8%
*-commutative58.8%
Simplified58.8%
if -6e6 < n < -1.6e-199Initial program 21.3%
Taylor expanded in i around 0 64.3%
if -1.6e-199 < n < 1.05e-241Initial program 71.0%
associate-*r/71.0%
sub-neg71.0%
distribute-rgt-in71.0%
metadata-eval71.0%
metadata-eval71.0%
Simplified71.0%
Taylor expanded in i around 0 84.0%
if 1.05e-241 < n Initial program 23.8%
associate-/r/24.0%
associate-*r*24.0%
*-commutative24.0%
associate-*r/24.0%
sub-neg24.0%
distribute-lft-in24.0%
metadata-eval24.0%
metadata-eval24.0%
metadata-eval24.0%
fma-define24.0%
metadata-eval24.0%
Simplified24.0%
Taylor expanded in i around 0 70.3%
*-commutative70.3%
associate-*r/70.3%
metadata-eval70.3%
Simplified70.3%
Taylor expanded in n around inf 70.4%
*-commutative70.4%
Simplified70.4%
Final simplification67.5%
(FPCore (i n)
:precision binary64
(if (<= n -12500000.0)
(* n (+ 100.0 (* i 50.0)))
(if (<= n -1.5e-203)
(* 100.0 (/ i (/ i n)))
(if (<= n 1.9e-231) (/ 0.0 (/ i n)) (+ (* n 100.0) (* 50.0 (* i n)))))))
double code(double i, double n) {
double tmp;
if (n <= -12500000.0) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= -1.5e-203) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.9e-231) {
tmp = 0.0 / (i / n);
} else {
tmp = (n * 100.0) + (50.0 * (i * n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-12500000.0d0)) then
tmp = n * (100.0d0 + (i * 50.0d0))
else if (n <= (-1.5d-203)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 1.9d-231) then
tmp = 0.0d0 / (i / n)
else
tmp = (n * 100.0d0) + (50.0d0 * (i * n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -12500000.0) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= -1.5e-203) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.9e-231) {
tmp = 0.0 / (i / n);
} else {
tmp = (n * 100.0) + (50.0 * (i * n));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -12500000.0: tmp = n * (100.0 + (i * 50.0)) elif n <= -1.5e-203: tmp = 100.0 * (i / (i / n)) elif n <= 1.9e-231: tmp = 0.0 / (i / n) else: tmp = (n * 100.0) + (50.0 * (i * n)) return tmp
function code(i, n) tmp = 0.0 if (n <= -12500000.0) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); elseif (n <= -1.5e-203) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 1.9e-231) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(Float64(n * 100.0) + Float64(50.0 * Float64(i * n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -12500000.0) tmp = n * (100.0 + (i * 50.0)); elseif (n <= -1.5e-203) tmp = 100.0 * (i / (i / n)); elseif (n <= 1.9e-231) tmp = 0.0 / (i / n); else tmp = (n * 100.0) + (50.0 * (i * n)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -12500000.0], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -1.5e-203], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.9e-231], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] + N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -12500000:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{elif}\;n \leq -1.5 \cdot 10^{-203}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 1.9 \cdot 10^{-231}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100 + 50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if n < -1.25e7Initial program 27.3%
associate-/r/27.8%
associate-*r*27.9%
*-commutative27.9%
associate-*r/27.9%
sub-neg27.9%
distribute-lft-in27.9%
metadata-eval27.9%
metadata-eval27.9%
metadata-eval27.9%
fma-define27.9%
metadata-eval27.9%
Simplified27.9%
Taylor expanded in i around 0 55.1%
*-commutative55.1%
associate-*r/55.1%
metadata-eval55.1%
Simplified55.1%
Taylor expanded in n around inf 55.3%
*-commutative55.3%
Simplified55.3%
if -1.25e7 < n < -1.5000000000000001e-203Initial program 21.3%
Taylor expanded in i around 0 64.3%
if -1.5000000000000001e-203 < n < 1.90000000000000007e-231Initial program 71.0%
associate-*r/71.0%
sub-neg71.0%
distribute-rgt-in71.0%
metadata-eval71.0%
metadata-eval71.0%
Simplified71.0%
Taylor expanded in i around 0 84.0%
if 1.90000000000000007e-231 < n Initial program 23.8%
associate-/r/24.0%
associate-*r*24.0%
*-commutative24.0%
associate-*r/24.0%
sub-neg24.0%
distribute-lft-in24.0%
metadata-eval24.0%
metadata-eval24.0%
metadata-eval24.0%
fma-define24.0%
metadata-eval24.0%
Simplified24.0%
Taylor expanded in n around inf 34.7%
sub-neg34.7%
metadata-eval34.7%
metadata-eval34.7%
distribute-lft-in34.7%
metadata-eval34.7%
sub-neg34.7%
expm1-define83.0%
Simplified83.0%
Taylor expanded in i around 0 66.2%
Final simplification64.6%
(FPCore (i n)
:precision binary64
(if (<= n -5200000.0)
(* n (+ 100.0 (* i 50.0)))
(if (<= n -1.25e-202)
(* 100.0 (/ i (/ i n)))
(if (<= n 4.1e-232) (/ 0.0 (/ i n)) (+ (* n 100.0) (* 50.0 (* i n)))))))
double code(double i, double n) {
double tmp;
if (n <= -5200000.0) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= -1.25e-202) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 4.1e-232) {
tmp = 0.0 / (i / n);
} else {
tmp = (n * 100.0) + (50.0 * (i * n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-5200000.0d0)) then
tmp = n * (100.0d0 + (i * 50.0d0))
else if (n <= (-1.25d-202)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 4.1d-232) then
tmp = 0.0d0 / (i / n)
else
tmp = (n * 100.0d0) + (50.0d0 * (i * n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -5200000.0) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= -1.25e-202) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 4.1e-232) {
tmp = 0.0 / (i / n);
} else {
tmp = (n * 100.0) + (50.0 * (i * n));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -5200000.0: tmp = n * (100.0 + (i * 50.0)) elif n <= -1.25e-202: tmp = 100.0 * (i / (i / n)) elif n <= 4.1e-232: tmp = 0.0 / (i / n) else: tmp = (n * 100.0) + (50.0 * (i * n)) return tmp
function code(i, n) tmp = 0.0 if (n <= -5200000.0) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); elseif (n <= -1.25e-202) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 4.1e-232) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(Float64(n * 100.0) + Float64(50.0 * Float64(i * n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -5200000.0) tmp = n * (100.0 + (i * 50.0)); elseif (n <= -1.25e-202) tmp = 100.0 * (i / (i / n)); elseif (n <= 4.1e-232) tmp = 0.0 / (i / n); else tmp = (n * 100.0) + (50.0 * (i * n)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -5200000.0], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -1.25e-202], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.1e-232], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] + N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -5200000:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{elif}\;n \leq -1.25 \cdot 10^{-202}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 4.1 \cdot 10^{-232}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100 + 50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if n < -5.2e6Initial program 27.3%
associate-/r/27.8%
associate-*r*27.9%
*-commutative27.9%
associate-*r/27.9%
sub-neg27.9%
distribute-lft-in27.9%
metadata-eval27.9%
metadata-eval27.9%
metadata-eval27.9%
fma-define27.9%
metadata-eval27.9%
Simplified27.9%
Taylor expanded in i around 0 55.1%
*-commutative55.1%
associate-*r/55.1%
metadata-eval55.1%
Simplified55.1%
Taylor expanded in n around inf 55.3%
*-commutative55.3%
Simplified55.3%
if -5.2e6 < n < -1.24999999999999993e-202Initial program 21.3%
Taylor expanded in i around 0 64.3%
if -1.24999999999999993e-202 < n < 4.09999999999999973e-232Initial program 71.0%
associate-*r/71.0%
sub-neg71.0%
distribute-rgt-in71.0%
metadata-eval71.0%
metadata-eval71.0%
Simplified71.0%
Taylor expanded in i around 0 71.8%
*-commutative71.8%
Simplified71.8%
Taylor expanded in i around 0 84.0%
if 4.09999999999999973e-232 < n Initial program 23.8%
associate-/r/24.0%
associate-*r*24.0%
*-commutative24.0%
associate-*r/24.0%
sub-neg24.0%
distribute-lft-in24.0%
metadata-eval24.0%
metadata-eval24.0%
metadata-eval24.0%
fma-define24.0%
metadata-eval24.0%
Simplified24.0%
Taylor expanded in n around inf 34.7%
sub-neg34.7%
metadata-eval34.7%
metadata-eval34.7%
distribute-lft-in34.7%
metadata-eval34.7%
sub-neg34.7%
expm1-define83.0%
Simplified83.0%
Taylor expanded in i around 0 66.2%
Final simplification64.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i 50.0)))))
(if (<= n -680000000.0)
t_0
(if (<= n -1.4e-203)
(* 100.0 (/ i (/ i n)))
(if (<= n 1.08e-231) (/ 0.0 (/ i n)) t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -680000000.0) {
tmp = t_0;
} else if (n <= -1.4e-203) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.08e-231) {
tmp = 0.0 / (i / n);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = n * (100.0d0 + (i * 50.0d0))
if (n <= (-680000000.0d0)) then
tmp = t_0
else if (n <= (-1.4d-203)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 1.08d-231) then
tmp = 0.0d0 / (i / n)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -680000000.0) {
tmp = t_0;
} else if (n <= -1.4e-203) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.08e-231) {
tmp = 0.0 / (i / n);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + (i * 50.0)) tmp = 0 if n <= -680000000.0: tmp = t_0 elif n <= -1.4e-203: tmp = 100.0 * (i / (i / n)) elif n <= 1.08e-231: tmp = 0.0 / (i / n) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 + Float64(i * 50.0))) tmp = 0.0 if (n <= -680000000.0) tmp = t_0; elseif (n <= -1.4e-203) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 1.08e-231) tmp = Float64(0.0 / Float64(i / n)); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = n * (100.0 + (i * 50.0)); tmp = 0.0; if (n <= -680000000.0) tmp = t_0; elseif (n <= -1.4e-203) tmp = 100.0 * (i / (i / n)); elseif (n <= 1.08e-231) tmp = 0.0 / (i / n); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -680000000.0], t$95$0, If[LessEqual[n, -1.4e-203], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.08e-231], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{if}\;n \leq -680000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -1.4 \cdot 10^{-203}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 1.08 \cdot 10^{-231}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -6.8e8Initial program 27.3%
associate-/r/27.8%
associate-*r*27.9%
*-commutative27.9%
associate-*r/27.9%
sub-neg27.9%
distribute-lft-in27.9%
metadata-eval27.9%
metadata-eval27.9%
metadata-eval27.9%
fma-define27.9%
metadata-eval27.9%
Simplified27.9%
Taylor expanded in i around 0 55.1%
*-commutative55.1%
associate-*r/55.1%
metadata-eval55.1%
Simplified55.1%
Taylor expanded in n around inf 55.3%
*-commutative55.3%
Simplified55.3%
if -6.8e8 < n < -1.40000000000000011e-203Initial program 21.3%
Taylor expanded in i around 0 64.3%
if -1.40000000000000011e-203 < n < 1.08e-231Initial program 71.0%
associate-*r/71.0%
sub-neg71.0%
distribute-rgt-in71.0%
metadata-eval71.0%
metadata-eval71.0%
Simplified71.0%
Taylor expanded in i around 0 71.8%
*-commutative71.8%
Simplified71.8%
Taylor expanded in i around 0 84.0%
if 1.08e-231 < n Initial program 23.8%
sub-neg23.8%
metadata-eval23.8%
Applied egg-rr23.8%
metadata-eval23.8%
sub-neg23.8%
exp-to-pow19.7%
log1p-undefine38.9%
*-commutative38.9%
expm1-undefine83.4%
Simplified83.4%
associate-*r/83.2%
Applied egg-rr83.2%
associate-/r/82.9%
Simplified82.9%
Taylor expanded in i around 0 66.0%
associate-*r/66.0%
metadata-eval66.0%
Simplified66.0%
Taylor expanded in n around inf 66.2%
*-commutative66.2%
Simplified66.2%
Final simplification64.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i 50.0)))))
(if (<= n -2900000000.0)
t_0
(if (<= n -1.9e-203)
(* 100.0 (/ i (/ i n)))
(if (<= n 2.25e-231) 0.0 t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -2900000000.0) {
tmp = t_0;
} else if (n <= -1.9e-203) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 2.25e-231) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = n * (100.0d0 + (i * 50.0d0))
if (n <= (-2900000000.0d0)) then
tmp = t_0
else if (n <= (-1.9d-203)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 2.25d-231) then
tmp = 0.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -2900000000.0) {
tmp = t_0;
} else if (n <= -1.9e-203) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 2.25e-231) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + (i * 50.0)) tmp = 0 if n <= -2900000000.0: tmp = t_0 elif n <= -1.9e-203: tmp = 100.0 * (i / (i / n)) elif n <= 2.25e-231: tmp = 0.0 else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 + Float64(i * 50.0))) tmp = 0.0 if (n <= -2900000000.0) tmp = t_0; elseif (n <= -1.9e-203) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 2.25e-231) tmp = 0.0; else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = n * (100.0 + (i * 50.0)); tmp = 0.0; if (n <= -2900000000.0) tmp = t_0; elseif (n <= -1.9e-203) tmp = 100.0 * (i / (i / n)); elseif (n <= 2.25e-231) tmp = 0.0; else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -2900000000.0], t$95$0, If[LessEqual[n, -1.9e-203], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.25e-231], 0.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{if}\;n \leq -2900000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -1.9 \cdot 10^{-203}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 2.25 \cdot 10^{-231}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.9e9Initial program 27.3%
associate-/r/27.8%
associate-*r*27.9%
*-commutative27.9%
associate-*r/27.9%
sub-neg27.9%
distribute-lft-in27.9%
metadata-eval27.9%
metadata-eval27.9%
metadata-eval27.9%
fma-define27.9%
metadata-eval27.9%
Simplified27.9%
Taylor expanded in i around 0 55.1%
*-commutative55.1%
associate-*r/55.1%
metadata-eval55.1%
Simplified55.1%
Taylor expanded in n around inf 55.3%
*-commutative55.3%
Simplified55.3%
if -2.9e9 < n < -1.90000000000000013e-203Initial program 21.3%
Taylor expanded in i around 0 64.3%
if -1.90000000000000013e-203 < n < 2.2499999999999999e-231Initial program 71.0%
associate-*r/71.0%
sub-neg71.0%
distribute-rgt-in71.0%
metadata-eval71.0%
metadata-eval71.0%
Simplified71.0%
Taylor expanded in i around 0 71.8%
*-commutative71.8%
Simplified71.8%
Taylor expanded in i around 0 84.0%
Taylor expanded in i around 0 84.0%
if 2.2499999999999999e-231 < n Initial program 23.8%
sub-neg23.8%
metadata-eval23.8%
Applied egg-rr23.8%
metadata-eval23.8%
sub-neg23.8%
exp-to-pow19.7%
log1p-undefine38.9%
*-commutative38.9%
expm1-undefine83.4%
Simplified83.4%
associate-*r/83.2%
Applied egg-rr83.2%
associate-/r/82.9%
Simplified82.9%
Taylor expanded in i around 0 66.0%
associate-*r/66.0%
metadata-eval66.0%
Simplified66.0%
Taylor expanded in n around inf 66.2%
*-commutative66.2%
Simplified66.2%
Final simplification64.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i 50.0)))))
(if (<= n -12500000.0)
t_0
(if (<= n -1.02e-200)
(* 100.0 (/ i (/ i n)))
(if (<= n 1.9e-231) 0.0 t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -12500000.0) {
tmp = t_0;
} else if (n <= -1.02e-200) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.9e-231) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = n * (100.0d0 + (i * 50.0d0))
if (n <= (-12500000.0d0)) then
tmp = t_0
else if (n <= (-1.02d-200)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 1.9d-231) then
tmp = 0.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -12500000.0) {
tmp = t_0;
} else if (n <= -1.02e-200) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.9e-231) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + (i * 50.0)) tmp = 0 if n <= -12500000.0: tmp = t_0 elif n <= -1.02e-200: tmp = 100.0 * (i / (i / n)) elif n <= 1.9e-231: tmp = 0.0 else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 + Float64(i * 50.0))) tmp = 0.0 if (n <= -12500000.0) tmp = t_0; elseif (n <= -1.02e-200) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 1.9e-231) tmp = 0.0; else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = n * (100.0 + (i * 50.0)); tmp = 0.0; if (n <= -12500000.0) tmp = t_0; elseif (n <= -1.02e-200) tmp = 100.0 * (i / (i / n)); elseif (n <= 1.9e-231) tmp = 0.0; else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -12500000.0], t$95$0, If[LessEqual[n, -1.02e-200], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.9e-231], 0.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{if}\;n \leq -12500000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -1.02 \cdot 10^{-200}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 1.9 \cdot 10^{-231}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.25e7 or 1.90000000000000007e-231 < n Initial program 25.1%
associate-/r/25.4%
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 i around 0 64.9%
*-commutative64.9%
associate-*r/64.9%
metadata-eval64.9%
Simplified64.9%
Taylor expanded in n around inf 62.3%
*-commutative62.3%
Simplified62.3%
if -1.25e7 < n < -1.02e-200Initial program 21.3%
Taylor expanded in i around 0 64.3%
if -1.02e-200 < n < 1.90000000000000007e-231Initial program 71.0%
associate-*r/71.0%
sub-neg71.0%
distribute-rgt-in71.0%
metadata-eval71.0%
metadata-eval71.0%
Simplified71.0%
Taylor expanded in i around 0 71.8%
*-commutative71.8%
Simplified71.8%
Taylor expanded in i around 0 84.0%
Taylor expanded in i around 0 84.0%
(FPCore (i n) :precision binary64 (if (<= i -9.5e+31) 0.0 (* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))))
double code(double i, double n) {
double tmp;
if (i <= -9.5e+31) {
tmp = 0.0;
} 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 (i <= (-9.5d+31)) then
tmp = 0.0d0
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 (i <= -9.5e+31) {
tmp = 0.0;
} else {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -9.5e+31: tmp = 0.0 else: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) return tmp
function code(i, n) tmp = 0.0 if (i <= -9.5e+31) tmp = 0.0; 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 (i <= -9.5e+31) tmp = 0.0; else tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -9.5e+31], 0.0, 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}\;i \leq -9.5 \cdot 10^{+31}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\end{array}
\end{array}
if i < -9.5000000000000008e31Initial program 60.3%
associate-*r/60.3%
sub-neg60.3%
distribute-rgt-in60.3%
metadata-eval60.3%
metadata-eval60.3%
Simplified60.3%
Taylor expanded in i around 0 24.3%
*-commutative24.3%
Simplified24.3%
Taylor expanded in i around 0 27.6%
Taylor expanded in i around 0 27.6%
if -9.5000000000000008e31 < i Initial program 20.3%
associate-/r/20.6%
associate-*r*20.6%
*-commutative20.6%
associate-*r/20.6%
sub-neg20.6%
distribute-lft-in20.6%
metadata-eval20.6%
metadata-eval20.6%
metadata-eval20.6%
fma-define20.6%
metadata-eval20.6%
Simplified20.6%
Taylor expanded in n around inf 26.9%
sub-neg26.9%
metadata-eval26.9%
metadata-eval26.9%
distribute-lft-in26.9%
metadata-eval26.9%
sub-neg26.9%
expm1-define78.8%
Simplified78.8%
Taylor expanded in i around 0 73.9%
*-commutative73.9%
Simplified73.9%
(FPCore (i n) :precision binary64 (if (<= i -9.6e+30) 0.0 (if (<= i 1.65e+20) (* n 100.0) (* 50.0 (* i n)))))
double code(double i, double n) {
double tmp;
if (i <= -9.6e+30) {
tmp = 0.0;
} else if (i <= 1.65e+20) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-9.6d+30)) then
tmp = 0.0d0
else if (i <= 1.65d+20) then
tmp = n * 100.0d0
else
tmp = 50.0d0 * (i * n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -9.6e+30) {
tmp = 0.0;
} else if (i <= 1.65e+20) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -9.6e+30: tmp = 0.0 elif i <= 1.65e+20: tmp = n * 100.0 else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= -9.6e+30) tmp = 0.0; elseif (i <= 1.65e+20) tmp = Float64(n * 100.0); else tmp = Float64(50.0 * Float64(i * n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -9.6e+30) tmp = 0.0; elseif (i <= 1.65e+20) tmp = n * 100.0; else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -9.6e+30], 0.0, If[LessEqual[i, 1.65e+20], N[(n * 100.0), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -9.6 \cdot 10^{+30}:\\
\;\;\;\;0\\
\mathbf{elif}\;i \leq 1.65 \cdot 10^{+20}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < -9.5999999999999997e30Initial program 60.3%
associate-*r/60.3%
sub-neg60.3%
distribute-rgt-in60.3%
metadata-eval60.3%
metadata-eval60.3%
Simplified60.3%
Taylor expanded in i around 0 24.3%
*-commutative24.3%
Simplified24.3%
Taylor expanded in i around 0 27.6%
Taylor expanded in i around 0 27.6%
if -9.5999999999999997e30 < i < 1.65e20Initial program 9.0%
Taylor expanded in i around 0 80.4%
*-commutative80.4%
Simplified80.4%
if 1.65e20 < i Initial program 49.8%
associate-/r/50.0%
associate-*r*50.0%
*-commutative50.0%
associate-*r/50.0%
sub-neg50.0%
distribute-lft-in49.9%
metadata-eval49.9%
metadata-eval49.9%
metadata-eval49.9%
fma-define50.0%
metadata-eval50.0%
Simplified50.0%
Taylor expanded in n around inf 64.8%
sub-neg64.8%
metadata-eval64.8%
metadata-eval64.8%
distribute-lft-in64.8%
metadata-eval64.8%
sub-neg64.8%
expm1-define64.8%
Simplified64.8%
Taylor expanded in i around 0 42.2%
Taylor expanded in i around inf 42.2%
*-commutative42.2%
*-commutative42.2%
Simplified42.2%
Final simplification61.1%
(FPCore (i n) :precision binary64 (if (<= i -9.5e+30) 0.0 (if (<= i 1.65e+20) (* n 100.0) (* i (* n 50.0)))))
double code(double i, double n) {
double tmp;
if (i <= -9.5e+30) {
tmp = 0.0;
} else if (i <= 1.65e+20) {
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 <= (-9.5d+30)) then
tmp = 0.0d0
else if (i <= 1.65d+20) 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 <= -9.5e+30) {
tmp = 0.0;
} else if (i <= 1.65e+20) {
tmp = n * 100.0;
} else {
tmp = i * (n * 50.0);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -9.5e+30: tmp = 0.0 elif i <= 1.65e+20: tmp = n * 100.0 else: tmp = i * (n * 50.0) return tmp
function code(i, n) tmp = 0.0 if (i <= -9.5e+30) tmp = 0.0; elseif (i <= 1.65e+20) tmp = Float64(n * 100.0); else tmp = Float64(i * Float64(n * 50.0)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -9.5e+30) tmp = 0.0; elseif (i <= 1.65e+20) tmp = n * 100.0; else tmp = i * (n * 50.0); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -9.5e+30], 0.0, If[LessEqual[i, 1.65e+20], N[(n * 100.0), $MachinePrecision], N[(i * N[(n * 50.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -9.5 \cdot 10^{+30}:\\
\;\;\;\;0\\
\mathbf{elif}\;i \leq 1.65 \cdot 10^{+20}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;i \cdot \left(n \cdot 50\right)\\
\end{array}
\end{array}
if i < -9.5000000000000003e30Initial program 60.3%
associate-*r/60.3%
sub-neg60.3%
distribute-rgt-in60.3%
metadata-eval60.3%
metadata-eval60.3%
Simplified60.3%
Taylor expanded in i around 0 24.3%
*-commutative24.3%
Simplified24.3%
Taylor expanded in i around 0 27.6%
Taylor expanded in i around 0 27.6%
if -9.5000000000000003e30 < i < 1.65e20Initial program 9.0%
Taylor expanded in i around 0 80.4%
*-commutative80.4%
Simplified80.4%
if 1.65e20 < i Initial program 49.8%
associate-/r/50.0%
associate-*r*50.0%
*-commutative50.0%
associate-*r/50.0%
sub-neg50.0%
distribute-lft-in49.9%
metadata-eval49.9%
metadata-eval49.9%
metadata-eval49.9%
fma-define50.0%
metadata-eval50.0%
Simplified50.0%
Taylor expanded in n around inf 64.8%
sub-neg64.8%
metadata-eval64.8%
metadata-eval64.8%
distribute-lft-in64.8%
metadata-eval64.8%
sub-neg64.8%
expm1-define64.8%
Simplified64.8%
Taylor expanded in i around 0 42.2%
Taylor expanded in i around inf 42.2%
*-commutative42.2%
associate-*r*42.2%
Simplified42.2%
(FPCore (i n) :precision binary64 (if (<= i -9.5e+30) 0.0 (if (<= i 42000000.0) (* n 100.0) 0.0)))
double code(double i, double n) {
double tmp;
if (i <= -9.5e+30) {
tmp = 0.0;
} else if (i <= 42000000.0) {
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 <= (-9.5d+30)) then
tmp = 0.0d0
else if (i <= 42000000.0d0) 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 <= -9.5e+30) {
tmp = 0.0;
} else if (i <= 42000000.0) {
tmp = n * 100.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -9.5e+30: tmp = 0.0 elif i <= 42000000.0: tmp = n * 100.0 else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if (i <= -9.5e+30) tmp = 0.0; elseif (i <= 42000000.0) tmp = Float64(n * 100.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -9.5e+30) tmp = 0.0; elseif (i <= 42000000.0) tmp = n * 100.0; else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -9.5e+30], 0.0, If[LessEqual[i, 42000000.0], N[(n * 100.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -9.5 \cdot 10^{+30}:\\
\;\;\;\;0\\
\mathbf{elif}\;i \leq 42000000:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if i < -9.5000000000000003e30 or 4.2e7 < i Initial program 55.3%
associate-*r/55.4%
sub-neg55.4%
distribute-rgt-in55.3%
metadata-eval55.3%
metadata-eval55.3%
Simplified55.3%
Taylor expanded in i around 0 19.5%
*-commutative19.5%
Simplified19.5%
Taylor expanded in i around 0 23.7%
Taylor expanded in i around 0 23.7%
if -9.5000000000000003e30 < i < 4.2e7Initial program 8.4%
Taylor expanded in i around 0 80.9%
*-commutative80.9%
Simplified80.9%
(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 28.6%
associate-*r/28.6%
sub-neg28.6%
distribute-rgt-in28.5%
metadata-eval28.5%
metadata-eval28.5%
Simplified28.5%
Taylor expanded in i around 0 13.1%
*-commutative13.1%
Simplified13.1%
Taylor expanded in i around 0 14.5%
Taylor expanded in i around 0 14.7%
(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 2024103
(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))))