
(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 15 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) -1.0) (/ i n))))
(if (<= t_0 0.0)
(* 100.0 (/ (expm1 (* n (log1p (/ i n)))) (/ i n)))
(if (<= t_0 INFINITY)
(/ (+ (* 100.0 (pow (/ i n) n)) -100.0) (/ i n))
(* n (/ 1.0 (+ 0.01 (* i -0.005))))))))
double code(double i, double n) {
double t_0 = (pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= 0.0) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) / (i / n));
} else if (t_0 <= ((double) INFINITY)) {
tmp = ((100.0 * pow((i / n), n)) + -100.0) / (i / n);
} else {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = (Math.pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= 0.0) {
tmp = 100.0 * (Math.expm1((n * Math.log1p((i / n)))) / (i / n));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = ((100.0 * Math.pow((i / n), n)) + -100.0) / (i / n);
} else {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
}
return tmp;
}
def code(i, n): t_0 = (math.pow((1.0 + (i / n)), n) + -1.0) / (i / n) tmp = 0 if t_0 <= 0.0: tmp = 100.0 * (math.expm1((n * math.log1p((i / n)))) / (i / n)) elif t_0 <= math.inf: tmp = ((100.0 * math.pow((i / n), n)) + -100.0) / (i / n) else: tmp = n * (1.0 / (0.01 + (i * -0.005))) return tmp
function code(i, n) t_0 = Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i / n))); elseif (t_0 <= Inf) tmp = Float64(Float64(Float64(100.0 * (Float64(i / n) ^ n)) + -100.0) / Float64(i / n)); else tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(i * -0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 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$0, Infinity], N[(N[(N[(100.0 * N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(1.0 / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{100 \cdot {\left(\frac{i}{n}\right)}^{n} + -100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + i \cdot -0.005}\\
\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 28.4%
sub-neg28.4%
metadata-eval28.4%
Applied egg-rr28.4%
metadata-eval28.4%
sub-neg28.4%
exp-to-pow26.7%
log1p-undefine52.3%
*-commutative52.3%
expm1-undefine97.9%
Simplified97.9%
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 98.6%
associate-*r/98.8%
sub-neg98.8%
distribute-rgt-in98.8%
metadata-eval98.8%
metadata-eval98.8%
Simplified98.8%
Taylor expanded in i around inf 98.8%
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%
associate-/r/2.0%
associate-*r*2.0%
*-commutative2.0%
associate-*r/2.0%
sub-neg2.0%
distribute-lft-in2.0%
metadata-eval2.0%
metadata-eval2.0%
metadata-eval2.0%
fma-define2.0%
metadata-eval2.0%
Simplified2.0%
Taylor expanded in n around inf 2.0%
sub-neg2.0%
metadata-eval2.0%
metadata-eval2.0%
distribute-lft-in2.0%
metadata-eval2.0%
sub-neg2.0%
expm1-define80.6%
Simplified80.6%
clear-num80.6%
inv-pow80.6%
*-un-lft-identity80.6%
times-frac80.7%
metadata-eval80.7%
Applied egg-rr80.7%
unpow-180.7%
Simplified80.7%
Taylor expanded in i around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification98.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n)))
(t_1 (/ (+ (* 100.0 (pow (/ i n) n)) -100.0) (/ i n))))
(if (<= t_0 -2e-163)
t_1
(if (<= t_0 0.0)
(* n (* 100.0 (/ (expm1 i) i)))
(if (<= t_0 INFINITY) t_1 (* n (/ 1.0 (+ 0.01 (* i -0.005)))))))))
double code(double i, double n) {
double t_0 = (pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double t_1 = ((100.0 * pow((i / n), n)) + -100.0) / (i / n);
double tmp;
if (t_0 <= -2e-163) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = n * (100.0 * (expm1(i) / i));
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = (Math.pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double t_1 = ((100.0 * Math.pow((i / n), n)) + -100.0) / (i / n);
double tmp;
if (t_0 <= -2e-163) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
}
return tmp;
}
def code(i, n): t_0 = (math.pow((1.0 + (i / n)), n) + -1.0) / (i / n) t_1 = ((100.0 * math.pow((i / n), n)) + -100.0) / (i / n) tmp = 0 if t_0 <= -2e-163: tmp = t_1 elif t_0 <= 0.0: tmp = n * (100.0 * (math.expm1(i) / i)) elif t_0 <= math.inf: tmp = t_1 else: tmp = n * (1.0 / (0.01 + (i * -0.005))) return tmp
function code(i, n) t_0 = Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) t_1 = Float64(Float64(Float64(100.0 * (Float64(i / n) ^ n)) + -100.0) / Float64(i / n)) tmp = 0.0 if (t_0 <= -2e-163) tmp = t_1; elseif (t_0 <= 0.0) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); elseif (t_0 <= Inf) tmp = t_1; else tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(i * -0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(100.0 * N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-163], t$95$1, If[LessEqual[t$95$0, 0.0], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], t$95$1, N[(n * N[(1.0 / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
t_1 := \frac{100 \cdot {\left(\frac{i}{n}\right)}^{n} + -100}{\frac{i}{n}}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-163}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + i \cdot -0.005}\\
\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)) < -1.99999999999999985e-163 or -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 97.0%
associate-*r/97.2%
sub-neg97.2%
distribute-rgt-in97.3%
metadata-eval97.3%
metadata-eval97.3%
Simplified97.3%
Taylor expanded in i around inf 97.3%
if -1.99999999999999985e-163 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -0.0Initial program 24.2%
associate-/r/24.1%
associate-*r*24.1%
*-commutative24.1%
associate-*r/24.1%
sub-neg24.1%
distribute-lft-in24.1%
metadata-eval24.1%
metadata-eval24.1%
metadata-eval24.1%
fma-define24.1%
metadata-eval24.1%
Simplified24.1%
Taylor expanded in n around inf 43.4%
associate-/l*43.4%
sub-neg43.4%
metadata-eval43.4%
metadata-eval43.4%
distribute-lft-in43.5%
metadata-eval43.5%
sub-neg43.5%
associate-*r/43.5%
*-commutative43.5%
expm1-define77.8%
Simplified77.8%
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%
associate-/r/2.0%
associate-*r*2.0%
*-commutative2.0%
associate-*r/2.0%
sub-neg2.0%
distribute-lft-in2.0%
metadata-eval2.0%
metadata-eval2.0%
metadata-eval2.0%
fma-define2.0%
metadata-eval2.0%
Simplified2.0%
Taylor expanded in n around inf 2.0%
sub-neg2.0%
metadata-eval2.0%
metadata-eval2.0%
distribute-lft-in2.0%
metadata-eval2.0%
sub-neg2.0%
expm1-define80.6%
Simplified80.6%
clear-num80.6%
inv-pow80.6%
*-un-lft-identity80.6%
times-frac80.7%
metadata-eval80.7%
Applied egg-rr80.7%
unpow-180.7%
Simplified80.7%
Taylor expanded in i around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification84.9%
(FPCore (i n) :precision binary64 (if (or (<= n -2.45e-40) (not (<= n 1.35e+24))) (* n (* 100.0 (/ (expm1 i) i))) (* n (/ 1.0 (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005)))))))
double code(double i, double n) {
double tmp;
if ((n <= -2.45e-40) || !(n <= 1.35e+24)) {
tmp = n * (100.0 * (expm1(i) / i));
} else {
tmp = n * (1.0 / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -2.45e-40) || !(n <= 1.35e+24)) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else {
tmp = n * (1.0 / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.45e-40) or not (n <= 1.35e+24): tmp = n * (100.0 * (math.expm1(i) / i)) else: tmp = n * (1.0 / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.45e-40) || !(n <= 1.35e+24)) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); else tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005))))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -2.45e-40], N[Not[LessEqual[n, 1.35e+24]], $MachinePrecision]], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(1.0 / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.45 \cdot 10^{-40} \lor \neg \left(n \leq 1.35 \cdot 10^{+24}\right):\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\end{array}
\end{array}
if n < -2.4499999999999999e-40 or 1.35e24 < n Initial program 27.1%
associate-/r/27.6%
associate-*r*27.6%
*-commutative27.6%
associate-*r/27.6%
sub-neg27.6%
distribute-lft-in27.7%
metadata-eval27.7%
metadata-eval27.7%
metadata-eval27.7%
fma-define27.6%
metadata-eval27.6%
Simplified27.6%
Taylor expanded in n around inf 48.1%
associate-/l*48.1%
sub-neg48.1%
metadata-eval48.1%
metadata-eval48.1%
distribute-lft-in48.2%
metadata-eval48.2%
sub-neg48.2%
associate-*r/48.1%
*-commutative48.1%
expm1-define89.4%
Simplified89.4%
if -2.4499999999999999e-40 < n < 1.35e24Initial program 38.5%
associate-/r/38.5%
associate-*r*38.5%
*-commutative38.5%
associate-*r/38.5%
sub-neg38.5%
distribute-lft-in38.5%
metadata-eval38.5%
metadata-eval38.5%
metadata-eval38.5%
fma-define38.5%
metadata-eval38.5%
Simplified38.5%
Taylor expanded in n around inf 23.1%
sub-neg23.1%
metadata-eval23.1%
metadata-eval23.1%
distribute-lft-in23.1%
metadata-eval23.1%
sub-neg23.1%
expm1-define52.7%
Simplified52.7%
clear-num52.6%
inv-pow52.6%
*-un-lft-identity52.6%
times-frac52.7%
metadata-eval52.7%
Applied egg-rr52.7%
unpow-152.7%
Simplified52.7%
Taylor expanded in i around 0 72.1%
Final simplification82.8%
(FPCore (i n)
:precision binary64
(if (<= i -5e-9)
(* 100.0 (/ (expm1 i) (/ i n)))
(+
(*
i
(+
(* n 50.0)
(* i (+ (* 4.166666666666667 (* i n)) (* n 16.666666666666668)))))
(* n 100.0))))
double code(double i, double n) {
double tmp;
if (i <= -5e-9) {
tmp = 100.0 * (expm1(i) / (i / n));
} else {
tmp = (i * ((n * 50.0) + (i * ((4.166666666666667 * (i * n)) + (n * 16.666666666666668))))) + (n * 100.0);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (i <= -5e-9) {
tmp = 100.0 * (Math.expm1(i) / (i / n));
} else {
tmp = (i * ((n * 50.0) + (i * ((4.166666666666667 * (i * n)) + (n * 16.666666666666668))))) + (n * 100.0);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -5e-9: tmp = 100.0 * (math.expm1(i) / (i / n)) else: tmp = (i * ((n * 50.0) + (i * ((4.166666666666667 * (i * n)) + (n * 16.666666666666668))))) + (n * 100.0) return tmp
function code(i, n) tmp = 0.0 if (i <= -5e-9) tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n))); else tmp = Float64(Float64(i * Float64(Float64(n * 50.0) + Float64(i * Float64(Float64(4.166666666666667 * Float64(i * n)) + Float64(n * 16.666666666666668))))) + Float64(n * 100.0)); end return tmp end
code[i_, n_] := If[LessEqual[i, -5e-9], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(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] + N[(n * 100.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -5 \cdot 10^{-9}:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;i \cdot \left(n \cdot 50 + i \cdot \left(4.166666666666667 \cdot \left(i \cdot n\right) + n \cdot 16.666666666666668\right)\right) + n \cdot 100\\
\end{array}
\end{array}
if i < -5.0000000000000001e-9Initial program 56.3%
Taylor expanded in n around inf 77.0%
expm1-define77.2%
Simplified77.2%
if -5.0000000000000001e-9 < i Initial program 23.6%
associate-/r/24.0%
associate-*r*24.1%
*-commutative24.1%
associate-*r/24.1%
sub-neg24.1%
distribute-lft-in24.1%
metadata-eval24.1%
metadata-eval24.1%
metadata-eval24.1%
fma-define24.1%
metadata-eval24.1%
Simplified24.1%
Taylor expanded in n around inf 26.3%
sub-neg26.3%
metadata-eval26.3%
metadata-eval26.3%
distribute-lft-in26.3%
metadata-eval26.3%
sub-neg26.3%
expm1-define74.8%
Simplified74.8%
Taylor expanded in i around 0 73.3%
Final simplification74.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))))
(if (<= n -5.1e+183)
t_0
(if (<= n -1.8e-112)
(* n (/ 1.0 (+ 0.01 (* i -0.005))))
(if (<= n 1.75e-130) 0.0 t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
double tmp;
if (n <= -5.1e+183) {
tmp = t_0;
} else if (n <= -1.8e-112) {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
} else if (n <= 1.75e-130) {
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 + (i * 16.666666666666668d0))))
if (n <= (-5.1d+183)) then
tmp = t_0
else if (n <= (-1.8d-112)) then
tmp = n * (1.0d0 / (0.01d0 + (i * (-0.005d0))))
else if (n <= 1.75d-130) 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 + (i * 16.666666666666668))));
double tmp;
if (n <= -5.1e+183) {
tmp = t_0;
} else if (n <= -1.8e-112) {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
} else if (n <= 1.75e-130) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) tmp = 0 if n <= -5.1e+183: tmp = t_0 elif n <= -1.8e-112: tmp = n * (1.0 / (0.01 + (i * -0.005))) elif n <= 1.75e-130: tmp = 0.0 else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))) tmp = 0.0 if (n <= -5.1e+183) tmp = t_0; elseif (n <= -1.8e-112) tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(i * -0.005)))); elseif (n <= 1.75e-130) 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 + (i * 16.666666666666668)))); tmp = 0.0; if (n <= -5.1e+183) tmp = t_0; elseif (n <= -1.8e-112) tmp = n * (1.0 / (0.01 + (i * -0.005))); elseif (n <= 1.75e-130) 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 * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -5.1e+183], t$95$0, If[LessEqual[n, -1.8e-112], N[(n * N[(1.0 / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.75e-130], 0.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{if}\;n \leq -5.1 \cdot 10^{+183}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -1.8 \cdot 10^{-112}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 1.75 \cdot 10^{-130}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -5.10000000000000045e183 or 1.75e-130 < n Initial program 19.1%
associate-/r/19.5%
associate-*r*19.5%
*-commutative19.5%
associate-*r/19.5%
sub-neg19.5%
distribute-lft-in19.6%
metadata-eval19.6%
metadata-eval19.6%
metadata-eval19.6%
fma-define19.5%
metadata-eval19.5%
Simplified19.5%
Taylor expanded in n around inf 45.5%
sub-neg45.5%
metadata-eval45.5%
metadata-eval45.5%
distribute-lft-in45.6%
metadata-eval45.6%
sub-neg45.6%
expm1-define90.5%
Simplified90.5%
Taylor expanded in i around 0 73.8%
*-commutative73.8%
Simplified73.8%
if -5.10000000000000045e183 < n < -1.8e-112Initial program 36.8%
associate-/r/36.6%
associate-*r*36.8%
*-commutative36.8%
associate-*r/36.8%
sub-neg36.8%
distribute-lft-in36.9%
metadata-eval36.9%
metadata-eval36.9%
metadata-eval36.9%
fma-define36.8%
metadata-eval36.8%
Simplified36.8%
Taylor expanded in n around inf 29.1%
sub-neg29.1%
metadata-eval29.1%
metadata-eval29.1%
distribute-lft-in29.2%
metadata-eval29.2%
sub-neg29.2%
expm1-define77.0%
Simplified77.0%
clear-num77.0%
inv-pow77.0%
*-un-lft-identity77.0%
times-frac77.1%
metadata-eval77.1%
Applied egg-rr77.1%
unpow-177.1%
Simplified77.1%
Taylor expanded in i around 0 60.6%
*-commutative60.6%
Simplified60.6%
if -1.8e-112 < n < 1.75e-130Initial program 53.8%
associate-*r/53.8%
sub-neg53.8%
distribute-rgt-in53.8%
metadata-eval53.8%
metadata-eval53.8%
Simplified53.8%
Taylor expanded in i around 0 66.9%
Taylor expanded in i around 0 66.9%
(FPCore (i n)
:precision binary64
(if (<= n -5e+127)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n 4.2e-5)
(* n (/ 1.0 (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005)))))
(*
n
(+
100.0
(* i (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667))))))))))
double code(double i, double n) {
double tmp;
if (n <= -5e+127) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 4.2e-5) {
tmp = n * (1.0 / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))));
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-5d+127)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= 4.2d-5) then
tmp = n * (1.0d0 / (0.01d0 + (i * ((i * 0.0008333333333333334d0) - 0.005d0))))
else
tmp = n * (100.0d0 + (i * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -5e+127) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 4.2e-5) {
tmp = n * (1.0 / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))));
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -5e+127: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= 4.2e-5: tmp = n * (1.0 / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)))) else: tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -5e+127) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= 4.2e-5) tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005))))); else tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -5e+127) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= 4.2e-5) tmp = n * (1.0 / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)))); else tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -5e+127], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.2e-5], N[(n * N[(1.0 / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -5 \cdot 10^{+127}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq 4.2 \cdot 10^{-5}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\end{array}
\end{array}
if n < -5.0000000000000004e127Initial program 13.2%
associate-/r/13.8%
associate-*r*13.8%
*-commutative13.8%
associate-*r/13.9%
sub-neg13.9%
distribute-lft-in13.9%
metadata-eval13.9%
metadata-eval13.9%
metadata-eval13.9%
fma-define13.9%
metadata-eval13.9%
Simplified13.9%
Taylor expanded in n around inf 47.5%
sub-neg47.5%
metadata-eval47.5%
metadata-eval47.5%
distribute-lft-in47.5%
metadata-eval47.5%
sub-neg47.5%
expm1-define91.6%
Simplified91.6%
Taylor expanded in i around 0 74.4%
*-commutative74.4%
Simplified74.4%
if -5.0000000000000004e127 < n < 4.19999999999999977e-5Initial program 42.1%
associate-/r/42.0%
associate-*r*42.1%
*-commutative42.1%
associate-*r/42.1%
sub-neg42.1%
distribute-lft-in42.2%
metadata-eval42.2%
metadata-eval42.2%
metadata-eval42.2%
fma-define42.1%
metadata-eval42.1%
Simplified42.1%
Taylor expanded in n around inf 25.5%
sub-neg25.5%
metadata-eval25.5%
metadata-eval25.5%
distribute-lft-in25.5%
metadata-eval25.5%
sub-neg25.5%
expm1-define54.8%
Simplified54.8%
clear-num54.8%
inv-pow54.8%
*-un-lft-identity54.8%
times-frac54.9%
metadata-eval54.9%
Applied egg-rr54.9%
unpow-154.9%
Simplified54.9%
Taylor expanded in i around 0 64.3%
if 4.19999999999999977e-5 < n Initial program 26.5%
associate-/r/27.0%
associate-*r*27.0%
*-commutative27.0%
associate-*r/27.0%
sub-neg27.0%
distribute-lft-in27.0%
metadata-eval27.0%
metadata-eval27.0%
metadata-eval27.0%
fma-define27.0%
metadata-eval27.0%
Simplified27.0%
Taylor expanded in n around inf 52.7%
sub-neg52.7%
metadata-eval52.7%
metadata-eval52.7%
distribute-lft-in52.8%
metadata-eval52.8%
sub-neg52.8%
expm1-define96.3%
Simplified96.3%
Taylor expanded in i around 0 79.5%
*-commutative79.5%
Simplified79.5%
Final simplification71.1%
(FPCore (i n) :precision binary64 (if (or (<= n -1.6e+124) (not (<= n 1.4e+24))) (* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668))))) (* n (/ 1.0 (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005)))))))
double code(double i, double n) {
double tmp;
if ((n <= -1.6e+124) || !(n <= 1.4e+24)) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else {
tmp = n * (1.0 / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-1.6d+124)) .or. (.not. (n <= 1.4d+24))) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else
tmp = n * (1.0d0 / (0.01d0 + (i * ((i * 0.0008333333333333334d0) - 0.005d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -1.6e+124) || !(n <= 1.4e+24)) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else {
tmp = n * (1.0 / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.6e+124) or not (n <= 1.4e+24): tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) else: tmp = n * (1.0 / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.6e+124) || !(n <= 1.4e+24)) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); else tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -1.6e+124) || ~((n <= 1.4e+24))) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); else tmp = n * (1.0 / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)))); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1.6e+124], N[Not[LessEqual[n, 1.4e+24]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(1.0 / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.6 \cdot 10^{+124} \lor \neg \left(n \leq 1.4 \cdot 10^{+24}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\end{array}
\end{array}
if n < -1.59999999999999996e124 or 1.4000000000000001e24 < n Initial program 21.9%
associate-/r/22.5%
associate-*r*22.5%
*-commutative22.5%
associate-*r/22.6%
sub-neg22.6%
distribute-lft-in22.6%
metadata-eval22.6%
metadata-eval22.6%
metadata-eval22.6%
fma-define22.6%
metadata-eval22.6%
Simplified22.6%
Taylor expanded in n around inf 53.9%
sub-neg53.9%
metadata-eval53.9%
metadata-eval53.9%
distribute-lft-in53.9%
metadata-eval53.9%
sub-neg53.9%
expm1-define95.0%
Simplified95.0%
Taylor expanded in i around 0 72.9%
*-commutative72.9%
Simplified72.9%
if -1.59999999999999996e124 < n < 1.4000000000000001e24Initial program 40.5%
associate-/r/40.4%
associate-*r*40.5%
*-commutative40.5%
associate-*r/40.5%
sub-neg40.5%
distribute-lft-in40.5%
metadata-eval40.5%
metadata-eval40.5%
metadata-eval40.5%
fma-define40.5%
metadata-eval40.5%
Simplified40.5%
Taylor expanded in n around inf 24.1%
sub-neg24.1%
metadata-eval24.1%
metadata-eval24.1%
distribute-lft-in24.1%
metadata-eval24.1%
sub-neg24.1%
expm1-define56.8%
Simplified56.8%
clear-num56.8%
inv-pow56.8%
*-un-lft-identity56.8%
times-frac56.9%
metadata-eval56.9%
Applied egg-rr56.9%
unpow-156.9%
Simplified56.9%
Taylor expanded in i around 0 65.7%
Final simplification69.2%
(FPCore (i n) :precision binary64 (if (or (<= n -2.6e+110) (not (<= n 1.35e+24))) (* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668))))) (* n (/ 1.0 (* 0.01 (+ 1.0 (* i (* i 0.08333333333333333))))))))
double code(double i, double n) {
double tmp;
if ((n <= -2.6e+110) || !(n <= 1.35e+24)) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else {
tmp = n * (1.0 / (0.01 * (1.0 + (i * (i * 0.08333333333333333)))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-2.6d+110)) .or. (.not. (n <= 1.35d+24))) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else
tmp = n * (1.0d0 / (0.01d0 * (1.0d0 + (i * (i * 0.08333333333333333d0)))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -2.6e+110) || !(n <= 1.35e+24)) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else {
tmp = n * (1.0 / (0.01 * (1.0 + (i * (i * 0.08333333333333333)))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.6e+110) or not (n <= 1.35e+24): tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) else: tmp = n * (1.0 / (0.01 * (1.0 + (i * (i * 0.08333333333333333))))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.6e+110) || !(n <= 1.35e+24)) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); else tmp = Float64(n * Float64(1.0 / Float64(0.01 * Float64(1.0 + Float64(i * Float64(i * 0.08333333333333333)))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -2.6e+110) || ~((n <= 1.35e+24))) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); else tmp = n * (1.0 / (0.01 * (1.0 + (i * (i * 0.08333333333333333))))); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -2.6e+110], N[Not[LessEqual[n, 1.35e+24]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(1.0 / N[(0.01 * N[(1.0 + N[(i * N[(i * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.6 \cdot 10^{+110} \lor \neg \left(n \leq 1.35 \cdot 10^{+24}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{1}{0.01 \cdot \left(1 + i \cdot \left(i \cdot 0.08333333333333333\right)\right)}\\
\end{array}
\end{array}
if n < -2.6e110 or 1.35e24 < n Initial program 21.8%
associate-/r/22.4%
associate-*r*22.4%
*-commutative22.4%
associate-*r/22.4%
sub-neg22.4%
distribute-lft-in22.4%
metadata-eval22.4%
metadata-eval22.4%
metadata-eval22.4%
fma-define22.4%
metadata-eval22.4%
Simplified22.4%
Taylor expanded in n around inf 53.7%
sub-neg53.7%
metadata-eval53.7%
metadata-eval53.7%
distribute-lft-in53.8%
metadata-eval53.8%
sub-neg53.8%
expm1-define95.1%
Simplified95.1%
Taylor expanded in i around 0 73.1%
*-commutative73.1%
Simplified73.1%
if -2.6e110 < n < 1.35e24Initial program 40.8%
associate-/r/40.7%
associate-*r*40.8%
*-commutative40.8%
associate-*r/40.8%
sub-neg40.8%
distribute-lft-in40.8%
metadata-eval40.8%
metadata-eval40.8%
metadata-eval40.8%
fma-define40.8%
metadata-eval40.8%
Simplified40.8%
Taylor expanded in n around inf 24.0%
sub-neg24.0%
metadata-eval24.0%
metadata-eval24.0%
distribute-lft-in24.0%
metadata-eval24.0%
sub-neg24.0%
expm1-define56.5%
Simplified56.5%
clear-num56.5%
inv-pow56.5%
*-un-lft-identity56.5%
times-frac56.6%
metadata-eval56.6%
Applied egg-rr56.6%
unpow-156.6%
Simplified56.6%
Taylor expanded in i around 0 65.4%
Taylor expanded in i around inf 65.4%
*-commutative65.4%
Simplified65.4%
Final simplification69.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i 50.0)))))
(if (<= n -7e+182)
t_0
(if (<= n -1.8e-112)
(* n (/ 1.0 (+ 0.01 (* i -0.005))))
(if (<= n 5.2e-140) 0.0 t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -7e+182) {
tmp = t_0;
} else if (n <= -1.8e-112) {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
} else if (n <= 5.2e-140) {
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 <= (-7d+182)) then
tmp = t_0
else if (n <= (-1.8d-112)) then
tmp = n * (1.0d0 / (0.01d0 + (i * (-0.005d0))))
else if (n <= 5.2d-140) 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 <= -7e+182) {
tmp = t_0;
} else if (n <= -1.8e-112) {
tmp = n * (1.0 / (0.01 + (i * -0.005)));
} else if (n <= 5.2e-140) {
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 <= -7e+182: tmp = t_0 elif n <= -1.8e-112: tmp = n * (1.0 / (0.01 + (i * -0.005))) elif n <= 5.2e-140: 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 <= -7e+182) tmp = t_0; elseif (n <= -1.8e-112) tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(i * -0.005)))); elseif (n <= 5.2e-140) 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 <= -7e+182) tmp = t_0; elseif (n <= -1.8e-112) tmp = n * (1.0 / (0.01 + (i * -0.005))); elseif (n <= 5.2e-140) 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, -7e+182], t$95$0, If[LessEqual[n, -1.8e-112], N[(n * N[(1.0 / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.2e-140], 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 -7 \cdot 10^{+182}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -1.8 \cdot 10^{-112}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 5.2 \cdot 10^{-140}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -7.00000000000000045e182 or 5.1999999999999996e-140 < n Initial program 19.1%
associate-/r/19.5%
associate-*r*19.5%
*-commutative19.5%
associate-*r/19.5%
sub-neg19.5%
distribute-lft-in19.6%
metadata-eval19.6%
metadata-eval19.6%
metadata-eval19.6%
fma-define19.5%
metadata-eval19.5%
Simplified19.5%
Taylor expanded in n around inf 45.5%
sub-neg45.5%
metadata-eval45.5%
metadata-eval45.5%
distribute-lft-in45.6%
metadata-eval45.6%
sub-neg45.6%
expm1-define90.5%
Simplified90.5%
Taylor expanded in i around 0 66.7%
*-commutative66.7%
Simplified66.7%
if -7.00000000000000045e182 < n < -1.8e-112Initial program 36.8%
associate-/r/36.6%
associate-*r*36.8%
*-commutative36.8%
associate-*r/36.8%
sub-neg36.8%
distribute-lft-in36.9%
metadata-eval36.9%
metadata-eval36.9%
metadata-eval36.9%
fma-define36.8%
metadata-eval36.8%
Simplified36.8%
Taylor expanded in n around inf 29.1%
sub-neg29.1%
metadata-eval29.1%
metadata-eval29.1%
distribute-lft-in29.2%
metadata-eval29.2%
sub-neg29.2%
expm1-define77.0%
Simplified77.0%
clear-num77.0%
inv-pow77.0%
*-un-lft-identity77.0%
times-frac77.1%
metadata-eval77.1%
Applied egg-rr77.1%
unpow-177.1%
Simplified77.1%
Taylor expanded in i around 0 60.6%
*-commutative60.6%
Simplified60.6%
if -1.8e-112 < n < 5.1999999999999996e-140Initial program 53.8%
associate-*r/53.8%
sub-neg53.8%
distribute-rgt-in53.8%
metadata-eval53.8%
metadata-eval53.8%
Simplified53.8%
Taylor expanded in i around 0 66.9%
Taylor expanded in i around 0 66.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i 50.0)))))
(if (<= n -2.1e+181)
t_0
(if (<= n -1.8e-112)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 2.7e-142) 0.0 t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -2.1e+181) {
tmp = t_0;
} else if (n <= -1.8e-112) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 2.7e-142) {
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 <= (-2.1d+181)) then
tmp = t_0
else if (n <= (-1.8d-112)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 2.7d-142) 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 <= -2.1e+181) {
tmp = t_0;
} else if (n <= -1.8e-112) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 2.7e-142) {
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 <= -2.1e+181: tmp = t_0 elif n <= -1.8e-112: tmp = n / (0.01 + (i * -0.005)) elif n <= 2.7e-142: 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 <= -2.1e+181) tmp = t_0; elseif (n <= -1.8e-112) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 2.7e-142) 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 <= -2.1e+181) tmp = t_0; elseif (n <= -1.8e-112) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 2.7e-142) 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, -2.1e+181], t$95$0, If[LessEqual[n, -1.8e-112], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.7e-142], 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 -2.1 \cdot 10^{+181}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -1.8 \cdot 10^{-112}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 2.7 \cdot 10^{-142}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.09999999999999997e181 or 2.6999999999999998e-142 < n Initial program 19.1%
associate-/r/19.5%
associate-*r*19.5%
*-commutative19.5%
associate-*r/19.5%
sub-neg19.5%
distribute-lft-in19.6%
metadata-eval19.6%
metadata-eval19.6%
metadata-eval19.6%
fma-define19.5%
metadata-eval19.5%
Simplified19.5%
Taylor expanded in n around inf 45.5%
sub-neg45.5%
metadata-eval45.5%
metadata-eval45.5%
distribute-lft-in45.6%
metadata-eval45.6%
sub-neg45.6%
expm1-define90.5%
Simplified90.5%
Taylor expanded in i around 0 66.7%
*-commutative66.7%
Simplified66.7%
if -2.09999999999999997e181 < n < -1.8e-112Initial program 36.8%
associate-/r/36.6%
associate-*r*36.8%
*-commutative36.8%
associate-*r/36.8%
sub-neg36.8%
distribute-lft-in36.9%
metadata-eval36.9%
metadata-eval36.9%
metadata-eval36.9%
fma-define36.8%
metadata-eval36.8%
Simplified36.8%
Taylor expanded in n around inf 29.1%
sub-neg29.1%
metadata-eval29.1%
metadata-eval29.1%
distribute-lft-in29.2%
metadata-eval29.2%
sub-neg29.2%
expm1-define77.0%
Simplified77.0%
clear-num77.0%
un-div-inv77.0%
*-un-lft-identity77.0%
times-frac77.1%
metadata-eval77.1%
Applied egg-rr77.1%
Taylor expanded in i around 0 60.6%
*-commutative60.6%
Simplified60.6%
if -1.8e-112 < n < 2.6999999999999998e-142Initial program 53.8%
associate-*r/53.8%
sub-neg53.8%
distribute-rgt-in53.8%
metadata-eval53.8%
metadata-eval53.8%
Simplified53.8%
Taylor expanded in i around 0 66.9%
Taylor expanded in i around 0 66.9%
(FPCore (i n) :precision binary64 (if (or (<= n -1.2e+124) (not (<= n 4.2e-5))) (* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668))))) (/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))))
double code(double i, double n) {
double tmp;
if ((n <= -1.2e+124) || !(n <= 4.2e-5)) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-1.2d+124)) .or. (.not. (n <= 4.2d-5))) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else
tmp = n / (0.01d0 + (i * ((i * 0.0008333333333333334d0) - 0.005d0)))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -1.2e+124) || !(n <= 4.2e-5)) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.2e+124) or not (n <= 4.2e-5): tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.2e+124) || !(n <= 4.2e-5)) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -1.2e+124) || ~((n <= 4.2e-5))) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); else tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1.2e+124], N[Not[LessEqual[n, 4.2e-5]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.2 \cdot 10^{+124} \lor \neg \left(n \leq 4.2 \cdot 10^{-5}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\end{array}
\end{array}
if n < -1.20000000000000003e124 or 4.19999999999999977e-5 < n Initial program 21.5%
associate-/r/22.1%
associate-*r*22.1%
*-commutative22.1%
associate-*r/22.1%
sub-neg22.1%
distribute-lft-in22.1%
metadata-eval22.1%
metadata-eval22.1%
metadata-eval22.1%
fma-define22.1%
metadata-eval22.1%
Simplified22.1%
Taylor expanded in n around inf 50.8%
sub-neg50.8%
metadata-eval50.8%
metadata-eval50.8%
distribute-lft-in50.8%
metadata-eval50.8%
sub-neg50.8%
expm1-define94.6%
Simplified94.6%
Taylor expanded in i around 0 73.8%
*-commutative73.8%
Simplified73.8%
if -1.20000000000000003e124 < n < 4.19999999999999977e-5Initial program 42.1%
associate-/r/42.0%
associate-*r*42.1%
*-commutative42.1%
associate-*r/42.1%
sub-neg42.1%
distribute-lft-in42.2%
metadata-eval42.2%
metadata-eval42.2%
metadata-eval42.2%
fma-define42.1%
metadata-eval42.1%
Simplified42.1%
Taylor expanded in n around inf 25.5%
sub-neg25.5%
metadata-eval25.5%
metadata-eval25.5%
distribute-lft-in25.5%
metadata-eval25.5%
sub-neg25.5%
expm1-define54.8%
Simplified54.8%
clear-num54.8%
un-div-inv54.8%
*-un-lft-identity54.8%
times-frac54.9%
metadata-eval54.9%
Applied egg-rr54.9%
Taylor expanded in i around 0 64.2%
Final simplification69.1%
(FPCore (i n) :precision binary64 (if (or (<= n -2.2e-112) (not (<= n 2.3e-127))) (* n (+ 100.0 (* i 50.0))) 0.0))
double code(double i, double n) {
double tmp;
if ((n <= -2.2e-112) || !(n <= 2.3e-127)) {
tmp = n * (100.0 + (i * 50.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 ((n <= (-2.2d-112)) .or. (.not. (n <= 2.3d-127))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -2.2e-112) || !(n <= 2.3e-127)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.2e-112) or not (n <= 2.3e-127): tmp = n * (100.0 + (i * 50.0)) else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.2e-112) || !(n <= 2.3e-127)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -2.2e-112) || ~((n <= 2.3e-127))) tmp = n * (100.0 + (i * 50.0)); else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -2.2e-112], N[Not[LessEqual[n, 2.3e-127]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.2 \cdot 10^{-112} \lor \neg \left(n \leq 2.3 \cdot 10^{-127}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if n < -2.20000000000000021e-112 or 2.30000000000000019e-127 < n Initial program 24.5%
associate-/r/24.8%
associate-*r*24.8%
*-commutative24.8%
associate-*r/24.8%
sub-neg24.8%
distribute-lft-in24.9%
metadata-eval24.9%
metadata-eval24.9%
metadata-eval24.9%
fma-define24.8%
metadata-eval24.8%
Simplified24.8%
Taylor expanded in n around inf 40.5%
sub-neg40.5%
metadata-eval40.5%
metadata-eval40.5%
distribute-lft-in40.5%
metadata-eval40.5%
sub-neg40.5%
expm1-define86.4%
Simplified86.4%
Taylor expanded in i around 0 61.7%
*-commutative61.7%
Simplified61.7%
if -2.20000000000000021e-112 < n < 2.30000000000000019e-127Initial program 53.8%
associate-*r/53.8%
sub-neg53.8%
distribute-rgt-in53.8%
metadata-eval53.8%
metadata-eval53.8%
Simplified53.8%
Taylor expanded in i around 0 66.9%
Taylor expanded in i around 0 66.9%
Final simplification63.0%
(FPCore (i n) :precision binary64 (if (<= i -0.016) 0.0 (if (<= i 2.0) (* n 100.0) (* i (* n 50.0)))))
double code(double i, double n) {
double tmp;
if (i <= -0.016) {
tmp = 0.0;
} else if (i <= 2.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 <= (-0.016d0)) then
tmp = 0.0d0
else if (i <= 2.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 <= -0.016) {
tmp = 0.0;
} else if (i <= 2.0) {
tmp = n * 100.0;
} else {
tmp = i * (n * 50.0);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -0.016: tmp = 0.0 elif i <= 2.0: tmp = n * 100.0 else: tmp = i * (n * 50.0) return tmp
function code(i, n) tmp = 0.0 if (i <= -0.016) tmp = 0.0; elseif (i <= 2.0) 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 <= -0.016) tmp = 0.0; elseif (i <= 2.0) tmp = n * 100.0; else tmp = i * (n * 50.0); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -0.016], 0.0, If[LessEqual[i, 2.0], N[(n * 100.0), $MachinePrecision], N[(i * N[(n * 50.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -0.016:\\
\;\;\;\;0\\
\mathbf{elif}\;i \leq 2:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;i \cdot \left(n \cdot 50\right)\\
\end{array}
\end{array}
if i < -0.016Initial program 58.1%
associate-*r/58.2%
sub-neg58.2%
distribute-rgt-in58.3%
metadata-eval58.3%
metadata-eval58.3%
Simplified58.3%
Taylor expanded in i around 0 37.1%
Taylor expanded in i around 0 37.1%
if -0.016 < i < 2Initial program 6.5%
associate-/r/7.2%
associate-*r*7.2%
*-commutative7.2%
associate-*r/7.2%
sub-neg7.2%
distribute-lft-in7.2%
metadata-eval7.2%
metadata-eval7.2%
metadata-eval7.2%
fma-define7.2%
metadata-eval7.2%
Simplified7.2%
Taylor expanded in i around 0 85.7%
*-commutative85.7%
Simplified85.7%
if 2 < i Initial program 50.5%
Taylor expanded in i around 0 33.0%
associate-*r*33.0%
*-commutative33.0%
associate-*r/33.0%
metadata-eval33.0%
Simplified33.0%
Taylor expanded in n around inf 33.4%
associate-*r*33.4%
*-commutative33.4%
Simplified33.4%
Taylor expanded in i around inf 33.4%
*-commutative33.4%
*-commutative33.4%
Simplified33.4%
Taylor expanded in n around 0 33.4%
*-commutative33.4%
associate-*r*33.4%
Simplified33.4%
(FPCore (i n) :precision binary64 (if (<= i -0.016) 0.0 (if (<= i 2.5e+35) (* n 100.0) 0.0)))
double code(double i, double n) {
double tmp;
if (i <= -0.016) {
tmp = 0.0;
} else if (i <= 2.5e+35) {
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 <= (-0.016d0)) then
tmp = 0.0d0
else if (i <= 2.5d+35) 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 <= -0.016) {
tmp = 0.0;
} else if (i <= 2.5e+35) {
tmp = n * 100.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -0.016: tmp = 0.0 elif i <= 2.5e+35: tmp = n * 100.0 else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if (i <= -0.016) tmp = 0.0; elseif (i <= 2.5e+35) tmp = Float64(n * 100.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -0.016) tmp = 0.0; elseif (i <= 2.5e+35) tmp = n * 100.0; else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -0.016], 0.0, If[LessEqual[i, 2.5e+35], N[(n * 100.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -0.016:\\
\;\;\;\;0\\
\mathbf{elif}\;i \leq 2.5 \cdot 10^{+35}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if i < -0.016 or 2.50000000000000011e35 < i Initial program 54.7%
associate-*r/54.7%
sub-neg54.7%
distribute-rgt-in54.8%
metadata-eval54.8%
metadata-eval54.8%
Simplified54.8%
Taylor expanded in i around 0 30.9%
Taylor expanded in i around 0 30.9%
if -0.016 < i < 2.50000000000000011e35Initial program 7.6%
associate-/r/8.2%
associate-*r*8.2%
*-commutative8.2%
associate-*r/8.2%
sub-neg8.2%
distribute-lft-in8.2%
metadata-eval8.2%
metadata-eval8.2%
metadata-eval8.2%
fma-define8.2%
metadata-eval8.2%
Simplified8.2%
Taylor expanded in i around 0 82.6%
*-commutative82.6%
Simplified82.6%
(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 31.5%
associate-*r/31.5%
sub-neg31.5%
distribute-rgt-in31.6%
metadata-eval31.6%
metadata-eval31.6%
Simplified31.6%
Taylor expanded in i around 0 18.8%
Taylor expanded in i around 0 19.1%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ 1.0 (/ i n))))
(*
100.0
(/
(-
(exp
(*
n
(if (== t_0 1.0)
(/ i n)
(/ (* (/ i n) (log t_0)) (- (+ (/ i n) 1.0) 1.0)))))
1.0)
(/ i n)))))
double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (i / n)
if (t_0 == 1.0d0) then
tmp = i / n
else
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0d0) - 1.0d0)
end if
code = 100.0d0 * ((exp((n * tmp)) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * Math.log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((Math.exp((n * tmp)) - 1.0) / (i / n));
}
def code(i, n): t_0 = 1.0 + (i / n) tmp = 0 if t_0 == 1.0: tmp = i / n else: tmp = ((i / n) * math.log(t_0)) / (((i / n) + 1.0) - 1.0) return 100.0 * ((math.exp((n * tmp)) - 1.0) / (i / n))
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) tmp = 0.0 if (t_0 == 1.0) tmp = Float64(i / n); else tmp = Float64(Float64(Float64(i / n) * log(t_0)) / Float64(Float64(Float64(i / n) + 1.0) - 1.0)); end return Float64(100.0 * Float64(Float64(exp(Float64(n * tmp)) - 1.0) / Float64(i / n))) end
function tmp_2 = code(i, n) t_0 = 1.0 + (i / n); tmp = 0.0; if (t_0 == 1.0) tmp = i / n; else tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0); end tmp_2 = 100.0 * ((exp((n * tmp)) - 1.0) / (i / n)); end
code[i_, n_] := Block[{t$95$0 = N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision]}, N[(100.0 * N[(N[(N[Exp[N[(n * If[Equal[t$95$0, 1.0], N[(i / n), $MachinePrecision], N[(N[(N[(i / n), $MachinePrecision] * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(i / n), $MachinePrecision] + 1.0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{i}{n}\\
100 \cdot \frac{e^{n \cdot \begin{array}{l}
\mathbf{if}\;t\_0 = 1:\\
\;\;\;\;\frac{i}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{i}{n} \cdot \log t\_0}{\left(\frac{i}{n} + 1\right) - 1}\\
\end{array}} - 1}{\frac{i}{n}}
\end{array}
\end{array}
herbie shell --seed 2024181
(FPCore (i n)
:name "Compound Interest"
:precision binary64
:alt
(! :herbie-platform default (let ((lnbase (if (== (+ 1 (/ i n)) 1) (/ i n) (/ (* (/ i n) (log (+ 1 (/ i n)))) (- (+ (/ i n) 1) 1))))) (* 100 (/ (- (exp (* n lnbase)) 1) (/ i n)))))
(* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))