
(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 18 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 0.0)
(/ (* 100.0 (expm1 (* n (log1p (/ i n))))) (/ i n))
(if (<= t_1 INFINITY)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(*
100.0
(/ n (+ 1.0 (+ (* i -0.5) (* 0.08333333333333333 (pow i 2.0))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = (100.0 * expm1((n * log1p((i / n))))) / (i / n);
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * pow(i, 2.0)))));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = (100.0 * Math.expm1((n * Math.log1p((i / n))))) / (i / n);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * Math.pow(i, 2.0)))));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 0.0: tmp = (100.0 * math.expm1((n * math.log1p((i / n))))) / (i / n) elif t_1 <= math.inf: tmp = n * (((t_0 * 100.0) + -100.0) / i) else: tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * math.pow(i, 2.0))))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(Float64(100.0 * expm1(Float64(n * log1p(Float64(i / n))))) / Float64(i / n)); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(Float64(i * -0.5) + Float64(0.08333333333333333 * (i ^ 2.0)))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], 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[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(N[(i * -0.5), $MachinePrecision] + N[(0.08333333333333333 * N[Power[i, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\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:\\
\;\;\;\;n \cdot \frac{t\_0 \cdot 100 + -100}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + \left(i \cdot -0.5 + 0.08333333333333333 \cdot {i}^{2}\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 29.5%
associate-/r/29.5%
sub-neg29.5%
metadata-eval29.5%
Simplified29.5%
metadata-eval29.5%
sub-neg29.5%
associate-/r/29.5%
associate-*r/29.5%
add-exp-log29.5%
expm1-def29.5%
log-pow39.6%
log1p-udef98.1%
Applied egg-rr98.1%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.6%
associate-/r/99.6%
associate-*r*99.7%
*-commutative99.7%
associate-*r/99.9%
sub-neg99.9%
distribute-lft-in99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
fma-def99.9%
metadata-eval99.9%
Simplified99.9%
fma-udef99.9%
*-commutative99.9%
Applied egg-rr99.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-/r/1.8%
sub-neg1.8%
metadata-eval1.8%
Simplified1.8%
Taylor expanded in n around inf 1.8%
associate-/l*1.8%
expm1-def72.2%
Simplified72.2%
Taylor expanded in i around 0 100.0%
Final simplification98.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0)) (t_1 (/ t_0 (/ i n))))
(if (<= t_1 0.0)
(* 100.0 (/ n (/ i (expm1 i))))
(if (<= t_1 INFINITY)
(* 100.0 (* n (/ t_0 i)))
(*
100.0
(/ n (+ 1.0 (+ (* i -0.5) (* 0.08333333333333333 (pow i 2.0))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = 100.0 * (n / (i / expm1(i)));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (n * (t_0 / i));
} else {
tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * pow(i, 2.0)))));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = 100.0 * (n / (i / Math.expm1(i)));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (n * (t_0 / i));
} else {
tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * Math.pow(i, 2.0)))));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) + -1.0 t_1 = t_0 / (i / n) tmp = 0 if t_1 <= 0.0: tmp = 100.0 * (n / (i / math.expm1(i))) elif t_1 <= math.inf: tmp = 100.0 * (n * (t_0 / i)) else: tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * math.pow(i, 2.0))))) return tmp
function code(i, n) t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) t_1 = Float64(t_0 / Float64(i / n)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(n * Float64(t_0 / i))); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(Float64(i * -0.5) + Float64(0.08333333333333333 * (i ^ 2.0)))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(n * N[(t$95$0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(N[(i * -0.5), $MachinePrecision] + N[(0.08333333333333333 * N[Power[i, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t\_0}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{t\_0}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + \left(i \cdot -0.5 + 0.08333333333333333 \cdot {i}^{2}\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 29.5%
associate-/r/29.5%
sub-neg29.5%
metadata-eval29.5%
Simplified29.5%
Taylor expanded in n around inf 39.8%
associate-/l*39.8%
expm1-def77.2%
Simplified77.2%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.6%
associate-/r/99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-/r/1.8%
sub-neg1.8%
metadata-eval1.8%
Simplified1.8%
Taylor expanded in n around inf 1.8%
associate-/l*1.8%
expm1-def72.2%
Simplified72.2%
Taylor expanded in i around 0 100.0%
Final simplification82.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 0.0)
(* 100.0 (/ n (/ i (expm1 i))))
(if (<= t_1 INFINITY)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(*
100.0
(/ n (+ 1.0 (+ (* i -0.5) (* 0.08333333333333333 (pow i 2.0))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = 100.0 * (n / (i / expm1(i)));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * pow(i, 2.0)))));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = 100.0 * (n / (i / Math.expm1(i)));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * Math.pow(i, 2.0)))));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 0.0: tmp = 100.0 * (n / (i / math.expm1(i))) elif t_1 <= math.inf: tmp = n * (((t_0 * 100.0) + -100.0) / i) else: tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * math.pow(i, 2.0))))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(Float64(i * -0.5) + Float64(0.08333333333333333 * (i ^ 2.0)))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(N[(i * -0.5), $MachinePrecision] + N[(0.08333333333333333 * N[Power[i, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{t\_0 \cdot 100 + -100}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + \left(i \cdot -0.5 + 0.08333333333333333 \cdot {i}^{2}\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 29.5%
associate-/r/29.5%
sub-neg29.5%
metadata-eval29.5%
Simplified29.5%
Taylor expanded in n around inf 39.8%
associate-/l*39.8%
expm1-def77.2%
Simplified77.2%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.6%
associate-/r/99.6%
associate-*r*99.7%
*-commutative99.7%
associate-*r/99.9%
sub-neg99.9%
distribute-lft-in99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
fma-def99.9%
metadata-eval99.9%
Simplified99.9%
fma-udef99.9%
*-commutative99.9%
Applied egg-rr99.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-/r/1.8%
sub-neg1.8%
metadata-eval1.8%
Simplified1.8%
Taylor expanded in n around inf 1.8%
associate-/l*1.8%
expm1-def72.2%
Simplified72.2%
Taylor expanded in i around 0 100.0%
Final simplification82.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 0.0)
(* (* 100.0 (expm1 (* n (log1p (/ i n))))) (/ n i))
(if (<= t_1 INFINITY)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(*
100.0
(/ n (+ 1.0 (+ (* i -0.5) (* 0.08333333333333333 (pow i 2.0))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = (100.0 * expm1((n * log1p((i / n))))) * (n / i);
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * pow(i, 2.0)))));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = (100.0 * Math.expm1((n * Math.log1p((i / n))))) * (n / i);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * Math.pow(i, 2.0)))));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 0.0: tmp = (100.0 * math.expm1((n * math.log1p((i / n))))) * (n / i) elif t_1 <= math.inf: tmp = n * (((t_0 * 100.0) + -100.0) / i) else: tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * math.pow(i, 2.0))))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(Float64(100.0 * expm1(Float64(n * log1p(Float64(i / n))))) * Float64(n / i)); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(Float64(i * -0.5) + Float64(0.08333333333333333 * (i ^ 2.0)))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(N[(100.0 * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(N[(i * -0.5), $MachinePrecision] + N[(0.08333333333333333 * N[Power[i, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\left(100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)\right) \cdot \frac{n}{i}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{t\_0 \cdot 100 + -100}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + \left(i \cdot -0.5 + 0.08333333333333333 \cdot {i}^{2}\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 29.5%
associate-/r/29.5%
sub-neg29.5%
metadata-eval29.5%
Simplified29.5%
metadata-eval29.5%
sub-neg29.5%
associate-/r/29.5%
associate-*r/29.5%
sub-neg29.5%
metadata-eval29.5%
distribute-lft-in29.5%
metadata-eval29.5%
fma-udef29.5%
associate-/r/29.5%
*-commutative29.5%
clear-num29.5%
un-div-inv29.5%
fma-udef29.5%
metadata-eval29.5%
distribute-lft-in29.5%
Applied egg-rr96.9%
associate-/r/96.1%
Simplified96.1%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.6%
associate-/r/99.6%
associate-*r*99.7%
*-commutative99.7%
associate-*r/99.9%
sub-neg99.9%
distribute-lft-in99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
fma-def99.9%
metadata-eval99.9%
Simplified99.9%
fma-udef99.9%
*-commutative99.9%
Applied egg-rr99.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-/r/1.8%
sub-neg1.8%
metadata-eval1.8%
Simplified1.8%
Taylor expanded in n around inf 1.8%
associate-/l*1.8%
expm1-def72.2%
Simplified72.2%
Taylor expanded in i around 0 100.0%
Final simplification97.0%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 0.0)
(* (expm1 (* n (log1p (/ i n)))) (/ n (* i 0.01)))
(if (<= t_1 INFINITY)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(*
100.0
(/ n (+ 1.0 (+ (* i -0.5) (* 0.08333333333333333 (pow i 2.0))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = expm1((n * log1p((i / n)))) * (n / (i * 0.01));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * pow(i, 2.0)))));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = Math.expm1((n * Math.log1p((i / n)))) * (n / (i * 0.01));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * Math.pow(i, 2.0)))));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 0.0: tmp = math.expm1((n * math.log1p((i / n)))) * (n / (i * 0.01)) elif t_1 <= math.inf: tmp = n * (((t_0 * 100.0) + -100.0) / i) else: tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * math.pow(i, 2.0))))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(n / Float64(i * 0.01))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(Float64(i * -0.5) + Float64(0.08333333333333333 * (i ^ 2.0)))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(n / N[(i * 0.01), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(N[(i * -0.5), $MachinePrecision] + N[(0.08333333333333333 * N[Power[i, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{n}{i \cdot 0.01}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{t\_0 \cdot 100 + -100}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + \left(i \cdot -0.5 + 0.08333333333333333 \cdot {i}^{2}\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 29.5%
associate-/r/29.5%
sub-neg29.5%
metadata-eval29.5%
Simplified29.5%
metadata-eval29.5%
sub-neg29.5%
associate-/r/29.5%
associate-*r/29.5%
sub-neg29.5%
metadata-eval29.5%
distribute-lft-in29.5%
metadata-eval29.5%
fma-udef29.5%
associate-/r/29.5%
*-commutative29.5%
clear-num29.5%
un-div-inv29.5%
fma-udef29.5%
metadata-eval29.5%
distribute-lft-in29.5%
Applied egg-rr96.9%
associate-/r*96.8%
associate-/r/96.1%
div-inv96.1%
metadata-eval96.1%
Applied egg-rr96.1%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.6%
associate-/r/99.6%
associate-*r*99.7%
*-commutative99.7%
associate-*r/99.9%
sub-neg99.9%
distribute-lft-in99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
fma-def99.9%
metadata-eval99.9%
Simplified99.9%
fma-udef99.9%
*-commutative99.9%
Applied egg-rr99.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-/r/1.8%
sub-neg1.8%
metadata-eval1.8%
Simplified1.8%
Taylor expanded in n around inf 1.8%
associate-/l*1.8%
expm1-def72.2%
Simplified72.2%
Taylor expanded in i around 0 100.0%
Final simplification97.0%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 0.0)
(/ n (/ i (* 100.0 (expm1 (* n (log1p (/ i n)))))))
(if (<= t_1 INFINITY)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(*
100.0
(/ n (+ 1.0 (+ (* i -0.5) (* 0.08333333333333333 (pow i 2.0))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = n / (i / (100.0 * expm1((n * log1p((i / n))))));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * pow(i, 2.0)))));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = n / (i / (100.0 * Math.expm1((n * Math.log1p((i / n))))));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * Math.pow(i, 2.0)))));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 0.0: tmp = n / (i / (100.0 * math.expm1((n * math.log1p((i / n)))))) elif t_1 <= math.inf: tmp = n * (((t_0 * 100.0) + -100.0) / i) else: tmp = 100.0 * (n / (1.0 + ((i * -0.5) + (0.08333333333333333 * math.pow(i, 2.0))))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(n / Float64(i / Float64(100.0 * expm1(Float64(n * log1p(Float64(i / n))))))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(Float64(i * -0.5) + Float64(0.08333333333333333 * (i ^ 2.0)))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(n / N[(i / N[(100.0 * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(N[(i * -0.5), $MachinePrecision] + N[(0.08333333333333333 * N[Power[i, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\frac{n}{\frac{i}{100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{t\_0 \cdot 100 + -100}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + \left(i \cdot -0.5 + 0.08333333333333333 \cdot {i}^{2}\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 29.5%
associate-/r/29.5%
sub-neg29.5%
metadata-eval29.5%
Simplified29.5%
metadata-eval29.5%
sub-neg29.5%
associate-/r/29.5%
associate-*r/29.5%
sub-neg29.5%
metadata-eval29.5%
distribute-lft-in29.5%
metadata-eval29.5%
fma-udef29.5%
associate-/r/29.5%
*-commutative29.5%
clear-num29.5%
un-div-inv29.5%
fma-udef29.5%
metadata-eval29.5%
distribute-lft-in29.5%
Applied egg-rr96.9%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.6%
associate-/r/99.6%
associate-*r*99.7%
*-commutative99.7%
associate-*r/99.9%
sub-neg99.9%
distribute-lft-in99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
fma-def99.9%
metadata-eval99.9%
Simplified99.9%
fma-udef99.9%
*-commutative99.9%
Applied egg-rr99.9%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-/r/1.8%
sub-neg1.8%
metadata-eval1.8%
Simplified1.8%
Taylor expanded in n around inf 1.8%
associate-/l*1.8%
expm1-def72.2%
Simplified72.2%
Taylor expanded in i around 0 100.0%
Final simplification97.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ n (/ i (expm1 i))))))
(if (<= n -1.2e-210)
t_0
(if (<= n 4.5e-223)
(* (/ 0.0 i) (* n 100.0))
(if (<= n 7e-41)
(/ (/ (* n 100.0) i) (- (+ (* i 0.08333333333333333) (/ 1.0 i)) 0.5))
t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (n / (i / expm1(i)));
double tmp;
if (n <= -1.2e-210) {
tmp = t_0;
} else if (n <= 4.5e-223) {
tmp = (0.0 / i) * (n * 100.0);
} else if (n <= 7e-41) {
tmp = ((n * 100.0) / i) / (((i * 0.08333333333333333) + (1.0 / i)) - 0.5);
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (n / (i / Math.expm1(i)));
double tmp;
if (n <= -1.2e-210) {
tmp = t_0;
} else if (n <= 4.5e-223) {
tmp = (0.0 / i) * (n * 100.0);
} else if (n <= 7e-41) {
tmp = ((n * 100.0) / i) / (((i * 0.08333333333333333) + (1.0 / i)) - 0.5);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n / (i / math.expm1(i))) tmp = 0 if n <= -1.2e-210: tmp = t_0 elif n <= 4.5e-223: tmp = (0.0 / i) * (n * 100.0) elif n <= 7e-41: tmp = ((n * 100.0) / i) / (((i * 0.08333333333333333) + (1.0 / i)) - 0.5) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n / Float64(i / expm1(i)))) tmp = 0.0 if (n <= -1.2e-210) tmp = t_0; elseif (n <= 4.5e-223) tmp = Float64(Float64(0.0 / i) * Float64(n * 100.0)); elseif (n <= 7e-41) tmp = Float64(Float64(Float64(n * 100.0) / i) / Float64(Float64(Float64(i * 0.08333333333333333) + Float64(1.0 / i)) - 0.5)); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.2e-210], t$95$0, If[LessEqual[n, 4.5e-223], N[(N[(0.0 / i), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7e-41], N[(N[(N[(n * 100.0), $MachinePrecision] / i), $MachinePrecision] / N[(N[(N[(i * 0.08333333333333333), $MachinePrecision] + N[(1.0 / i), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{if}\;n \leq -1.2 \cdot 10^{-210}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 4.5 \cdot 10^{-223}:\\
\;\;\;\;\frac{0}{i} \cdot \left(n \cdot 100\right)\\
\mathbf{elif}\;n \leq 7 \cdot 10^{-41}:\\
\;\;\;\;\frac{\frac{n \cdot 100}{i}}{\left(i \cdot 0.08333333333333333 + \frac{1}{i}\right) - 0.5}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.20000000000000002e-210 or 6.9999999999999999e-41 < n Initial program 27.1%
associate-/r/27.4%
sub-neg27.4%
metadata-eval27.4%
Simplified27.4%
Taylor expanded in n around inf 39.2%
associate-/l*39.2%
expm1-def87.7%
Simplified87.7%
if -1.20000000000000002e-210 < n < 4.49999999999999968e-223Initial program 69.8%
*-commutative69.8%
associate-/r/70.1%
associate-*l*70.1%
sub-neg70.1%
metadata-eval70.1%
Simplified70.1%
Taylor expanded in i around 0 85.5%
if 4.49999999999999968e-223 < n < 6.9999999999999999e-41Initial program 18.4%
associate-/r/18.7%
sub-neg18.7%
metadata-eval18.7%
Simplified18.7%
Taylor expanded in n around inf 3.4%
associate-/l*3.4%
expm1-def39.7%
Simplified39.7%
associate-*r/39.7%
*-commutative39.7%
div-inv39.6%
associate-/r*39.4%
Applied egg-rr39.4%
Taylor expanded in i around 0 64.7%
Final simplification83.7%
(FPCore (i n)
:precision binary64
(if (<= n -1.7e-209)
(* 100.0 (/ n (/ i (expm1 i))))
(if (<= n 3.8e-222)
(* (/ 0.0 i) (* n 100.0))
(if (<= n 7e-41)
(/ (/ (* n 100.0) i) (- (+ (* i 0.08333333333333333) (/ 1.0 i)) 0.5))
(* (* n 100.0) (/ (expm1 i) i))))))
double code(double i, double n) {
double tmp;
if (n <= -1.7e-209) {
tmp = 100.0 * (n / (i / expm1(i)));
} else if (n <= 3.8e-222) {
tmp = (0.0 / i) * (n * 100.0);
} else if (n <= 7e-41) {
tmp = ((n * 100.0) / i) / (((i * 0.08333333333333333) + (1.0 / i)) - 0.5);
} else {
tmp = (n * 100.0) * (expm1(i) / i);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -1.7e-209) {
tmp = 100.0 * (n / (i / Math.expm1(i)));
} else if (n <= 3.8e-222) {
tmp = (0.0 / i) * (n * 100.0);
} else if (n <= 7e-41) {
tmp = ((n * 100.0) / i) / (((i * 0.08333333333333333) + (1.0 / i)) - 0.5);
} else {
tmp = (n * 100.0) * (Math.expm1(i) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.7e-209: tmp = 100.0 * (n / (i / math.expm1(i))) elif n <= 3.8e-222: tmp = (0.0 / i) * (n * 100.0) elif n <= 7e-41: tmp = ((n * 100.0) / i) / (((i * 0.08333333333333333) + (1.0 / i)) - 0.5) else: tmp = (n * 100.0) * (math.expm1(i) / i) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.7e-209) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); elseif (n <= 3.8e-222) tmp = Float64(Float64(0.0 / i) * Float64(n * 100.0)); elseif (n <= 7e-41) tmp = Float64(Float64(Float64(n * 100.0) / i) / Float64(Float64(Float64(i * 0.08333333333333333) + Float64(1.0 / i)) - 0.5)); else tmp = Float64(Float64(n * 100.0) * Float64(expm1(i) / i)); end return tmp end
code[i_, n_] := If[LessEqual[n, -1.7e-209], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.8e-222], N[(N[(0.0 / i), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7e-41], N[(N[(N[(n * 100.0), $MachinePrecision] / i), $MachinePrecision] / N[(N[(N[(i * 0.08333333333333333), $MachinePrecision] + N[(1.0 / i), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.7 \cdot 10^{-209}:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{elif}\;n \leq 3.8 \cdot 10^{-222}:\\
\;\;\;\;\frac{0}{i} \cdot \left(n \cdot 100\right)\\
\mathbf{elif}\;n \leq 7 \cdot 10^{-41}:\\
\;\;\;\;\frac{\frac{n \cdot 100}{i}}{\left(i \cdot 0.08333333333333333 + \frac{1}{i}\right) - 0.5}\\
\mathbf{else}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\\
\end{array}
\end{array}
if n < -1.69999999999999994e-209Initial program 30.1%
associate-/r/30.4%
sub-neg30.4%
metadata-eval30.4%
Simplified30.4%
Taylor expanded in n around inf 38.6%
associate-/l*38.6%
expm1-def82.8%
Simplified82.8%
if -1.69999999999999994e-209 < n < 3.79999999999999997e-222Initial program 69.8%
*-commutative69.8%
associate-/r/70.1%
associate-*l*70.1%
sub-neg70.1%
metadata-eval70.1%
Simplified70.1%
Taylor expanded in i around 0 85.5%
if 3.79999999999999997e-222 < n < 6.9999999999999999e-41Initial program 18.4%
associate-/r/18.7%
sub-neg18.7%
metadata-eval18.7%
Simplified18.7%
Taylor expanded in n around inf 3.4%
associate-/l*3.4%
expm1-def39.7%
Simplified39.7%
associate-*r/39.7%
*-commutative39.7%
div-inv39.6%
associate-/r*39.4%
Applied egg-rr39.4%
Taylor expanded in i around 0 64.7%
if 6.9999999999999999e-41 < n Initial program 22.8%
*-commutative22.8%
associate-/r/23.1%
associate-*l*23.1%
sub-neg23.1%
metadata-eval23.1%
Simplified23.1%
Taylor expanded in n around inf 39.9%
expm1-def94.7%
Simplified94.7%
Final simplification83.7%
(FPCore (i n)
:precision binary64
(if (<= n -4.9e+178)
(* (* n 100.0) (+ 1.0 (* i 0.5)))
(if (<= n -7e-210)
(* 100.0 (/ n (+ 1.0 (* i -0.5))))
(if (<= n 2.5e-222)
(* (/ 0.0 i) (* n 100.0))
(if (<= n 7e-41)
(/ (/ (* n 100.0) i) (- (+ (* i 0.08333333333333333) (/ 1.0 i)) 0.5))
(* n (+ 100.0 (* i 50.0))))))))
double code(double i, double n) {
double tmp;
if (n <= -4.9e+178) {
tmp = (n * 100.0) * (1.0 + (i * 0.5));
} else if (n <= -7e-210) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 2.5e-222) {
tmp = (0.0 / i) * (n * 100.0);
} else if (n <= 7e-41) {
tmp = ((n * 100.0) / i) / (((i * 0.08333333333333333) + (1.0 / i)) - 0.5);
} 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 <= (-4.9d+178)) then
tmp = (n * 100.0d0) * (1.0d0 + (i * 0.5d0))
else if (n <= (-7d-210)) then
tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
else if (n <= 2.5d-222) then
tmp = (0.0d0 / i) * (n * 100.0d0)
else if (n <= 7d-41) then
tmp = ((n * 100.0d0) / i) / (((i * 0.08333333333333333d0) + (1.0d0 / i)) - 0.5d0)
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 <= -4.9e+178) {
tmp = (n * 100.0) * (1.0 + (i * 0.5));
} else if (n <= -7e-210) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 2.5e-222) {
tmp = (0.0 / i) * (n * 100.0);
} else if (n <= 7e-41) {
tmp = ((n * 100.0) / i) / (((i * 0.08333333333333333) + (1.0 / i)) - 0.5);
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -4.9e+178: tmp = (n * 100.0) * (1.0 + (i * 0.5)) elif n <= -7e-210: tmp = 100.0 * (n / (1.0 + (i * -0.5))) elif n <= 2.5e-222: tmp = (0.0 / i) * (n * 100.0) elif n <= 7e-41: tmp = ((n * 100.0) / i) / (((i * 0.08333333333333333) + (1.0 / i)) - 0.5) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -4.9e+178) tmp = Float64(Float64(n * 100.0) * Float64(1.0 + Float64(i * 0.5))); elseif (n <= -7e-210) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); elseif (n <= 2.5e-222) tmp = Float64(Float64(0.0 / i) * Float64(n * 100.0)); elseif (n <= 7e-41) tmp = Float64(Float64(Float64(n * 100.0) / i) / Float64(Float64(Float64(i * 0.08333333333333333) + Float64(1.0 / i)) - 0.5)); 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 <= -4.9e+178) tmp = (n * 100.0) * (1.0 + (i * 0.5)); elseif (n <= -7e-210) tmp = 100.0 * (n / (1.0 + (i * -0.5))); elseif (n <= 2.5e-222) tmp = (0.0 / i) * (n * 100.0); elseif (n <= 7e-41) tmp = ((n * 100.0) / i) / (((i * 0.08333333333333333) + (1.0 / i)) - 0.5); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -4.9e+178], N[(N[(n * 100.0), $MachinePrecision] * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -7e-210], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.5e-222], N[(N[(0.0 / i), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7e-41], N[(N[(N[(n * 100.0), $MachinePrecision] / i), $MachinePrecision] / N[(N[(N[(i * 0.08333333333333333), $MachinePrecision] + N[(1.0 / i), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.9 \cdot 10^{+178}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \left(1 + i \cdot 0.5\right)\\
\mathbf{elif}\;n \leq -7 \cdot 10^{-210}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 2.5 \cdot 10^{-222}:\\
\;\;\;\;\frac{0}{i} \cdot \left(n \cdot 100\right)\\
\mathbf{elif}\;n \leq 7 \cdot 10^{-41}:\\
\;\;\;\;\frac{\frac{n \cdot 100}{i}}{\left(i \cdot 0.08333333333333333 + \frac{1}{i}\right) - 0.5}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -4.9000000000000001e178Initial program 15.6%
*-commutative15.6%
associate-/r/16.2%
associate-*l*16.2%
sub-neg16.2%
metadata-eval16.2%
Simplified16.2%
Taylor expanded in i around 0 60.7%
associate-*r/60.7%
metadata-eval60.7%
Simplified60.7%
Taylor expanded in n around inf 60.7%
*-commutative60.7%
Simplified60.7%
if -4.9000000000000001e178 < n < -7.00000000000000031e-210Initial program 36.9%
associate-/r/37.0%
sub-neg37.0%
metadata-eval37.0%
Simplified37.0%
Taylor expanded in n around inf 29.2%
associate-/l*29.2%
expm1-def76.3%
Simplified76.3%
Taylor expanded in i around 0 66.6%
*-commutative66.6%
Simplified66.6%
if -7.00000000000000031e-210 < n < 2.50000000000000004e-222Initial program 69.8%
*-commutative69.8%
associate-/r/70.1%
associate-*l*70.1%
sub-neg70.1%
metadata-eval70.1%
Simplified70.1%
Taylor expanded in i around 0 85.5%
if 2.50000000000000004e-222 < n < 6.9999999999999999e-41Initial program 18.4%
associate-/r/18.7%
sub-neg18.7%
metadata-eval18.7%
Simplified18.7%
Taylor expanded in n around inf 3.4%
associate-/l*3.4%
expm1-def39.7%
Simplified39.7%
associate-*r/39.7%
*-commutative39.7%
div-inv39.6%
associate-/r*39.4%
Applied egg-rr39.4%
Taylor expanded in i around 0 64.7%
if 6.9999999999999999e-41 < n Initial program 22.8%
associate-/r/23.1%
sub-neg23.1%
metadata-eval23.1%
Simplified23.1%
Taylor expanded in n around inf 39.9%
associate-/l*39.9%
expm1-def94.7%
Simplified94.7%
associate-*r/94.7%
*-commutative94.7%
div-inv94.6%
associate-/r*78.4%
Applied egg-rr78.4%
Taylor expanded in i around 0 73.9%
associate-*r*73.9%
distribute-rgt-out73.9%
Simplified73.9%
Final simplification70.0%
(FPCore (i n)
:precision binary64
(if (<= n -4.8e+178)
(* (* n 100.0) (+ 1.0 (* i 0.5)))
(if (<= n -1.32e-210)
(* 100.0 (/ n (+ 1.0 (* i -0.5))))
(if (<= n 1.35e-152)
(* (/ 0.0 i) (* n 100.0))
(* n (+ 100.0 (* i 50.0)))))))
double code(double i, double n) {
double tmp;
if (n <= -4.8e+178) {
tmp = (n * 100.0) * (1.0 + (i * 0.5));
} else if (n <= -1.32e-210) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 1.35e-152) {
tmp = (0.0 / i) * (n * 100.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) :: tmp
if (n <= (-4.8d+178)) then
tmp = (n * 100.0d0) * (1.0d0 + (i * 0.5d0))
else if (n <= (-1.32d-210)) then
tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
else if (n <= 1.35d-152) then
tmp = (0.0d0 / i) * (n * 100.0d0)
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 <= -4.8e+178) {
tmp = (n * 100.0) * (1.0 + (i * 0.5));
} else if (n <= -1.32e-210) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else if (n <= 1.35e-152) {
tmp = (0.0 / i) * (n * 100.0);
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -4.8e+178: tmp = (n * 100.0) * (1.0 + (i * 0.5)) elif n <= -1.32e-210: tmp = 100.0 * (n / (1.0 + (i * -0.5))) elif n <= 1.35e-152: tmp = (0.0 / i) * (n * 100.0) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -4.8e+178) tmp = Float64(Float64(n * 100.0) * Float64(1.0 + Float64(i * 0.5))); elseif (n <= -1.32e-210) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); elseif (n <= 1.35e-152) tmp = Float64(Float64(0.0 / i) * Float64(n * 100.0)); 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 <= -4.8e+178) tmp = (n * 100.0) * (1.0 + (i * 0.5)); elseif (n <= -1.32e-210) tmp = 100.0 * (n / (1.0 + (i * -0.5))); elseif (n <= 1.35e-152) tmp = (0.0 / i) * (n * 100.0); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -4.8e+178], N[(N[(n * 100.0), $MachinePrecision] * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -1.32e-210], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.35e-152], N[(N[(0.0 / i), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.8 \cdot 10^{+178}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \left(1 + i \cdot 0.5\right)\\
\mathbf{elif}\;n \leq -1.32 \cdot 10^{-210}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 1.35 \cdot 10^{-152}:\\
\;\;\;\;\frac{0}{i} \cdot \left(n \cdot 100\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -4.8e178Initial program 15.6%
*-commutative15.6%
associate-/r/16.2%
associate-*l*16.2%
sub-neg16.2%
metadata-eval16.2%
Simplified16.2%
Taylor expanded in i around 0 60.7%
associate-*r/60.7%
metadata-eval60.7%
Simplified60.7%
Taylor expanded in n around inf 60.7%
*-commutative60.7%
Simplified60.7%
if -4.8e178 < n < -1.3200000000000001e-210Initial program 36.9%
associate-/r/37.0%
sub-neg37.0%
metadata-eval37.0%
Simplified37.0%
Taylor expanded in n around inf 29.2%
associate-/l*29.2%
expm1-def76.3%
Simplified76.3%
Taylor expanded in i around 0 66.6%
*-commutative66.6%
Simplified66.6%
if -1.3200000000000001e-210 < n < 1.34999999999999999e-152Initial program 59.3%
*-commutative59.3%
associate-/r/59.6%
associate-*l*59.6%
sub-neg59.6%
metadata-eval59.6%
Simplified59.6%
Taylor expanded in i around 0 77.1%
if 1.34999999999999999e-152 < n Initial program 19.7%
associate-/r/20.0%
sub-neg20.0%
metadata-eval20.0%
Simplified20.0%
Taylor expanded in n around inf 29.7%
associate-/l*29.7%
expm1-def80.2%
Simplified80.2%
associate-*r/80.2%
*-commutative80.2%
div-inv80.1%
associate-/r*68.4%
Applied egg-rr68.4%
Taylor expanded in i around 0 65.4%
associate-*r*65.4%
distribute-rgt-out65.4%
Simplified65.4%
Final simplification67.2%
(FPCore (i n) :precision binary64 (if (or (<= n -1.45e+178) (not (<= n 1e-67))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ n (+ 1.0 (* i -0.5))))))
double code(double i, double n) {
double tmp;
if ((n <= -1.45e+178) || !(n <= 1e-67)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-1.45d+178)) .or. (.not. (n <= 1d-67))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -1.45e+178) || !(n <= 1e-67)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.45e+178) or not (n <= 1e-67): tmp = n * (100.0 + (i * 50.0)) else: tmp = 100.0 * (n / (1.0 + (i * -0.5))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.45e+178) || !(n <= 1e-67)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -1.45e+178) || ~((n <= 1e-67))) tmp = n * (100.0 + (i * 50.0)); else tmp = 100.0 * (n / (1.0 + (i * -0.5))); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1.45e+178], N[Not[LessEqual[n, 1e-67]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.45 \cdot 10^{+178} \lor \neg \left(n \leq 10^{-67}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\end{array}
\end{array}
if n < -1.45e178 or 9.99999999999999943e-68 < n Initial program 19.6%
associate-/r/20.0%
sub-neg20.0%
metadata-eval20.0%
Simplified20.0%
Taylor expanded in n around inf 43.3%
associate-/l*43.3%
expm1-def92.3%
Simplified92.3%
associate-*r/92.3%
*-commutative92.3%
div-inv92.2%
associate-/r*72.2%
Applied egg-rr72.2%
Taylor expanded in i around 0 68.3%
associate-*r*68.3%
distribute-rgt-out68.3%
Simplified68.3%
if -1.45e178 < n < 9.99999999999999943e-68Initial program 40.5%
associate-/r/40.7%
sub-neg40.7%
metadata-eval40.7%
Simplified40.7%
Taylor expanded in n around inf 29.5%
associate-/l*29.5%
expm1-def60.5%
Simplified60.5%
Taylor expanded in i around 0 62.6%
*-commutative62.6%
Simplified62.6%
Final simplification65.2%
(FPCore (i n)
:precision binary64
(if (<= n -1.5e+178)
(* (* n 100.0) (+ 1.0 (* i 0.5)))
(if (<= n 2.4e-69)
(* 100.0 (/ n (+ 1.0 (* i -0.5))))
(* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -1.5e+178) {
tmp = (n * 100.0) * (1.0 + (i * 0.5));
} else if (n <= 2.4e-69) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} 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.5d+178)) then
tmp = (n * 100.0d0) * (1.0d0 + (i * 0.5d0))
else if (n <= 2.4d-69) then
tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
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.5e+178) {
tmp = (n * 100.0) * (1.0 + (i * 0.5));
} else if (n <= 2.4e-69) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.5e+178: tmp = (n * 100.0) * (1.0 + (i * 0.5)) elif n <= 2.4e-69: tmp = 100.0 * (n / (1.0 + (i * -0.5))) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.5e+178) tmp = Float64(Float64(n * 100.0) * Float64(1.0 + Float64(i * 0.5))); elseif (n <= 2.4e-69) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); 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.5e+178) tmp = (n * 100.0) * (1.0 + (i * 0.5)); elseif (n <= 2.4e-69) tmp = 100.0 * (n / (1.0 + (i * -0.5))); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.5e+178], N[(N[(n * 100.0), $MachinePrecision] * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.4e-69], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $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.5 \cdot 10^{+178}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \left(1 + i \cdot 0.5\right)\\
\mathbf{elif}\;n \leq 2.4 \cdot 10^{-69}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -1.50000000000000008e178Initial program 15.6%
*-commutative15.6%
associate-/r/16.2%
associate-*l*16.2%
sub-neg16.2%
metadata-eval16.2%
Simplified16.2%
Taylor expanded in i around 0 60.7%
associate-*r/60.7%
metadata-eval60.7%
Simplified60.7%
Taylor expanded in n around inf 60.7%
*-commutative60.7%
Simplified60.7%
if -1.50000000000000008e178 < n < 2.4000000000000001e-69Initial program 40.5%
associate-/r/40.7%
sub-neg40.7%
metadata-eval40.7%
Simplified40.7%
Taylor expanded in n around inf 29.5%
associate-/l*29.5%
expm1-def60.5%
Simplified60.5%
Taylor expanded in i around 0 62.6%
*-commutative62.6%
Simplified62.6%
if 2.4000000000000001e-69 < n Initial program 21.2%
associate-/r/21.5%
sub-neg21.5%
metadata-eval21.5%
Simplified21.5%
Taylor expanded in n around inf 36.8%
associate-/l*36.8%
expm1-def90.5%
Simplified90.5%
associate-*r/90.5%
*-commutative90.5%
div-inv90.3%
associate-/r*75.6%
Applied egg-rr75.6%
Taylor expanded in i around 0 71.5%
associate-*r*71.5%
distribute-rgt-out71.5%
Simplified71.5%
Final simplification65.2%
(FPCore (i n) :precision binary64 (if (or (<= n -4.7e+56) (not (<= n 2.5e-33))) (* n (+ 100.0 (* i 50.0))) (* i (/ n (* i 0.01)))))
double code(double i, double n) {
double tmp;
if ((n <= -4.7e+56) || !(n <= 2.5e-33)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = i * (n / (i * 0.01));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-4.7d+56)) .or. (.not. (n <= 2.5d-33))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = i * (n / (i * 0.01d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -4.7e+56) || !(n <= 2.5e-33)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = i * (n / (i * 0.01));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -4.7e+56) or not (n <= 2.5e-33): tmp = n * (100.0 + (i * 50.0)) else: tmp = i * (n / (i * 0.01)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -4.7e+56) || !(n <= 2.5e-33)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(i * Float64(n / Float64(i * 0.01))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -4.7e+56) || ~((n <= 2.5e-33))) tmp = n * (100.0 + (i * 50.0)); else tmp = i * (n / (i * 0.01)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -4.7e+56], N[Not[LessEqual[n, 2.5e-33]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(i * N[(n / N[(i * 0.01), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.7 \cdot 10^{+56} \lor \neg \left(n \leq 2.5 \cdot 10^{-33}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;i \cdot \frac{n}{i \cdot 0.01}\\
\end{array}
\end{array}
if n < -4.7e56 or 2.50000000000000014e-33 < n Initial program 23.8%
associate-/r/24.2%
sub-neg24.2%
metadata-eval24.2%
Simplified24.2%
Taylor expanded in n around inf 42.9%
associate-/l*42.9%
expm1-def92.6%
Simplified92.6%
associate-*r/92.6%
*-commutative92.6%
div-inv92.4%
associate-/r*71.3%
Applied egg-rr71.3%
Taylor expanded in i around 0 67.1%
associate-*r*67.1%
distribute-rgt-out67.1%
Simplified67.1%
if -4.7e56 < n < 2.50000000000000014e-33Initial program 39.3%
associate-/r/39.4%
sub-neg39.4%
metadata-eval39.4%
Simplified39.4%
Taylor expanded in n around inf 27.5%
associate-/l*27.5%
expm1-def54.5%
Simplified54.5%
associate-*r/54.5%
*-commutative54.5%
div-inv54.4%
associate-/r*54.2%
Applied egg-rr54.2%
Taylor expanded in i around 0 58.9%
associate-/r/59.0%
clear-num60.5%
clear-num60.5%
clear-num59.0%
associate-/l*58.9%
div-inv58.9%
metadata-eval58.9%
Applied egg-rr58.9%
Final simplification63.3%
(FPCore (i n) :precision binary64 (if (or (<= n -5.6e+50) (not (<= n 5.1e-33))) (* n (+ 100.0 (* i 50.0))) (/ i (/ i (/ n 0.01)))))
double code(double i, double n) {
double tmp;
if ((n <= -5.6e+50) || !(n <= 5.1e-33)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = i / (i / (n / 0.01));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-5.6d+50)) .or. (.not. (n <= 5.1d-33))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = i / (i / (n / 0.01d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -5.6e+50) || !(n <= 5.1e-33)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = i / (i / (n / 0.01));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -5.6e+50) or not (n <= 5.1e-33): tmp = n * (100.0 + (i * 50.0)) else: tmp = i / (i / (n / 0.01)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -5.6e+50) || !(n <= 5.1e-33)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(i / Float64(i / Float64(n / 0.01))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -5.6e+50) || ~((n <= 5.1e-33))) tmp = n * (100.0 + (i * 50.0)); else tmp = i / (i / (n / 0.01)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -5.6e+50], N[Not[LessEqual[n, 5.1e-33]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(i / N[(i / N[(n / 0.01), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -5.6 \cdot 10^{+50} \lor \neg \left(n \leq 5.1 \cdot 10^{-33}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{i}{\frac{i}{\frac{n}{0.01}}}\\
\end{array}
\end{array}
if n < -5.5999999999999996e50 or 5.10000000000000008e-33 < n Initial program 23.8%
associate-/r/24.2%
sub-neg24.2%
metadata-eval24.2%
Simplified24.2%
Taylor expanded in n around inf 42.9%
associate-/l*42.9%
expm1-def92.6%
Simplified92.6%
associate-*r/92.6%
*-commutative92.6%
div-inv92.4%
associate-/r*71.3%
Applied egg-rr71.3%
Taylor expanded in i around 0 67.1%
associate-*r*67.1%
distribute-rgt-out67.1%
Simplified67.1%
if -5.5999999999999996e50 < n < 5.10000000000000008e-33Initial program 39.3%
associate-/r/39.4%
sub-neg39.4%
metadata-eval39.4%
Simplified39.4%
Taylor expanded in n around inf 27.5%
associate-/l*27.5%
expm1-def54.5%
Simplified54.5%
associate-*r/54.5%
*-commutative54.5%
div-inv54.4%
associate-/r*54.2%
Applied egg-rr54.2%
Taylor expanded in i around 0 58.9%
associate-/r/59.0%
/-rgt-identity59.0%
*-commutative59.0%
associate-/l*58.9%
div-inv58.9%
metadata-eval58.9%
Applied egg-rr58.9%
associate-*r/25.3%
associate-/l*60.4%
associate-/l*60.6%
Simplified60.6%
Final simplification64.0%
(FPCore (i n) :precision binary64 (if (or (<= n -1.12e+55) (not (<= n 3e-35))) (* n (+ 100.0 (* i 50.0))) (/ (* i 100.0) (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -1.12e+55) || !(n <= 3e-35)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = (i * 100.0) / (i / n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-1.12d+55)) .or. (.not. (n <= 3d-35))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = (i * 100.0d0) / (i / n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -1.12e+55) || !(n <= 3e-35)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = (i * 100.0) / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.12e+55) or not (n <= 3e-35): tmp = n * (100.0 + (i * 50.0)) else: tmp = (i * 100.0) / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.12e+55) || !(n <= 3e-35)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(Float64(i * 100.0) / Float64(i / n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -1.12e+55) || ~((n <= 3e-35))) tmp = n * (100.0 + (i * 50.0)); else tmp = (i * 100.0) / (i / n); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1.12e+55], N[Not[LessEqual[n, 3e-35]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(i * 100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.12 \cdot 10^{+55} \lor \neg \left(n \leq 3 \cdot 10^{-35}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{i \cdot 100}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -1.12000000000000006e55 or 2.99999999999999989e-35 < n Initial program 23.8%
associate-/r/24.2%
sub-neg24.2%
metadata-eval24.2%
Simplified24.2%
Taylor expanded in n around inf 42.9%
associate-/l*42.9%
expm1-def92.6%
Simplified92.6%
associate-*r/92.6%
*-commutative92.6%
div-inv92.4%
associate-/r*71.3%
Applied egg-rr71.3%
Taylor expanded in i around 0 67.1%
associate-*r*67.1%
distribute-rgt-out67.1%
Simplified67.1%
if -1.12000000000000006e55 < n < 2.99999999999999989e-35Initial program 39.3%
associate-/r/39.4%
sub-neg39.4%
metadata-eval39.4%
Simplified39.4%
metadata-eval39.4%
sub-neg39.4%
associate-/r/39.3%
associate-*r/39.3%
add-exp-log39.3%
expm1-def39.3%
log-pow56.7%
log1p-udef88.8%
Applied egg-rr88.8%
Taylor expanded in i around 0 61.2%
*-commutative61.2%
Simplified61.2%
Final simplification64.3%
(FPCore (i n) :precision binary64 (* n (+ 100.0 (* i 50.0))))
double code(double i, double n) {
return n * (100.0 + (i * 50.0));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = n * (100.0d0 + (i * 50.0d0))
end function
public static double code(double i, double n) {
return n * (100.0 + (i * 50.0));
}
def code(i, n): return n * (100.0 + (i * 50.0))
function code(i, n) return Float64(n * Float64(100.0 + Float64(i * 50.0))) end
function tmp = code(i, n) tmp = n * (100.0 + (i * 50.0)); end
code[i_, n_] := N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
n \cdot \left(100 + i \cdot 50\right)
\end{array}
Initial program 31.0%
associate-/r/31.3%
sub-neg31.3%
metadata-eval31.3%
Simplified31.3%
Taylor expanded in n around inf 35.7%
associate-/l*35.7%
expm1-def74.9%
Simplified74.9%
associate-*r/74.9%
*-commutative74.9%
div-inv74.7%
associate-/r*63.4%
Applied egg-rr63.4%
Taylor expanded in i around 0 53.0%
associate-*r*53.0%
distribute-rgt-out53.0%
Simplified53.0%
Final simplification53.0%
(FPCore (i n) :precision binary64 (* i -50.0))
double code(double i, double n) {
return i * -50.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = i * (-50.0d0)
end function
public static double code(double i, double n) {
return i * -50.0;
}
def code(i, n): return i * -50.0
function code(i, n) return Float64(i * -50.0) end
function tmp = code(i, n) tmp = i * -50.0; end
code[i_, n_] := N[(i * -50.0), $MachinePrecision]
\begin{array}{l}
\\
i \cdot -50
\end{array}
Initial program 31.0%
*-commutative31.0%
associate-/r/31.3%
associate-*l*31.3%
sub-neg31.3%
metadata-eval31.3%
Simplified31.3%
Taylor expanded in i around 0 52.6%
associate-*r/52.6%
metadata-eval52.6%
Simplified52.6%
Taylor expanded in n around 0 2.9%
*-commutative2.9%
Simplified2.9%
Final simplification2.9%
(FPCore (i n) :precision binary64 (* n 100.0))
double code(double i, double n) {
return n * 100.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = n * 100.0d0
end function
public static double code(double i, double n) {
return n * 100.0;
}
def code(i, n): return n * 100.0
function code(i, n) return Float64(n * 100.0) end
function tmp = code(i, n) tmp = n * 100.0; end
code[i_, n_] := N[(n * 100.0), $MachinePrecision]
\begin{array}{l}
\\
n \cdot 100
\end{array}
Initial program 31.0%
associate-/r/31.3%
sub-neg31.3%
metadata-eval31.3%
Simplified31.3%
Taylor expanded in i around 0 46.7%
*-commutative46.7%
Simplified46.7%
Final simplification46.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ 1.0 (/ i n))))
(*
100.0
(/
(-
(exp
(*
n
(if (== t_0 1.0)
(/ i n)
(/ (* (/ i n) (log t_0)) (- (+ (/ i n) 1.0) 1.0)))))
1.0)
(/ i n)))))
double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (i / n)
if (t_0 == 1.0d0) then
tmp = i / n
else
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0d0) - 1.0d0)
end if
code = 100.0d0 * ((exp((n * tmp)) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * Math.log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((Math.exp((n * tmp)) - 1.0) / (i / n));
}
def code(i, n): t_0 = 1.0 + (i / n) tmp = 0 if t_0 == 1.0: tmp = i / n else: tmp = ((i / n) * math.log(t_0)) / (((i / n) + 1.0) - 1.0) return 100.0 * ((math.exp((n * tmp)) - 1.0) / (i / n))
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) tmp = 0.0 if (t_0 == 1.0) tmp = Float64(i / n); else tmp = Float64(Float64(Float64(i / n) * log(t_0)) / Float64(Float64(Float64(i / n) + 1.0) - 1.0)); end return Float64(100.0 * Float64(Float64(exp(Float64(n * tmp)) - 1.0) / Float64(i / n))) end
function tmp_2 = code(i, n) t_0 = 1.0 + (i / n); tmp = 0.0; if (t_0 == 1.0) tmp = i / n; else tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0); end tmp_2 = 100.0 * ((exp((n * tmp)) - 1.0) / (i / n)); end
code[i_, n_] := Block[{t$95$0 = N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision]}, N[(100.0 * N[(N[(N[Exp[N[(n * If[Equal[t$95$0, 1.0], N[(i / n), $MachinePrecision], N[(N[(N[(i / n), $MachinePrecision] * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(i / n), $MachinePrecision] + 1.0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{i}{n}\\
100 \cdot \frac{e^{n \cdot \begin{array}{l}
\mathbf{if}\;t\_0 = 1:\\
\;\;\;\;\frac{i}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{i}{n} \cdot \log t\_0}{\left(\frac{i}{n} + 1\right) - 1}\\
\end{array}} - 1}{\frac{i}{n}}
\end{array}
\end{array}
herbie shell --seed 2024101
(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))))