
(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 16 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 (- INFINITY))
(* t_1 100.0)
(if (<= t_1 1e-212)
(/ (* n 100.0) (/ i (expm1 (* n (log1p (/ i n))))))
(if (<= t_1 INFINITY)
(* 100.0 (- (* t_0 (/ n i)) (/ n i)))
(/ (* n 100.0) (+ 1.0 (* i (+ (/ 0.5 n) -0.5)))))))))
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 <= -((double) INFINITY)) {
tmp = t_1 * 100.0;
} else if (t_1 <= 1e-212) {
tmp = (n * 100.0) / (i / expm1((n * log1p((i / n)))));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * ((t_0 * (n / i)) - (n / i));
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
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 <= -Double.POSITIVE_INFINITY) {
tmp = t_1 * 100.0;
} else if (t_1 <= 1e-212) {
tmp = (n * 100.0) / (i / Math.expm1((n * Math.log1p((i / n)))));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * ((t_0 * (n / i)) - (n / i));
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
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 <= -math.inf: tmp = t_1 * 100.0 elif t_1 <= 1e-212: tmp = (n * 100.0) / (i / math.expm1((n * math.log1p((i / n))))) elif t_1 <= math.inf: tmp = 100.0 * ((t_0 * (n / i)) - (n / i)) else: tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))) 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 <= Float64(-Inf)) tmp = Float64(t_1 * 100.0); elseif (t_1 <= 1e-212) tmp = Float64(Float64(n * 100.0) / Float64(i / expm1(Float64(n * log1p(Float64(i / n)))))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(Float64(t_0 * Float64(n / i)) - Float64(n / i))); else tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5)))); 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, (-Infinity)], N[(t$95$1 * 100.0), $MachinePrecision], If[LessEqual[t$95$1, 1e-212], N[(N[(n * 100.0), $MachinePrecision] / N[(i / N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(N[(t$95$0 * N[(n / i), $MachinePrecision]), $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $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 -\infty:\\
\;\;\;\;t_1 \cdot 100\\
\mathbf{elif}\;t_1 \leq 10^{-212}:\\
\;\;\;\;\frac{n \cdot 100}{\frac{i}{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(t_0 \cdot \frac{n}{i} - \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -inf.0Initial program 100.0%
if -inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 9.99999999999999954e-213Initial program 19.4%
*-commutative19.4%
associate-/r/19.4%
sub-neg19.4%
metadata-eval19.4%
associate-*r*19.5%
*-commutative19.5%
clear-num19.5%
un-div-inv19.5%
metadata-eval19.5%
sub-neg19.5%
pow-to-exp19.5%
expm1-def33.3%
*-commutative33.3%
log1p-udef99.6%
Applied egg-rr99.6%
if 9.99999999999999954e-213 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.5%
div-sub99.5%
clear-num99.7%
sub-neg99.7%
div-inv99.7%
clear-num99.7%
Applied egg-rr99.7%
sub-neg99.7%
Simplified99.7%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
*-commutative0.0%
associate-/r/1.9%
sub-neg1.9%
metadata-eval1.9%
associate-*r*1.9%
*-commutative1.9%
clear-num1.9%
un-div-inv1.9%
metadata-eval1.9%
sub-neg1.9%
pow-to-exp1.9%
expm1-def1.9%
*-commutative1.9%
log1p-udef1.9%
Applied egg-rr1.9%
Taylor expanded in i around 0 100.0%
sub-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification99.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (+ t_0 -1.0)) (t_2 (/ t_1 (/ i n))))
(if (<= t_2 -5e-160)
(* (* n 100.0) (/ t_1 i))
(if (<= t_2 1e-212)
(* (expm1 (* n (log1p (/ i n)))) (* 100.0 (/ n i)))
(if (<= t_2 INFINITY)
(* 100.0 (- (* t_0 (/ n i)) (/ n i)))
(/ (* n 100.0) (+ 1.0 (* i (+ (/ 0.5 n) -0.5)))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = t_0 + -1.0;
double t_2 = t_1 / (i / n);
double tmp;
if (t_2 <= -5e-160) {
tmp = (n * 100.0) * (t_1 / i);
} else if (t_2 <= 1e-212) {
tmp = expm1((n * log1p((i / n)))) * (100.0 * (n / i));
} else if (t_2 <= ((double) INFINITY)) {
tmp = 100.0 * ((t_0 * (n / i)) - (n / i));
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
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;
double t_2 = t_1 / (i / n);
double tmp;
if (t_2 <= -5e-160) {
tmp = (n * 100.0) * (t_1 / i);
} else if (t_2 <= 1e-212) {
tmp = Math.expm1((n * Math.log1p((i / n)))) * (100.0 * (n / i));
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * ((t_0 * (n / i)) - (n / i));
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = t_0 + -1.0 t_2 = t_1 / (i / n) tmp = 0 if t_2 <= -5e-160: tmp = (n * 100.0) * (t_1 / i) elif t_2 <= 1e-212: tmp = math.expm1((n * math.log1p((i / n)))) * (100.0 * (n / i)) elif t_2 <= math.inf: tmp = 100.0 * ((t_0 * (n / i)) - (n / i)) else: tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(t_0 + -1.0) t_2 = Float64(t_1 / Float64(i / n)) tmp = 0.0 if (t_2 <= -5e-160) tmp = Float64(Float64(n * 100.0) * Float64(t_1 / i)); elseif (t_2 <= 1e-212) tmp = Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(100.0 * Float64(n / i))); elseif (t_2 <= Inf) tmp = Float64(100.0 * Float64(Float64(t_0 * Float64(n / i)) - Float64(n / i))); else tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5)))); 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[(t$95$0 + -1.0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-160], N[(N[(n * 100.0), $MachinePrecision] * N[(t$95$1 / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e-212], N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(100.0 * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(100.0 * N[(N[(t$95$0 * N[(n / i), $MachinePrecision]), $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := t_0 + -1\\
t_2 := \frac{t_1}{\frac{i}{n}}\\
\mathbf{if}\;t_2 \leq -5 \cdot 10^{-160}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{t_1}{i}\\
\mathbf{elif}\;t_2 \leq 10^{-212}:\\
\;\;\;\;\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \left(100 \cdot \frac{n}{i}\right)\\
\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;100 \cdot \left(t_0 \cdot \frac{n}{i} - \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -4.99999999999999994e-160Initial program 99.8%
*-commutative99.8%
associate-/r/99.6%
associate-*l*100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
if -4.99999999999999994e-160 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 9.99999999999999954e-213Initial program 16.2%
associate-*r/16.2%
sub-neg16.2%
distribute-lft-in16.2%
fma-def16.2%
metadata-eval16.2%
metadata-eval16.2%
Simplified16.2%
fma-udef16.2%
metadata-eval16.2%
distribute-lft-in16.2%
metadata-eval16.2%
sub-neg16.2%
associate-*r/16.2%
*-commutative16.2%
div-inv16.2%
clear-num16.2%
associate-*l*16.2%
pow-to-exp16.2%
expm1-def30.6%
*-commutative30.6%
log1p-udef98.9%
Applied egg-rr98.9%
if 9.99999999999999954e-213 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.5%
div-sub99.5%
clear-num99.7%
sub-neg99.7%
div-inv99.7%
clear-num99.7%
Applied egg-rr99.7%
sub-neg99.7%
Simplified99.7%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
*-commutative0.0%
associate-/r/1.9%
sub-neg1.9%
metadata-eval1.9%
associate-*r*1.9%
*-commutative1.9%
clear-num1.9%
un-div-inv1.9%
metadata-eval1.9%
sub-neg1.9%
pow-to-exp1.9%
expm1-def1.9%
*-commutative1.9%
log1p-udef1.9%
Applied egg-rr1.9%
Taylor expanded in i around 0 100.0%
sub-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification99.3%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 -2e-83)
(* t_1 100.0)
(if (<= t_1 1e-212)
(* n (* 100.0 (/ (expm1 (* n (log1p (/ i n)))) i)))
(if (<= t_1 INFINITY)
(* 100.0 (- (* t_0 (/ n i)) (/ n i)))
(/ (* n 100.0) (+ 1.0 (* i (+ (/ 0.5 n) -0.5)))))))))
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-83) {
tmp = t_1 * 100.0;
} else if (t_1 <= 1e-212) {
tmp = n * (100.0 * (expm1((n * log1p((i / n)))) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * ((t_0 * (n / i)) - (n / i));
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
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-83) {
tmp = t_1 * 100.0;
} else if (t_1 <= 1e-212) {
tmp = n * (100.0 * (Math.expm1((n * Math.log1p((i / n)))) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * ((t_0 * (n / i)) - (n / i));
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
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-83: tmp = t_1 * 100.0 elif t_1 <= 1e-212: tmp = n * (100.0 * (math.expm1((n * math.log1p((i / n)))) / i)) elif t_1 <= math.inf: tmp = 100.0 * ((t_0 * (n / i)) - (n / i)) else: tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))) 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-83) tmp = Float64(t_1 * 100.0); elseif (t_1 <= 1e-212) tmp = Float64(n * Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(Float64(t_0 * Float64(n / i)) - Float64(n / i))); else tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5)))); 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-83], N[(t$95$1 * 100.0), $MachinePrecision], If[LessEqual[t$95$1, 1e-212], N[(n * N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(N[(t$95$0 * N[(n / i), $MachinePrecision]), $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $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^{-83}:\\
\;\;\;\;t_1 \cdot 100\\
\mathbf{elif}\;t_1 \leq 10^{-212}:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(t_0 \cdot \frac{n}{i} - \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -2.0000000000000001e-83Initial program 100.0%
if -2.0000000000000001e-83 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 9.99999999999999954e-213Initial program 17.1%
associate-*r/17.1%
sub-neg17.1%
distribute-lft-in17.1%
fma-def17.1%
metadata-eval17.1%
metadata-eval17.1%
Simplified17.1%
fma-udef17.1%
metadata-eval17.1%
distribute-lft-in17.1%
metadata-eval17.1%
sub-neg17.1%
associate-*r/17.1%
*-commutative17.1%
associate-/r/17.1%
sub-neg17.1%
metadata-eval17.1%
associate-*r*17.1%
*-commutative17.1%
associate-*r*17.1%
Applied egg-rr99.5%
if 9.99999999999999954e-213 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.5%
div-sub99.5%
clear-num99.7%
sub-neg99.7%
div-inv99.7%
clear-num99.7%
Applied egg-rr99.7%
sub-neg99.7%
Simplified99.7%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
*-commutative0.0%
associate-/r/1.9%
sub-neg1.9%
metadata-eval1.9%
associate-*r*1.9%
*-commutative1.9%
clear-num1.9%
un-div-inv1.9%
metadata-eval1.9%
sub-neg1.9%
pow-to-exp1.9%
expm1-def1.9%
*-commutative1.9%
log1p-udef1.9%
Applied egg-rr1.9%
Taylor expanded in i around 0 100.0%
sub-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification99.7%
(FPCore (i n) :precision binary64 (if (or (<= i -1.45e-6) (not (<= i 6.1e+15))) (* 100.0 (/ (expm1 i) (/ i n))) (/ (* n 100.0) (+ 1.0 (* i (+ (/ 0.5 n) -0.5))))))
double code(double i, double n) {
double tmp;
if ((i <= -1.45e-6) || !(i <= 6.1e+15)) {
tmp = 100.0 * (expm1(i) / (i / n));
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((i <= -1.45e-6) || !(i <= 6.1e+15)) {
tmp = 100.0 * (Math.expm1(i) / (i / n));
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -1.45e-6) or not (i <= 6.1e+15): tmp = 100.0 * (math.expm1(i) / (i / n)) else: tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))) return tmp
function code(i, n) tmp = 0.0 if ((i <= -1.45e-6) || !(i <= 6.1e+15)) tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n))); else tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5)))); end return tmp end
code[i_, n_] := If[Or[LessEqual[i, -1.45e-6], N[Not[LessEqual[i, 6.1e+15]], $MachinePrecision]], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.45 \cdot 10^{-6} \lor \neg \left(i \leq 6.1 \cdot 10^{+15}\right):\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\end{array}
\end{array}
if i < -1.4500000000000001e-6 or 6.1e15 < i Initial program 45.6%
Taylor expanded in n around inf 57.9%
expm1-def57.9%
Simplified57.9%
if -1.4500000000000001e-6 < i < 6.1e15Initial program 9.1%
*-commutative9.1%
associate-/r/9.7%
sub-neg9.7%
metadata-eval9.7%
associate-*r*9.7%
*-commutative9.7%
clear-num9.7%
un-div-inv9.7%
metadata-eval9.7%
sub-neg9.7%
pow-to-exp9.7%
expm1-def17.8%
*-commutative17.8%
log1p-udef73.0%
Applied egg-rr73.0%
Taylor expanded in i around 0 93.5%
sub-neg93.5%
associate-*r/93.5%
metadata-eval93.5%
metadata-eval93.5%
Simplified93.5%
Final simplification78.9%
(FPCore (i n) :precision binary64 (if (or (<= n -7.5e+27) (not (<= n 1.0))) (* n (* 100.0 (/ (expm1 i) i))) (/ (* n 100.0) (+ 1.0 (* i (+ (/ 0.5 n) -0.5))))))
double code(double i, double n) {
double tmp;
if ((n <= -7.5e+27) || !(n <= 1.0)) {
tmp = n * (100.0 * (expm1(i) / i));
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -7.5e+27) || !(n <= 1.0)) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -7.5e+27) or not (n <= 1.0): tmp = n * (100.0 * (math.expm1(i) / i)) else: tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -7.5e+27) || !(n <= 1.0)) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); else tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5)))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -7.5e+27], N[Not[LessEqual[n, 1.0]], $MachinePrecision]], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -7.5 \cdot 10^{+27} \lor \neg \left(n \leq 1\right):\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\end{array}
\end{array}
if n < -7.5000000000000002e27 or 1 < n Initial program 23.5%
associate-*r/23.5%
sub-neg23.5%
distribute-lft-in23.5%
fma-def23.5%
metadata-eval23.5%
metadata-eval23.5%
Simplified23.5%
fma-udef23.5%
metadata-eval23.5%
distribute-lft-in23.5%
metadata-eval23.5%
sub-neg23.5%
associate-*r/23.5%
*-commutative23.5%
associate-/r/24.0%
sub-neg24.0%
metadata-eval24.0%
associate-*r*24.1%
*-commutative24.1%
associate-*r*24.1%
Applied egg-rr62.8%
Taylor expanded in n around inf 90.4%
if -7.5000000000000002e27 < n < 1Initial program 24.9%
*-commutative24.9%
associate-/r/25.1%
sub-neg25.1%
metadata-eval25.1%
associate-*r*25.1%
*-commutative25.1%
clear-num25.1%
un-div-inv25.1%
metadata-eval25.1%
sub-neg25.1%
pow-to-exp24.2%
expm1-def46.9%
*-commutative46.9%
log1p-udef90.7%
Applied egg-rr90.7%
Taylor expanded in i around 0 78.5%
sub-neg78.5%
associate-*r/78.5%
metadata-eval78.5%
metadata-eval78.5%
Simplified78.5%
Final simplification85.3%
(FPCore (i n)
:precision binary64
(if (<= n -7.5e+27)
(* 100.0 (/ n (/ i (expm1 i))))
(if (<= n 1.0)
(/ (* n 100.0) (+ 1.0 (* i (+ (/ 0.5 n) -0.5))))
(* n (* 100.0 (/ (expm1 i) i))))))
double code(double i, double n) {
double tmp;
if (n <= -7.5e+27) {
tmp = 100.0 * (n / (i / expm1(i)));
} else if (n <= 1.0) {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
} else {
tmp = n * (100.0 * (expm1(i) / i));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -7.5e+27) {
tmp = 100.0 * (n / (i / Math.expm1(i)));
} else if (n <= 1.0) {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
} else {
tmp = n * (100.0 * (Math.expm1(i) / i));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -7.5e+27: tmp = 100.0 * (n / (i / math.expm1(i))) elif n <= 1.0: tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))) else: tmp = n * (100.0 * (math.expm1(i) / i)) return tmp
function code(i, n) tmp = 0.0 if (n <= -7.5e+27) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); elseif (n <= 1.0) tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5)))); else tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); end return tmp end
code[i_, n_] := If[LessEqual[n, -7.5e+27], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.0], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -7.5 \cdot 10^{+27}:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{elif}\;n \leq 1:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\end{array}
\end{array}
if n < -7.5000000000000002e27Initial program 24.4%
Taylor expanded in n around inf 33.9%
*-commutative33.9%
associate-/l*33.9%
expm1-def88.3%
Simplified88.3%
if -7.5000000000000002e27 < n < 1Initial program 24.9%
*-commutative24.9%
associate-/r/25.1%
sub-neg25.1%
metadata-eval25.1%
associate-*r*25.1%
*-commutative25.1%
clear-num25.1%
un-div-inv25.1%
metadata-eval25.1%
sub-neg25.1%
pow-to-exp24.2%
expm1-def46.9%
*-commutative46.9%
log1p-udef90.7%
Applied egg-rr90.7%
Taylor expanded in i around 0 78.5%
sub-neg78.5%
associate-*r/78.5%
metadata-eval78.5%
metadata-eval78.5%
Simplified78.5%
if 1 < n Initial program 22.4%
associate-*r/22.5%
sub-neg22.5%
distribute-lft-in22.5%
fma-def22.5%
metadata-eval22.5%
metadata-eval22.5%
Simplified22.5%
fma-udef22.5%
metadata-eval22.5%
distribute-lft-in22.5%
metadata-eval22.5%
sub-neg22.5%
associate-*r/22.4%
*-commutative22.4%
associate-/r/23.1%
sub-neg23.1%
metadata-eval23.1%
associate-*r*23.1%
*-commutative23.1%
associate-*r*23.1%
Applied egg-rr63.3%
Taylor expanded in n around inf 92.8%
Final simplification85.3%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (expm1 i) i)))
(if (<= n -1e+28)
(* (* n 100.0) t_0)
(if (<= n 1.0)
(/ (* n 100.0) (+ 1.0 (* i (+ (/ 0.5 n) -0.5))))
(* n (* 100.0 t_0))))))
double code(double i, double n) {
double t_0 = expm1(i) / i;
double tmp;
if (n <= -1e+28) {
tmp = (n * 100.0) * t_0;
} else if (n <= 1.0) {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
} else {
tmp = n * (100.0 * t_0);
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.expm1(i) / i;
double tmp;
if (n <= -1e+28) {
tmp = (n * 100.0) * t_0;
} else if (n <= 1.0) {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
} else {
tmp = n * (100.0 * t_0);
}
return tmp;
}
def code(i, n): t_0 = math.expm1(i) / i tmp = 0 if n <= -1e+28: tmp = (n * 100.0) * t_0 elif n <= 1.0: tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))) else: tmp = n * (100.0 * t_0) return tmp
function code(i, n) t_0 = Float64(expm1(i) / i) tmp = 0.0 if (n <= -1e+28) tmp = Float64(Float64(n * 100.0) * t_0); elseif (n <= 1.0) tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5)))); else tmp = Float64(n * Float64(100.0 * t_0)); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]}, If[LessEqual[n, -1e+28], N[(N[(n * 100.0), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[n, 1.0], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{expm1}\left(i\right)}{i}\\
\mathbf{if}\;n \leq -1 \cdot 10^{+28}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot t_0\\
\mathbf{elif}\;n \leq 1:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 \cdot t_0\right)\\
\end{array}
\end{array}
if n < -9.99999999999999958e27Initial program 24.4%
*-commutative24.4%
associate-/r/24.9%
associate-*l*25.0%
sub-neg25.0%
metadata-eval25.0%
Simplified25.0%
Taylor expanded in n around inf 34.0%
expm1-def88.3%
Simplified88.3%
if -9.99999999999999958e27 < n < 1Initial program 24.9%
*-commutative24.9%
associate-/r/25.1%
sub-neg25.1%
metadata-eval25.1%
associate-*r*25.1%
*-commutative25.1%
clear-num25.1%
un-div-inv25.1%
metadata-eval25.1%
sub-neg25.1%
pow-to-exp24.2%
expm1-def46.9%
*-commutative46.9%
log1p-udef90.7%
Applied egg-rr90.7%
Taylor expanded in i around 0 78.5%
sub-neg78.5%
associate-*r/78.5%
metadata-eval78.5%
metadata-eval78.5%
Simplified78.5%
if 1 < n Initial program 22.4%
associate-*r/22.5%
sub-neg22.5%
distribute-lft-in22.5%
fma-def22.5%
metadata-eval22.5%
metadata-eval22.5%
Simplified22.5%
fma-udef22.5%
metadata-eval22.5%
distribute-lft-in22.5%
metadata-eval22.5%
sub-neg22.5%
associate-*r/22.4%
*-commutative22.4%
associate-/r/23.1%
sub-neg23.1%
metadata-eval23.1%
associate-*r*23.1%
*-commutative23.1%
associate-*r*23.1%
Applied egg-rr63.3%
Taylor expanded in n around inf 92.8%
Final simplification85.4%
(FPCore (i n)
:precision binary64
(if (or (<= n -9.6e+209) (not (<= n 2.0)))
(*
n
(+
100.0
(*
100.0
(+
(* i (- 0.5 (/ 0.5 n)))
(*
(* i i)
(-
(+ 0.16666666666666666 (/ 0.3333333333333333 (* n n)))
(/ 0.5 n)))))))
(/ (* n 100.0) (+ 1.0 (* i (+ (/ 0.5 n) -0.5))))))
double code(double i, double n) {
double tmp;
if ((n <= -9.6e+209) || !(n <= 2.0)) {
tmp = n * (100.0 + (100.0 * ((i * (0.5 - (0.5 / n))) + ((i * i) * ((0.16666666666666666 + (0.3333333333333333 / (n * n))) - (0.5 / n))))));
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -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 <= (-9.6d+209)) .or. (.not. (n <= 2.0d0))) then
tmp = n * (100.0d0 + (100.0d0 * ((i * (0.5d0 - (0.5d0 / n))) + ((i * i) * ((0.16666666666666666d0 + (0.3333333333333333d0 / (n * n))) - (0.5d0 / n))))))
else
tmp = (n * 100.0d0) / (1.0d0 + (i * ((0.5d0 / n) + (-0.5d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -9.6e+209) || !(n <= 2.0)) {
tmp = n * (100.0 + (100.0 * ((i * (0.5 - (0.5 / n))) + ((i * i) * ((0.16666666666666666 + (0.3333333333333333 / (n * n))) - (0.5 / n))))));
} else {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -9.6e+209) or not (n <= 2.0): tmp = n * (100.0 + (100.0 * ((i * (0.5 - (0.5 / n))) + ((i * i) * ((0.16666666666666666 + (0.3333333333333333 / (n * n))) - (0.5 / n)))))) else: tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -9.6e+209) || !(n <= 2.0)) tmp = Float64(n * Float64(100.0 + Float64(100.0 * Float64(Float64(i * Float64(0.5 - Float64(0.5 / n))) + Float64(Float64(i * i) * Float64(Float64(0.16666666666666666 + Float64(0.3333333333333333 / Float64(n * n))) - Float64(0.5 / n))))))); else tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -9.6e+209) || ~((n <= 2.0))) tmp = n * (100.0 + (100.0 * ((i * (0.5 - (0.5 / n))) + ((i * i) * ((0.16666666666666666 + (0.3333333333333333 / (n * n))) - (0.5 / n)))))); else tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -9.6e+209], N[Not[LessEqual[n, 2.0]], $MachinePrecision]], N[(n * N[(100.0 + N[(100.0 * N[(N[(i * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(i * i), $MachinePrecision] * N[(N[(0.16666666666666666 + N[(0.3333333333333333 / N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -9.6 \cdot 10^{+209} \lor \neg \left(n \leq 2\right):\\
\;\;\;\;n \cdot \left(100 + 100 \cdot \left(i \cdot \left(0.5 - \frac{0.5}{n}\right) + \left(i \cdot i\right) \cdot \left(\left(0.16666666666666666 + \frac{0.3333333333333333}{n \cdot n}\right) - \frac{0.5}{n}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\end{array}
\end{array}
if n < -9.59999999999999983e209 or 2 < n Initial program 20.5%
associate-*r/20.5%
sub-neg20.5%
distribute-lft-in20.5%
fma-def20.5%
metadata-eval20.5%
metadata-eval20.5%
Simplified20.5%
fma-udef20.5%
metadata-eval20.5%
distribute-lft-in20.5%
metadata-eval20.5%
sub-neg20.5%
associate-*r/20.5%
*-commutative20.5%
associate-/r/21.2%
sub-neg21.2%
metadata-eval21.2%
associate-*r*21.2%
*-commutative21.2%
associate-*r*21.2%
Applied egg-rr59.3%
Taylor expanded in i around 0 74.3%
distribute-lft-out74.3%
associate-*r/74.3%
metadata-eval74.3%
unpow274.3%
associate-*r/74.3%
metadata-eval74.3%
unpow274.3%
associate-*r/74.3%
metadata-eval74.3%
Simplified74.3%
if -9.59999999999999983e209 < n < 2Initial program 26.3%
*-commutative26.3%
associate-/r/26.5%
sub-neg26.5%
metadata-eval26.5%
associate-*r*26.5%
*-commutative26.5%
clear-num26.5%
un-div-inv26.5%
metadata-eval26.5%
sub-neg26.5%
pow-to-exp20.9%
expm1-def36.5%
*-commutative36.5%
log1p-udef84.1%
Applied egg-rr84.1%
Taylor expanded in i around 0 74.3%
sub-neg74.3%
associate-*r/74.3%
metadata-eval74.3%
metadata-eval74.3%
Simplified74.3%
Final simplification74.3%
(FPCore (i n) :precision binary64 (if (<= n 1.0) (/ (* n 100.0) (+ 1.0 (* i (+ (/ 0.5 n) -0.5)))) (* n (+ 100.0 (* i 50.0)))))
double code(double i, double n) {
double tmp;
if (n <= 1.0) {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -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.0d0) then
tmp = (n * 100.0d0) / (1.0d0 + (i * ((0.5d0 / n) + (-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.0) {
tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5)));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= 1.0: tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= 1.0) tmp = Float64(Float64(n * 100.0) / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -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.0) tmp = (n * 100.0) / (1.0 + (i * ((0.5 / n) + -0.5))); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, 1.0], N[(N[(n * 100.0), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -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:\\
\;\;\;\;\frac{n \cdot 100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < 1Initial program 24.7%
*-commutative24.7%
associate-/r/25.0%
sub-neg25.0%
metadata-eval25.0%
associate-*r*25.0%
*-commutative25.0%
clear-num25.0%
un-div-inv25.0%
metadata-eval25.0%
sub-neg25.0%
pow-to-exp19.7%
expm1-def33.0%
*-commutative33.0%
log1p-udef79.0%
Applied egg-rr79.0%
Taylor expanded in i around 0 71.8%
sub-neg71.8%
associate-*r/71.8%
metadata-eval71.8%
metadata-eval71.8%
Simplified71.8%
if 1 < n Initial program 22.4%
associate-/r/23.1%
associate-*r*23.1%
*-commutative23.1%
associate-*r/23.1%
sub-neg23.1%
distribute-lft-in23.1%
fma-def23.1%
metadata-eval23.1%
metadata-eval23.1%
Simplified23.1%
Taylor expanded in i around 0 72.3%
associate-*r*72.3%
*-commutative72.3%
associate-*r/72.3%
metadata-eval72.3%
Simplified72.3%
Taylor expanded in n around inf 72.3%
*-commutative72.3%
Simplified72.3%
Final simplification71.9%
(FPCore (i n) :precision binary64 (if (or (<= n -7.5e+81) (not (<= n 1.5))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (* i (/ n i)))))
double code(double i, double n) {
double tmp;
if ((n <= -7.5e+81) || !(n <= 1.5)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i * (n / i));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-7.5d+81)) .or. (.not. (n <= 1.5d0))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 100.0d0 * (i * (n / i))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -7.5e+81) || !(n <= 1.5)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i * (n / i));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -7.5e+81) or not (n <= 1.5): tmp = n * (100.0 + (i * 50.0)) else: tmp = 100.0 * (i * (n / i)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -7.5e+81) || !(n <= 1.5)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(100.0 * Float64(i * Float64(n / i))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -7.5e+81) || ~((n <= 1.5))) tmp = n * (100.0 + (i * 50.0)); else tmp = 100.0 * (i * (n / i)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -7.5e+81], N[Not[LessEqual[n, 1.5]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(i * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -7.5 \cdot 10^{+81} \lor \neg \left(n \leq 1.5\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(i \cdot \frac{n}{i}\right)\\
\end{array}
\end{array}
if n < -7.49999999999999973e81 or 1.5 < n Initial program 20.4%
associate-/r/21.0%
associate-*r*21.0%
*-commutative21.0%
associate-*r/21.0%
sub-neg21.0%
distribute-lft-in21.0%
fma-def21.0%
metadata-eval21.0%
metadata-eval21.0%
Simplified21.0%
Taylor expanded in i around 0 68.2%
associate-*r*68.2%
*-commutative68.2%
associate-*r/68.2%
metadata-eval68.2%
Simplified68.2%
Taylor expanded in n around inf 68.2%
*-commutative68.2%
Simplified68.2%
if -7.49999999999999973e81 < n < 1.5Initial program 27.9%
Taylor expanded in i around 0 61.0%
clear-num60.8%
associate-/r/60.9%
clear-num61.0%
Applied egg-rr61.0%
Final simplification64.6%
(FPCore (i n) :precision binary64 (if (<= n -2.8e+66) (/ (* 100.0 (* i n)) i) (if (<= n 1.5) (* 100.0 (* i (/ n i))) (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -2.8e+66) {
tmp = (100.0 * (i * n)) / i;
} else if (n <= 1.5) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.8d+66)) then
tmp = (100.0d0 * (i * n)) / i
else if (n <= 1.5d0) then
tmp = 100.0d0 * (i * (n / i))
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.8e+66) {
tmp = (100.0 * (i * n)) / i;
} else if (n <= 1.5) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.8e+66: tmp = (100.0 * (i * n)) / i elif n <= 1.5: tmp = 100.0 * (i * (n / i)) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.8e+66) tmp = Float64(Float64(100.0 * Float64(i * n)) / i); elseif (n <= 1.5) tmp = Float64(100.0 * Float64(i * Float64(n / i))); else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.8e+66) tmp = (100.0 * (i * n)) / i; elseif (n <= 1.5) tmp = 100.0 * (i * (n / i)); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.8e+66], N[(N[(100.0 * N[(i * n), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], If[LessEqual[n, 1.5], N[(100.0 * N[(i * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.8 \cdot 10^{+66}:\\
\;\;\;\;\frac{100 \cdot \left(i \cdot n\right)}{i}\\
\mathbf{elif}\;n \leq 1.5:\\
\;\;\;\;100 \cdot \left(i \cdot \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -2.8000000000000001e66Initial program 19.0%
Taylor expanded in i around 0 31.9%
unpow231.9%
associate-*r/31.9%
metadata-eval31.9%
Simplified31.9%
Taylor expanded in n around inf 64.3%
associate-*r/65.6%
associate-*r*65.9%
+-commutative65.9%
fma-def65.9%
unpow265.9%
Simplified65.9%
Taylor expanded in i around 0 63.7%
*-commutative63.7%
Simplified63.7%
if -2.8000000000000001e66 < n < 1.5Initial program 27.5%
Taylor expanded in i around 0 61.1%
clear-num60.9%
associate-/r/61.1%
clear-num61.1%
Applied egg-rr61.1%
if 1.5 < n Initial program 22.4%
associate-/r/23.1%
associate-*r*23.1%
*-commutative23.1%
associate-*r/23.1%
sub-neg23.1%
distribute-lft-in23.1%
fma-def23.1%
metadata-eval23.1%
metadata-eval23.1%
Simplified23.1%
Taylor expanded in i around 0 72.3%
associate-*r*72.3%
*-commutative72.3%
associate-*r/72.3%
metadata-eval72.3%
Simplified72.3%
Taylor expanded in n around inf 72.3%
*-commutative72.3%
Simplified72.3%
Final simplification64.8%
(FPCore (i n) :precision binary64 (if (<= n -2.8e+85) (/ (* i (* n 100.0)) i) (if (<= n 1.5) (* 100.0 (* i (/ n i))) (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -2.8e+85) {
tmp = (i * (n * 100.0)) / i;
} else if (n <= 1.5) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.8d+85)) then
tmp = (i * (n * 100.0d0)) / i
else if (n <= 1.5d0) then
tmp = 100.0d0 * (i * (n / i))
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.8e+85) {
tmp = (i * (n * 100.0)) / i;
} else if (n <= 1.5) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.8e+85: tmp = (i * (n * 100.0)) / i elif n <= 1.5: tmp = 100.0 * (i * (n / i)) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.8e+85) tmp = Float64(Float64(i * Float64(n * 100.0)) / i); elseif (n <= 1.5) tmp = Float64(100.0 * Float64(i * Float64(n / i))); else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.8e+85) tmp = (i * (n * 100.0)) / i; elseif (n <= 1.5) tmp = 100.0 * (i * (n / i)); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.8e+85], N[(N[(i * N[(n * 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], If[LessEqual[n, 1.5], N[(100.0 * N[(i * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.8 \cdot 10^{+85}:\\
\;\;\;\;\frac{i \cdot \left(n \cdot 100\right)}{i}\\
\mathbf{elif}\;n \leq 1.5:\\
\;\;\;\;100 \cdot \left(i \cdot \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -2.7999999999999999e85Initial program 18.2%
Taylor expanded in i around 0 31.8%
unpow231.8%
associate-*r/31.8%
metadata-eval31.8%
Simplified31.8%
Taylor expanded in n around inf 65.8%
associate-*r/67.2%
associate-*r*67.5%
+-commutative67.5%
fma-def67.5%
unpow267.5%
Simplified67.5%
Taylor expanded in i around 0 65.5%
if -2.7999999999999999e85 < n < 1.5Initial program 27.7%
Taylor expanded in i around 0 60.5%
clear-num60.4%
associate-/r/60.5%
clear-num60.6%
Applied egg-rr60.6%
if 1.5 < n Initial program 22.4%
associate-/r/23.1%
associate-*r*23.1%
*-commutative23.1%
associate-*r/23.1%
sub-neg23.1%
distribute-lft-in23.1%
fma-def23.1%
metadata-eval23.1%
metadata-eval23.1%
Simplified23.1%
Taylor expanded in i around 0 72.3%
associate-*r*72.3%
*-commutative72.3%
associate-*r/72.3%
metadata-eval72.3%
Simplified72.3%
Taylor expanded in n around inf 72.3%
*-commutative72.3%
Simplified72.3%
Final simplification64.9%
(FPCore (i n) :precision binary64 (if (<= i -2.2e+135) (* 100.0 (* i (/ n i))) (if (<= i 4.8e+25) (* n 100.0) (* 50.0 (* i n)))))
double code(double i, double n) {
double tmp;
if (i <= -2.2e+135) {
tmp = 100.0 * (i * (n / i));
} else if (i <= 4.8e+25) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-2.2d+135)) then
tmp = 100.0d0 * (i * (n / i))
else if (i <= 4.8d+25) then
tmp = n * 100.0d0
else
tmp = 50.0d0 * (i * n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -2.2e+135) {
tmp = 100.0 * (i * (n / i));
} else if (i <= 4.8e+25) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -2.2e+135: tmp = 100.0 * (i * (n / i)) elif i <= 4.8e+25: tmp = n * 100.0 else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= -2.2e+135) tmp = Float64(100.0 * Float64(i * Float64(n / i))); elseif (i <= 4.8e+25) tmp = Float64(n * 100.0); else tmp = Float64(50.0 * Float64(i * n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -2.2e+135) tmp = 100.0 * (i * (n / i)); elseif (i <= 4.8e+25) tmp = n * 100.0; else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -2.2e+135], N[(100.0 * N[(i * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 4.8e+25], N[(n * 100.0), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2.2 \cdot 10^{+135}:\\
\;\;\;\;100 \cdot \left(i \cdot \frac{n}{i}\right)\\
\mathbf{elif}\;i \leq 4.8 \cdot 10^{+25}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < -2.1999999999999999e135Initial program 69.5%
Taylor expanded in i around 0 26.4%
clear-num26.4%
associate-/r/26.4%
clear-num26.4%
Applied egg-rr26.4%
if -2.1999999999999999e135 < i < 4.79999999999999992e25Initial program 11.5%
Taylor expanded in i around 0 74.1%
*-commutative74.1%
Simplified74.1%
if 4.79999999999999992e25 < i Initial program 46.9%
*-commutative46.9%
associate-/r/47.2%
associate-*l*47.2%
sub-neg47.2%
metadata-eval47.2%
Simplified47.2%
Taylor expanded in n around inf 44.7%
expm1-def44.7%
Simplified44.7%
Taylor expanded in i around 0 33.8%
*-commutative33.8%
Simplified33.8%
Taylor expanded in i around inf 33.8%
*-commutative33.8%
Simplified33.8%
Final simplification61.2%
(FPCore (i n) :precision binary64 (if (<= i 4.8e+25) (* n 100.0) (* 50.0 (* i n))))
double code(double i, double n) {
double tmp;
if (i <= 4.8e+25) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 4.8d+25) then
tmp = n * 100.0d0
else
tmp = 50.0d0 * (i * n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 4.8e+25) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 4.8e+25: tmp = n * 100.0 else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= 4.8e+25) tmp = Float64(n * 100.0); else tmp = Float64(50.0 * Float64(i * n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 4.8e+25) tmp = n * 100.0; else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 4.8e+25], N[(n * 100.0), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 4.8 \cdot 10^{+25}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < 4.79999999999999992e25Initial program 17.6%
Taylor expanded in i around 0 66.7%
*-commutative66.7%
Simplified66.7%
if 4.79999999999999992e25 < i Initial program 46.9%
*-commutative46.9%
associate-/r/47.2%
associate-*l*47.2%
sub-neg47.2%
metadata-eval47.2%
Simplified47.2%
Taylor expanded in n around inf 44.7%
expm1-def44.7%
Simplified44.7%
Taylor expanded in i around 0 33.8%
*-commutative33.8%
Simplified33.8%
Taylor expanded in i around inf 33.8%
*-commutative33.8%
Simplified33.8%
Final simplification59.4%
(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 24.1%
associate-/r/24.5%
associate-*r*24.5%
*-commutative24.5%
associate-*r/24.5%
sub-neg24.5%
distribute-lft-in24.5%
fma-def24.5%
metadata-eval24.5%
metadata-eval24.5%
Simplified24.5%
Taylor expanded in i around 0 59.0%
associate-*r*59.0%
*-commutative59.0%
associate-*r/59.0%
metadata-eval59.0%
Simplified59.0%
Taylor expanded in n around 0 2.7%
*-commutative2.7%
Simplified2.7%
Final simplification2.7%
(FPCore (i n) :precision binary64 (* n 100.0))
double code(double i, double n) {
return n * 100.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = n * 100.0d0
end function
public static double code(double i, double n) {
return n * 100.0;
}
def code(i, n): return n * 100.0
function code(i, n) return Float64(n * 100.0) end
function tmp = code(i, n) tmp = n * 100.0; end
code[i_, n_] := N[(n * 100.0), $MachinePrecision]
\begin{array}{l}
\\
n \cdot 100
\end{array}
Initial program 24.1%
Taylor expanded in i around 0 53.0%
*-commutative53.0%
Simplified53.0%
Final simplification53.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 2023297
(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))))