
(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 14 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-281)
(* n (+ (* 100.0 (/ t_0 i)) (/ -100.0 i)))
(if (<= t_1 1e-263)
(/ (* 100.0 (expm1 (* n (log1p (/ i n))))) (/ i n))
(if (<= t_1 INFINITY)
(* 100.0 (* n (/ (+ (pow (/ i n) n) -1.0) i)))
(/
1.0
(+
(* 0.01 (* i (+ (* 0.5 (/ 1.0 (pow n 2.0))) (* 0.5 (/ -1.0 n)))))
(* 0.01 (/ 1.0 n)))))))))
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-281) {
tmp = n * ((100.0 * (t_0 / i)) + (-100.0 / i));
} else if (t_1 <= 1e-263) {
tmp = (100.0 * expm1((n * log1p((i / n))))) / (i / n);
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (n * ((pow((i / n), n) + -1.0) / i));
} else {
tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n)));
}
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-281) {
tmp = n * ((100.0 * (t_0 / i)) + (-100.0 / i));
} else if (t_1 <= 1e-263) {
tmp = (100.0 * Math.expm1((n * Math.log1p((i / n))))) / (i / n);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (n * ((Math.pow((i / n), n) + -1.0) / i));
} else {
tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / Math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n)));
}
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-281: tmp = n * ((100.0 * (t_0 / i)) + (-100.0 / i)) elif t_1 <= 1e-263: tmp = (100.0 * math.expm1((n * math.log1p((i / n))))) / (i / n) elif t_1 <= math.inf: tmp = 100.0 * (n * ((math.pow((i / n), n) + -1.0) / i)) else: tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n))) 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-281) tmp = Float64(n * Float64(Float64(100.0 * Float64(t_0 / i)) + Float64(-100.0 / i))); elseif (t_1 <= 1e-263) tmp = Float64(Float64(100.0 * expm1(Float64(n * log1p(Float64(i / n))))) / Float64(i / n)); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(n * Float64(Float64((Float64(i / n) ^ n) + -1.0) / i))); else tmp = Float64(1.0 / Float64(Float64(0.01 * Float64(i * Float64(Float64(0.5 * Float64(1.0 / (n ^ 2.0))) + Float64(0.5 * Float64(-1.0 / n))))) + Float64(0.01 * Float64(1.0 / n)))); 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-281], N[(n * N[(N[(100.0 * N[(t$95$0 / i), $MachinePrecision]), $MachinePrecision] + N[(-100.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e-263], N[(N[(100.0 * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(n * N[(N[(N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(0.01 * N[(i * N[(N[(0.5 * N[(1.0 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.01 * N[(1.0 / n), $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^{-281}:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{t\_0}{i} + \frac{-100}{i}\right)\\
\mathbf{elif}\;t\_1 \leq 10^{-263}:\\
\;\;\;\;\frac{100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{{\left(\frac{i}{n}\right)}^{n} + -1}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{0.01 \cdot \left(i \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)\right) + 0.01 \cdot \frac{1}{n}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -2e-281Initial program 99.4%
associate-*r/99.6%
sub-neg99.6%
distribute-lft-in99.7%
metadata-eval99.7%
metadata-eval99.7%
metadata-eval99.7%
fma-define99.7%
metadata-eval99.7%
Simplified99.7%
fma-undefine99.7%
metadata-eval99.7%
distribute-lft-in99.6%
metadata-eval99.6%
sub-neg99.6%
*-commutative99.6%
add-exp-log99.6%
expm1-define99.6%
log-pow63.2%
log1p-define63.2%
Applied egg-rr63.2%
clear-num63.4%
inv-pow63.4%
*-commutative63.4%
associate-/r*63.4%
Applied egg-rr63.4%
unpow-163.4%
associate-/l/63.4%
*-commutative63.4%
Simplified63.4%
associate-/r*63.4%
associate-/r/63.4%
associate-/l/63.1%
*-commutative63.1%
Applied egg-rr63.1%
associate-*l/63.1%
*-lft-identity63.1%
Simplified63.1%
associate-/r/63.2%
expm1-undefine63.2%
*-commutative63.2%
log1p-undefine63.2%
pow-to-exp99.6%
sub-div99.6%
*-commutative99.6%
sub-neg99.6%
distribute-lft-in99.4%
+-commutative99.4%
distribute-neg-frac99.4%
metadata-eval99.4%
Applied egg-rr99.4%
associate-*l*99.4%
associate-*l*99.6%
distribute-lft-out99.8%
+-commutative99.8%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
if -2e-281 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 1e-263Initial program 22.5%
associate-*r/22.5%
sub-neg22.5%
distribute-lft-in22.5%
metadata-eval22.5%
metadata-eval22.5%
metadata-eval22.5%
fma-define22.5%
metadata-eval22.5%
Simplified22.5%
fma-undefine22.5%
metadata-eval22.5%
distribute-lft-in22.5%
metadata-eval22.5%
sub-neg22.5%
*-commutative22.5%
add-exp-log22.5%
expm1-define22.5%
log-pow34.1%
log1p-define99.7%
Applied egg-rr99.7%
if 1e-263 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.8%
associate-*r/99.7%
sub-neg99.7%
distribute-lft-in99.7%
metadata-eval99.7%
metadata-eval99.7%
metadata-eval99.7%
fma-define99.7%
metadata-eval99.7%
Simplified99.7%
fma-undefine99.7%
metadata-eval99.7%
distribute-lft-in99.7%
metadata-eval99.7%
sub-neg99.7%
*-commutative99.7%
add-exp-log99.7%
expm1-define99.7%
log-pow49.9%
log1p-define49.9%
Applied egg-rr49.9%
clear-num50.0%
inv-pow50.0%
*-commutative50.0%
associate-/r*50.0%
Applied egg-rr50.0%
unpow-150.0%
associate-/l/50.0%
*-commutative50.0%
Simplified50.0%
Taylor expanded in i around inf 37.5%
associate-/l*37.5%
Simplified99.8%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-*r/0.0%
sub-neg0.0%
distribute-lft-in0.0%
metadata-eval0.0%
metadata-eval0.0%
metadata-eval0.0%
fma-define0.0%
metadata-eval0.0%
Simplified0.0%
fma-undefine0.0%
metadata-eval0.0%
distribute-lft-in0.0%
metadata-eval0.0%
sub-neg0.0%
*-commutative0.0%
add-exp-log0.0%
expm1-define0.0%
log-pow0.0%
log1p-define0.0%
Applied egg-rr0.0%
clear-num0.0%
inv-pow0.0%
*-commutative0.0%
associate-/r*0.0%
Applied egg-rr0.0%
unpow-10.0%
associate-/l/0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in i around 0 99.5%
Final simplification99.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n))
(t_1 (/ (+ t_0 -1.0) (/ i n)))
(t_2 (/ t_0 (* i (/ 0.01 n)))))
(if (<= t_1 -2e-315)
(- t_2 (* n (/ 100.0 i)))
(if (<= t_1 0.0)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= t_1 INFINITY)
(- t_2 (/ (* n 100.0) i))
(/
1.0
(+
(* 0.01 (* i (+ (* 0.5 (/ 1.0 (pow n 2.0))) (* 0.5 (/ -1.0 n)))))
(* 0.01 (/ 1.0 n)))))))))
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 = t_0 / (i * (0.01 / n));
double tmp;
if (t_1 <= -2e-315) {
tmp = t_2 - (n * (100.0 / i));
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2 - ((n * 100.0) / i);
} else {
tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n)));
}
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 = t_0 / (i * (0.01 / n));
double tmp;
if (t_1 <= -2e-315) {
tmp = t_2 - (n * (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 = t_2 - ((n * 100.0) / i);
} else {
tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / Math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n)));
}
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 = t_0 / (i * (0.01 / n)) tmp = 0 if t_1 <= -2e-315: tmp = t_2 - (n * (100.0 / i)) elif t_1 <= 0.0: tmp = 100.0 * (n * (math.expm1(i) / i)) elif t_1 <= math.inf: tmp = t_2 - ((n * 100.0) / i) else: tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n))) 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(t_0 / Float64(i * Float64(0.01 / n))) tmp = 0.0 if (t_1 <= -2e-315) tmp = Float64(t_2 - Float64(n * Float64(100.0 / i))); elseif (t_1 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (t_1 <= Inf) tmp = Float64(t_2 - Float64(Float64(n * 100.0) / i)); else tmp = Float64(1.0 / Float64(Float64(0.01 * Float64(i * Float64(Float64(0.5 * Float64(1.0 / (n ^ 2.0))) + Float64(0.5 * Float64(-1.0 / n))))) + Float64(0.01 * Float64(1.0 / n)))); 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[(t$95$0 / N[(i * N[(0.01 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-315], N[(t$95$2 - N[(n * N[(100.0 / i), $MachinePrecision]), $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[(t$95$2 - N[(N[(n * 100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(0.01 * N[(i * N[(N[(0.5 * N[(1.0 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.01 * N[(1.0 / n), $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 := \frac{t\_0}{i \cdot \frac{0.01}{n}}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-315}:\\
\;\;\;\;t\_2 - n \cdot \frac{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:\\
\;\;\;\;t\_2 - \frac{n \cdot 100}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{0.01 \cdot \left(i \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)\right) + 0.01 \cdot \frac{1}{n}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -2.0000000019e-315Initial program 95.0%
associate-*r/95.2%
sub-neg95.2%
distribute-lft-in95.2%
metadata-eval95.2%
metadata-eval95.2%
metadata-eval95.2%
fma-define95.3%
metadata-eval95.3%
Simplified95.3%
fma-undefine95.2%
metadata-eval95.2%
distribute-lft-in95.2%
metadata-eval95.2%
sub-neg95.2%
*-commutative95.2%
add-exp-log95.2%
expm1-define95.2%
log-pow66.3%
log1p-define66.3%
Applied egg-rr66.3%
clear-num61.8%
inv-pow61.8%
*-commutative61.8%
associate-/r*61.8%
Applied egg-rr61.8%
unpow-161.8%
associate-/l/61.8%
*-commutative61.8%
Simplified61.8%
associate-/r*61.8%
associate-/r/66.4%
associate-/l/66.1%
*-commutative66.1%
Applied egg-rr66.1%
associate-*l/66.1%
*-lft-identity66.1%
Simplified66.1%
expm1-undefine61.7%
*-commutative61.7%
log1p-undefine61.7%
pow-to-exp95.0%
div-sub95.0%
+-commutative95.0%
div-inv95.0%
*-commutative95.0%
associate-/r*95.0%
metadata-eval95.0%
clear-num95.1%
Applied egg-rr95.1%
+-commutative95.1%
associate-/l*95.4%
Simplified95.4%
if -2.0000000019e-315 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 22.2%
associate-/r/22.2%
sub-neg22.2%
metadata-eval22.2%
Simplified22.2%
Taylor expanded in n around inf 38.2%
expm1-define76.1%
Simplified76.1%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 96.7%
associate-*r/96.6%
sub-neg96.6%
distribute-lft-in96.5%
metadata-eval96.5%
metadata-eval96.5%
metadata-eval96.5%
fma-define96.6%
metadata-eval96.6%
Simplified96.6%
fma-undefine96.5%
metadata-eval96.5%
distribute-lft-in96.6%
metadata-eval96.6%
sub-neg96.6%
*-commutative96.6%
add-exp-log96.6%
expm1-define96.6%
log-pow52.8%
log1p-define52.8%
Applied egg-rr52.8%
clear-num52.8%
inv-pow52.8%
*-commutative52.8%
associate-/r*52.8%
Applied egg-rr52.8%
unpow-152.8%
associate-/l/52.8%
*-commutative52.8%
Simplified52.8%
associate-/r*52.8%
associate-/r/52.9%
associate-/l/52.9%
*-commutative52.9%
Applied egg-rr52.9%
associate-*l/52.8%
*-lft-identity52.8%
Simplified52.8%
expm1-undefine49.8%
*-commutative49.8%
log1p-undefine49.8%
pow-to-exp96.5%
div-sub96.5%
+-commutative96.5%
div-inv96.5%
*-commutative96.5%
associate-/r*96.5%
metadata-eval96.5%
clear-num96.7%
Applied egg-rr96.7%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-*r/0.0%
sub-neg0.0%
distribute-lft-in0.0%
metadata-eval0.0%
metadata-eval0.0%
metadata-eval0.0%
fma-define0.0%
metadata-eval0.0%
Simplified0.0%
fma-undefine0.0%
metadata-eval0.0%
distribute-lft-in0.0%
metadata-eval0.0%
sub-neg0.0%
*-commutative0.0%
add-exp-log0.0%
expm1-define0.0%
log-pow0.0%
log1p-define0.0%
Applied egg-rr0.0%
clear-num0.0%
inv-pow0.0%
*-commutative0.0%
associate-/r*0.0%
Applied egg-rr0.0%
unpow-10.0%
associate-/l/0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in i around 0 99.5%
Final simplification82.5%
(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 -1e-119)
(/ (+ -100.0 (* t_0 100.0)) (/ i n))
(if (<= t_1 1e-263)
(* 100.0 (* (expm1 (* n (log1p (/ i n)))) (/ n i)))
(if (<= t_1 INFINITY)
(* 100.0 (* n (/ (+ (pow (/ i n) n) -1.0) i)))
(/
1.0
(+
(* 0.01 (* i (+ (* 0.5 (/ 1.0 (pow n 2.0))) (* 0.5 (/ -1.0 n)))))
(* 0.01 (/ 1.0 n)))))))))
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 <= -1e-119) {
tmp = (-100.0 + (t_0 * 100.0)) / (i / n);
} else if (t_1 <= 1e-263) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) * (n / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (n * ((pow((i / n), n) + -1.0) / i));
} else {
tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n)));
}
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 <= -1e-119) {
tmp = (-100.0 + (t_0 * 100.0)) / (i / n);
} else if (t_1 <= 1e-263) {
tmp = 100.0 * (Math.expm1((n * Math.log1p((i / n)))) * (n / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (n * ((Math.pow((i / n), n) + -1.0) / i));
} else {
tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / Math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n)));
}
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 <= -1e-119: tmp = (-100.0 + (t_0 * 100.0)) / (i / n) elif t_1 <= 1e-263: tmp = 100.0 * (math.expm1((n * math.log1p((i / n)))) * (n / i)) elif t_1 <= math.inf: tmp = 100.0 * (n * ((math.pow((i / n), n) + -1.0) / i)) else: tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n))) 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 <= -1e-119) tmp = Float64(Float64(-100.0 + Float64(t_0 * 100.0)) / Float64(i / n)); elseif (t_1 <= 1e-263) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(n / i))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(n * Float64(Float64((Float64(i / n) ^ n) + -1.0) / i))); else tmp = Float64(1.0 / Float64(Float64(0.01 * Float64(i * Float64(Float64(0.5 * Float64(1.0 / (n ^ 2.0))) + Float64(0.5 * Float64(-1.0 / n))))) + Float64(0.01 * Float64(1.0 / n)))); 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, -1e-119], N[(N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e-263], N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(n * N[(N[(N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(0.01 * N[(i * N[(N[(0.5 * N[(1.0 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.01 * N[(1.0 / n), $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 -1 \cdot 10^{-119}:\\
\;\;\;\;\frac{-100 + t\_0 \cdot 100}{\frac{i}{n}}\\
\mathbf{elif}\;t\_1 \leq 10^{-263}:\\
\;\;\;\;100 \cdot \left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{n}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{{\left(\frac{i}{n}\right)}^{n} + -1}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{0.01 \cdot \left(i \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)\right) + 0.01 \cdot \frac{1}{n}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -1.00000000000000001e-119Initial program 99.4%
associate-*r/99.8%
sub-neg99.8%
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 -1.00000000000000001e-119 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 1e-263Initial program 23.7%
clear-num23.7%
associate-/r/23.6%
clear-num23.6%
add-exp-log23.6%
expm1-define23.6%
log-pow34.9%
log1p-define96.5%
Applied egg-rr96.5%
if 1e-263 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.8%
associate-*r/99.7%
sub-neg99.7%
distribute-lft-in99.7%
metadata-eval99.7%
metadata-eval99.7%
metadata-eval99.7%
fma-define99.7%
metadata-eval99.7%
Simplified99.7%
fma-undefine99.7%
metadata-eval99.7%
distribute-lft-in99.7%
metadata-eval99.7%
sub-neg99.7%
*-commutative99.7%
add-exp-log99.7%
expm1-define99.7%
log-pow49.9%
log1p-define49.9%
Applied egg-rr49.9%
clear-num50.0%
inv-pow50.0%
*-commutative50.0%
associate-/r*50.0%
Applied egg-rr50.0%
unpow-150.0%
associate-/l/50.0%
*-commutative50.0%
Simplified50.0%
Taylor expanded in i around inf 37.5%
associate-/l*37.5%
Simplified99.8%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-*r/0.0%
sub-neg0.0%
distribute-lft-in0.0%
metadata-eval0.0%
metadata-eval0.0%
metadata-eval0.0%
fma-define0.0%
metadata-eval0.0%
Simplified0.0%
fma-undefine0.0%
metadata-eval0.0%
distribute-lft-in0.0%
metadata-eval0.0%
sub-neg0.0%
*-commutative0.0%
add-exp-log0.0%
expm1-define0.0%
log-pow0.0%
log1p-define0.0%
Applied egg-rr0.0%
clear-num0.0%
inv-pow0.0%
*-commutative0.0%
associate-/r*0.0%
Applied egg-rr0.0%
unpow-10.0%
associate-/l/0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in i around 0 99.5%
Final simplification97.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-281)
(* n (+ (* 100.0 (/ t_0 i)) (/ -100.0 i)))
(if (<= t_1 1e-263)
(* (expm1 (* n (log1p (/ i n)))) (/ 100.0 (/ i n)))
(if (<= t_1 INFINITY)
(* 100.0 (* n (/ (+ (pow (/ i n) n) -1.0) i)))
(/
1.0
(+
(* 0.01 (* i (+ (* 0.5 (/ 1.0 (pow n 2.0))) (* 0.5 (/ -1.0 n)))))
(* 0.01 (/ 1.0 n)))))))))
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-281) {
tmp = n * ((100.0 * (t_0 / i)) + (-100.0 / i));
} else if (t_1 <= 1e-263) {
tmp = expm1((n * log1p((i / n)))) * (100.0 / (i / n));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (n * ((pow((i / n), n) + -1.0) / i));
} else {
tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n)));
}
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-281) {
tmp = n * ((100.0 * (t_0 / i)) + (-100.0 / i));
} else if (t_1 <= 1e-263) {
tmp = Math.expm1((n * Math.log1p((i / n)))) * (100.0 / (i / n));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (n * ((Math.pow((i / n), n) + -1.0) / i));
} else {
tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / Math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n)));
}
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-281: tmp = n * ((100.0 * (t_0 / i)) + (-100.0 / i)) elif t_1 <= 1e-263: tmp = math.expm1((n * math.log1p((i / n)))) * (100.0 / (i / n)) elif t_1 <= math.inf: tmp = 100.0 * (n * ((math.pow((i / n), n) + -1.0) / i)) else: tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n))) 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-281) tmp = Float64(n * Float64(Float64(100.0 * Float64(t_0 / i)) + Float64(-100.0 / i))); elseif (t_1 <= 1e-263) tmp = Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(100.0 / Float64(i / n))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(n * Float64(Float64((Float64(i / n) ^ n) + -1.0) / i))); else tmp = Float64(1.0 / Float64(Float64(0.01 * Float64(i * Float64(Float64(0.5 * Float64(1.0 / (n ^ 2.0))) + Float64(0.5 * Float64(-1.0 / n))))) + Float64(0.01 * Float64(1.0 / n)))); 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-281], N[(n * N[(N[(100.0 * N[(t$95$0 / i), $MachinePrecision]), $MachinePrecision] + N[(-100.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e-263], N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(100.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(n * N[(N[(N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(0.01 * N[(i * N[(N[(0.5 * N[(1.0 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.01 * N[(1.0 / n), $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^{-281}:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{t\_0}{i} + \frac{-100}{i}\right)\\
\mathbf{elif}\;t\_1 \leq 10^{-263}:\\
\;\;\;\;\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{100}{\frac{i}{n}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{{\left(\frac{i}{n}\right)}^{n} + -1}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{0.01 \cdot \left(i \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)\right) + 0.01 \cdot \frac{1}{n}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -2e-281Initial program 99.4%
associate-*r/99.6%
sub-neg99.6%
distribute-lft-in99.7%
metadata-eval99.7%
metadata-eval99.7%
metadata-eval99.7%
fma-define99.7%
metadata-eval99.7%
Simplified99.7%
fma-undefine99.7%
metadata-eval99.7%
distribute-lft-in99.6%
metadata-eval99.6%
sub-neg99.6%
*-commutative99.6%
add-exp-log99.6%
expm1-define99.6%
log-pow63.2%
log1p-define63.2%
Applied egg-rr63.2%
clear-num63.4%
inv-pow63.4%
*-commutative63.4%
associate-/r*63.4%
Applied egg-rr63.4%
unpow-163.4%
associate-/l/63.4%
*-commutative63.4%
Simplified63.4%
associate-/r*63.4%
associate-/r/63.4%
associate-/l/63.1%
*-commutative63.1%
Applied egg-rr63.1%
associate-*l/63.1%
*-lft-identity63.1%
Simplified63.1%
associate-/r/63.2%
expm1-undefine63.2%
*-commutative63.2%
log1p-undefine63.2%
pow-to-exp99.6%
sub-div99.6%
*-commutative99.6%
sub-neg99.6%
distribute-lft-in99.4%
+-commutative99.4%
distribute-neg-frac99.4%
metadata-eval99.4%
Applied egg-rr99.4%
associate-*l*99.4%
associate-*l*99.6%
distribute-lft-out99.8%
+-commutative99.8%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
if -2e-281 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 1e-263Initial program 22.5%
associate-*r/22.5%
sub-neg22.5%
distribute-lft-in22.5%
metadata-eval22.5%
metadata-eval22.5%
metadata-eval22.5%
fma-define22.5%
metadata-eval22.5%
Simplified22.5%
fma-undefine22.5%
metadata-eval22.5%
distribute-lft-in22.5%
metadata-eval22.5%
sub-neg22.5%
*-commutative22.5%
add-exp-log22.5%
expm1-define22.5%
log-pow34.1%
log1p-define99.7%
Applied egg-rr99.7%
clear-num98.4%
inv-pow98.4%
*-commutative98.4%
associate-/r*96.3%
Applied egg-rr96.3%
unpow-196.3%
associate-/l/98.4%
*-commutative98.4%
Simplified98.4%
clear-num99.7%
*-commutative99.7%
associate-/l*96.6%
Applied egg-rr96.6%
if 1e-263 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.8%
associate-*r/99.7%
sub-neg99.7%
distribute-lft-in99.7%
metadata-eval99.7%
metadata-eval99.7%
metadata-eval99.7%
fma-define99.7%
metadata-eval99.7%
Simplified99.7%
fma-undefine99.7%
metadata-eval99.7%
distribute-lft-in99.7%
metadata-eval99.7%
sub-neg99.7%
*-commutative99.7%
add-exp-log99.7%
expm1-define99.7%
log-pow49.9%
log1p-define49.9%
Applied egg-rr49.9%
clear-num50.0%
inv-pow50.0%
*-commutative50.0%
associate-/r*50.0%
Applied egg-rr50.0%
unpow-150.0%
associate-/l/50.0%
*-commutative50.0%
Simplified50.0%
Taylor expanded in i around inf 37.5%
associate-/l*37.5%
Simplified99.8%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-*r/0.0%
sub-neg0.0%
distribute-lft-in0.0%
metadata-eval0.0%
metadata-eval0.0%
metadata-eval0.0%
fma-define0.0%
metadata-eval0.0%
Simplified0.0%
fma-undefine0.0%
metadata-eval0.0%
distribute-lft-in0.0%
metadata-eval0.0%
sub-neg0.0%
*-commutative0.0%
add-exp-log0.0%
expm1-define0.0%
log-pow0.0%
log1p-define0.0%
Applied egg-rr0.0%
clear-num0.0%
inv-pow0.0%
*-commutative0.0%
associate-/r*0.0%
Applied egg-rr0.0%
unpow-10.0%
associate-/l/0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in i around 0 99.5%
Final simplification97.5%
(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 -1e-247)
(* n (+ (* 100.0 (/ t_0 i)) (/ -100.0 i)))
(if (<= t_1 1e-263)
(* (expm1 (* n (log1p (/ i n)))) (/ (* n 100.0) i))
(if (<= t_1 INFINITY)
(* 100.0 (* n (/ (+ (pow (/ i n) n) -1.0) i)))
(/
1.0
(+
(* 0.01 (* i (+ (* 0.5 (/ 1.0 (pow n 2.0))) (* 0.5 (/ -1.0 n)))))
(* 0.01 (/ 1.0 n)))))))))
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 <= -1e-247) {
tmp = n * ((100.0 * (t_0 / i)) + (-100.0 / i));
} else if (t_1 <= 1e-263) {
tmp = expm1((n * log1p((i / n)))) * ((n * 100.0) / i);
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (n * ((pow((i / n), n) + -1.0) / i));
} else {
tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n)));
}
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 <= -1e-247) {
tmp = n * ((100.0 * (t_0 / i)) + (-100.0 / i));
} else if (t_1 <= 1e-263) {
tmp = Math.expm1((n * Math.log1p((i / n)))) * ((n * 100.0) / i);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (n * ((Math.pow((i / n), n) + -1.0) / i));
} else {
tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / Math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n)));
}
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 <= -1e-247: tmp = n * ((100.0 * (t_0 / i)) + (-100.0 / i)) elif t_1 <= 1e-263: tmp = math.expm1((n * math.log1p((i / n)))) * ((n * 100.0) / i) elif t_1 <= math.inf: tmp = 100.0 * (n * ((math.pow((i / n), n) + -1.0) / i)) else: tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n))) 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 <= -1e-247) tmp = Float64(n * Float64(Float64(100.0 * Float64(t_0 / i)) + Float64(-100.0 / i))); elseif (t_1 <= 1e-263) tmp = Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(Float64(n * 100.0) / i)); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(n * Float64(Float64((Float64(i / n) ^ n) + -1.0) / i))); else tmp = Float64(1.0 / Float64(Float64(0.01 * Float64(i * Float64(Float64(0.5 * Float64(1.0 / (n ^ 2.0))) + Float64(0.5 * Float64(-1.0 / n))))) + Float64(0.01 * Float64(1.0 / n)))); 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, -1e-247], N[(n * N[(N[(100.0 * N[(t$95$0 / i), $MachinePrecision]), $MachinePrecision] + N[(-100.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e-263], N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(N[(n * 100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(n * N[(N[(N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(0.01 * N[(i * N[(N[(0.5 * N[(1.0 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.01 * N[(1.0 / n), $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 -1 \cdot 10^{-247}:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{t\_0}{i} + \frac{-100}{i}\right)\\
\mathbf{elif}\;t\_1 \leq 10^{-263}:\\
\;\;\;\;\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{n \cdot 100}{i}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{{\left(\frac{i}{n}\right)}^{n} + -1}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{0.01 \cdot \left(i \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)\right) + 0.01 \cdot \frac{1}{n}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -1e-247Initial program 99.4%
associate-*r/99.7%
sub-neg99.7%
distribute-lft-in99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
fma-define99.8%
metadata-eval99.8%
Simplified99.8%
fma-undefine99.8%
metadata-eval99.8%
distribute-lft-in99.7%
metadata-eval99.7%
sub-neg99.7%
*-commutative99.7%
add-exp-log99.7%
expm1-define99.7%
log-pow59.7%
log1p-define59.7%
Applied egg-rr59.7%
clear-num59.7%
inv-pow59.7%
*-commutative59.7%
associate-/r*59.7%
Applied egg-rr59.7%
unpow-159.7%
associate-/l/59.7%
*-commutative59.7%
Simplified59.7%
associate-/r*59.7%
associate-/r/59.7%
associate-/l/59.4%
*-commutative59.4%
Applied egg-rr59.4%
associate-*l/59.4%
*-lft-identity59.4%
Simplified59.4%
associate-/r/59.5%
expm1-undefine59.5%
*-commutative59.5%
log1p-undefine59.5%
pow-to-exp99.5%
sub-div99.5%
*-commutative99.5%
sub-neg99.5%
distribute-lft-in99.4%
+-commutative99.4%
distribute-neg-frac99.4%
metadata-eval99.4%
Applied egg-rr99.4%
associate-*l*99.4%
associate-*l*99.6%
distribute-lft-out99.8%
+-commutative99.8%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
if -1e-247 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 1e-263Initial program 22.9%
associate-*r/22.9%
sub-neg22.9%
distribute-lft-in22.9%
metadata-eval22.9%
metadata-eval22.9%
metadata-eval22.9%
fma-define22.9%
metadata-eval22.9%
Simplified22.9%
associate-/r/22.9%
associate-*l/22.9%
fma-undefine22.9%
metadata-eval22.9%
distribute-lft-in22.9%
metadata-eval22.9%
sub-neg22.9%
*-commutative22.9%
associate-*r*22.9%
*-commutative22.9%
associate-/l*22.8%
add-exp-log22.8%
expm1-define22.8%
log-pow34.3%
log1p-define96.7%
Applied egg-rr96.7%
if 1e-263 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.8%
associate-*r/99.7%
sub-neg99.7%
distribute-lft-in99.7%
metadata-eval99.7%
metadata-eval99.7%
metadata-eval99.7%
fma-define99.7%
metadata-eval99.7%
Simplified99.7%
fma-undefine99.7%
metadata-eval99.7%
distribute-lft-in99.7%
metadata-eval99.7%
sub-neg99.7%
*-commutative99.7%
add-exp-log99.7%
expm1-define99.7%
log-pow49.9%
log1p-define49.9%
Applied egg-rr49.9%
clear-num50.0%
inv-pow50.0%
*-commutative50.0%
associate-/r*50.0%
Applied egg-rr50.0%
unpow-150.0%
associate-/l/50.0%
*-commutative50.0%
Simplified50.0%
Taylor expanded in i around inf 37.5%
associate-/l*37.5%
Simplified99.8%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-*r/0.0%
sub-neg0.0%
distribute-lft-in0.0%
metadata-eval0.0%
metadata-eval0.0%
metadata-eval0.0%
fma-define0.0%
metadata-eval0.0%
Simplified0.0%
fma-undefine0.0%
metadata-eval0.0%
distribute-lft-in0.0%
metadata-eval0.0%
sub-neg0.0%
*-commutative0.0%
add-exp-log0.0%
expm1-define0.0%
log-pow0.0%
log1p-define0.0%
Applied egg-rr0.0%
clear-num0.0%
inv-pow0.0%
*-commutative0.0%
associate-/r*0.0%
Applied egg-rr0.0%
unpow-10.0%
associate-/l/0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in i around 0 99.5%
Final simplification97.5%
(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 -1e-247)
(* n (+ (* 100.0 (/ t_0 i)) (/ -100.0 i)))
(if (<= t_1 1e-263)
(/ (expm1 (* n (log1p (/ i n)))) (* (/ i n) 0.01))
(if (<= t_1 INFINITY)
(* 100.0 (* n (/ (+ (pow (/ i n) n) -1.0) i)))
(/
1.0
(+
(* 0.01 (* i (+ (* 0.5 (/ 1.0 (pow n 2.0))) (* 0.5 (/ -1.0 n)))))
(* 0.01 (/ 1.0 n)))))))))
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 <= -1e-247) {
tmp = n * ((100.0 * (t_0 / i)) + (-100.0 / i));
} else if (t_1 <= 1e-263) {
tmp = expm1((n * log1p((i / n)))) / ((i / n) * 0.01);
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (n * ((pow((i / n), n) + -1.0) / i));
} else {
tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n)));
}
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 <= -1e-247) {
tmp = n * ((100.0 * (t_0 / i)) + (-100.0 / i));
} else if (t_1 <= 1e-263) {
tmp = Math.expm1((n * Math.log1p((i / n)))) / ((i / n) * 0.01);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (n * ((Math.pow((i / n), n) + -1.0) / i));
} else {
tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / Math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n)));
}
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 <= -1e-247: tmp = n * ((100.0 * (t_0 / i)) + (-100.0 / i)) elif t_1 <= 1e-263: tmp = math.expm1((n * math.log1p((i / n)))) / ((i / n) * 0.01) elif t_1 <= math.inf: tmp = 100.0 * (n * ((math.pow((i / n), n) + -1.0) / i)) else: tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n))) 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 <= -1e-247) tmp = Float64(n * Float64(Float64(100.0 * Float64(t_0 / i)) + Float64(-100.0 / i))); elseif (t_1 <= 1e-263) tmp = Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(Float64(i / n) * 0.01)); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(n * Float64(Float64((Float64(i / n) ^ n) + -1.0) / i))); else tmp = Float64(1.0 / Float64(Float64(0.01 * Float64(i * Float64(Float64(0.5 * Float64(1.0 / (n ^ 2.0))) + Float64(0.5 * Float64(-1.0 / n))))) + Float64(0.01 * Float64(1.0 / n)))); 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, -1e-247], N[(n * N[(N[(100.0 * N[(t$95$0 / i), $MachinePrecision]), $MachinePrecision] + N[(-100.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e-263], N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / N[(N[(i / n), $MachinePrecision] * 0.01), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(n * N[(N[(N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(0.01 * N[(i * N[(N[(0.5 * N[(1.0 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.01 * N[(1.0 / n), $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 -1 \cdot 10^{-247}:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{t\_0}{i} + \frac{-100}{i}\right)\\
\mathbf{elif}\;t\_1 \leq 10^{-263}:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n} \cdot 0.01}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{{\left(\frac{i}{n}\right)}^{n} + -1}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{0.01 \cdot \left(i \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)\right) + 0.01 \cdot \frac{1}{n}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -1e-247Initial program 99.4%
associate-*r/99.7%
sub-neg99.7%
distribute-lft-in99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
fma-define99.8%
metadata-eval99.8%
Simplified99.8%
fma-undefine99.8%
metadata-eval99.8%
distribute-lft-in99.7%
metadata-eval99.7%
sub-neg99.7%
*-commutative99.7%
add-exp-log99.7%
expm1-define99.7%
log-pow59.7%
log1p-define59.7%
Applied egg-rr59.7%
clear-num59.7%
inv-pow59.7%
*-commutative59.7%
associate-/r*59.7%
Applied egg-rr59.7%
unpow-159.7%
associate-/l/59.7%
*-commutative59.7%
Simplified59.7%
associate-/r*59.7%
associate-/r/59.7%
associate-/l/59.4%
*-commutative59.4%
Applied egg-rr59.4%
associate-*l/59.4%
*-lft-identity59.4%
Simplified59.4%
associate-/r/59.5%
expm1-undefine59.5%
*-commutative59.5%
log1p-undefine59.5%
pow-to-exp99.5%
sub-div99.5%
*-commutative99.5%
sub-neg99.5%
distribute-lft-in99.4%
+-commutative99.4%
distribute-neg-frac99.4%
metadata-eval99.4%
Applied egg-rr99.4%
associate-*l*99.4%
associate-*l*99.6%
distribute-lft-out99.8%
+-commutative99.8%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
if -1e-247 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 1e-263Initial program 22.9%
associate-*r/22.9%
sub-neg22.9%
distribute-lft-in22.9%
metadata-eval22.9%
metadata-eval22.9%
metadata-eval22.9%
fma-define22.9%
metadata-eval22.9%
Simplified22.9%
fma-undefine22.9%
metadata-eval22.9%
distribute-lft-in22.9%
metadata-eval22.9%
sub-neg22.9%
*-commutative22.9%
add-exp-log22.9%
expm1-define22.9%
log-pow34.4%
log1p-define99.7%
Applied egg-rr99.7%
clear-num98.4%
inv-pow98.4%
*-commutative98.4%
associate-/r*96.3%
Applied egg-rr96.3%
unpow-196.3%
associate-/l/98.4%
*-commutative98.4%
Simplified98.4%
associate-/r*96.3%
associate-/r/96.5%
associate-/l/96.6%
*-commutative96.6%
Applied egg-rr96.6%
associate-*l/97.6%
*-lft-identity97.6%
Simplified97.6%
associate-/r*97.5%
div-inv97.5%
metadata-eval97.5%
Applied egg-rr97.5%
if 1e-263 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.8%
associate-*r/99.7%
sub-neg99.7%
distribute-lft-in99.7%
metadata-eval99.7%
metadata-eval99.7%
metadata-eval99.7%
fma-define99.7%
metadata-eval99.7%
Simplified99.7%
fma-undefine99.7%
metadata-eval99.7%
distribute-lft-in99.7%
metadata-eval99.7%
sub-neg99.7%
*-commutative99.7%
add-exp-log99.7%
expm1-define99.7%
log-pow49.9%
log1p-define49.9%
Applied egg-rr49.9%
clear-num50.0%
inv-pow50.0%
*-commutative50.0%
associate-/r*50.0%
Applied egg-rr50.0%
unpow-150.0%
associate-/l/50.0%
*-commutative50.0%
Simplified50.0%
Taylor expanded in i around inf 37.5%
associate-/l*37.5%
Simplified99.8%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-*r/0.0%
sub-neg0.0%
distribute-lft-in0.0%
metadata-eval0.0%
metadata-eval0.0%
metadata-eval0.0%
fma-define0.0%
metadata-eval0.0%
Simplified0.0%
fma-undefine0.0%
metadata-eval0.0%
distribute-lft-in0.0%
metadata-eval0.0%
sub-neg0.0%
*-commutative0.0%
add-exp-log0.0%
expm1-define0.0%
log-pow0.0%
log1p-define0.0%
Applied egg-rr0.0%
clear-num0.0%
inv-pow0.0%
*-commutative0.0%
associate-/r*0.0%
Applied egg-rr0.0%
unpow-10.0%
associate-/l/0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in i around 0 99.5%
Final simplification98.1%
(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 -1e-247)
(* n (+ (* 100.0 (/ t_0 i)) (/ -100.0 i)))
(if (<= t_1 1e-263)
(/ (expm1 (* n (log1p (/ i n)))) (/ i (* n 100.0)))
(if (<= t_1 INFINITY)
(* 100.0 (* n (/ (+ (pow (/ i n) n) -1.0) i)))
(/
1.0
(+
(* 0.01 (* i (+ (* 0.5 (/ 1.0 (pow n 2.0))) (* 0.5 (/ -1.0 n)))))
(* 0.01 (/ 1.0 n)))))))))
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 <= -1e-247) {
tmp = n * ((100.0 * (t_0 / i)) + (-100.0 / i));
} else if (t_1 <= 1e-263) {
tmp = expm1((n * log1p((i / n)))) / (i / (n * 100.0));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (n * ((pow((i / n), n) + -1.0) / i));
} else {
tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n)));
}
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 <= -1e-247) {
tmp = n * ((100.0 * (t_0 / i)) + (-100.0 / i));
} else if (t_1 <= 1e-263) {
tmp = Math.expm1((n * Math.log1p((i / n)))) / (i / (n * 100.0));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (n * ((Math.pow((i / n), n) + -1.0) / i));
} else {
tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / Math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n)));
}
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 <= -1e-247: tmp = n * ((100.0 * (t_0 / i)) + (-100.0 / i)) elif t_1 <= 1e-263: tmp = math.expm1((n * math.log1p((i / n)))) / (i / (n * 100.0)) elif t_1 <= math.inf: tmp = 100.0 * (n * ((math.pow((i / n), n) + -1.0) / i)) else: tmp = 1.0 / ((0.01 * (i * ((0.5 * (1.0 / math.pow(n, 2.0))) + (0.5 * (-1.0 / n))))) + (0.01 * (1.0 / n))) 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 <= -1e-247) tmp = Float64(n * Float64(Float64(100.0 * Float64(t_0 / i)) + Float64(-100.0 / i))); elseif (t_1 <= 1e-263) tmp = Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i / Float64(n * 100.0))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(n * Float64(Float64((Float64(i / n) ^ n) + -1.0) / i))); else tmp = Float64(1.0 / Float64(Float64(0.01 * Float64(i * Float64(Float64(0.5 * Float64(1.0 / (n ^ 2.0))) + Float64(0.5 * Float64(-1.0 / n))))) + Float64(0.01 * Float64(1.0 / n)))); 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, -1e-247], N[(n * N[(N[(100.0 * N[(t$95$0 / i), $MachinePrecision]), $MachinePrecision] + N[(-100.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e-263], N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / N[(i / N[(n * 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(n * N[(N[(N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(0.01 * N[(i * N[(N[(0.5 * N[(1.0 / N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.01 * N[(1.0 / n), $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 -1 \cdot 10^{-247}:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{t\_0}{i} + \frac{-100}{i}\right)\\
\mathbf{elif}\;t\_1 \leq 10^{-263}:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n \cdot 100}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{{\left(\frac{i}{n}\right)}^{n} + -1}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{0.01 \cdot \left(i \cdot \left(0.5 \cdot \frac{1}{{n}^{2}} + 0.5 \cdot \frac{-1}{n}\right)\right) + 0.01 \cdot \frac{1}{n}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -1e-247Initial program 99.4%
associate-*r/99.7%
sub-neg99.7%
distribute-lft-in99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
fma-define99.8%
metadata-eval99.8%
Simplified99.8%
fma-undefine99.8%
metadata-eval99.8%
distribute-lft-in99.7%
metadata-eval99.7%
sub-neg99.7%
*-commutative99.7%
add-exp-log99.7%
expm1-define99.7%
log-pow59.7%
log1p-define59.7%
Applied egg-rr59.7%
clear-num59.7%
inv-pow59.7%
*-commutative59.7%
associate-/r*59.7%
Applied egg-rr59.7%
unpow-159.7%
associate-/l/59.7%
*-commutative59.7%
Simplified59.7%
associate-/r*59.7%
associate-/r/59.7%
associate-/l/59.4%
*-commutative59.4%
Applied egg-rr59.4%
associate-*l/59.4%
*-lft-identity59.4%
Simplified59.4%
associate-/r/59.5%
expm1-undefine59.5%
*-commutative59.5%
log1p-undefine59.5%
pow-to-exp99.5%
sub-div99.5%
*-commutative99.5%
sub-neg99.5%
distribute-lft-in99.4%
+-commutative99.4%
distribute-neg-frac99.4%
metadata-eval99.4%
Applied egg-rr99.4%
associate-*l*99.4%
associate-*l*99.6%
distribute-lft-out99.8%
+-commutative99.8%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
if -1e-247 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 1e-263Initial program 22.9%
associate-*r/22.9%
sub-neg22.9%
distribute-lft-in22.9%
metadata-eval22.9%
metadata-eval22.9%
metadata-eval22.9%
fma-define22.9%
metadata-eval22.9%
Simplified22.9%
fma-undefine22.9%
metadata-eval22.9%
distribute-lft-in22.9%
metadata-eval22.9%
sub-neg22.9%
*-commutative22.9%
add-exp-log22.9%
expm1-define22.9%
log-pow34.4%
log1p-define99.7%
Applied egg-rr99.7%
clear-num98.4%
inv-pow98.4%
*-commutative98.4%
associate-/r*96.3%
Applied egg-rr96.3%
unpow-196.3%
associate-/l/98.4%
*-commutative98.4%
Simplified98.4%
associate-/r*96.3%
associate-/r/96.5%
associate-/l/96.6%
*-commutative96.6%
Applied egg-rr96.6%
associate-*l/97.6%
*-lft-identity97.6%
Simplified97.6%
if 1e-263 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.8%
associate-*r/99.7%
sub-neg99.7%
distribute-lft-in99.7%
metadata-eval99.7%
metadata-eval99.7%
metadata-eval99.7%
fma-define99.7%
metadata-eval99.7%
Simplified99.7%
fma-undefine99.7%
metadata-eval99.7%
distribute-lft-in99.7%
metadata-eval99.7%
sub-neg99.7%
*-commutative99.7%
add-exp-log99.7%
expm1-define99.7%
log-pow49.9%
log1p-define49.9%
Applied egg-rr49.9%
clear-num50.0%
inv-pow50.0%
*-commutative50.0%
associate-/r*50.0%
Applied egg-rr50.0%
unpow-150.0%
associate-/l/50.0%
*-commutative50.0%
Simplified50.0%
Taylor expanded in i around inf 37.5%
associate-/l*37.5%
Simplified99.8%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-*r/0.0%
sub-neg0.0%
distribute-lft-in0.0%
metadata-eval0.0%
metadata-eval0.0%
metadata-eval0.0%
fma-define0.0%
metadata-eval0.0%
Simplified0.0%
fma-undefine0.0%
metadata-eval0.0%
distribute-lft-in0.0%
metadata-eval0.0%
sub-neg0.0%
*-commutative0.0%
add-exp-log0.0%
expm1-define0.0%
log-pow0.0%
log1p-define0.0%
Applied egg-rr0.0%
clear-num0.0%
inv-pow0.0%
*-commutative0.0%
associate-/r*0.0%
Applied egg-rr0.0%
unpow-10.0%
associate-/l/0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in i around 0 99.5%
Final simplification98.1%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (* n (/ (expm1 i) i)))))
(if (<= n -1.42e-238)
t_0
(if (<= n 2.6e-218) 0.0 (if (<= n 2.9) (/ (* i 100.0) (/ i n)) t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (n * (expm1(i) / i));
double tmp;
if (n <= -1.42e-238) {
tmp = t_0;
} else if (n <= 2.6e-218) {
tmp = 0.0;
} else if (n <= 2.9) {
tmp = (i * 100.0) / (i / n);
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (n * (Math.expm1(i) / i));
double tmp;
if (n <= -1.42e-238) {
tmp = t_0;
} else if (n <= 2.6e-218) {
tmp = 0.0;
} else if (n <= 2.9) {
tmp = (i * 100.0) / (i / n);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n * (math.expm1(i) / i)) tmp = 0 if n <= -1.42e-238: tmp = t_0 elif n <= 2.6e-218: tmp = 0.0 elif n <= 2.9: tmp = (i * 100.0) / (i / n) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n * Float64(expm1(i) / i))) tmp = 0.0 if (n <= -1.42e-238) tmp = t_0; elseif (n <= 2.6e-218) tmp = 0.0; elseif (n <= 2.9) tmp = Float64(Float64(i * 100.0) / Float64(i / n)); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.42e-238], t$95$0, If[LessEqual[n, 2.6e-218], 0.0, If[LessEqual[n, 2.9], N[(N[(i * 100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{if}\;n \leq -1.42 \cdot 10^{-238}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 2.6 \cdot 10^{-218}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 2.9:\\
\;\;\;\;\frac{i \cdot 100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.4199999999999999e-238 or 2.89999999999999991 < n Initial program 21.9%
associate-/r/22.2%
sub-neg22.2%
metadata-eval22.2%
Simplified22.2%
Taylor expanded in n around inf 36.1%
expm1-define84.4%
Simplified84.4%
if -1.4199999999999999e-238 < n < 2.59999999999999983e-218Initial program 71.7%
associate-*r/71.7%
sub-neg71.7%
distribute-lft-in71.7%
metadata-eval71.7%
metadata-eval71.7%
metadata-eval71.7%
fma-define71.7%
metadata-eval71.7%
Simplified71.7%
fma-undefine71.7%
*-commutative71.7%
Applied egg-rr71.7%
Taylor expanded in i around 0 80.4%
Taylor expanded in i around 0 80.4%
if 2.59999999999999983e-218 < n < 2.89999999999999991Initial program 23.6%
associate-*r/23.6%
sub-neg23.6%
distribute-lft-in23.5%
metadata-eval23.5%
metadata-eval23.5%
metadata-eval23.5%
fma-define23.6%
metadata-eval23.6%
Simplified23.6%
Taylor expanded in i around 0 66.7%
*-commutative66.7%
Simplified66.7%
Final simplification80.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i 50.0)))) (t_1 (/ (* i 100.0) (/ i n))))
(if (<= n -7e+78)
t_0
(if (<= n -4.5e-243)
t_1
(if (<= n 4e-217) 0.0 (if (<= n 1.16e-10) t_1 t_0))))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double t_1 = (i * 100.0) / (i / n);
double tmp;
if (n <= -7e+78) {
tmp = t_0;
} else if (n <= -4.5e-243) {
tmp = t_1;
} else if (n <= 4e-217) {
tmp = 0.0;
} else if (n <= 1.16e-10) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = n * (100.0d0 + (i * 50.0d0))
t_1 = (i * 100.0d0) / (i / n)
if (n <= (-7d+78)) then
tmp = t_0
else if (n <= (-4.5d-243)) then
tmp = t_1
else if (n <= 4d-217) then
tmp = 0.0d0
else if (n <= 1.16d-10) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double t_1 = (i * 100.0) / (i / n);
double tmp;
if (n <= -7e+78) {
tmp = t_0;
} else if (n <= -4.5e-243) {
tmp = t_1;
} else if (n <= 4e-217) {
tmp = 0.0;
} else if (n <= 1.16e-10) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + (i * 50.0)) t_1 = (i * 100.0) / (i / n) tmp = 0 if n <= -7e+78: tmp = t_0 elif n <= -4.5e-243: tmp = t_1 elif n <= 4e-217: tmp = 0.0 elif n <= 1.16e-10: tmp = t_1 else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 + Float64(i * 50.0))) t_1 = Float64(Float64(i * 100.0) / Float64(i / n)) tmp = 0.0 if (n <= -7e+78) tmp = t_0; elseif (n <= -4.5e-243) tmp = t_1; elseif (n <= 4e-217) tmp = 0.0; elseif (n <= 1.16e-10) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = n * (100.0 + (i * 50.0)); t_1 = (i * 100.0) / (i / n); tmp = 0.0; if (n <= -7e+78) tmp = t_0; elseif (n <= -4.5e-243) tmp = t_1; elseif (n <= 4e-217) tmp = 0.0; elseif (n <= 1.16e-10) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(i * 100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -7e+78], t$95$0, If[LessEqual[n, -4.5e-243], t$95$1, If[LessEqual[n, 4e-217], 0.0, If[LessEqual[n, 1.16e-10], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot 50\right)\\
t_1 := \frac{i \cdot 100}{\frac{i}{n}}\\
\mathbf{if}\;n \leq -7 \cdot 10^{+78}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -4.5 \cdot 10^{-243}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;n \leq 4 \cdot 10^{-217}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 1.16 \cdot 10^{-10}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -7.0000000000000003e78 or 1.16e-10 < n Initial program 16.6%
associate-/r/17.0%
sub-neg17.0%
metadata-eval17.0%
Simplified17.0%
Taylor expanded in n around inf 41.0%
expm1-define93.4%
Simplified93.4%
Taylor expanded in i around 0 70.7%
+-commutative70.7%
associate-*r*70.7%
distribute-rgt-out70.7%
Simplified70.7%
if -7.0000000000000003e78 < n < -4.50000000000000017e-243 or 4.00000000000000033e-217 < n < 1.16e-10Initial program 28.6%
associate-*r/28.6%
sub-neg28.6%
distribute-lft-in28.6%
metadata-eval28.6%
metadata-eval28.6%
metadata-eval28.6%
fma-define28.6%
metadata-eval28.6%
Simplified28.6%
Taylor expanded in i around 0 61.0%
*-commutative61.0%
Simplified61.0%
if -4.50000000000000017e-243 < n < 4.00000000000000033e-217Initial program 71.7%
associate-*r/71.7%
sub-neg71.7%
distribute-lft-in71.7%
metadata-eval71.7%
metadata-eval71.7%
metadata-eval71.7%
fma-define71.7%
metadata-eval71.7%
Simplified71.7%
fma-undefine71.7%
*-commutative71.7%
Applied egg-rr71.7%
Taylor expanded in i around 0 80.4%
Taylor expanded in i around 0 80.4%
Final simplification67.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (* i 100.0) (/ i n))))
(if (<= n -3.6e-30)
(/ (* 100.0 (* i n)) i)
(if (<= n -1.4e-242)
t_0
(if (<= n 9e-219)
0.0
(if (<= n 0.002) t_0 (* n (+ 100.0 (* i 50.0)))))))))
double code(double i, double n) {
double t_0 = (i * 100.0) / (i / n);
double tmp;
if (n <= -3.6e-30) {
tmp = (100.0 * (i * n)) / i;
} else if (n <= -1.4e-242) {
tmp = t_0;
} else if (n <= 9e-219) {
tmp = 0.0;
} else if (n <= 0.002) {
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 = (i * 100.0d0) / (i / n)
if (n <= (-3.6d-30)) then
tmp = (100.0d0 * (i * n)) / i
else if (n <= (-1.4d-242)) then
tmp = t_0
else if (n <= 9d-219) then
tmp = 0.0d0
else if (n <= 0.002d0) 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 = (i * 100.0) / (i / n);
double tmp;
if (n <= -3.6e-30) {
tmp = (100.0 * (i * n)) / i;
} else if (n <= -1.4e-242) {
tmp = t_0;
} else if (n <= 9e-219) {
tmp = 0.0;
} else if (n <= 0.002) {
tmp = t_0;
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): t_0 = (i * 100.0) / (i / n) tmp = 0 if n <= -3.6e-30: tmp = (100.0 * (i * n)) / i elif n <= -1.4e-242: tmp = t_0 elif n <= 9e-219: tmp = 0.0 elif n <= 0.002: tmp = t_0 else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) t_0 = Float64(Float64(i * 100.0) / Float64(i / n)) tmp = 0.0 if (n <= -3.6e-30) tmp = Float64(Float64(100.0 * Float64(i * n)) / i); elseif (n <= -1.4e-242) tmp = t_0; elseif (n <= 9e-219) tmp = 0.0; elseif (n <= 0.002) 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 = (i * 100.0) / (i / n); tmp = 0.0; if (n <= -3.6e-30) tmp = (100.0 * (i * n)) / i; elseif (n <= -1.4e-242) tmp = t_0; elseif (n <= 9e-219) tmp = 0.0; elseif (n <= 0.002) 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[(i * 100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -3.6e-30], N[(N[(100.0 * N[(i * n), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], If[LessEqual[n, -1.4e-242], t$95$0, If[LessEqual[n, 9e-219], 0.0, If[LessEqual[n, 0.002], t$95$0, N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{i \cdot 100}{\frac{i}{n}}\\
\mathbf{if}\;n \leq -3.6 \cdot 10^{-30}:\\
\;\;\;\;\frac{100 \cdot \left(i \cdot n\right)}{i}\\
\mathbf{elif}\;n \leq -1.4 \cdot 10^{-242}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 9 \cdot 10^{-219}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 0.002:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -3.6000000000000003e-30Initial program 21.9%
associate-/r/22.2%
sub-neg22.2%
metadata-eval22.2%
Simplified22.2%
Taylor expanded in n around inf 35.2%
expm1-define87.4%
Simplified87.4%
*-commutative87.4%
associate-*l/87.4%
associate-*l/87.2%
*-commutative87.2%
Applied egg-rr87.2%
Taylor expanded in i around 0 61.9%
*-commutative61.9%
Simplified61.9%
if -3.6000000000000003e-30 < n < -1.39999999999999992e-242 or 9.00000000000000029e-219 < n < 2e-3Initial program 26.3%
associate-*r/26.3%
sub-neg26.3%
distribute-lft-in26.3%
metadata-eval26.3%
metadata-eval26.3%
metadata-eval26.3%
fma-define26.3%
metadata-eval26.3%
Simplified26.3%
Taylor expanded in i around 0 63.6%
*-commutative63.6%
Simplified63.6%
if -1.39999999999999992e-242 < n < 9.00000000000000029e-219Initial program 71.7%
associate-*r/71.7%
sub-neg71.7%
distribute-lft-in71.7%
metadata-eval71.7%
metadata-eval71.7%
metadata-eval71.7%
fma-define71.7%
metadata-eval71.7%
Simplified71.7%
fma-undefine71.7%
*-commutative71.7%
Applied egg-rr71.7%
Taylor expanded in i around 0 80.4%
Taylor expanded in i around 0 80.4%
if 2e-3 < n Initial program 17.8%
associate-/r/18.2%
sub-neg18.2%
metadata-eval18.2%
Simplified18.2%
Taylor expanded in n around inf 43.0%
expm1-define94.4%
Simplified94.4%
Taylor expanded in i around 0 73.9%
+-commutative73.9%
associate-*r*73.9%
distribute-rgt-out73.9%
Simplified73.9%
Final simplification67.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (* i 100.0) (/ i n))))
(if (<= n -7e+78)
(* (* n 100.0) (/ (* (/ 1.0 (+ i 2.0)) (* i (+ i 2.0))) i))
(if (<= n -6.4e-244)
t_0
(if (<= n 8e-218)
0.0
(if (<= n 0.053) t_0 (* n (+ 100.0 (* i 50.0)))))))))
double code(double i, double n) {
double t_0 = (i * 100.0) / (i / n);
double tmp;
if (n <= -7e+78) {
tmp = (n * 100.0) * (((1.0 / (i + 2.0)) * (i * (i + 2.0))) / i);
} else if (n <= -6.4e-244) {
tmp = t_0;
} else if (n <= 8e-218) {
tmp = 0.0;
} else if (n <= 0.053) {
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 = (i * 100.0d0) / (i / n)
if (n <= (-7d+78)) then
tmp = (n * 100.0d0) * (((1.0d0 / (i + 2.0d0)) * (i * (i + 2.0d0))) / i)
else if (n <= (-6.4d-244)) then
tmp = t_0
else if (n <= 8d-218) then
tmp = 0.0d0
else if (n <= 0.053d0) 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 = (i * 100.0) / (i / n);
double tmp;
if (n <= -7e+78) {
tmp = (n * 100.0) * (((1.0 / (i + 2.0)) * (i * (i + 2.0))) / i);
} else if (n <= -6.4e-244) {
tmp = t_0;
} else if (n <= 8e-218) {
tmp = 0.0;
} else if (n <= 0.053) {
tmp = t_0;
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): t_0 = (i * 100.0) / (i / n) tmp = 0 if n <= -7e+78: tmp = (n * 100.0) * (((1.0 / (i + 2.0)) * (i * (i + 2.0))) / i) elif n <= -6.4e-244: tmp = t_0 elif n <= 8e-218: tmp = 0.0 elif n <= 0.053: tmp = t_0 else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) t_0 = Float64(Float64(i * 100.0) / Float64(i / n)) tmp = 0.0 if (n <= -7e+78) tmp = Float64(Float64(n * 100.0) * Float64(Float64(Float64(1.0 / Float64(i + 2.0)) * Float64(i * Float64(i + 2.0))) / i)); elseif (n <= -6.4e-244) tmp = t_0; elseif (n <= 8e-218) tmp = 0.0; elseif (n <= 0.053) 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 = (i * 100.0) / (i / n); tmp = 0.0; if (n <= -7e+78) tmp = (n * 100.0) * (((1.0 / (i + 2.0)) * (i * (i + 2.0))) / i); elseif (n <= -6.4e-244) tmp = t_0; elseif (n <= 8e-218) tmp = 0.0; elseif (n <= 0.053) 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[(i * 100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -7e+78], N[(N[(n * 100.0), $MachinePrecision] * N[(N[(N[(1.0 / N[(i + 2.0), $MachinePrecision]), $MachinePrecision] * N[(i * N[(i + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -6.4e-244], t$95$0, If[LessEqual[n, 8e-218], 0.0, If[LessEqual[n, 0.053], t$95$0, N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{i \cdot 100}{\frac{i}{n}}\\
\mathbf{if}\;n \leq -7 \cdot 10^{+78}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{\frac{1}{i + 2} \cdot \left(i \cdot \left(i + 2\right)\right)}{i}\\
\mathbf{elif}\;n \leq -6.4 \cdot 10^{-244}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 8 \cdot 10^{-218}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 0.053:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -7.0000000000000003e78Initial program 14.9%
*-commutative14.9%
associate-/r/15.3%
associate-*l*15.3%
sub-neg15.3%
metadata-eval15.3%
Simplified15.3%
Taylor expanded in i around 0 4.3%
+-commutative4.3%
Simplified4.3%
flip-+13.1%
div-inv13.1%
metadata-eval13.1%
difference-of-sqr-113.1%
metadata-eval13.1%
sub-neg13.1%
associate--l+13.1%
metadata-eval13.1%
add-exp-log11.8%
expm1-undefine11.8%
+-commutative11.8%
log1p-define65.6%
expm1-log1p-u66.9%
associate--l+66.9%
metadata-eval66.9%
Applied egg-rr66.9%
*-commutative66.9%
*-commutative66.9%
Simplified66.9%
if -7.0000000000000003e78 < n < -6.3999999999999996e-244 or 8.0000000000000003e-218 < n < 0.0529999999999999985Initial program 28.6%
associate-*r/28.6%
sub-neg28.6%
distribute-lft-in28.6%
metadata-eval28.6%
metadata-eval28.6%
metadata-eval28.6%
fma-define28.6%
metadata-eval28.6%
Simplified28.6%
Taylor expanded in i around 0 61.0%
*-commutative61.0%
Simplified61.0%
if -6.3999999999999996e-244 < n < 8.0000000000000003e-218Initial program 71.7%
associate-*r/71.7%
sub-neg71.7%
distribute-lft-in71.7%
metadata-eval71.7%
metadata-eval71.7%
metadata-eval71.7%
fma-define71.7%
metadata-eval71.7%
Simplified71.7%
fma-undefine71.7%
*-commutative71.7%
Applied egg-rr71.7%
Taylor expanded in i around 0 80.4%
Taylor expanded in i around 0 80.4%
if 0.0529999999999999985 < n Initial program 17.8%
associate-/r/18.2%
sub-neg18.2%
metadata-eval18.2%
Simplified18.2%
Taylor expanded in n around inf 43.0%
expm1-define94.4%
Simplified94.4%
Taylor expanded in i around 0 73.9%
+-commutative73.9%
associate-*r*73.9%
distribute-rgt-out73.9%
Simplified73.9%
Final simplification67.6%
(FPCore (i n) :precision binary64 (if (or (<= n -4.1e-169) (not (<= n 4.6e-42))) (* n (+ 100.0 (* i 50.0))) 0.0))
double code(double i, double n) {
double tmp;
if ((n <= -4.1e-169) || !(n <= 4.6e-42)) {
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 <= (-4.1d-169)) .or. (.not. (n <= 4.6d-42))) 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 <= -4.1e-169) || !(n <= 4.6e-42)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -4.1e-169) or not (n <= 4.6e-42): tmp = n * (100.0 + (i * 50.0)) else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if ((n <= -4.1e-169) || !(n <= 4.6e-42)) 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 <= -4.1e-169) || ~((n <= 4.6e-42))) tmp = n * (100.0 + (i * 50.0)); else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -4.1e-169], N[Not[LessEqual[n, 4.6e-42]], $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 -4.1 \cdot 10^{-169} \lor \neg \left(n \leq 4.6 \cdot 10^{-42}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if n < -4.0999999999999998e-169 or 4.60000000000000008e-42 < n Initial program 19.3%
associate-/r/19.7%
sub-neg19.7%
metadata-eval19.7%
Simplified19.7%
Taylor expanded in n around inf 34.8%
expm1-define85.7%
Simplified85.7%
Taylor expanded in i around 0 64.6%
+-commutative64.6%
associate-*r*64.6%
distribute-rgt-out64.6%
Simplified64.6%
if -4.0999999999999998e-169 < n < 4.60000000000000008e-42Initial program 42.5%
associate-*r/42.5%
sub-neg42.5%
distribute-lft-in42.5%
metadata-eval42.5%
metadata-eval42.5%
metadata-eval42.5%
fma-define42.5%
metadata-eval42.5%
Simplified42.5%
fma-undefine42.5%
*-commutative42.5%
Applied egg-rr42.5%
Taylor expanded in i around 0 59.8%
Taylor expanded in i around 0 59.8%
Final simplification63.1%
(FPCore (i n) :precision binary64 (if (<= i -122000000000.0) 0.0 (if (<= i 28000000000.0) (* n 100.0) 0.0)))
double code(double i, double n) {
double tmp;
if (i <= -122000000000.0) {
tmp = 0.0;
} else if (i <= 28000000000.0) {
tmp = n * 100.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-122000000000.0d0)) then
tmp = 0.0d0
else if (i <= 28000000000.0d0) then
tmp = n * 100.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -122000000000.0) {
tmp = 0.0;
} else if (i <= 28000000000.0) {
tmp = n * 100.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -122000000000.0: tmp = 0.0 elif i <= 28000000000.0: tmp = n * 100.0 else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if (i <= -122000000000.0) tmp = 0.0; elseif (i <= 28000000000.0) tmp = Float64(n * 100.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -122000000000.0) tmp = 0.0; elseif (i <= 28000000000.0) tmp = n * 100.0; else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -122000000000.0], 0.0, If[LessEqual[i, 28000000000.0], N[(n * 100.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -122000000000:\\
\;\;\;\;0\\
\mathbf{elif}\;i \leq 28000000000:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if i < -1.22e11 or 2.8e10 < i Initial program 48.8%
associate-*r/48.8%
sub-neg48.8%
distribute-lft-in48.8%
metadata-eval48.8%
metadata-eval48.8%
metadata-eval48.8%
fma-define48.8%
metadata-eval48.8%
Simplified48.8%
fma-undefine48.8%
*-commutative48.8%
Applied egg-rr48.8%
Taylor expanded in i around 0 36.9%
Taylor expanded in i around 0 36.9%
if -1.22e11 < i < 2.8e10Initial program 11.5%
associate-/r/11.9%
sub-neg11.9%
metadata-eval11.9%
Simplified11.9%
Taylor expanded in i around 0 78.2%
*-commutative78.2%
Simplified78.2%
Final simplification61.4%
(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 26.7%
associate-*r/26.7%
sub-neg26.7%
distribute-lft-in26.7%
metadata-eval26.7%
metadata-eval26.7%
metadata-eval26.7%
fma-define26.7%
metadata-eval26.7%
Simplified26.7%
fma-undefine26.7%
*-commutative26.7%
Applied egg-rr26.7%
Taylor expanded in i around 0 21.8%
Taylor expanded in i around 0 22.0%
Final simplification22.0%
(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 2024036
(FPCore (i n)
:name "Compound Interest"
:precision binary64
:herbie-target
(* 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))))