
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 -2e-179)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(if (<= t_1 1e-276)
(/ 100.0 (/ (/ i n) (expm1 (* n (log1p (/ i n))))))
(if (<= t_1 INFINITY)
(* 100.0 (/ (- (* n t_0) n) 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 <= -2e-179) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else if (t_1 <= 1e-276) {
tmp = 100.0 / ((i / n) / expm1((n * log1p((i / n)))));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (((n * t_0) - n) / i);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -2e-179) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else if (t_1 <= 1e-276) {
tmp = 100.0 / ((i / n) / Math.expm1((n * Math.log1p((i / n)))));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (((n * t_0) - n) / i);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= -2e-179: tmp = n * (((t_0 * 100.0) + -100.0) / i) elif t_1 <= 1e-276: tmp = 100.0 / ((i / n) / math.expm1((n * math.log1p((i / n))))) elif t_1 <= math.inf: tmp = 100.0 * (((n * t_0) - n) / 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 <= -2e-179) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); elseif (t_1 <= 1e-276) tmp = Float64(100.0 / Float64(Float64(i / n) / expm1(Float64(n * log1p(Float64(i / n)))))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(Float64(Float64(n * t_0) - n) / 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, -2e-179], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e-276], N[(100.0 / N[(N[(i / n), $MachinePrecision] / N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(N[(N[(n * t$95$0), $MachinePrecision] - n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-179}:\\
\;\;\;\;n \cdot \frac{t\_0 \cdot 100 + -100}{i}\\
\mathbf{elif}\;t\_1 \leq 10^{-276}:\\
\;\;\;\;\frac{100}{\frac{\frac{i}{n}}{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \frac{n \cdot t\_0 - n}{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)) < -2e-179Initial program 99.5%
associate-/r/99.4%
associate-*r*99.7%
*-commutative99.7%
associate-*r/99.9%
sub-neg99.9%
distribute-lft-in99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
fma-define99.9%
metadata-eval99.9%
Simplified99.9%
fma-undefine99.9%
*-commutative99.9%
Applied egg-rr99.9%
if -2e-179 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 1e-276Initial program 19.6%
associate-/r/19.6%
associate-*r*19.6%
*-commutative19.6%
associate-*r/19.6%
sub-neg19.6%
distribute-lft-in19.6%
metadata-eval19.6%
metadata-eval19.6%
metadata-eval19.6%
fma-define19.6%
metadata-eval19.6%
Simplified19.6%
*-commutative19.6%
fma-undefine19.6%
*-commutative19.6%
associate-/r/19.6%
metadata-eval19.6%
metadata-eval19.6%
distribute-rgt-in19.6%
sub-neg19.6%
associate-*r/19.6%
clear-num19.6%
un-div-inv19.6%
add-exp-log19.6%
expm1-define19.6%
log-pow29.6%
log1p-define99.1%
Applied egg-rr99.1%
if 1e-276 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 99.7%
div-sub99.7%
clear-num99.8%
sub-neg99.8%
div-inv99.8%
clear-num99.8%
Applied egg-rr99.8%
sub-neg99.8%
Simplified99.8%
associate-*r/99.8%
sub-div99.8%
Applied egg-rr99.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%
Taylor expanded in n around inf 1.8%
*-commutative1.8%
associate-/l*1.8%
expm1-define70.5%
Simplified70.5%
*-commutative70.5%
associate-*r*70.5%
*-commutative70.5%
associate-*r*70.5%
associate-/l*70.4%
clear-num70.4%
un-div-inv70.4%
*-un-lft-identity70.4%
times-frac70.4%
metadata-eval70.4%
Applied egg-rr70.4%
Taylor expanded in i around 0 99.9%
Final simplification99.4%
(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 -2e-46)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(if (<= t_1 0.0)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= t_1 INFINITY)
(+ (* 100.0 (* t_0 (/ n i))) (* -100.0 (/ n 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 <= -2e-46) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = (100.0 * (t_0 * (n / i))) + (-100.0 * (n / i));
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -2e-46) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (100.0 * (t_0 * (n / i))) + (-100.0 * (n / i));
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= -2e-46: tmp = n * (((t_0 * 100.0) + -100.0) / i) elif t_1 <= 0.0: tmp = 100.0 * (n * (math.expm1(i) / i)) elif t_1 <= math.inf: tmp = (100.0 * (t_0 * (n / i))) + (-100.0 * (n / 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 <= -2e-46) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); elseif (t_1 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (t_1 <= Inf) tmp = Float64(Float64(100.0 * Float64(t_0 * Float64(n / i))) + Float64(-100.0 * Float64(n / 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, -2e-46], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(100.0 * N[(t$95$0 * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-100.0 * N[(n / i), $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}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-46}:\\
\;\;\;\;n \cdot \frac{t\_0 \cdot 100 + -100}{i}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(t\_0 \cdot \frac{n}{i}\right) + -100 \cdot \frac{n}{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)) < -2.00000000000000005e-46Initial program 99.6%
associate-/r/99.4%
associate-*r*99.8%
*-commutative99.8%
associate-*r/100.0%
sub-neg100.0%
distribute-lft-in100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-define100.0%
metadata-eval100.0%
Simplified100.0%
fma-undefine100.0%
*-commutative100.0%
Applied egg-rr100.0%
if -2.00000000000000005e-46 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 22.3%
Taylor expanded in n around inf 39.3%
*-commutative39.3%
associate-/l*39.2%
expm1-define81.2%
Simplified81.2%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 97.3%
div-sub97.2%
clear-num97.3%
sub-neg97.3%
div-inv97.3%
clear-num97.3%
Applied egg-rr97.3%
sub-neg97.3%
Simplified97.3%
sub-neg97.3%
distribute-rgt-in97.6%
distribute-neg-frac97.6%
Applied egg-rr97.6%
Taylor expanded in n around 0 97.6%
*-commutative97.6%
Simplified97.6%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
Taylor expanded in n around inf 1.8%
*-commutative1.8%
associate-/l*1.8%
expm1-define70.5%
Simplified70.5%
*-commutative70.5%
associate-*r*70.5%
*-commutative70.5%
associate-*r*70.5%
associate-/l*70.4%
clear-num70.4%
un-div-inv70.4%
*-un-lft-identity70.4%
times-frac70.4%
metadata-eval70.4%
Applied egg-rr70.4%
Taylor expanded in i around 0 99.9%
Final simplification87.4%
(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 -2e-46)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(if (<= t_1 1e-276)
(* 100.0 (* n (/ (expm1 (* n (log1p (/ i n)))) i)))
(if (<= t_1 INFINITY)
(* 100.0 (/ (- (* n t_0) n) 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 <= -2e-46) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else if (t_1 <= 1e-276) {
tmp = 100.0 * (n * (expm1((n * log1p((i / n)))) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (((n * t_0) - n) / i);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -2e-46) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else if (t_1 <= 1e-276) {
tmp = 100.0 * (n * (Math.expm1((n * Math.log1p((i / n)))) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (((n * t_0) - n) / i);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= -2e-46: tmp = n * (((t_0 * 100.0) + -100.0) / i) elif t_1 <= 1e-276: tmp = 100.0 * (n * (math.expm1((n * math.log1p((i / n)))) / i)) elif t_1 <= math.inf: tmp = 100.0 * (((n * t_0) - n) / 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 <= -2e-46) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); elseif (t_1 <= 1e-276) tmp = Float64(100.0 * Float64(n * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(Float64(Float64(n * t_0) - n) / 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, -2e-46], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e-276], N[(100.0 * N[(n * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(N[(N[(n * t$95$0), $MachinePrecision] - n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-46}:\\
\;\;\;\;n \cdot \frac{t\_0 \cdot 100 + -100}{i}\\
\mathbf{elif}\;t\_1 \leq 10^{-276}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \frac{n \cdot t\_0 - n}{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)) < -2.00000000000000005e-46Initial program 99.6%
associate-/r/99.4%
associate-*r*99.8%
*-commutative99.8%
associate-*r/100.0%
sub-neg100.0%
distribute-lft-in100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-define100.0%
metadata-eval100.0%
Simplified100.0%
fma-undefine100.0%
*-commutative100.0%
Applied egg-rr100.0%
if -2.00000000000000005e-46 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 1e-276Initial program 22.5%
associate-/r/22.5%
add-exp-log22.5%
expm1-define22.5%
log-pow32.5%
log1p-define98.6%
Applied egg-rr98.6%
if 1e-276 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 99.7%
div-sub99.7%
clear-num99.8%
sub-neg99.8%
div-inv99.8%
clear-num99.8%
Applied egg-rr99.8%
sub-neg99.8%
Simplified99.8%
associate-*r/99.8%
sub-div99.8%
Applied egg-rr99.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%
Taylor expanded in n around inf 1.8%
*-commutative1.8%
associate-/l*1.8%
expm1-define70.5%
Simplified70.5%
*-commutative70.5%
associate-*r*70.5%
*-commutative70.5%
associate-*r*70.5%
associate-/l*70.4%
clear-num70.4%
un-div-inv70.4%
*-un-lft-identity70.4%
times-frac70.4%
metadata-eval70.4%
Applied egg-rr70.4%
Taylor expanded in i around 0 99.9%
Final simplification99.0%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n))
(t_1 (+ (* t_0 100.0) -100.0))
(t_2 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_2 -2e-46)
(* n (/ t_1 i))
(if (<= t_2 0.0)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= t_2 INFINITY)
(* (/ n i) t_1)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005)))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 * 100.0) + -100.0;
double t_2 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_2 <= -2e-46) {
tmp = n * (t_1 / i);
} else if (t_2 <= 0.0) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (t_2 <= ((double) INFINITY)) {
tmp = (n / i) * t_1;
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 * 100.0) + -100.0;
double t_2 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_2 <= -2e-46) {
tmp = n * (t_1 / i);
} else if (t_2 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = (n / i) * t_1;
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 * 100.0) + -100.0 t_2 = (t_0 + -1.0) / (i / n) tmp = 0 if t_2 <= -2e-46: tmp = n * (t_1 / i) elif t_2 <= 0.0: tmp = 100.0 * (n * (math.expm1(i) / i)) elif t_2 <= math.inf: tmp = (n / i) * t_1 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 * 100.0) + -100.0) t_2 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_2 <= -2e-46) tmp = Float64(n * Float64(t_1 / i)); elseif (t_2 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (t_2 <= Inf) tmp = Float64(Float64(n / i) * t_1); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-46], N[(n * N[(t$95$1 / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(n / i), $MachinePrecision] * t$95$1), $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 := t\_0 \cdot 100 + -100\\
t_2 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-46}:\\
\;\;\;\;n \cdot \frac{t\_1}{i}\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\frac{n}{i} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -2.00000000000000005e-46Initial program 99.6%
associate-/r/99.4%
associate-*r*99.8%
*-commutative99.8%
associate-*r/100.0%
sub-neg100.0%
distribute-lft-in100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-define100.0%
metadata-eval100.0%
Simplified100.0%
fma-undefine100.0%
*-commutative100.0%
Applied egg-rr100.0%
if -2.00000000000000005e-46 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 22.3%
Taylor expanded in n around inf 39.3%
*-commutative39.3%
associate-/l*39.2%
expm1-define81.2%
Simplified81.2%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 97.3%
div-sub97.2%
clear-num97.3%
sub-neg97.3%
div-inv97.3%
clear-num97.3%
Applied egg-rr97.3%
sub-neg97.3%
Simplified97.3%
sub-neg97.3%
distribute-rgt-in97.6%
distribute-neg-frac97.6%
Applied egg-rr97.6%
Taylor expanded in n around 0 97.6%
*-commutative97.6%
Simplified97.6%
*-un-lft-identity97.6%
*-commutative97.6%
fma-define97.3%
associate-*l/97.2%
associate-/l*97.0%
Applied egg-rr97.0%
*-lft-identity97.0%
fma-undefine97.2%
associate-*r*97.2%
associate-*r/97.4%
*-commutative97.4%
associate-*r/97.6%
distribute-rgt-out97.4%
Simplified97.4%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
Taylor expanded in n around inf 1.8%
*-commutative1.8%
associate-/l*1.8%
expm1-define70.5%
Simplified70.5%
*-commutative70.5%
associate-*r*70.5%
*-commutative70.5%
associate-*r*70.5%
associate-/l*70.4%
clear-num70.4%
un-div-inv70.4%
*-un-lft-identity70.4%
times-frac70.4%
metadata-eval70.4%
Applied egg-rr70.4%
Taylor expanded in i around 0 99.9%
Final simplification87.4%
(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 -2e-46)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(if (<= t_1 0.0)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= t_1 INFINITY)
(* 100.0 (/ (- (* n t_0) n) 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 <= -2e-46) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (((n * t_0) - n) / i);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -2e-46) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (((n * t_0) - n) / i);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= -2e-46: tmp = n * (((t_0 * 100.0) + -100.0) / i) elif t_1 <= 0.0: tmp = 100.0 * (n * (math.expm1(i) / i)) elif t_1 <= math.inf: tmp = 100.0 * (((n * t_0) - n) / 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 <= -2e-46) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); elseif (t_1 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(Float64(Float64(n * t_0) - n) / 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, -2e-46], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(N[(N[(n * t$95$0), $MachinePrecision] - n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-46}:\\
\;\;\;\;n \cdot \frac{t\_0 \cdot 100 + -100}{i}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \frac{n \cdot t\_0 - n}{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)) < -2.00000000000000005e-46Initial program 99.6%
associate-/r/99.4%
associate-*r*99.8%
*-commutative99.8%
associate-*r/100.0%
sub-neg100.0%
distribute-lft-in100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-define100.0%
metadata-eval100.0%
Simplified100.0%
fma-undefine100.0%
*-commutative100.0%
Applied egg-rr100.0%
if -2.00000000000000005e-46 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 22.3%
Taylor expanded in n around inf 39.3%
*-commutative39.3%
associate-/l*39.2%
expm1-define81.2%
Simplified81.2%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 97.3%
div-sub97.2%
clear-num97.3%
sub-neg97.3%
div-inv97.3%
clear-num97.3%
Applied egg-rr97.3%
sub-neg97.3%
Simplified97.3%
associate-*r/97.3%
sub-div97.4%
Applied egg-rr97.4%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
Taylor expanded in n around inf 1.8%
*-commutative1.8%
associate-/l*1.8%
expm1-define70.5%
Simplified70.5%
*-commutative70.5%
associate-*r*70.5%
*-commutative70.5%
associate-*r*70.5%
associate-/l*70.4%
clear-num70.4%
un-div-inv70.4%
*-un-lft-identity70.4%
times-frac70.4%
metadata-eval70.4%
Applied egg-rr70.4%
Taylor expanded in i around 0 99.9%
Final simplification87.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n))
(t_1 (/ (+ t_0 -1.0) (/ i n)))
(t_2 (* 100.0 (/ (- (* n t_0) n) i))))
(if (<= t_1 -2e-46)
t_2
(if (<= t_1 0.0)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= t_1 INFINITY)
t_2
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005)))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double t_2 = 100.0 * (((n * t_0) - n) / i);
double tmp;
if (t_1 <= -2e-46) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double t_2 = 100.0 * (((n * t_0) - n) / i);
double tmp;
if (t_1 <= -2e-46) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) t_2 = 100.0 * (((n * t_0) - n) / i) tmp = 0 if t_1 <= -2e-46: tmp = t_2 elif t_1 <= 0.0: tmp = 100.0 * (n * (math.expm1(i) / i)) elif t_1 <= math.inf: tmp = t_2 else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) t_2 = Float64(100.0 * Float64(Float64(Float64(n * t_0) - n) / i)) tmp = 0.0 if (t_1 <= -2e-46) tmp = t_2; elseif (t_1 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (t_1 <= Inf) tmp = t_2; else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(100.0 * N[(N[(N[(n * t$95$0), $MachinePrecision] - n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-46], t$95$2, If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
t_2 := 100 \cdot \frac{n \cdot t\_0 - n}{i}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-46}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_2\\
\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)) < -2.00000000000000005e-46 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 98.4%
div-sub98.3%
clear-num98.5%
sub-neg98.5%
div-inv98.5%
clear-num98.5%
Applied egg-rr98.5%
sub-neg98.5%
Simplified98.5%
associate-*r/98.5%
sub-div98.5%
Applied egg-rr98.5%
if -2.00000000000000005e-46 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 22.3%
Taylor expanded in n around inf 39.3%
*-commutative39.3%
associate-/l*39.2%
expm1-define81.2%
Simplified81.2%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
Taylor expanded in n around inf 1.8%
*-commutative1.8%
associate-/l*1.8%
expm1-define70.5%
Simplified70.5%
*-commutative70.5%
associate-*r*70.5%
*-commutative70.5%
associate-*r*70.5%
associate-/l*70.4%
clear-num70.4%
un-div-inv70.4%
*-un-lft-identity70.4%
times-frac70.4%
metadata-eval70.4%
Applied egg-rr70.4%
Taylor expanded in i around 0 99.9%
Final simplification87.4%
(FPCore (i n) :precision binary64 (if (or (<= n -16500000.0) (not (<= n 1.5e-7))) (* n (/ (* 100.0 (expm1 i)) i)) (/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))))
double code(double i, double n) {
double tmp;
if ((n <= -16500000.0) || !(n <= 1.5e-7)) {
tmp = n * ((100.0 * expm1(i)) / i);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -16500000.0) || !(n <= 1.5e-7)) {
tmp = n * ((100.0 * Math.expm1(i)) / i);
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -16500000.0) or not (n <= 1.5e-7): tmp = n * ((100.0 * math.expm1(i)) / i) else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -16500000.0) || !(n <= 1.5e-7)) tmp = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -16500000.0], N[Not[LessEqual[n, 1.5e-7]], $MachinePrecision]], N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -16500000 \lor \neg \left(n \leq 1.5 \cdot 10^{-7}\right):\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\end{array}
\end{array}
if n < -1.65e7 or 1.4999999999999999e-7 < n Initial program 28.8%
associate-/r/29.2%
associate-*r*29.2%
*-commutative29.2%
associate-*r/29.2%
sub-neg29.2%
distribute-lft-in29.2%
metadata-eval29.2%
metadata-eval29.2%
metadata-eval29.2%
fma-define29.2%
metadata-eval29.2%
Simplified29.2%
Taylor expanded in n around inf 43.2%
sub-neg43.2%
metadata-eval43.2%
metadata-eval43.2%
distribute-lft-in43.2%
metadata-eval43.2%
sub-neg43.2%
expm1-define88.9%
Simplified88.9%
if -1.65e7 < n < 1.4999999999999999e-7Initial program 29.1%
Taylor expanded in n around inf 16.4%
*-commutative16.4%
associate-/l*16.4%
expm1-define49.7%
Simplified49.7%
*-commutative49.7%
associate-*r*49.6%
*-commutative49.6%
associate-*r*49.6%
associate-/l*49.6%
clear-num49.6%
un-div-inv49.6%
*-un-lft-identity49.6%
times-frac49.6%
metadata-eval49.6%
Applied egg-rr49.6%
Taylor expanded in i around 0 75.5%
Final simplification83.9%
(FPCore (i n)
:precision binary64
(if (<= n -16500000.0)
(* n (/ (* 100.0 (expm1 i)) i))
(if (<= n 1.5e-7)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
(* 100.0 (* n (/ (expm1 i) i))))))
double code(double i, double n) {
double tmp;
if (n <= -16500000.0) {
tmp = n * ((100.0 * expm1(i)) / i);
} else if (n <= 1.5e-7) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = 100.0 * (n * (expm1(i) / i));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -16500000.0) {
tmp = n * ((100.0 * Math.expm1(i)) / i);
} else if (n <= 1.5e-7) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = 100.0 * (n * (Math.expm1(i) / i));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -16500000.0: tmp = n * ((100.0 * math.expm1(i)) / i) elif n <= 1.5e-7: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = 100.0 * (n * (math.expm1(i) / i)) return tmp
function code(i, n) tmp = 0.0 if (n <= -16500000.0) tmp = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)); elseif (n <= 1.5e-7) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); else tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); end return tmp end
code[i_, n_] := If[LessEqual[n, -16500000.0], N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.5e-7], 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[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -16500000:\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{elif}\;n \leq 1.5 \cdot 10^{-7}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\end{array}
\end{array}
if n < -1.65e7Initial program 38.1%
associate-/r/38.4%
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 53.2%
sub-neg53.2%
metadata-eval53.2%
metadata-eval53.2%
distribute-lft-in53.2%
metadata-eval53.2%
sub-neg53.2%
expm1-define86.7%
Simplified86.7%
if -1.65e7 < n < 1.4999999999999999e-7Initial program 29.1%
Taylor expanded in n around inf 16.4%
*-commutative16.4%
associate-/l*16.4%
expm1-define49.7%
Simplified49.7%
*-commutative49.7%
associate-*r*49.6%
*-commutative49.6%
associate-*r*49.6%
associate-/l*49.6%
clear-num49.6%
un-div-inv49.6%
*-un-lft-identity49.6%
times-frac49.6%
metadata-eval49.6%
Applied egg-rr49.6%
Taylor expanded in i around 0 75.5%
if 1.4999999999999999e-7 < n Initial program 20.8%
Taylor expanded in n around inf 34.6%
*-commutative34.6%
associate-/l*34.6%
expm1-define90.8%
Simplified90.8%
Final simplification84.0%
(FPCore (i n)
:precision binary64
(let* ((t_0
(*
n
(+
100.0
(*
i
(+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))))
(if (<= n -9.5e+210)
t_0
(if (<= n -16500000.0)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 1.4e+14)
(/ 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 <= -9.5e+210) {
tmp = t_0;
} else if (n <= -16500000.0) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 1.4e+14) {
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 <= (-9.5d+210)) then
tmp = t_0
else if (n <= (-16500000.0d0)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 1.4d+14) 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 <= -9.5e+210) {
tmp = t_0;
} else if (n <= -16500000.0) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 1.4e+14) {
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 <= -9.5e+210: tmp = t_0 elif n <= -16500000.0: tmp = n / (0.01 + (i * -0.005)) elif n <= 1.4e+14: 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 <= -9.5e+210) tmp = t_0; elseif (n <= -16500000.0) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 1.4e+14) 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 <= -9.5e+210) tmp = t_0; elseif (n <= -16500000.0) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 1.4e+14) 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, -9.5e+210], t$95$0, If[LessEqual[n, -16500000.0], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.4e+14], 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 -9.5 \cdot 10^{+210}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -16500000:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 1.4 \cdot 10^{+14}:\\
\;\;\;\;\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.5000000000000004e210 or 1.4e14 < n Initial program 18.7%
associate-/r/19.2%
associate-*r*19.2%
*-commutative19.2%
associate-*r/19.2%
sub-neg19.2%
distribute-lft-in19.2%
metadata-eval19.2%
metadata-eval19.2%
metadata-eval19.2%
fma-define19.2%
metadata-eval19.2%
Simplified19.2%
Taylor expanded in n around inf 42.7%
sub-neg42.7%
metadata-eval42.7%
metadata-eval42.7%
distribute-lft-in42.7%
metadata-eval42.7%
sub-neg42.7%
expm1-define92.5%
Simplified92.5%
Taylor expanded in i around 0 76.4%
*-commutative76.4%
Simplified76.4%
if -9.5000000000000004e210 < n < -1.65e7Initial program 50.7%
Taylor expanded in n around inf 45.5%
*-commutative45.5%
associate-/l*45.3%
expm1-define79.8%
Simplified79.8%
*-commutative79.8%
associate-*r*79.9%
*-commutative79.9%
associate-*r*79.9%
associate-/l*80.0%
clear-num80.0%
un-div-inv80.0%
*-un-lft-identity80.0%
times-frac80.0%
metadata-eval80.0%
Applied egg-rr80.0%
Taylor expanded in i around 0 47.2%
*-commutative47.2%
Simplified47.2%
if -1.65e7 < n < 1.4e14Initial program 29.1%
Taylor expanded in n around inf 16.8%
*-commutative16.8%
associate-/l*16.8%
expm1-define51.8%
Simplified51.8%
*-commutative51.8%
associate-*r*51.7%
*-commutative51.7%
associate-*r*51.7%
associate-/l*51.6%
clear-num51.6%
un-div-inv51.6%
*-un-lft-identity51.6%
times-frac51.7%
metadata-eval51.7%
Applied egg-rr51.7%
Taylor expanded in i around 0 75.5%
Final simplification70.4%
(FPCore (i n)
:precision binary64
(if (<= n -6.5e+209)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n -16500000.0)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 1.4e+14)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
(* n (/ (* i (+ 100.0 (* i 50.0))) i))))))
double code(double i, double n) {
double tmp;
if (n <= -6.5e+209) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= -16500000.0) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 1.4e+14) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = n * ((i * (100.0 + (i * 50.0))) / i);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-6.5d+209)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= (-16500000.0d0)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 1.4d+14) then
tmp = n / (0.01d0 + (i * ((i * 0.0008333333333333334d0) - 0.005d0)))
else
tmp = n * ((i * (100.0d0 + (i * 50.0d0))) / i)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -6.5e+209) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= -16500000.0) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 1.4e+14) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = n * ((i * (100.0 + (i * 50.0))) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -6.5e+209: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= -16500000.0: tmp = n / (0.01 + (i * -0.005)) elif n <= 1.4e+14: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = n * ((i * (100.0 + (i * 50.0))) / i) return tmp
function code(i, n) tmp = 0.0 if (n <= -6.5e+209) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= -16500000.0) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 1.4e+14) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); else tmp = Float64(n * Float64(Float64(i * Float64(100.0 + Float64(i * 50.0))) / i)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -6.5e+209) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= -16500000.0) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 1.4e+14) tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))); else tmp = n * ((i * (100.0 + (i * 50.0))) / i); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -6.5e+209], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -16500000.0], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.4e+14], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(N[(i * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -6.5 \cdot 10^{+209}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq -16500000:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 1.4 \cdot 10^{+14}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{i \cdot \left(100 + i \cdot 50\right)}{i}\\
\end{array}
\end{array}
if n < -6.49999999999999975e209Initial program 13.0%
associate-/r/13.5%
associate-*r*13.6%
*-commutative13.6%
associate-*r/13.7%
sub-neg13.7%
distribute-lft-in13.7%
metadata-eval13.7%
metadata-eval13.7%
metadata-eval13.7%
fma-define13.7%
metadata-eval13.7%
Simplified13.7%
Taylor expanded in n around inf 68.5%
sub-neg68.5%
metadata-eval68.5%
metadata-eval68.5%
distribute-lft-in68.5%
metadata-eval68.5%
sub-neg68.5%
expm1-define99.9%
Simplified99.9%
Taylor expanded in i around 0 61.8%
*-commutative61.8%
Simplified61.8%
if -6.49999999999999975e209 < n < -1.65e7Initial program 50.7%
Taylor expanded in n around inf 45.5%
*-commutative45.5%
associate-/l*45.3%
expm1-define79.8%
Simplified79.8%
*-commutative79.8%
associate-*r*79.9%
*-commutative79.9%
associate-*r*79.9%
associate-/l*80.0%
clear-num80.0%
un-div-inv80.0%
*-un-lft-identity80.0%
times-frac80.0%
metadata-eval80.0%
Applied egg-rr80.0%
Taylor expanded in i around 0 47.2%
*-commutative47.2%
Simplified47.2%
if -1.65e7 < n < 1.4e14Initial program 29.1%
Taylor expanded in n around inf 16.8%
*-commutative16.8%
associate-/l*16.8%
expm1-define51.8%
Simplified51.8%
*-commutative51.8%
associate-*r*51.7%
*-commutative51.7%
associate-*r*51.7%
associate-/l*51.6%
clear-num51.6%
un-div-inv51.6%
*-un-lft-identity51.6%
times-frac51.7%
metadata-eval51.7%
Applied egg-rr51.7%
Taylor expanded in i around 0 75.5%
if 1.4e14 < n Initial program 20.5%
associate-/r/20.9%
associate-*r*20.9%
*-commutative20.9%
associate-*r/20.9%
sub-neg20.9%
distribute-lft-in20.9%
metadata-eval20.9%
metadata-eval20.9%
metadata-eval20.9%
fma-define20.9%
metadata-eval20.9%
Simplified20.9%
Taylor expanded in n around inf 35.0%
sub-neg35.0%
metadata-eval35.0%
metadata-eval35.0%
distribute-lft-in35.0%
metadata-eval35.0%
sub-neg35.0%
expm1-define90.3%
Simplified90.3%
Taylor expanded in i around 0 78.7%
*-commutative78.7%
Simplified78.7%
Final simplification69.7%
(FPCore (i n)
:precision binary64
(if (<= n -7.2e+210)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n 1.4e+14)
(/ n (+ 0.01 (* i -0.005)))
(* n (/ (* i (+ 100.0 (* i 50.0))) i)))))
double code(double i, double n) {
double tmp;
if (n <= -7.2e+210) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 1.4e+14) {
tmp = n / (0.01 + (i * -0.005));
} else {
tmp = n * ((i * (100.0 + (i * 50.0))) / i);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-7.2d+210)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= 1.4d+14) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else
tmp = n * ((i * (100.0d0 + (i * 50.0d0))) / i)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -7.2e+210) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 1.4e+14) {
tmp = n / (0.01 + (i * -0.005));
} else {
tmp = n * ((i * (100.0 + (i * 50.0))) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -7.2e+210: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= 1.4e+14: tmp = n / (0.01 + (i * -0.005)) else: tmp = n * ((i * (100.0 + (i * 50.0))) / i) return tmp
function code(i, n) tmp = 0.0 if (n <= -7.2e+210) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= 1.4e+14) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); else tmp = Float64(n * Float64(Float64(i * Float64(100.0 + Float64(i * 50.0))) / i)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -7.2e+210) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= 1.4e+14) tmp = n / (0.01 + (i * -0.005)); else tmp = n * ((i * (100.0 + (i * 50.0))) / i); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -7.2e+210], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.4e+14], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(N[(i * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -7.2 \cdot 10^{+210}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq 1.4 \cdot 10^{+14}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{i \cdot \left(100 + i \cdot 50\right)}{i}\\
\end{array}
\end{array}
if n < -7.2000000000000005e210Initial program 13.0%
associate-/r/13.5%
associate-*r*13.6%
*-commutative13.6%
associate-*r/13.7%
sub-neg13.7%
distribute-lft-in13.7%
metadata-eval13.7%
metadata-eval13.7%
metadata-eval13.7%
fma-define13.7%
metadata-eval13.7%
Simplified13.7%
Taylor expanded in n around inf 68.5%
sub-neg68.5%
metadata-eval68.5%
metadata-eval68.5%
distribute-lft-in68.5%
metadata-eval68.5%
sub-neg68.5%
expm1-define99.9%
Simplified99.9%
Taylor expanded in i around 0 61.8%
*-commutative61.8%
Simplified61.8%
if -7.2000000000000005e210 < n < 1.4e14Initial program 36.4%
Taylor expanded in n around inf 26.5%
*-commutative26.5%
associate-/l*26.4%
expm1-define61.3%
Simplified61.3%
*-commutative61.3%
associate-*r*61.2%
*-commutative61.2%
associate-*r*61.2%
associate-/l*61.2%
clear-num61.2%
un-div-inv61.2%
*-un-lft-identity61.2%
times-frac61.2%
metadata-eval61.2%
Applied egg-rr61.2%
Taylor expanded in i around 0 59.8%
*-commutative59.8%
Simplified59.8%
if 1.4e14 < n Initial program 20.5%
associate-/r/20.9%
associate-*r*20.9%
*-commutative20.9%
associate-*r/20.9%
sub-neg20.9%
distribute-lft-in20.9%
metadata-eval20.9%
metadata-eval20.9%
metadata-eval20.9%
fma-define20.9%
metadata-eval20.9%
Simplified20.9%
Taylor expanded in n around inf 35.0%
sub-neg35.0%
metadata-eval35.0%
metadata-eval35.0%
distribute-lft-in35.0%
metadata-eval35.0%
sub-neg35.0%
expm1-define90.3%
Simplified90.3%
Taylor expanded in i around 0 78.7%
*-commutative78.7%
Simplified78.7%
(FPCore (i n) :precision binary64 (if (or (<= n -1.2e-144) (not (<= n 1.65e-146))) (* n (+ 100.0 (* i 50.0))) 0.0))
double code(double i, double n) {
double tmp;
if ((n <= -1.2e-144) || !(n <= 1.65e-146)) {
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 <= (-1.2d-144)) .or. (.not. (n <= 1.65d-146))) 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 <= -1.2e-144) || !(n <= 1.65e-146)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.2e-144) or not (n <= 1.65e-146): tmp = n * (100.0 + (i * 50.0)) else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.2e-144) || !(n <= 1.65e-146)) 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 <= -1.2e-144) || ~((n <= 1.65e-146))) tmp = n * (100.0 + (i * 50.0)); else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1.2e-144], N[Not[LessEqual[n, 1.65e-146]], $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 -1.2 \cdot 10^{-144} \lor \neg \left(n \leq 1.65 \cdot 10^{-146}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if n < -1.19999999999999997e-144 or 1.65e-146 < n Initial program 26.3%
associate-/r/26.6%
associate-*r*26.6%
*-commutative26.6%
associate-*r/26.6%
sub-neg26.6%
distribute-lft-in26.6%
metadata-eval26.6%
metadata-eval26.6%
metadata-eval26.6%
fma-define26.6%
metadata-eval26.6%
Simplified26.6%
Taylor expanded in n around inf 34.4%
sub-neg34.4%
metadata-eval34.4%
metadata-eval34.4%
distribute-lft-in34.4%
metadata-eval34.4%
sub-neg34.4%
expm1-define82.9%
Simplified82.9%
Taylor expanded in i around 0 58.9%
*-commutative58.9%
Simplified58.9%
if -1.19999999999999997e-144 < n < 1.65e-146Initial program 40.5%
div-sub40.5%
clear-num36.5%
sub-neg36.5%
div-inv36.5%
clear-num40.6%
Applied egg-rr40.6%
sub-neg40.6%
Simplified40.6%
sub-neg40.6%
distribute-rgt-in40.6%
distribute-neg-frac40.6%
Applied egg-rr40.6%
Taylor expanded in i around 0 70.3%
distribute-rgt-out70.3%
metadata-eval70.3%
mul0-rgt70.3%
Simplified70.3%
Taylor expanded in i around 0 70.3%
Final simplification61.0%
(FPCore (i n)
:precision binary64
(if (<= n -1.35e+211)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n 2.95e+152)
(/ n (+ 0.01 (* i -0.005)))
(* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -1.35e+211) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 2.95e+152) {
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 <= (-1.35d+211)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= 2.95d+152) 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 <= -1.35e+211) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 2.95e+152) {
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 <= -1.35e+211: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= 2.95e+152: 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 <= -1.35e+211) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= 2.95e+152) 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 <= -1.35e+211) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= 2.95e+152) 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, -1.35e+211], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.95e+152], 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 -1.35 \cdot 10^{+211}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq 2.95 \cdot 10^{+152}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -1.35e211Initial program 13.0%
associate-/r/13.5%
associate-*r*13.6%
*-commutative13.6%
associate-*r/13.7%
sub-neg13.7%
distribute-lft-in13.7%
metadata-eval13.7%
metadata-eval13.7%
metadata-eval13.7%
fma-define13.7%
metadata-eval13.7%
Simplified13.7%
Taylor expanded in n around inf 68.5%
sub-neg68.5%
metadata-eval68.5%
metadata-eval68.5%
distribute-lft-in68.5%
metadata-eval68.5%
sub-neg68.5%
expm1-define99.9%
Simplified99.9%
Taylor expanded in i around 0 61.8%
*-commutative61.8%
Simplified61.8%
if -1.35e211 < n < 2.9500000000000001e152Initial program 35.4%
Taylor expanded in n around inf 27.2%
*-commutative27.2%
associate-/l*27.2%
expm1-define65.7%
Simplified65.7%
*-commutative65.7%
associate-*r*65.7%
*-commutative65.7%
associate-*r*65.7%
associate-/l*65.7%
clear-num65.7%
un-div-inv65.7%
*-un-lft-identity65.7%
times-frac65.7%
metadata-eval65.7%
Applied egg-rr65.7%
Taylor expanded in i around 0 60.1%
*-commutative60.1%
Simplified60.1%
if 2.9500000000000001e152 < n Initial program 14.3%
associate-/r/15.0%
associate-*r*15.0%
*-commutative15.0%
associate-*r/15.0%
sub-neg15.0%
distribute-lft-in15.0%
metadata-eval15.0%
metadata-eval15.0%
metadata-eval15.0%
fma-define15.0%
metadata-eval15.0%
Simplified15.0%
Taylor expanded in n around inf 37.6%
sub-neg37.6%
metadata-eval37.6%
metadata-eval37.6%
distribute-lft-in37.6%
metadata-eval37.6%
sub-neg37.6%
expm1-define92.3%
Simplified92.3%
Taylor expanded in i around 0 83.0%
*-commutative83.0%
Simplified83.0%
(FPCore (i n) :precision binary64 (if (<= i -2.15e+21) 0.0 (if (<= i 3.2e+28) (* 100.0 (+ n (* i -0.5))) 0.0)))
double code(double i, double n) {
double tmp;
if (i <= -2.15e+21) {
tmp = 0.0;
} else if (i <= 3.2e+28) {
tmp = 100.0 * (n + (i * -0.5));
} 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 <= (-2.15d+21)) then
tmp = 0.0d0
else if (i <= 3.2d+28) then
tmp = 100.0d0 * (n + (i * (-0.5d0)))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -2.15e+21) {
tmp = 0.0;
} else if (i <= 3.2e+28) {
tmp = 100.0 * (n + (i * -0.5));
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -2.15e+21: tmp = 0.0 elif i <= 3.2e+28: tmp = 100.0 * (n + (i * -0.5)) else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if (i <= -2.15e+21) tmp = 0.0; elseif (i <= 3.2e+28) tmp = Float64(100.0 * Float64(n + Float64(i * -0.5))); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -2.15e+21) tmp = 0.0; elseif (i <= 3.2e+28) tmp = 100.0 * (n + (i * -0.5)); else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -2.15e+21], 0.0, If[LessEqual[i, 3.2e+28], N[(100.0 * N[(n + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2.15 \cdot 10^{+21}:\\
\;\;\;\;0\\
\mathbf{elif}\;i \leq 3.2 \cdot 10^{+28}:\\
\;\;\;\;100 \cdot \left(n + i \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if i < -2.15e21 or 3.2e28 < i Initial program 55.6%
div-sub55.6%
clear-num52.0%
sub-neg52.0%
div-inv52.0%
clear-num55.7%
Applied egg-rr55.7%
sub-neg55.7%
Simplified55.7%
sub-neg55.7%
distribute-rgt-in55.7%
distribute-neg-frac55.7%
Applied egg-rr55.7%
Taylor expanded in i around 0 32.9%
distribute-rgt-out32.9%
metadata-eval32.9%
mul0-rgt32.9%
Simplified32.9%
Taylor expanded in i around 0 32.9%
if -2.15e21 < i < 3.2e28Initial program 7.5%
Taylor expanded in i around 0 81.3%
associate-*r*81.2%
*-commutative81.2%
associate-*r/81.2%
metadata-eval81.2%
Simplified81.2%
Taylor expanded in n around 0 81.6%
*-commutative81.6%
Simplified81.6%
(FPCore (i n) :precision binary64 (if (<= i -2.9e+21) 0.0 (if (<= i 5.5e+28) (* n 100.0) 0.0)))
double code(double i, double n) {
double tmp;
if (i <= -2.9e+21) {
tmp = 0.0;
} else if (i <= 5.5e+28) {
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 <= (-2.9d+21)) then
tmp = 0.0d0
else if (i <= 5.5d+28) 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 <= -2.9e+21) {
tmp = 0.0;
} else if (i <= 5.5e+28) {
tmp = n * 100.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -2.9e+21: tmp = 0.0 elif i <= 5.5e+28: tmp = n * 100.0 else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if (i <= -2.9e+21) tmp = 0.0; elseif (i <= 5.5e+28) tmp = Float64(n * 100.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -2.9e+21) tmp = 0.0; elseif (i <= 5.5e+28) tmp = n * 100.0; else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -2.9e+21], 0.0, If[LessEqual[i, 5.5e+28], N[(n * 100.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2.9 \cdot 10^{+21}:\\
\;\;\;\;0\\
\mathbf{elif}\;i \leq 5.5 \cdot 10^{+28}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if i < -2.9e21 or 5.5000000000000003e28 < i Initial program 55.6%
div-sub55.6%
clear-num52.0%
sub-neg52.0%
div-inv52.0%
clear-num55.7%
Applied egg-rr55.7%
sub-neg55.7%
Simplified55.7%
sub-neg55.7%
distribute-rgt-in55.7%
distribute-neg-frac55.7%
Applied egg-rr55.7%
Taylor expanded in i around 0 32.9%
distribute-rgt-out32.9%
metadata-eval32.9%
mul0-rgt32.9%
Simplified32.9%
Taylor expanded in i around 0 32.9%
if -2.9e21 < i < 5.5000000000000003e28Initial program 7.5%
associate-/r/8.0%
associate-*r*8.0%
*-commutative8.0%
associate-*r/8.0%
sub-neg8.0%
distribute-lft-in8.0%
metadata-eval8.0%
metadata-eval8.0%
metadata-eval8.0%
fma-define8.0%
metadata-eval8.0%
Simplified8.0%
Taylor expanded in i around 0 81.5%
*-commutative81.5%
Simplified81.5%
(FPCore (i n) :precision binary64 (if (<= n 2.95e+152) (/ n (+ 0.01 (* i -0.005))) (* n (+ 100.0 (* i 50.0)))))
double code(double i, double n) {
double tmp;
if (n <= 2.95e+152) {
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 <= 2.95d+152) 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 <= 2.95e+152) {
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 <= 2.95e+152: 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 <= 2.95e+152) 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 <= 2.95e+152) 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, 2.95e+152], 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 2.95 \cdot 10^{+152}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < 2.9500000000000001e152Initial program 32.6%
Taylor expanded in n around inf 32.3%
*-commutative32.3%
associate-/l*32.2%
expm1-define69.9%
Simplified69.9%
*-commutative69.9%
associate-*r*69.9%
*-commutative69.9%
associate-*r*69.9%
associate-/l*69.9%
clear-num69.9%
un-div-inv69.8%
*-un-lft-identity69.8%
times-frac69.9%
metadata-eval69.9%
Applied egg-rr69.9%
Taylor expanded in i around 0 57.5%
*-commutative57.5%
Simplified57.5%
if 2.9500000000000001e152 < n Initial program 14.3%
associate-/r/15.0%
associate-*r*15.0%
*-commutative15.0%
associate-*r/15.0%
sub-neg15.0%
distribute-lft-in15.0%
metadata-eval15.0%
metadata-eval15.0%
metadata-eval15.0%
fma-define15.0%
metadata-eval15.0%
Simplified15.0%
Taylor expanded in n around inf 37.6%
sub-neg37.6%
metadata-eval37.6%
metadata-eval37.6%
distribute-lft-in37.6%
metadata-eval37.6%
sub-neg37.6%
expm1-define92.3%
Simplified92.3%
Taylor expanded in i around 0 83.0%
*-commutative83.0%
Simplified83.0%
(FPCore (i n) :precision binary64 0.0)
double code(double i, double n) {
return 0.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 0.0d0
end function
public static double code(double i, double n) {
return 0.0;
}
def code(i, n): return 0.0
function code(i, n) return 0.0 end
function tmp = code(i, n) tmp = 0.0; end
code[i_, n_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 28.9%
div-sub28.9%
clear-num26.9%
sub-neg26.9%
div-inv26.9%
clear-num28.9%
Applied egg-rr28.9%
sub-neg28.9%
Simplified28.9%
sub-neg28.9%
distribute-rgt-in28.9%
distribute-neg-frac28.9%
Applied egg-rr28.9%
Taylor expanded in i around 0 17.9%
distribute-rgt-out17.9%
metadata-eval17.9%
mul0-rgt17.9%
Simplified17.9%
Taylor expanded in i around 0 17.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ 1.0 (/ i n))))
(*
100.0
(/
(-
(exp
(*
n
(if (== t_0 1.0)
(/ i n)
(/ (* (/ i n) (log t_0)) (- (+ (/ i n) 1.0) 1.0)))))
1.0)
(/ i n)))))
double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (i / n)
if (t_0 == 1.0d0) then
tmp = i / n
else
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0d0) - 1.0d0)
end if
code = 100.0d0 * ((exp((n * tmp)) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * Math.log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((Math.exp((n * tmp)) - 1.0) / (i / n));
}
def code(i, n): t_0 = 1.0 + (i / n) tmp = 0 if t_0 == 1.0: tmp = i / n else: tmp = ((i / n) * math.log(t_0)) / (((i / n) + 1.0) - 1.0) return 100.0 * ((math.exp((n * tmp)) - 1.0) / (i / n))
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) tmp = 0.0 if (t_0 == 1.0) tmp = Float64(i / n); else tmp = Float64(Float64(Float64(i / n) * log(t_0)) / Float64(Float64(Float64(i / n) + 1.0) - 1.0)); end return Float64(100.0 * Float64(Float64(exp(Float64(n * tmp)) - 1.0) / Float64(i / n))) end
function tmp_2 = code(i, n) t_0 = 1.0 + (i / n); tmp = 0.0; if (t_0 == 1.0) tmp = i / n; else tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0); end tmp_2 = 100.0 * ((exp((n * tmp)) - 1.0) / (i / n)); end
code[i_, n_] := Block[{t$95$0 = N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision]}, N[(100.0 * N[(N[(N[Exp[N[(n * If[Equal[t$95$0, 1.0], N[(i / n), $MachinePrecision], N[(N[(N[(i / n), $MachinePrecision] * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(i / n), $MachinePrecision] + 1.0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{i}{n}\\
100 \cdot \frac{e^{n \cdot \begin{array}{l}
\mathbf{if}\;t\_0 = 1:\\
\;\;\;\;\frac{i}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{i}{n} \cdot \log t\_0}{\left(\frac{i}{n} + 1\right) - 1}\\
\end{array}} - 1}{\frac{i}{n}}
\end{array}
\end{array}
herbie shell --seed 2024180
(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))))