
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 5e-248)
(* (/ (expm1 (* n (log1p (/ i n)))) i) (* n 100.0))
(if (<= t_1 INFINITY)
(/ (* n (fma t_0 100.0 -100.0)) i)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 5e-248) {
tmp = (expm1((n * log1p((i / n)))) / i) * (n * 100.0);
} else if (t_1 <= ((double) INFINITY)) {
tmp = (n * fma(t_0, 100.0, -100.0)) / i;
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 5e-248) tmp = Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i) * Float64(n * 100.0)); elseif (t_1 <= Inf) tmp = Float64(Float64(n * fma(t_0, 100.0, -100.0)) / i); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-248], N[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(n * N[(t$95$0 * 100.0 + -100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-248}:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i} \cdot \left(n \cdot 100\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{n \cdot \mathsf{fma}\left(t\_0, 100, -100\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 5.0000000000000001e-248Initial program 30.6%
associate-*r/30.7%
sub-neg30.7%
distribute-rgt-in30.7%
metadata-eval30.7%
metadata-eval30.7%
Simplified30.7%
metadata-eval30.7%
metadata-eval30.7%
distribute-rgt-in30.7%
sub-neg30.7%
associate-*r/30.6%
*-commutative30.6%
associate-/r/30.3%
associate-*l*30.3%
add-exp-log30.3%
expm1-define30.3%
log-pow40.7%
log1p-define98.1%
Applied egg-rr98.1%
if 5.0000000000000001e-248 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 94.8%
associate-*r/95.0%
sub-neg95.0%
distribute-rgt-in95.0%
metadata-eval95.0%
metadata-eval95.0%
associate-/r/94.8%
associate-*l/95.0%
*-commutative95.0%
fma-define95.0%
Applied egg-rr95.0%
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/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
metadata-eval1.9%
metadata-eval1.9%
metadata-eval1.9%
fma-define1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in n around inf 1.9%
div-sub1.9%
associate-*r/2.5%
metadata-eval2.5%
associate-*r/1.9%
distribute-lft-out--1.9%
div-sub1.9%
*-commutative1.9%
expm1-define81.0%
Simplified81.0%
associate-*l/80.8%
Applied egg-rr80.8%
clear-num80.9%
un-div-inv80.8%
*-un-lft-identity80.8%
*-commutative80.8%
times-frac80.9%
metadata-eval80.9%
Applied egg-rr80.9%
Taylor expanded in i around 0 99.8%
Final simplification98.3%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n))))
(if (<= t_0 0.0)
(* n (* 100.0 (/ (expm1 i) i)))
(if (<= t_0 INFINITY)
(* t_0 100.0)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))))))
double code(double i, double n) {
double t_0 = (pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= 0.0) {
tmp = n * (100.0 * (expm1(i) / i));
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_0 * 100.0;
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = (Math.pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= 0.0) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0 * 100.0;
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = (math.pow((1.0 + (i / n)), n) + -1.0) / (i / n) tmp = 0 if t_0 <= 0.0: tmp = n * (100.0 * (math.expm1(i) / i)) elif t_0 <= math.inf: tmp = t_0 * 100.0 else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) return tmp
function code(i, n) t_0 = Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); elseif (t_0 <= Inf) tmp = Float64(t_0 * 100.0); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(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[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(t$95$0 * 100.0), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0 \cdot 100\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -0.0Initial program 30.3%
associate-/r/29.9%
associate-*r*29.9%
*-commutative29.9%
associate-*r/29.9%
sub-neg29.9%
distribute-lft-in29.9%
metadata-eval29.9%
metadata-eval29.9%
metadata-eval29.9%
fma-define29.9%
metadata-eval29.9%
Simplified29.9%
Taylor expanded in n around inf 44.3%
div-sub44.5%
associate-*r/44.6%
metadata-eval44.6%
associate-*r/44.8%
distribute-lft-out--45.2%
div-sub44.4%
*-commutative44.4%
expm1-define77.6%
Simplified77.6%
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 92.0%
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/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
metadata-eval1.9%
metadata-eval1.9%
metadata-eval1.9%
fma-define1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in n around inf 1.9%
div-sub1.9%
associate-*r/2.5%
metadata-eval2.5%
associate-*r/1.9%
distribute-lft-out--1.9%
div-sub1.9%
*-commutative1.9%
expm1-define81.0%
Simplified81.0%
associate-*l/80.8%
Applied egg-rr80.8%
clear-num80.9%
un-div-inv80.8%
*-un-lft-identity80.8%
*-commutative80.8%
times-frac80.9%
metadata-eval80.9%
Applied egg-rr80.9%
Taylor expanded in i around 0 99.8%
Final simplification83.3%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 0.0)
(* n (* 100.0 (/ (expm1 i) i)))
(if (<= t_1 INFINITY)
(/ (+ -100.0 (* t_0 100.0)) (/ i n))
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = n * (100.0 * (expm1(i) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = (-100.0 + (t_0 * 100.0)) / (i / n);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (-100.0 + (t_0 * 100.0)) / (i / n);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 0.0: tmp = n * (100.0 * (math.expm1(i) / i)) elif t_1 <= math.inf: tmp = (-100.0 + (t_0 * 100.0)) / (i / n) else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); elseif (t_1 <= Inf) tmp = Float64(Float64(-100.0 + Float64(t_0 * 100.0)) / Float64(i / n)); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{-100 + t\_0 \cdot 100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -0.0Initial program 30.3%
associate-/r/29.9%
associate-*r*29.9%
*-commutative29.9%
associate-*r/29.9%
sub-neg29.9%
distribute-lft-in29.9%
metadata-eval29.9%
metadata-eval29.9%
metadata-eval29.9%
fma-define29.9%
metadata-eval29.9%
Simplified29.9%
Taylor expanded in n around inf 44.3%
div-sub44.5%
associate-*r/44.6%
metadata-eval44.6%
associate-*r/44.8%
distribute-lft-out--45.2%
div-sub44.4%
*-commutative44.4%
expm1-define77.6%
Simplified77.6%
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 92.0%
associate-*r/92.2%
sub-neg92.2%
distribute-rgt-in92.1%
metadata-eval92.1%
metadata-eval92.1%
Simplified92.1%
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/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
metadata-eval1.9%
metadata-eval1.9%
metadata-eval1.9%
fma-define1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in n around inf 1.9%
div-sub1.9%
associate-*r/2.5%
metadata-eval2.5%
associate-*r/1.9%
distribute-lft-out--1.9%
div-sub1.9%
*-commutative1.9%
expm1-define81.0%
Simplified81.0%
associate-*l/80.8%
Applied egg-rr80.8%
clear-num80.9%
un-div-inv80.8%
*-un-lft-identity80.8%
*-commutative80.8%
times-frac80.9%
metadata-eval80.9%
Applied egg-rr80.9%
Taylor expanded in i around 0 99.8%
Final simplification83.3%
(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-248)
(* n (/ (* (expm1 (* n (log1p (/ i n)))) 100.0) i))
(if (<= t_1 INFINITY)
(/ (+ -100.0 (* t_0 100.0)) (/ i n))
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 5e-248) {
tmp = n * ((expm1((n * log1p((i / n)))) * 100.0) / i);
} else if (t_1 <= ((double) INFINITY)) {
tmp = (-100.0 + (t_0 * 100.0)) / (i / n);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 5e-248) {
tmp = n * ((Math.expm1((n * Math.log1p((i / n)))) * 100.0) / i);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (-100.0 + (t_0 * 100.0)) / (i / n);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 5e-248: tmp = n * ((math.expm1((n * math.log1p((i / n)))) * 100.0) / i) elif t_1 <= math.inf: tmp = (-100.0 + (t_0 * 100.0)) / (i / n) else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 5e-248) tmp = Float64(n * Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) * 100.0) / i)); elseif (t_1 <= Inf) tmp = Float64(Float64(-100.0 + Float64(t_0 * 100.0)) / Float64(i / n)); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-248], N[(n * N[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * 100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-248}:\\
\;\;\;\;n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{i}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{-100 + t\_0 \cdot 100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 5.0000000000000001e-248Initial program 30.6%
associate-/r/30.3%
associate-*r*30.3%
*-commutative30.3%
associate-*r/30.3%
sub-neg30.3%
distribute-lft-in30.3%
metadata-eval30.3%
metadata-eval30.3%
metadata-eval30.3%
fma-define30.3%
metadata-eval30.3%
Simplified30.3%
fma-undefine30.3%
metadata-eval30.3%
metadata-eval30.3%
distribute-lft-in30.3%
sub-neg30.3%
*-commutative30.3%
add-exp-log30.3%
expm1-define30.3%
log-pow40.6%
log1p-define98.1%
Applied egg-rr98.1%
if 5.0000000000000001e-248 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 94.8%
associate-*r/95.0%
sub-neg95.0%
distribute-rgt-in95.0%
metadata-eval95.0%
metadata-eval95.0%
Simplified95.0%
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/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
metadata-eval1.9%
metadata-eval1.9%
metadata-eval1.9%
fma-define1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in n around inf 1.9%
div-sub1.9%
associate-*r/2.5%
metadata-eval2.5%
associate-*r/1.9%
distribute-lft-out--1.9%
div-sub1.9%
*-commutative1.9%
expm1-define81.0%
Simplified81.0%
associate-*l/80.8%
Applied egg-rr80.8%
clear-num80.9%
un-div-inv80.8%
*-un-lft-identity80.8%
*-commutative80.8%
times-frac80.9%
metadata-eval80.9%
Applied egg-rr80.9%
Taylor expanded in i around 0 99.8%
Final simplification98.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 5e-248)
(* n (* (/ (expm1 (* n (log1p (/ i n)))) i) 100.0))
(if (<= t_1 INFINITY)
(/ (+ -100.0 (* t_0 100.0)) (/ i n))
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 5e-248) {
tmp = n * ((expm1((n * log1p((i / n)))) / i) * 100.0);
} else if (t_1 <= ((double) INFINITY)) {
tmp = (-100.0 + (t_0 * 100.0)) / (i / n);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 5e-248) {
tmp = n * ((Math.expm1((n * Math.log1p((i / n)))) / i) * 100.0);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (-100.0 + (t_0 * 100.0)) / (i / n);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 5e-248: tmp = n * ((math.expm1((n * math.log1p((i / n)))) / i) * 100.0) elif t_1 <= math.inf: tmp = (-100.0 + (t_0 * 100.0)) / (i / n) else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 5e-248) tmp = Float64(n * Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i) * 100.0)); elseif (t_1 <= Inf) tmp = Float64(Float64(-100.0 + Float64(t_0 * 100.0)) / Float64(i / n)); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-248], N[(n * N[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision] * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-248}:\\
\;\;\;\;n \cdot \left(\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i} \cdot 100\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{-100 + t\_0 \cdot 100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 5.0000000000000001e-248Initial program 30.6%
associate-*r/30.7%
sub-neg30.7%
distribute-rgt-in30.7%
metadata-eval30.7%
metadata-eval30.7%
Simplified30.7%
metadata-eval30.7%
metadata-eval30.7%
distribute-rgt-in30.7%
sub-neg30.7%
associate-*r/30.6%
associate-/r/30.3%
associate-*r*30.3%
add-exp-log30.3%
expm1-define30.3%
log-pow40.7%
log1p-define98.1%
Applied egg-rr98.1%
if 5.0000000000000001e-248 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 94.8%
associate-*r/95.0%
sub-neg95.0%
distribute-rgt-in95.0%
metadata-eval95.0%
metadata-eval95.0%
Simplified95.0%
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/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
metadata-eval1.9%
metadata-eval1.9%
metadata-eval1.9%
fma-define1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in n around inf 1.9%
div-sub1.9%
associate-*r/2.5%
metadata-eval2.5%
associate-*r/1.9%
distribute-lft-out--1.9%
div-sub1.9%
*-commutative1.9%
expm1-define81.0%
Simplified81.0%
associate-*l/80.8%
Applied egg-rr80.8%
clear-num80.9%
un-div-inv80.8%
*-un-lft-identity80.8%
*-commutative80.8%
times-frac80.9%
metadata-eval80.9%
Applied egg-rr80.9%
Taylor expanded in i around 0 99.8%
Final simplification98.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 5e-248)
(* (/ (expm1 (* n (log1p (/ i n)))) i) (* n 100.0))
(if (<= t_1 INFINITY)
(/ (+ -100.0 (* t_0 100.0)) (/ i n))
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 5e-248) {
tmp = (expm1((n * log1p((i / n)))) / i) * (n * 100.0);
} else if (t_1 <= ((double) INFINITY)) {
tmp = (-100.0 + (t_0 * 100.0)) / (i / n);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 5e-248) {
tmp = (Math.expm1((n * Math.log1p((i / n)))) / i) * (n * 100.0);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (-100.0 + (t_0 * 100.0)) / (i / n);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 5e-248: tmp = (math.expm1((n * math.log1p((i / n)))) / i) * (n * 100.0) elif t_1 <= math.inf: tmp = (-100.0 + (t_0 * 100.0)) / (i / n) else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 5e-248) tmp = Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i) * Float64(n * 100.0)); elseif (t_1 <= Inf) tmp = Float64(Float64(-100.0 + Float64(t_0 * 100.0)) / Float64(i / n)); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-248], N[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-248}:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i} \cdot \left(n \cdot 100\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{-100 + t\_0 \cdot 100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 5.0000000000000001e-248Initial program 30.6%
associate-*r/30.7%
sub-neg30.7%
distribute-rgt-in30.7%
metadata-eval30.7%
metadata-eval30.7%
Simplified30.7%
metadata-eval30.7%
metadata-eval30.7%
distribute-rgt-in30.7%
sub-neg30.7%
associate-*r/30.6%
*-commutative30.6%
associate-/r/30.3%
associate-*l*30.3%
add-exp-log30.3%
expm1-define30.3%
log-pow40.7%
log1p-define98.1%
Applied egg-rr98.1%
if 5.0000000000000001e-248 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 94.8%
associate-*r/95.0%
sub-neg95.0%
distribute-rgt-in95.0%
metadata-eval95.0%
metadata-eval95.0%
Simplified95.0%
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/1.9%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
metadata-eval1.9%
metadata-eval1.9%
metadata-eval1.9%
fma-define1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in n around inf 1.9%
div-sub1.9%
associate-*r/2.5%
metadata-eval2.5%
associate-*r/1.9%
distribute-lft-out--1.9%
div-sub1.9%
*-commutative1.9%
expm1-define81.0%
Simplified81.0%
associate-*l/80.8%
Applied egg-rr80.8%
clear-num80.9%
un-div-inv80.8%
*-un-lft-identity80.8%
*-commutative80.8%
times-frac80.9%
metadata-eval80.9%
Applied egg-rr80.9%
Taylor expanded in i around 0 99.8%
Final simplification98.3%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ (expm1 i) (/ i n)))))
(if (<= i -1.1e-6)
t_0
(if (<= i 7.2e-6)
(*
100.0
(*
n
(+ 1.0 (+ (* (/ i n) -0.5) (* i (+ 0.5 (* i 0.16666666666666666)))))))
(if (<= i 9e+199)
t_0
(if (<= i 3.6e+245) (/ 0.0 (/ i n)) (* 50.0 (* i n))))))))
double code(double i, double n) {
double t_0 = 100.0 * (expm1(i) / (i / n));
double tmp;
if (i <= -1.1e-6) {
tmp = t_0;
} else if (i <= 7.2e-6) {
tmp = 100.0 * (n * (1.0 + (((i / n) * -0.5) + (i * (0.5 + (i * 0.16666666666666666))))));
} else if (i <= 9e+199) {
tmp = t_0;
} else if (i <= 3.6e+245) {
tmp = 0.0 / (i / n);
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (Math.expm1(i) / (i / n));
double tmp;
if (i <= -1.1e-6) {
tmp = t_0;
} else if (i <= 7.2e-6) {
tmp = 100.0 * (n * (1.0 + (((i / n) * -0.5) + (i * (0.5 + (i * 0.16666666666666666))))));
} else if (i <= 9e+199) {
tmp = t_0;
} else if (i <= 3.6e+245) {
tmp = 0.0 / (i / n);
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (math.expm1(i) / (i / n)) tmp = 0 if i <= -1.1e-6: tmp = t_0 elif i <= 7.2e-6: tmp = 100.0 * (n * (1.0 + (((i / n) * -0.5) + (i * (0.5 + (i * 0.16666666666666666)))))) elif i <= 9e+199: tmp = t_0 elif i <= 3.6e+245: tmp = 0.0 / (i / n) else: tmp = 50.0 * (i * n) return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(expm1(i) / Float64(i / n))) tmp = 0.0 if (i <= -1.1e-6) tmp = t_0; elseif (i <= 7.2e-6) tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(Float64(Float64(i / n) * -0.5) + Float64(i * Float64(0.5 + Float64(i * 0.16666666666666666))))))); elseif (i <= 9e+199) tmp = t_0; elseif (i <= 3.6e+245) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(50.0 * Float64(i * n)); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -1.1e-6], t$95$0, If[LessEqual[i, 7.2e-6], N[(100.0 * N[(n * N[(1.0 + N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(i * N[(0.5 + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 9e+199], t$95$0, If[LessEqual[i, 3.6e+245], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{if}\;i \leq -1.1 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;i \leq 7.2 \cdot 10^{-6}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + \left(\frac{i}{n} \cdot -0.5 + i \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\right)\\
\mathbf{elif}\;i \leq 9 \cdot 10^{+199}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;i \leq 3.6 \cdot 10^{+245}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < -1.1000000000000001e-6 or 7.19999999999999967e-6 < i < 8.9999999999999994e199Initial program 49.7%
Taylor expanded in n around inf 72.0%
expm1-define72.2%
Simplified72.2%
if -1.1000000000000001e-6 < i < 7.19999999999999967e-6Initial program 9.9%
Taylor expanded in i around 0 46.5%
associate--l+46.5%
associate--l+46.5%
associate-*r/46.5%
metadata-eval46.5%
associate-*r/46.5%
metadata-eval46.5%
associate-*r/46.5%
metadata-eval46.5%
Simplified46.5%
Taylor expanded in n around inf 56.9%
*-commutative56.9%
Simplified56.9%
Taylor expanded in n around inf 87.3%
if 8.9999999999999994e199 < i < 3.6000000000000002e245Initial program 37.7%
associate-*r/37.7%
sub-neg37.7%
distribute-rgt-in37.7%
metadata-eval37.7%
metadata-eval37.7%
Simplified37.7%
Taylor expanded in i around 0 64.6%
if 3.6000000000000002e245 < i Initial program 70.8%
associate-/r/71.1%
associate-*r*71.1%
*-commutative71.1%
associate-*r/71.1%
sub-neg71.1%
distribute-lft-in71.1%
metadata-eval71.1%
metadata-eval71.1%
metadata-eval71.1%
fma-define71.1%
metadata-eval71.1%
Simplified71.1%
Taylor expanded in n around inf 45.2%
div-sub45.2%
associate-*r/45.2%
metadata-eval45.2%
associate-*r/45.2%
distribute-lft-out--45.2%
div-sub45.2%
*-commutative45.2%
expm1-define45.2%
Simplified45.2%
associate-*l/45.2%
Applied egg-rr45.2%
Taylor expanded in i around 0 45.2%
Taylor expanded in i around inf 45.3%
*-commutative45.3%
Simplified45.3%
Final simplification78.8%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (* 100.0 (/ (expm1 i) i)))))
(if (<= n -2.5e-248)
t_0
(if (<= n 5.2e-153)
(/ 0.0 (/ i n))
(if (<= n 0.00045)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 * (expm1(i) / i));
double tmp;
if (n <= -2.5e-248) {
tmp = t_0;
} else if (n <= 5.2e-153) {
tmp = 0.0 / (i / n);
} else if (n <= 0.00045) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = n * (100.0 * (Math.expm1(i) / i));
double tmp;
if (n <= -2.5e-248) {
tmp = t_0;
} else if (n <= 5.2e-153) {
tmp = 0.0 / (i / n);
} else if (n <= 0.00045) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 * (math.expm1(i) / i)) tmp = 0 if n <= -2.5e-248: tmp = t_0 elif n <= 5.2e-153: tmp = 0.0 / (i / n) elif n <= 0.00045: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 * Float64(expm1(i) / i))) tmp = 0.0 if (n <= -2.5e-248) tmp = t_0; elseif (n <= 5.2e-153) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 0.00045) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -2.5e-248], t$95$0, If[LessEqual[n, 5.2e-153], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.00045], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{if}\;n \leq -2.5 \cdot 10^{-248}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 5.2 \cdot 10^{-153}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 0.00045:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.5e-248 or 4.4999999999999999e-4 < n Initial program 26.4%
associate-/r/26.5%
associate-*r*26.5%
*-commutative26.5%
associate-*r/26.5%
sub-neg26.5%
distribute-lft-in26.5%
metadata-eval26.5%
metadata-eval26.5%
metadata-eval26.5%
fma-define26.5%
metadata-eval26.5%
Simplified26.5%
Taylor expanded in n around inf 40.9%
div-sub41.0%
associate-*r/41.5%
metadata-eval41.5%
associate-*r/41.3%
distribute-lft-out--41.7%
div-sub40.9%
*-commutative40.9%
expm1-define88.8%
Simplified88.8%
if -2.5e-248 < n < 5.2000000000000003e-153Initial program 59.8%
associate-*r/59.8%
sub-neg59.8%
distribute-rgt-in59.8%
metadata-eval59.8%
metadata-eval59.8%
Simplified59.8%
Taylor expanded in i around 0 75.4%
if 5.2000000000000003e-153 < n < 4.4999999999999999e-4Initial program 14.0%
associate-/r/14.3%
associate-*r*14.3%
*-commutative14.3%
associate-*r/14.3%
sub-neg14.3%
distribute-lft-in14.3%
metadata-eval14.3%
metadata-eval14.3%
metadata-eval14.3%
fma-define14.3%
metadata-eval14.3%
Simplified14.3%
Taylor expanded in n around inf 2.7%
div-sub2.7%
associate-*r/2.5%
metadata-eval2.5%
associate-*r/2.7%
distribute-lft-out--2.7%
div-sub2.7%
*-commutative2.7%
expm1-define42.5%
Simplified42.5%
associate-*l/42.5%
Applied egg-rr42.5%
clear-num42.5%
un-div-inv42.4%
*-un-lft-identity42.4%
*-commutative42.4%
times-frac42.4%
metadata-eval42.4%
Applied egg-rr42.4%
Taylor expanded in i around 0 64.2%
Final simplification84.4%
(FPCore (i n)
:precision binary64
(let* ((t_0
(*
n
(+
100.0
(*
i
(+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))))
(if (<= n -1e+125)
t_0
(if (<= n -5.2e-244)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 6.8e-153)
(/ 0.0 (/ i n))
(if (<= n 6.2e+23)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
t_0))))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
double tmp;
if (n <= -1e+125) {
tmp = t_0;
} else if (n <= -5.2e-244) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 6.8e-153) {
tmp = 0.0 / (i / n);
} else if (n <= 6.2e+23) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} 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 + (i * 4.166666666666667d0))))))
if (n <= (-1d+125)) then
tmp = t_0
else if (n <= (-5.2d-244)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 6.8d-153) then
tmp = 0.0d0 / (i / n)
else if (n <= 6.2d+23) then
tmp = n / (0.01d0 + (i * ((i * 0.0008333333333333334d0) - 0.005d0)))
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 + (i * 4.166666666666667))))));
double tmp;
if (n <= -1e+125) {
tmp = t_0;
} else if (n <= -5.2e-244) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 6.8e-153) {
tmp = 0.0 / (i / n);
} else if (n <= 6.2e+23) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))) tmp = 0 if n <= -1e+125: tmp = t_0 elif n <= -5.2e-244: tmp = n / (0.01 + (i * -0.005)) elif n <= 6.8e-153: tmp = 0.0 / (i / n) elif n <= 6.2e+23: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))) tmp = 0.0 if (n <= -1e+125) tmp = t_0; elseif (n <= -5.2e-244) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 6.8e-153) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 6.2e+23) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); 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 + (i * 4.166666666666667)))))); tmp = 0.0; if (n <= -1e+125) tmp = t_0; elseif (n <= -5.2e-244) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 6.8e-153) tmp = 0.0 / (i / n); elseif (n <= 6.2e+23) tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))); 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 * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1e+125], t$95$0, If[LessEqual[n, -5.2e-244], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 6.8e-153], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 6.2e+23], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\mathbf{if}\;n \leq -1 \cdot 10^{+125}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -5.2 \cdot 10^{-244}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 6.8 \cdot 10^{-153}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 6.2 \cdot 10^{+23}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -9.9999999999999992e124 or 6.19999999999999941e23 < n Initial program 15.3%
associate-/r/15.9%
associate-*r*16.0%
*-commutative16.0%
associate-*r/16.0%
sub-neg16.0%
distribute-lft-in16.0%
metadata-eval16.0%
metadata-eval16.0%
metadata-eval16.0%
fma-define16.0%
metadata-eval16.0%
Simplified16.0%
Taylor expanded in n around inf 46.3%
div-sub46.5%
associate-*r/47.4%
metadata-eval47.4%
associate-*r/47.0%
distribute-lft-out--47.7%
div-sub46.3%
*-commutative46.3%
expm1-define98.1%
Simplified98.1%
Taylor expanded in i around 0 74.6%
*-commutative74.6%
Simplified74.6%
if -9.9999999999999992e124 < n < -5.2000000000000003e-244Initial program 41.4%
associate-/r/40.7%
associate-*r*40.6%
*-commutative40.6%
associate-*r/40.7%
sub-neg40.7%
distribute-lft-in40.7%
metadata-eval40.7%
metadata-eval40.7%
metadata-eval40.7%
fma-define40.7%
metadata-eval40.7%
Simplified40.7%
Taylor expanded in n around inf 31.7%
div-sub31.7%
associate-*r/31.7%
metadata-eval31.7%
associate-*r/31.7%
distribute-lft-out--31.7%
div-sub31.7%
*-commutative31.7%
expm1-define76.0%
Simplified76.0%
associate-*l/75.9%
Applied egg-rr75.9%
clear-num75.9%
un-div-inv75.9%
*-un-lft-identity75.9%
*-commutative75.9%
times-frac75.9%
metadata-eval75.9%
Applied egg-rr75.9%
Taylor expanded in i around 0 65.6%
*-commutative65.6%
Simplified65.6%
if -5.2000000000000003e-244 < n < 6.7999999999999997e-153Initial program 59.8%
associate-*r/59.8%
sub-neg59.8%
distribute-rgt-in59.8%
metadata-eval59.8%
metadata-eval59.8%
Simplified59.8%
Taylor expanded in i around 0 75.4%
if 6.7999999999999997e-153 < n < 6.19999999999999941e23Initial program 18.3%
associate-/r/18.5%
associate-*r*18.5%
*-commutative18.5%
associate-*r/18.5%
sub-neg18.5%
distribute-lft-in18.5%
metadata-eval18.5%
metadata-eval18.5%
metadata-eval18.5%
fma-define18.5%
metadata-eval18.5%
Simplified18.5%
Taylor expanded in n around inf 11.6%
div-sub11.6%
associate-*r/11.4%
metadata-eval11.4%
associate-*r/11.5%
distribute-lft-out--11.6%
div-sub11.7%
*-commutative11.7%
expm1-define48.4%
Simplified48.4%
associate-*l/48.4%
Applied egg-rr48.4%
clear-num48.4%
un-div-inv48.3%
*-un-lft-identity48.3%
*-commutative48.3%
times-frac48.3%
metadata-eval48.3%
Applied egg-rr48.3%
Taylor expanded in i around 0 61.7%
Final simplification70.3%
(FPCore (i n)
:precision binary64
(if (<= n -1.8e-245)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 5.2e-153)
(/ 0.0 (/ i n))
(if (<= n 6.2e+23)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
(* 100.0 (+ n (* i (* n (+ 0.5 (* i 0.16666666666666666))))))))))
double code(double i, double n) {
double tmp;
if (n <= -1.8e-245) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 5.2e-153) {
tmp = 0.0 / (i / n);
} else if (n <= 6.2e+23) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = 100.0 * (n + (i * (n * (0.5 + (i * 0.16666666666666666)))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.8d-245)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 5.2d-153) then
tmp = 0.0d0 / (i / n)
else if (n <= 6.2d+23) then
tmp = n / (0.01d0 + (i * ((i * 0.0008333333333333334d0) - 0.005d0)))
else
tmp = 100.0d0 * (n + (i * (n * (0.5d0 + (i * 0.16666666666666666d0)))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.8e-245) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 5.2e-153) {
tmp = 0.0 / (i / n);
} else if (n <= 6.2e+23) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = 100.0 * (n + (i * (n * (0.5 + (i * 0.16666666666666666)))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.8e-245: tmp = n / (0.01 + (i * -0.005)) elif n <= 5.2e-153: tmp = 0.0 / (i / n) elif n <= 6.2e+23: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = 100.0 * (n + (i * (n * (0.5 + (i * 0.16666666666666666))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.8e-245) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 5.2e-153) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 6.2e+23) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); else tmp = Float64(100.0 * Float64(n + Float64(i * Float64(n * Float64(0.5 + Float64(i * 0.16666666666666666)))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.8e-245) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 5.2e-153) tmp = 0.0 / (i / n); elseif (n <= 6.2e+23) tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))); else tmp = 100.0 * (n + (i * (n * (0.5 + (i * 0.16666666666666666))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.8e-245], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.2e-153], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 6.2e+23], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n + N[(i * N[(n * N[(0.5 + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.8 \cdot 10^{-245}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 5.2 \cdot 10^{-153}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 6.2 \cdot 10^{+23}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n + i \cdot \left(n \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if n < -1.8e-245Initial program 31.6%
associate-/r/31.5%
associate-*r*31.5%
*-commutative31.5%
associate-*r/31.5%
sub-neg31.5%
distribute-lft-in31.5%
metadata-eval31.5%
metadata-eval31.5%
metadata-eval31.5%
fma-define31.5%
metadata-eval31.5%
Simplified31.5%
Taylor expanded in n around inf 37.8%
div-sub37.8%
associate-*r/37.7%
metadata-eval37.7%
associate-*r/37.8%
distribute-lft-out--38.4%
div-sub37.8%
*-commutative37.8%
expm1-define83.8%
Simplified83.8%
associate-*l/83.7%
Applied egg-rr83.7%
clear-num83.7%
un-div-inv83.7%
*-un-lft-identity83.7%
*-commutative83.7%
times-frac83.7%
metadata-eval83.7%
Applied egg-rr83.7%
Taylor expanded in i around 0 62.6%
*-commutative62.6%
Simplified62.6%
if -1.8e-245 < n < 5.2000000000000003e-153Initial program 59.8%
associate-*r/59.8%
sub-neg59.8%
distribute-rgt-in59.8%
metadata-eval59.8%
metadata-eval59.8%
Simplified59.8%
Taylor expanded in i around 0 75.4%
if 5.2000000000000003e-153 < n < 6.19999999999999941e23Initial program 18.3%
associate-/r/18.5%
associate-*r*18.5%
*-commutative18.5%
associate-*r/18.5%
sub-neg18.5%
distribute-lft-in18.5%
metadata-eval18.5%
metadata-eval18.5%
metadata-eval18.5%
fma-define18.5%
metadata-eval18.5%
Simplified18.5%
Taylor expanded in n around inf 11.6%
div-sub11.6%
associate-*r/11.4%
metadata-eval11.4%
associate-*r/11.5%
distribute-lft-out--11.6%
div-sub11.7%
*-commutative11.7%
expm1-define48.4%
Simplified48.4%
associate-*l/48.4%
Applied egg-rr48.4%
clear-num48.4%
un-div-inv48.3%
*-un-lft-identity48.3%
*-commutative48.3%
times-frac48.3%
metadata-eval48.3%
Applied egg-rr48.3%
Taylor expanded in i around 0 61.7%
if 6.19999999999999941e23 < n Initial program 15.8%
Taylor expanded in n around inf 44.4%
expm1-define70.5%
Simplified70.5%
Taylor expanded in i around 0 76.2%
+-commutative76.2%
associate-*r*76.2%
distribute-rgt-in76.2%
*-commutative76.2%
Simplified76.2%
Final simplification67.7%
(FPCore (i n)
:precision binary64
(if (<= n -3.9e-246)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 5.2e-153)
(/ 0.0 (/ i n))
(if (<= n 1.6)
(* 100.0 (/ i (/ i n)))
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))))))
double code(double i, double n) {
double tmp;
if (n <= -3.9e-246) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 5.2e-153) {
tmp = 0.0 / (i / n);
} else if (n <= 1.6) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-3.9d-246)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 5.2d-153) then
tmp = 0.0d0 / (i / n)
else if (n <= 1.6d0) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -3.9e-246) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 5.2e-153) {
tmp = 0.0 / (i / n);
} else if (n <= 1.6) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -3.9e-246: tmp = n / (0.01 + (i * -0.005)) elif n <= 5.2e-153: tmp = 0.0 / (i / n) elif n <= 1.6: tmp = 100.0 * (i / (i / n)) else: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) return tmp
function code(i, n) tmp = 0.0 if (n <= -3.9e-246) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 5.2e-153) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 1.6) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -3.9e-246) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 5.2e-153) tmp = 0.0 / (i / n); elseif (n <= 1.6) tmp = 100.0 * (i / (i / n)); else tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -3.9e-246], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.2e-153], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.6], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.9 \cdot 10^{-246}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 5.2 \cdot 10^{-153}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 1.6:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\end{array}
\end{array}
if n < -3.89999999999999979e-246Initial program 31.6%
associate-/r/31.5%
associate-*r*31.5%
*-commutative31.5%
associate-*r/31.5%
sub-neg31.5%
distribute-lft-in31.5%
metadata-eval31.5%
metadata-eval31.5%
metadata-eval31.5%
fma-define31.5%
metadata-eval31.5%
Simplified31.5%
Taylor expanded in n around inf 37.8%
div-sub37.8%
associate-*r/37.7%
metadata-eval37.7%
associate-*r/37.8%
distribute-lft-out--38.4%
div-sub37.8%
*-commutative37.8%
expm1-define83.8%
Simplified83.8%
associate-*l/83.7%
Applied egg-rr83.7%
clear-num83.7%
un-div-inv83.7%
*-un-lft-identity83.7%
*-commutative83.7%
times-frac83.7%
metadata-eval83.7%
Applied egg-rr83.7%
Taylor expanded in i around 0 62.6%
*-commutative62.6%
Simplified62.6%
if -3.89999999999999979e-246 < n < 5.2000000000000003e-153Initial program 59.8%
associate-*r/59.8%
sub-neg59.8%
distribute-rgt-in59.8%
metadata-eval59.8%
metadata-eval59.8%
Simplified59.8%
Taylor expanded in i around 0 75.4%
if 5.2000000000000003e-153 < n < 1.6000000000000001Initial program 15.9%
Taylor expanded in i around 0 59.4%
if 1.6000000000000001 < n Initial program 17.0%
associate-/r/17.5%
associate-*r*17.5%
*-commutative17.5%
associate-*r/17.5%
sub-neg17.5%
distribute-lft-in17.5%
metadata-eval17.5%
metadata-eval17.5%
metadata-eval17.5%
fma-define17.5%
metadata-eval17.5%
Simplified17.5%
Taylor expanded in n around inf 46.2%
div-sub46.5%
associate-*r/47.9%
metadata-eval47.9%
associate-*r/47.3%
distribute-lft-out--47.3%
div-sub46.4%
*-commutative46.4%
expm1-define98.2%
Simplified98.2%
Taylor expanded in i around 0 74.6%
*-commutative74.6%
Simplified74.6%
Final simplification67.2%
(FPCore (i n)
:precision binary64
(if (<= n -9.5e-249)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 8.2e-153)
(/ 0.0 (/ i n))
(if (<= n 6.2e+23)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))))))
double code(double i, double n) {
double tmp;
if (n <= -9.5e-249) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 8.2e-153) {
tmp = 0.0 / (i / n);
} else if (n <= 6.2e+23) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-9.5d-249)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 8.2d-153) then
tmp = 0.0d0 / (i / n)
else if (n <= 6.2d+23) then
tmp = n / (0.01d0 + (i * ((i * 0.0008333333333333334d0) - 0.005d0)))
else
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -9.5e-249) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 8.2e-153) {
tmp = 0.0 / (i / n);
} else if (n <= 6.2e+23) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -9.5e-249: tmp = n / (0.01 + (i * -0.005)) elif n <= 8.2e-153: tmp = 0.0 / (i / n) elif n <= 6.2e+23: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) return tmp
function code(i, n) tmp = 0.0 if (n <= -9.5e-249) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 8.2e-153) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 6.2e+23) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); else tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -9.5e-249) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 8.2e-153) tmp = 0.0 / (i / n); elseif (n <= 6.2e+23) tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))); else tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -9.5e-249], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 8.2e-153], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 6.2e+23], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -9.5 \cdot 10^{-249}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 8.2 \cdot 10^{-153}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 6.2 \cdot 10^{+23}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\end{array}
\end{array}
if n < -9.4999999999999997e-249Initial program 31.6%
associate-/r/31.5%
associate-*r*31.5%
*-commutative31.5%
associate-*r/31.5%
sub-neg31.5%
distribute-lft-in31.5%
metadata-eval31.5%
metadata-eval31.5%
metadata-eval31.5%
fma-define31.5%
metadata-eval31.5%
Simplified31.5%
Taylor expanded in n around inf 37.8%
div-sub37.8%
associate-*r/37.7%
metadata-eval37.7%
associate-*r/37.8%
distribute-lft-out--38.4%
div-sub37.8%
*-commutative37.8%
expm1-define83.8%
Simplified83.8%
associate-*l/83.7%
Applied egg-rr83.7%
clear-num83.7%
un-div-inv83.7%
*-un-lft-identity83.7%
*-commutative83.7%
times-frac83.7%
metadata-eval83.7%
Applied egg-rr83.7%
Taylor expanded in i around 0 62.6%
*-commutative62.6%
Simplified62.6%
if -9.4999999999999997e-249 < n < 8.2e-153Initial program 59.8%
associate-*r/59.8%
sub-neg59.8%
distribute-rgt-in59.8%
metadata-eval59.8%
metadata-eval59.8%
Simplified59.8%
Taylor expanded in i around 0 75.4%
if 8.2e-153 < n < 6.19999999999999941e23Initial program 18.3%
associate-/r/18.5%
associate-*r*18.5%
*-commutative18.5%
associate-*r/18.5%
sub-neg18.5%
distribute-lft-in18.5%
metadata-eval18.5%
metadata-eval18.5%
metadata-eval18.5%
fma-define18.5%
metadata-eval18.5%
Simplified18.5%
Taylor expanded in n around inf 11.6%
div-sub11.6%
associate-*r/11.4%
metadata-eval11.4%
associate-*r/11.5%
distribute-lft-out--11.6%
div-sub11.7%
*-commutative11.7%
expm1-define48.4%
Simplified48.4%
associate-*l/48.4%
Applied egg-rr48.4%
clear-num48.4%
un-div-inv48.3%
*-un-lft-identity48.3%
*-commutative48.3%
times-frac48.3%
metadata-eval48.3%
Applied egg-rr48.3%
Taylor expanded in i around 0 61.7%
if 6.19999999999999941e23 < n Initial program 15.8%
associate-/r/16.4%
associate-*r*16.4%
*-commutative16.4%
associate-*r/16.4%
sub-neg16.4%
distribute-lft-in16.4%
metadata-eval16.4%
metadata-eval16.4%
metadata-eval16.4%
fma-define16.4%
metadata-eval16.4%
Simplified16.4%
Taylor expanded in n around inf 44.9%
div-sub45.1%
associate-*r/46.6%
metadata-eval46.6%
associate-*r/46.0%
distribute-lft-out--46.0%
div-sub44.9%
*-commutative44.9%
expm1-define98.4%
Simplified98.4%
Taylor expanded in i around 0 76.2%
*-commutative76.2%
Simplified76.2%
Final simplification67.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ n (+ 0.01 (* i -0.005)))))
(if (<= n -1.05e-245)
t_0
(if (<= n 5.2e-153)
(/ 0.0 (/ i n))
(if (<= n 6.8e+25) t_0 (* n (+ 100.0 (* i 50.0))))))))
double code(double i, double n) {
double t_0 = n / (0.01 + (i * -0.005));
double tmp;
if (n <= -1.05e-245) {
tmp = t_0;
} else if (n <= 5.2e-153) {
tmp = 0.0 / (i / n);
} else if (n <= 6.8e+25) {
tmp = t_0;
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = n / (0.01d0 + (i * (-0.005d0)))
if (n <= (-1.05d-245)) then
tmp = t_0
else if (n <= 5.2d-153) then
tmp = 0.0d0 / (i / n)
else if (n <= 6.8d+25) then
tmp = t_0
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = n / (0.01 + (i * -0.005));
double tmp;
if (n <= -1.05e-245) {
tmp = t_0;
} else if (n <= 5.2e-153) {
tmp = 0.0 / (i / n);
} else if (n <= 6.8e+25) {
tmp = t_0;
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): t_0 = n / (0.01 + (i * -0.005)) tmp = 0 if n <= -1.05e-245: tmp = t_0 elif n <= 5.2e-153: tmp = 0.0 / (i / n) elif n <= 6.8e+25: tmp = t_0 else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) t_0 = Float64(n / Float64(0.01 + Float64(i * -0.005))) tmp = 0.0 if (n <= -1.05e-245) tmp = t_0; elseif (n <= 5.2e-153) tmp = Float64(0.0 / Float64(i / n)); elseif (n <= 6.8e+25) tmp = t_0; else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) t_0 = n / (0.01 + (i * -0.005)); tmp = 0.0; if (n <= -1.05e-245) tmp = t_0; elseif (n <= 5.2e-153) tmp = 0.0 / (i / n); elseif (n <= 6.8e+25) tmp = t_0; else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.05e-245], t$95$0, If[LessEqual[n, 5.2e-153], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 6.8e+25], t$95$0, N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{if}\;n \leq -1.05 \cdot 10^{-245}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 5.2 \cdot 10^{-153}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 6.8 \cdot 10^{+25}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -1.05000000000000005e-245 or 5.2000000000000003e-153 < n < 6.79999999999999967e25Initial program 28.7%
associate-/r/28.7%
associate-*r*28.7%
*-commutative28.7%
associate-*r/28.7%
sub-neg28.7%
distribute-lft-in28.7%
metadata-eval28.7%
metadata-eval28.7%
metadata-eval28.7%
fma-define28.7%
metadata-eval28.7%
Simplified28.7%
Taylor expanded in n around inf 32.1%
div-sub32.1%
associate-*r/32.0%
metadata-eval32.0%
associate-*r/32.1%
distribute-lft-out--32.6%
div-sub32.1%
*-commutative32.1%
expm1-define76.1%
Simplified76.1%
associate-*l/76.0%
Applied egg-rr76.0%
clear-num76.0%
un-div-inv76.0%
*-un-lft-identity76.0%
*-commutative76.0%
times-frac76.0%
metadata-eval76.0%
Applied egg-rr76.0%
Taylor expanded in i around 0 61.6%
*-commutative61.6%
Simplified61.6%
if -1.05000000000000005e-245 < n < 5.2000000000000003e-153Initial program 59.8%
associate-*r/59.8%
sub-neg59.8%
distribute-rgt-in59.8%
metadata-eval59.8%
metadata-eval59.8%
Simplified59.8%
Taylor expanded in i around 0 75.4%
if 6.79999999999999967e25 < n Initial program 15.8%
associate-/r/16.4%
associate-*r*16.4%
*-commutative16.4%
associate-*r/16.4%
sub-neg16.4%
distribute-lft-in16.4%
metadata-eval16.4%
metadata-eval16.4%
metadata-eval16.4%
fma-define16.4%
metadata-eval16.4%
Simplified16.4%
Taylor expanded in n around inf 44.9%
div-sub45.1%
associate-*r/46.6%
metadata-eval46.6%
associate-*r/46.0%
distribute-lft-out--46.0%
div-sub44.9%
*-commutative44.9%
expm1-define98.4%
Simplified98.4%
Taylor expanded in i around 0 71.6%
+-commutative71.6%
associate-*r*71.6%
distribute-rgt-in71.6%
*-commutative71.6%
Simplified71.6%
Final simplification66.0%
(FPCore (i n) :precision binary64 (if (or (<= n -5e+67) (not (<= n 2e-37))) (* n 100.0) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -5e+67) || !(n <= 2e-37)) {
tmp = n * 100.0;
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-5d+67)) .or. (.not. (n <= 2d-37))) then
tmp = n * 100.0d0
else
tmp = 100.0d0 * (i / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -5e+67) || !(n <= 2e-37)) {
tmp = n * 100.0;
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -5e+67) or not (n <= 2e-37): tmp = n * 100.0 else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -5e+67) || !(n <= 2e-37)) tmp = Float64(n * 100.0); else tmp = Float64(100.0 * Float64(i / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -5e+67) || ~((n <= 2e-37))) tmp = n * 100.0; else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -5e+67], N[Not[LessEqual[n, 2e-37]], $MachinePrecision]], N[(n * 100.0), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -5 \cdot 10^{+67} \lor \neg \left(n \leq 2 \cdot 10^{-37}\right):\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -4.99999999999999976e67 or 2.00000000000000013e-37 < n Initial program 20.8%
Taylor expanded in i around 0 54.5%
*-commutative54.5%
Simplified54.5%
if -4.99999999999999976e67 < n < 2.00000000000000013e-37Initial program 39.0%
Taylor expanded in i around 0 60.5%
Final simplification57.3%
(FPCore (i n) :precision binary64 (if (or (<= n -2.6e+67) (not (<= n 1.52))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -2.6e+67) || !(n <= 1.52)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-2.6d+67)) .or. (.not. (n <= 1.52d0))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 100.0d0 * (i / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -2.6e+67) || !(n <= 1.52)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.6e+67) or not (n <= 1.52): tmp = n * (100.0 + (i * 50.0)) else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.6e+67) || !(n <= 1.52)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(100.0 * Float64(i / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -2.6e+67) || ~((n <= 1.52))) tmp = n * (100.0 + (i * 50.0)); else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -2.6e+67], N[Not[LessEqual[n, 1.52]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.6 \cdot 10^{+67} \lor \neg \left(n \leq 1.52\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -2.6e67 or 1.52 < n Initial program 19.9%
associate-/r/20.5%
associate-*r*20.5%
*-commutative20.5%
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 44.9%
div-sub45.0%
associate-*r/45.8%
metadata-eval45.8%
associate-*r/45.4%
distribute-lft-out--46.0%
div-sub44.9%
*-commutative44.9%
expm1-define95.2%
Simplified95.2%
Taylor expanded in i around 0 64.0%
+-commutative64.0%
associate-*r*64.0%
distribute-rgt-in64.0%
*-commutative64.0%
Simplified64.0%
if -2.6e67 < n < 1.52Initial program 39.4%
Taylor expanded in i around 0 59.7%
Final simplification62.0%
(FPCore (i n) :precision binary64 (if (<= n 6.2e+23) (/ n (+ 0.01 (* i -0.005))) (* n (+ 100.0 (* i 50.0)))))
double code(double i, double n) {
double tmp;
if (n <= 6.2e+23) {
tmp = n / (0.01 + (i * -0.005));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= 6.2d+23) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= 6.2e+23) {
tmp = n / (0.01 + (i * -0.005));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= 6.2e+23: tmp = n / (0.01 + (i * -0.005)) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= 6.2e+23) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= 6.2e+23) tmp = n / (0.01 + (i * -0.005)); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, 6.2e+23], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 6.2 \cdot 10^{+23}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < 6.19999999999999941e23Initial program 34.0%
associate-/r/34.0%
associate-*r*34.0%
*-commutative34.0%
associate-*r/34.0%
sub-neg34.0%
distribute-lft-in34.0%
metadata-eval34.0%
metadata-eval34.0%
metadata-eval34.0%
fma-define34.0%
metadata-eval34.0%
Simplified34.0%
Taylor expanded in n around inf 33.4%
div-sub33.4%
associate-*r/33.2%
metadata-eval33.2%
associate-*r/33.4%
distribute-lft-out--33.8%
div-sub33.4%
*-commutative33.4%
expm1-define68.3%
Simplified68.3%
associate-*l/68.3%
Applied egg-rr68.3%
clear-num68.3%
un-div-inv68.2%
*-un-lft-identity68.2%
*-commutative68.2%
times-frac68.3%
metadata-eval68.3%
Applied egg-rr68.3%
Taylor expanded in i around 0 58.8%
*-commutative58.8%
Simplified58.8%
if 6.19999999999999941e23 < n Initial program 15.8%
associate-/r/16.4%
associate-*r*16.4%
*-commutative16.4%
associate-*r/16.4%
sub-neg16.4%
distribute-lft-in16.4%
metadata-eval16.4%
metadata-eval16.4%
metadata-eval16.4%
fma-define16.4%
metadata-eval16.4%
Simplified16.4%
Taylor expanded in n around inf 44.9%
div-sub45.1%
associate-*r/46.6%
metadata-eval46.6%
associate-*r/46.0%
distribute-lft-out--46.0%
div-sub44.9%
*-commutative44.9%
expm1-define98.4%
Simplified98.4%
Taylor expanded in i around 0 71.6%
+-commutative71.6%
associate-*r*71.6%
distribute-rgt-in71.6%
*-commutative71.6%
Simplified71.6%
Final simplification62.2%
(FPCore (i n) :precision binary64 (if (<= i 1.9e+34) (* n 100.0) (* 50.0 (* i n))))
double code(double i, double n) {
double tmp;
if (i <= 1.9e+34) {
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 <= 1.9d+34) 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 <= 1.9e+34) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 1.9e+34: tmp = n * 100.0 else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= 1.9e+34) 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 <= 1.9e+34) tmp = n * 100.0; else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 1.9e+34], N[(n * 100.0), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 1.9 \cdot 10^{+34}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < 1.9000000000000001e34Initial program 25.9%
Taylor expanded in i around 0 59.5%
*-commutative59.5%
Simplified59.5%
if 1.9000000000000001e34 < i Initial program 41.0%
associate-/r/41.3%
associate-*r*41.3%
*-commutative41.3%
associate-*r/41.4%
sub-neg41.4%
distribute-lft-in41.4%
metadata-eval41.4%
metadata-eval41.4%
metadata-eval41.4%
fma-define41.4%
metadata-eval41.4%
Simplified41.4%
Taylor expanded in n around inf 48.0%
div-sub48.0%
associate-*r/48.0%
metadata-eval48.0%
associate-*r/48.0%
distribute-lft-out--48.0%
div-sub48.0%
*-commutative48.0%
expm1-define48.0%
Simplified48.0%
associate-*l/48.0%
Applied egg-rr48.0%
Taylor expanded in i around 0 27.8%
Taylor expanded in i around inf 26.4%
*-commutative26.4%
Simplified26.4%
Final simplification52.3%
(FPCore (i n) :precision binary64 (* i -50.0))
double code(double i, double n) {
return i * -50.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = i * (-50.0d0)
end function
public static double code(double i, double n) {
return i * -50.0;
}
def code(i, n): return i * -50.0
function code(i, n) return Float64(i * -50.0) end
function tmp = code(i, n) tmp = i * -50.0; end
code[i_, n_] := N[(i * -50.0), $MachinePrecision]
\begin{array}{l}
\\
i \cdot -50
\end{array}
Initial program 29.2%
associate-/r/29.3%
associate-*r*29.3%
*-commutative29.3%
associate-*r/29.3%
sub-neg29.3%
distribute-lft-in29.3%
metadata-eval29.3%
metadata-eval29.3%
metadata-eval29.3%
fma-define29.3%
metadata-eval29.3%
Simplified29.3%
Taylor expanded in i around 0 51.6%
*-commutative51.6%
associate-*r/51.6%
metadata-eval51.6%
Simplified51.6%
Taylor expanded in n around 0 2.7%
*-commutative2.7%
Simplified2.7%
Final simplification2.7%
(FPCore (i n) :precision binary64 (* n 100.0))
double code(double i, double n) {
return n * 100.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = n * 100.0d0
end function
public static double code(double i, double n) {
return n * 100.0;
}
def code(i, n): return n * 100.0
function code(i, n) return Float64(n * 100.0) end
function tmp = code(i, n) tmp = n * 100.0; end
code[i_, n_] := N[(n * 100.0), $MachinePrecision]
\begin{array}{l}
\\
n \cdot 100
\end{array}
Initial program 29.2%
Taylor expanded in i around 0 47.7%
*-commutative47.7%
Simplified47.7%
Final simplification47.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 2024095
(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))))