
(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 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 -5e-246)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(if (<= t_1 0.0)
(/ (* 100.0 (expm1 (* n (log1p (/ i n))))) (/ i n))
(if (<= t_1 INFINITY)
(* (+ (/ t_0 i) (/ -1.0 i)) (* n 100.0))
(* n 100.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 <= -5e-246) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else if (t_1 <= 0.0) {
tmp = (100.0 * expm1((n * log1p((i / n))))) / (i / n);
} else if (t_1 <= ((double) INFINITY)) {
tmp = ((t_0 / i) + (-1.0 / i)) * (n * 100.0);
} else {
tmp = n * 100.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 <= -5e-246) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else 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 = ((t_0 / i) + (-1.0 / i)) * (n * 100.0);
} else {
tmp = n * 100.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 <= -5e-246: tmp = n * (((t_0 * 100.0) + -100.0) / i) elif t_1 <= 0.0: tmp = (100.0 * math.expm1((n * math.log1p((i / n))))) / (i / n) elif t_1 <= math.inf: tmp = ((t_0 / i) + (-1.0 / i)) * (n * 100.0) else: tmp = n * 100.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 <= -5e-246) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); elseif (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(Float64(Float64(t_0 / i) + Float64(-1.0 / i)) * Float64(n * 100.0)); else tmp = Float64(n * 100.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, -5e-246], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(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[(t$95$0 / i), $MachinePrecision] + N[(-1.0 / i), $MachinePrecision]), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{-246}:\\
\;\;\;\;n \cdot \frac{t_0 \cdot 100 + -100}{i}\\
\mathbf{elif}\;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:\\
\;\;\;\;\left(\frac{t_0}{i} + \frac{-1}{i}\right) \cdot \left(n \cdot 100\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -4.9999999999999997e-246Initial program 99.5%
associate-/r/99.5%
associate-*r*99.9%
*-commutative99.9%
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 -4.9999999999999997e-246 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 16.2%
associate-/r/15.9%
sub-neg15.9%
metadata-eval15.9%
Simplified15.9%
metadata-eval15.9%
sub-neg15.9%
associate-/r/16.2%
associate-*r/16.2%
add-exp-log16.2%
expm1-def16.2%
log-pow30.0%
log1p-udef99.7%
Applied egg-rr99.7%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 98.3%
*-commutative98.3%
associate-/r/98.3%
associate-*l*98.4%
sub-neg98.4%
metadata-eval98.4%
Simplified98.4%
metadata-eval98.4%
sub-neg98.4%
div-sub98.6%
Applied egg-rr98.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.9%
sub-neg1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in i around 0 83.4%
*-commutative83.4%
Simplified83.4%
Final simplification96.3%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 -5e-229)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(if (<= t_1 0.0)
(* 100.0 (* (expm1 (* n (log1p (/ i n)))) (/ n i)))
(if (<= t_1 INFINITY)
(* (+ (/ t_0 i) (/ -1.0 i)) (* n 100.0))
(* n 100.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 <= -5e-229) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) * (n / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = ((t_0 / i) + (-1.0 / i)) * (n * 100.0);
} else {
tmp = n * 100.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 <= -5e-229) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else 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 = ((t_0 / i) + (-1.0 / i)) * (n * 100.0);
} else {
tmp = n * 100.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 <= -5e-229: tmp = n * (((t_0 * 100.0) + -100.0) / i) elif t_1 <= 0.0: tmp = 100.0 * (math.expm1((n * math.log1p((i / n)))) * (n / i)) elif t_1 <= math.inf: tmp = ((t_0 / i) + (-1.0 / i)) * (n * 100.0) else: tmp = n * 100.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 <= -5e-229) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); elseif (t_1 <= 0.0) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(n / i))); elseif (t_1 <= Inf) tmp = Float64(Float64(Float64(t_0 / i) + Float64(-1.0 / i)) * Float64(n * 100.0)); else tmp = Float64(n * 100.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, -5e-229], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[(t$95$0 / i), $MachinePrecision] + N[(-1.0 / i), $MachinePrecision]), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{-229}:\\
\;\;\;\;n \cdot \frac{t_0 \cdot 100 + -100}{i}\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;100 \cdot \left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{n}{i}\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\left(\frac{t_0}{i} + \frac{-1}{i}\right) \cdot \left(n \cdot 100\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -5.00000000000000016e-229Initial program 99.5%
associate-/r/99.6%
associate-*r*99.9%
*-commutative99.9%
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 -5.00000000000000016e-229 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 16.7%
clear-num16.7%
associate-/r/16.6%
clear-num16.4%
add-exp-log16.4%
expm1-def16.4%
log-pow30.2%
log1p-udef97.8%
Applied egg-rr97.8%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 98.3%
*-commutative98.3%
associate-/r/98.3%
associate-*l*98.4%
sub-neg98.4%
metadata-eval98.4%
Simplified98.4%
metadata-eval98.4%
sub-neg98.4%
div-sub98.6%
Applied egg-rr98.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.9%
sub-neg1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in i around 0 83.4%
*-commutative83.4%
Simplified83.4%
Final simplification95.1%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 -5e-246)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(if (<= t_1 0.0)
(* 100.0 (* n (/ (expm1 (* n (log1p (/ i n)))) i)))
(if (<= t_1 INFINITY)
(* (+ (/ t_0 i) (/ -1.0 i)) (* n 100.0))
(* n 100.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 <= -5e-246) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (expm1((n * log1p((i / n)))) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = ((t_0 / i) + (-1.0 / i)) * (n * 100.0);
} else {
tmp = n * 100.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 <= -5e-246) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1((n * Math.log1p((i / n)))) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = ((t_0 / i) + (-1.0 / i)) * (n * 100.0);
} else {
tmp = n * 100.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 <= -5e-246: tmp = n * (((t_0 * 100.0) + -100.0) / i) elif t_1 <= 0.0: tmp = 100.0 * (n * (math.expm1((n * math.log1p((i / n)))) / i)) elif t_1 <= math.inf: tmp = ((t_0 / i) + (-1.0 / i)) * (n * 100.0) else: tmp = n * 100.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 <= -5e-246) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); elseif (t_1 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i))); elseif (t_1 <= Inf) tmp = Float64(Float64(Float64(t_0 / i) + Float64(-1.0 / i)) * Float64(n * 100.0)); else tmp = Float64(n * 100.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, -5e-246], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(n * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[(t$95$0 / i), $MachinePrecision] + N[(-1.0 / i), $MachinePrecision]), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{-246}:\\
\;\;\;\;n \cdot \frac{t_0 \cdot 100 + -100}{i}\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\left(\frac{t_0}{i} + \frac{-1}{i}\right) \cdot \left(n \cdot 100\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -4.9999999999999997e-246Initial program 99.5%
associate-/r/99.5%
associate-*r*99.9%
*-commutative99.9%
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 -4.9999999999999997e-246 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0Initial program 16.2%
associate-/r/15.9%
sub-neg15.9%
metadata-eval15.9%
Simplified15.9%
*-un-lft-identity15.9%
metadata-eval15.9%
sub-neg15.9%
add-exp-log15.9%
expm1-def15.9%
log-pow29.8%
log1p-udef98.9%
Applied egg-rr98.9%
*-lft-identity98.9%
Simplified98.9%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 98.3%
*-commutative98.3%
associate-/r/98.3%
associate-*l*98.4%
sub-neg98.4%
metadata-eval98.4%
Simplified98.4%
metadata-eval98.4%
sub-neg98.4%
div-sub98.6%
Applied egg-rr98.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.9%
sub-neg1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in i around 0 83.4%
*-commutative83.4%
Simplified83.4%
Final simplification95.8%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (* n (/ (expm1 i) i)))))
(if (<= n -7.2e-224)
t_0
(if (<= n 2.5e-242)
(* (* n 100.0) (/ 0.0 i))
(if (<= n 1.32e-17) (* 100.0 (/ i (/ i n))) t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (n * (expm1(i) / i));
double tmp;
if (n <= -7.2e-224) {
tmp = t_0;
} else if (n <= 2.5e-242) {
tmp = (n * 100.0) * (0.0 / i);
} else if (n <= 1.32e-17) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (n * (Math.expm1(i) / i));
double tmp;
if (n <= -7.2e-224) {
tmp = t_0;
} else if (n <= 2.5e-242) {
tmp = (n * 100.0) * (0.0 / i);
} else if (n <= 1.32e-17) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n * (math.expm1(i) / i)) tmp = 0 if n <= -7.2e-224: tmp = t_0 elif n <= 2.5e-242: tmp = (n * 100.0) * (0.0 / i) elif n <= 1.32e-17: tmp = 100.0 * (i / (i / n)) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n * Float64(expm1(i) / i))) tmp = 0.0 if (n <= -7.2e-224) tmp = t_0; elseif (n <= 2.5e-242) tmp = Float64(Float64(n * 100.0) * Float64(0.0 / i)); elseif (n <= 1.32e-17) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -7.2e-224], t$95$0, If[LessEqual[n, 2.5e-242], N[(N[(n * 100.0), $MachinePrecision] * N[(0.0 / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.32e-17], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{if}\;n \leq -7.2 \cdot 10^{-224}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 2.5 \cdot 10^{-242}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{0}{i}\\
\mathbf{elif}\;n \leq 1.32 \cdot 10^{-17}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if n < -7.1999999999999999e-224 or 1.3200000000000001e-17 < n Initial program 24.1%
associate-/r/24.5%
sub-neg24.5%
metadata-eval24.5%
Simplified24.5%
Taylor expanded in n around inf 35.3%
expm1-def86.9%
Simplified86.8%
if -7.1999999999999999e-224 < n < 2.4999999999999999e-242Initial program 81.8%
*-commutative81.8%
associate-/r/79.7%
associate-*l*79.7%
sub-neg79.7%
metadata-eval79.7%
Simplified79.7%
Taylor expanded in i around 0 94.3%
if 2.4999999999999999e-242 < n < 1.3200000000000001e-17Initial program 9.3%
Taylor expanded in i around 0 22.9%
+-commutative22.9%
Simplified22.9%
Taylor expanded in i around 0 63.0%
Final simplification83.8%
(FPCore (i n)
:precision binary64
(if (<= n -2.6e-222)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= n 2.3e-241)
(* (* n 100.0) (/ 0.0 i))
(if (<= n 1.32e-17)
(* 100.0 (/ i (/ i n)))
(* 100.0 (/ n (/ i (expm1 i))))))))
double code(double i, double n) {
double tmp;
if (n <= -2.6e-222) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (n <= 2.3e-241) {
tmp = (n * 100.0) * (0.0 / i);
} else if (n <= 1.32e-17) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = 100.0 * (n / (i / expm1(i)));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -2.6e-222) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (n <= 2.3e-241) {
tmp = (n * 100.0) * (0.0 / i);
} else if (n <= 1.32e-17) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = 100.0 * (n / (i / Math.expm1(i)));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.6e-222: tmp = 100.0 * (n * (math.expm1(i) / i)) elif n <= 2.3e-241: tmp = (n * 100.0) * (0.0 / i) elif n <= 1.32e-17: tmp = 100.0 * (i / (i / n)) else: tmp = 100.0 * (n / (i / math.expm1(i))) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.6e-222) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (n <= 2.3e-241) tmp = Float64(Float64(n * 100.0) * Float64(0.0 / i)); elseif (n <= 1.32e-17) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); end return tmp end
code[i_, n_] := If[LessEqual[n, -2.6e-222], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.3e-241], N[(N[(n * 100.0), $MachinePrecision] * N[(0.0 / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.32e-17], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.6 \cdot 10^{-222}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;n \leq 2.3 \cdot 10^{-241}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{0}{i}\\
\mathbf{elif}\;n \leq 1.32 \cdot 10^{-17}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\end{array}
\end{array}
if n < -2.5999999999999998e-222Initial program 29.0%
associate-/r/29.3%
sub-neg29.3%
metadata-eval29.3%
Simplified29.3%
Taylor expanded in n around inf 32.1%
expm1-def80.1%
Simplified80.1%
if -2.5999999999999998e-222 < n < 2.2999999999999999e-241Initial program 81.8%
*-commutative81.8%
associate-/r/79.7%
associate-*l*79.7%
sub-neg79.7%
metadata-eval79.7%
Simplified79.7%
Taylor expanded in i around 0 94.3%
if 2.2999999999999999e-241 < n < 1.3200000000000001e-17Initial program 9.3%
Taylor expanded in i around 0 22.9%
+-commutative22.9%
Simplified22.9%
Taylor expanded in i around 0 63.0%
if 1.3200000000000001e-17 < n Initial program 18.2%
associate-/r/18.7%
sub-neg18.7%
metadata-eval18.7%
Simplified18.7%
Taylor expanded in n around inf 39.0%
associate-/l*39.0%
expm1-def94.9%
Simplified94.9%
Final simplification83.9%
(FPCore (i n)
:precision binary64
(if (<= n -7.8e-227)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= n 6.9e-242)
(* (* n 100.0) (/ 0.0 i))
(if (<= n 1.32e-17)
(* 100.0 (/ i (/ i n)))
(* n (* (expm1 i) (/ 100.0 i)))))))
double code(double i, double n) {
double tmp;
if (n <= -7.8e-227) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (n <= 6.9e-242) {
tmp = (n * 100.0) * (0.0 / i);
} else if (n <= 1.32e-17) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (expm1(i) * (100.0 / i));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -7.8e-227) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (n <= 6.9e-242) {
tmp = (n * 100.0) * (0.0 / i);
} else if (n <= 1.32e-17) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (Math.expm1(i) * (100.0 / i));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -7.8e-227: tmp = 100.0 * (n * (math.expm1(i) / i)) elif n <= 6.9e-242: tmp = (n * 100.0) * (0.0 / i) elif n <= 1.32e-17: tmp = 100.0 * (i / (i / n)) else: tmp = n * (math.expm1(i) * (100.0 / i)) return tmp
function code(i, n) tmp = 0.0 if (n <= -7.8e-227) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (n <= 6.9e-242) tmp = Float64(Float64(n * 100.0) * Float64(0.0 / i)); elseif (n <= 1.32e-17) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(n * Float64(expm1(i) * Float64(100.0 / i))); end return tmp end
code[i_, n_] := If[LessEqual[n, -7.8e-227], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 6.9e-242], N[(N[(n * 100.0), $MachinePrecision] * N[(0.0 / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.32e-17], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] * N[(100.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -7.8 \cdot 10^{-227}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;n \leq 6.9 \cdot 10^{-242}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{0}{i}\\
\mathbf{elif}\;n \leq 1.32 \cdot 10^{-17}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(\mathsf{expm1}\left(i\right) \cdot \frac{100}{i}\right)\\
\end{array}
\end{array}
if n < -7.7999999999999999e-227Initial program 29.0%
associate-/r/29.3%
sub-neg29.3%
metadata-eval29.3%
Simplified29.3%
Taylor expanded in n around inf 32.1%
expm1-def80.1%
Simplified80.1%
if -7.7999999999999999e-227 < n < 6.89999999999999996e-242Initial program 81.8%
*-commutative81.8%
associate-/r/79.7%
associate-*l*79.7%
sub-neg79.7%
metadata-eval79.7%
Simplified79.7%
Taylor expanded in i around 0 94.3%
if 6.89999999999999996e-242 < n < 1.3200000000000001e-17Initial program 9.3%
Taylor expanded in i around 0 22.9%
+-commutative22.9%
Simplified22.9%
Taylor expanded in i around 0 63.0%
if 1.3200000000000001e-17 < n Initial program 18.2%
associate-/r/18.7%
associate-*r*18.7%
*-commutative18.7%
associate-*r/18.7%
sub-neg18.7%
distribute-lft-in18.8%
metadata-eval18.8%
metadata-eval18.8%
metadata-eval18.8%
fma-def18.7%
metadata-eval18.7%
Simplified18.7%
expm1-log1p-u14.4%
expm1-udef14.4%
Applied egg-rr60.3%
expm1-def69.7%
expm1-log1p70.3%
associate-*r/70.3%
*-lft-identity70.3%
associate-*l/70.2%
associate-*r*70.2%
*-commutative70.2%
associate-*r/70.3%
metadata-eval70.3%
Simplified70.3%
Taylor expanded in n around inf 94.9%
Final simplification83.9%
(FPCore (i n)
:precision binary64
(if (<= n -1.6e-227)
(* (* n 100.0) (/ (expm1 i) i))
(if (<= n 1.5e-240)
(* (* n 100.0) (/ 0.0 i))
(if (<= n 1.32e-17)
(* 100.0 (/ i (/ i n)))
(* n (* (expm1 i) (/ 100.0 i)))))))
double code(double i, double n) {
double tmp;
if (n <= -1.6e-227) {
tmp = (n * 100.0) * (expm1(i) / i);
} else if (n <= 1.5e-240) {
tmp = (n * 100.0) * (0.0 / i);
} else if (n <= 1.32e-17) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (expm1(i) * (100.0 / i));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -1.6e-227) {
tmp = (n * 100.0) * (Math.expm1(i) / i);
} else if (n <= 1.5e-240) {
tmp = (n * 100.0) * (0.0 / i);
} else if (n <= 1.32e-17) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (Math.expm1(i) * (100.0 / i));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.6e-227: tmp = (n * 100.0) * (math.expm1(i) / i) elif n <= 1.5e-240: tmp = (n * 100.0) * (0.0 / i) elif n <= 1.32e-17: tmp = 100.0 * (i / (i / n)) else: tmp = n * (math.expm1(i) * (100.0 / i)) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.6e-227) tmp = Float64(Float64(n * 100.0) * Float64(expm1(i) / i)); elseif (n <= 1.5e-240) tmp = Float64(Float64(n * 100.0) * Float64(0.0 / i)); elseif (n <= 1.32e-17) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(n * Float64(expm1(i) * Float64(100.0 / i))); end return tmp end
code[i_, n_] := If[LessEqual[n, -1.6e-227], N[(N[(n * 100.0), $MachinePrecision] * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.5e-240], N[(N[(n * 100.0), $MachinePrecision] * N[(0.0 / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.32e-17], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] * N[(100.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.6 \cdot 10^{-227}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\\
\mathbf{elif}\;n \leq 1.5 \cdot 10^{-240}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{0}{i}\\
\mathbf{elif}\;n \leq 1.32 \cdot 10^{-17}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(\mathsf{expm1}\left(i\right) \cdot \frac{100}{i}\right)\\
\end{array}
\end{array}
if n < -1.60000000000000005e-227Initial program 29.0%
*-commutative29.0%
associate-/r/29.3%
associate-*l*29.4%
sub-neg29.4%
metadata-eval29.4%
Simplified29.4%
Taylor expanded in n around inf 32.1%
expm1-def80.1%
Simplified80.1%
if -1.60000000000000005e-227 < n < 1.49999999999999995e-240Initial program 81.8%
*-commutative81.8%
associate-/r/79.7%
associate-*l*79.7%
sub-neg79.7%
metadata-eval79.7%
Simplified79.7%
Taylor expanded in i around 0 94.3%
if 1.49999999999999995e-240 < n < 1.3200000000000001e-17Initial program 9.3%
Taylor expanded in i around 0 22.9%
+-commutative22.9%
Simplified22.9%
Taylor expanded in i around 0 63.0%
if 1.3200000000000001e-17 < n Initial program 18.2%
associate-/r/18.7%
associate-*r*18.7%
*-commutative18.7%
associate-*r/18.7%
sub-neg18.7%
distribute-lft-in18.8%
metadata-eval18.8%
metadata-eval18.8%
metadata-eval18.8%
fma-def18.7%
metadata-eval18.7%
Simplified18.7%
expm1-log1p-u14.4%
expm1-udef14.4%
Applied egg-rr60.3%
expm1-def69.7%
expm1-log1p70.3%
associate-*r/70.3%
*-lft-identity70.3%
associate-*l/70.2%
associate-*r*70.2%
*-commutative70.2%
associate-*r/70.3%
metadata-eval70.3%
Simplified70.3%
Taylor expanded in n around inf 94.9%
Final simplification83.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ i (/ i n)))))
(if (<= n -7e-32)
(* 100.0 (/ (* i n) i))
(if (<= n -1.02e-226)
t_0
(if (<= n 1.05e-241)
(* (* n 100.0) (/ 0.0 i))
(if (<= n 4.8e-18)
t_0
(* 100.0 (* n (+ 1.0 (* i (- 0.5 (/ 0.5 n))))))))))))
double code(double i, double n) {
double t_0 = 100.0 * (i / (i / n));
double tmp;
if (n <= -7e-32) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= -1.02e-226) {
tmp = t_0;
} else if (n <= 1.05e-241) {
tmp = (n * 100.0) * (0.0 / i);
} else if (n <= 4.8e-18) {
tmp = t_0;
} else {
tmp = 100.0 * (n * (1.0 + (i * (0.5 - (0.5 / n)))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 100.0d0 * (i / (i / n))
if (n <= (-7d-32)) then
tmp = 100.0d0 * ((i * n) / i)
else if (n <= (-1.02d-226)) then
tmp = t_0
else if (n <= 1.05d-241) then
tmp = (n * 100.0d0) * (0.0d0 / i)
else if (n <= 4.8d-18) then
tmp = t_0
else
tmp = 100.0d0 * (n * (1.0d0 + (i * (0.5d0 - (0.5d0 / n)))))
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = 100.0 * (i / (i / n));
double tmp;
if (n <= -7e-32) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= -1.02e-226) {
tmp = t_0;
} else if (n <= 1.05e-241) {
tmp = (n * 100.0) * (0.0 / i);
} else if (n <= 4.8e-18) {
tmp = t_0;
} else {
tmp = 100.0 * (n * (1.0 + (i * (0.5 - (0.5 / n)))));
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (i / (i / n)) tmp = 0 if n <= -7e-32: tmp = 100.0 * ((i * n) / i) elif n <= -1.02e-226: tmp = t_0 elif n <= 1.05e-241: tmp = (n * 100.0) * (0.0 / i) elif n <= 4.8e-18: tmp = t_0 else: tmp = 100.0 * (n * (1.0 + (i * (0.5 - (0.5 / n))))) return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(i / Float64(i / n))) tmp = 0.0 if (n <= -7e-32) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); elseif (n <= -1.02e-226) tmp = t_0; elseif (n <= 1.05e-241) tmp = Float64(Float64(n * 100.0) * Float64(0.0 / i)); elseif (n <= 4.8e-18) tmp = t_0; else tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * Float64(0.5 - Float64(0.5 / n)))))); end return tmp end
function tmp_2 = code(i, n) t_0 = 100.0 * (i / (i / n)); tmp = 0.0; if (n <= -7e-32) tmp = 100.0 * ((i * n) / i); elseif (n <= -1.02e-226) tmp = t_0; elseif (n <= 1.05e-241) tmp = (n * 100.0) * (0.0 / i); elseif (n <= 4.8e-18) tmp = t_0; else tmp = 100.0 * (n * (1.0 + (i * (0.5 - (0.5 / n))))); end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -7e-32], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -1.02e-226], t$95$0, If[LessEqual[n, 1.05e-241], N[(N[(n * 100.0), $MachinePrecision] * N[(0.0 / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.8e-18], t$95$0, N[(100.0 * N[(n * N[(1.0 + N[(i * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{if}\;n \leq -7 \cdot 10^{-32}:\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{elif}\;n \leq -1.02 \cdot 10^{-226}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 1.05 \cdot 10^{-241}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{0}{i}\\
\mathbf{elif}\;n \leq 4.8 \cdot 10^{-18}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)\\
\end{array}
\end{array}
if n < -6.9999999999999997e-32Initial program 30.4%
associate-/r/30.9%
sub-neg30.9%
metadata-eval30.9%
Simplified30.9%
Taylor expanded in i around 0 56.3%
associate-*r/56.3%
metadata-eval56.3%
Simplified56.3%
Taylor expanded in n around inf 55.9%
Taylor expanded in i around 0 56.5%
if -6.9999999999999997e-32 < n < -1.01999999999999998e-226 or 1.05e-241 < n < 4.79999999999999988e-18Initial program 16.8%
Taylor expanded in i around 0 21.3%
+-commutative21.3%
Simplified21.3%
Taylor expanded in i around 0 66.1%
if -1.01999999999999998e-226 < n < 1.05e-241Initial program 81.8%
*-commutative81.8%
associate-/r/79.7%
associate-*l*79.7%
sub-neg79.7%
metadata-eval79.7%
Simplified79.7%
Taylor expanded in i around 0 94.3%
if 4.79999999999999988e-18 < n Initial program 18.2%
associate-/r/18.7%
sub-neg18.7%
metadata-eval18.7%
Simplified18.7%
Taylor expanded in i around 0 78.7%
associate-*r/78.7%
metadata-eval78.7%
Simplified78.7%
Final simplification69.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ i (/ i n)))))
(if (<= n -7.8e-32)
(* 100.0 (/ (* i n) i))
(if (<= n -1.8e-223)
t_0
(if (<= n 2.1e-242)
(* (* n 100.0) (/ 0.0 i))
(if (<= n 1.32e-17) t_0 (* n (+ 100.0 (* i 50.0)))))))))
double code(double i, double n) {
double t_0 = 100.0 * (i / (i / n));
double tmp;
if (n <= -7.8e-32) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= -1.8e-223) {
tmp = t_0;
} else if (n <= 2.1e-242) {
tmp = (n * 100.0) * (0.0 / i);
} else if (n <= 1.32e-17) {
tmp = t_0;
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 100.0d0 * (i / (i / n))
if (n <= (-7.8d-32)) then
tmp = 100.0d0 * ((i * n) / i)
else if (n <= (-1.8d-223)) then
tmp = t_0
else if (n <= 2.1d-242) then
tmp = (n * 100.0d0) * (0.0d0 / i)
else if (n <= 1.32d-17) then
tmp = t_0
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = 100.0 * (i / (i / n));
double tmp;
if (n <= -7.8e-32) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= -1.8e-223) {
tmp = t_0;
} else if (n <= 2.1e-242) {
tmp = (n * 100.0) * (0.0 / i);
} else if (n <= 1.32e-17) {
tmp = t_0;
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (i / (i / n)) tmp = 0 if n <= -7.8e-32: tmp = 100.0 * ((i * n) / i) elif n <= -1.8e-223: tmp = t_0 elif n <= 2.1e-242: tmp = (n * 100.0) * (0.0 / i) elif n <= 1.32e-17: tmp = t_0 else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(i / Float64(i / n))) tmp = 0.0 if (n <= -7.8e-32) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); elseif (n <= -1.8e-223) tmp = t_0; elseif (n <= 2.1e-242) tmp = Float64(Float64(n * 100.0) * Float64(0.0 / i)); elseif (n <= 1.32e-17) tmp = t_0; else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) t_0 = 100.0 * (i / (i / n)); tmp = 0.0; if (n <= -7.8e-32) tmp = 100.0 * ((i * n) / i); elseif (n <= -1.8e-223) tmp = t_0; elseif (n <= 2.1e-242) tmp = (n * 100.0) * (0.0 / i); elseif (n <= 1.32e-17) tmp = t_0; else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -7.8e-32], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -1.8e-223], t$95$0, If[LessEqual[n, 2.1e-242], N[(N[(n * 100.0), $MachinePrecision] * N[(0.0 / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.32e-17], t$95$0, N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{if}\;n \leq -7.8 \cdot 10^{-32}:\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{elif}\;n \leq -1.8 \cdot 10^{-223}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 2.1 \cdot 10^{-242}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{0}{i}\\
\mathbf{elif}\;n \leq 1.32 \cdot 10^{-17}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -7.8000000000000003e-32Initial program 30.4%
associate-/r/30.9%
sub-neg30.9%
metadata-eval30.9%
Simplified30.9%
Taylor expanded in i around 0 56.3%
associate-*r/56.3%
metadata-eval56.3%
Simplified56.3%
Taylor expanded in n around inf 55.9%
Taylor expanded in i around 0 56.5%
if -7.8000000000000003e-32 < n < -1.8000000000000002e-223 or 2.10000000000000019e-242 < n < 1.3200000000000001e-17Initial program 16.8%
Taylor expanded in i around 0 21.3%
+-commutative21.3%
Simplified21.3%
Taylor expanded in i around 0 66.1%
if -1.8000000000000002e-223 < n < 2.10000000000000019e-242Initial program 81.8%
*-commutative81.8%
associate-/r/79.7%
associate-*l*79.7%
sub-neg79.7%
metadata-eval79.7%
Simplified79.7%
Taylor expanded in i around 0 94.3%
if 1.3200000000000001e-17 < n Initial program 18.2%
*-commutative18.2%
associate-/r/18.7%
associate-*l*18.7%
sub-neg18.7%
metadata-eval18.7%
Simplified18.7%
Taylor expanded in n around inf 39.0%
expm1-def94.9%
Simplified94.9%
Taylor expanded in i around 0 78.6%
associate-*r*78.6%
distribute-rgt-out78.6%
Simplified78.6%
Final simplification69.5%
(FPCore (i n) :precision binary64 (if (or (<= n -7.8e-32) (not (<= n 3.7e-78))) (* 100.0 (/ (* i n) i)) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -7.8e-32) || !(n <= 3.7e-78)) {
tmp = 100.0 * ((i * n) / i);
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-7.8d-32)) .or. (.not. (n <= 3.7d-78))) then
tmp = 100.0d0 * ((i * n) / i)
else
tmp = 100.0d0 * (i / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -7.8e-32) || !(n <= 3.7e-78)) {
tmp = 100.0 * ((i * n) / i);
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -7.8e-32) or not (n <= 3.7e-78): tmp = 100.0 * ((i * n) / i) else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -7.8e-32) || !(n <= 3.7e-78)) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); else tmp = Float64(100.0 * Float64(i / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -7.8e-32) || ~((n <= 3.7e-78))) tmp = 100.0 * ((i * n) / i); else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -7.8e-32], N[Not[LessEqual[n, 3.7e-78]], $MachinePrecision]], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -7.8 \cdot 10^{-32} \lor \neg \left(n \leq 3.7 \cdot 10^{-78}\right):\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -7.8000000000000003e-32 or 3.70000000000000006e-78 < n Initial program 22.9%
associate-/r/23.4%
sub-neg23.4%
metadata-eval23.4%
Simplified23.4%
Taylor expanded in i around 0 69.7%
associate-*r/69.7%
metadata-eval69.7%
Simplified69.7%
Taylor expanded in n around inf 71.1%
Taylor expanded in i around 0 65.4%
if -7.8000000000000003e-32 < n < 3.70000000000000006e-78Initial program 31.6%
Taylor expanded in i around 0 35.9%
+-commutative35.9%
Simplified35.9%
Taylor expanded in i around 0 65.0%
Final simplification65.3%
(FPCore (i n) :precision binary64 (if (<= n -7.8e-32) (* 100.0 (/ (* i n) i)) (if (<= n 2.9e-27) (* 100.0 (/ i (/ i n))) (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -7.8e-32) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= 2.9e-27) {
tmp = 100.0 * (i / (i / n));
} 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 <= (-7.8d-32)) then
tmp = 100.0d0 * ((i * n) / i)
else if (n <= 2.9d-27) then
tmp = 100.0d0 * (i / (i / n))
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 <= -7.8e-32) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= 2.9e-27) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -7.8e-32: tmp = 100.0 * ((i * n) / i) elif n <= 2.9e-27: tmp = 100.0 * (i / (i / n)) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -7.8e-32) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); elseif (n <= 2.9e-27) tmp = Float64(100.0 * Float64(i / Float64(i / n))); 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 <= -7.8e-32) tmp = 100.0 * ((i * n) / i); elseif (n <= 2.9e-27) tmp = 100.0 * (i / (i / n)); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -7.8e-32], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.9e-27], N[(100.0 * N[(i / N[(i / n), $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 -7.8 \cdot 10^{-32}:\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{elif}\;n \leq 2.9 \cdot 10^{-27}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -7.8000000000000003e-32Initial program 30.4%
associate-/r/30.9%
sub-neg30.9%
metadata-eval30.9%
Simplified30.9%
Taylor expanded in i around 0 56.3%
associate-*r/56.3%
metadata-eval56.3%
Simplified56.3%
Taylor expanded in n around inf 55.9%
Taylor expanded in i around 0 56.5%
if -7.8000000000000003e-32 < n < 2.90000000000000004e-27Initial program 29.1%
Taylor expanded in i around 0 32.9%
+-commutative32.9%
Simplified32.9%
Taylor expanded in i around 0 62.8%
if 2.90000000000000004e-27 < n Initial program 18.2%
*-commutative18.2%
associate-/r/18.7%
associate-*l*18.7%
sub-neg18.7%
metadata-eval18.7%
Simplified18.7%
Taylor expanded in n around inf 39.0%
expm1-def94.9%
Simplified94.9%
Taylor expanded in i around 0 78.6%
associate-*r*78.6%
distribute-rgt-out78.6%
Simplified78.6%
Final simplification66.6%
(FPCore (i n) :precision binary64 (if (<= i -2e+39) (* 100.0 (/ i (/ i n))) (if (<= i 9.5e+28) (* n 100.0) (* (* i n) 50.0))))
double code(double i, double n) {
double tmp;
if (i <= -2e+39) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 9.5e+28) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-2d+39)) then
tmp = 100.0d0 * (i / (i / n))
else if (i <= 9.5d+28) then
tmp = n * 100.0d0
else
tmp = (i * n) * 50.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -2e+39) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 9.5e+28) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -2e+39: tmp = 100.0 * (i / (i / n)) elif i <= 9.5e+28: tmp = n * 100.0 else: tmp = (i * n) * 50.0 return tmp
function code(i, n) tmp = 0.0 if (i <= -2e+39) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (i <= 9.5e+28) tmp = Float64(n * 100.0); else tmp = Float64(Float64(i * n) * 50.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -2e+39) tmp = 100.0 * (i / (i / n)); elseif (i <= 9.5e+28) tmp = n * 100.0; else tmp = (i * n) * 50.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -2e+39], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 9.5e+28], N[(n * 100.0), $MachinePrecision], N[(N[(i * n), $MachinePrecision] * 50.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2 \cdot 10^{+39}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 9.5 \cdot 10^{+28}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot n\right) \cdot 50\\
\end{array}
\end{array}
if i < -1.99999999999999988e39Initial program 62.1%
Taylor expanded in i around 0 24.9%
+-commutative24.9%
Simplified24.9%
Taylor expanded in i around 0 24.9%
if -1.99999999999999988e39 < i < 9.49999999999999927e28Initial program 8.0%
associate-/r/8.6%
sub-neg8.6%
metadata-eval8.6%
Simplified8.6%
Taylor expanded in i around 0 81.9%
*-commutative81.9%
Simplified81.9%
if 9.49999999999999927e28 < i Initial program 43.7%
associate-/r/44.0%
sub-neg44.0%
metadata-eval44.0%
Simplified44.0%
Taylor expanded in i around 0 44.1%
associate-*r/44.1%
metadata-eval44.1%
Simplified44.1%
Taylor expanded in n around inf 49.4%
Taylor expanded in i around inf 38.0%
Final simplification62.1%
(FPCore (i n) :precision binary64 (if (<= i 1e+29) (* n 100.0) (* (* i n) 50.0)))
double code(double i, double n) {
double tmp;
if (i <= 1e+29) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 1d+29) then
tmp = n * 100.0d0
else
tmp = (i * n) * 50.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 1e+29) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 1e+29: tmp = n * 100.0 else: tmp = (i * n) * 50.0 return tmp
function code(i, n) tmp = 0.0 if (i <= 1e+29) tmp = Float64(n * 100.0); else tmp = Float64(Float64(i * n) * 50.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 1e+29) tmp = n * 100.0; else tmp = (i * n) * 50.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 1e+29], N[(n * 100.0), $MachinePrecision], N[(N[(i * n), $MachinePrecision] * 50.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 10^{+29}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot n\right) \cdot 50\\
\end{array}
\end{array}
if i < 9.99999999999999914e28Initial program 20.4%
associate-/r/20.7%
sub-neg20.7%
metadata-eval20.7%
Simplified20.7%
Taylor expanded in i around 0 64.1%
*-commutative64.1%
Simplified64.1%
if 9.99999999999999914e28 < i Initial program 43.7%
associate-/r/44.0%
sub-neg44.0%
metadata-eval44.0%
Simplified44.0%
Taylor expanded in i around 0 44.1%
associate-*r/44.1%
metadata-eval44.1%
Simplified44.1%
Taylor expanded in n around inf 49.4%
Taylor expanded in i around inf 38.0%
Final simplification58.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 25.5%
*-commutative25.5%
associate-/r/25.8%
associate-*l*25.8%
sub-neg25.8%
metadata-eval25.8%
Simplified25.8%
Taylor expanded in i around 0 59.2%
associate-*r/59.2%
metadata-eval59.2%
Simplified59.2%
Taylor expanded in n around 0 2.6%
*-commutative2.6%
Simplified2.6%
Final simplification2.6%
(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 25.5%
associate-/r/25.8%
sub-neg25.8%
metadata-eval25.8%
Simplified25.8%
Taylor expanded in i around 0 51.2%
*-commutative51.2%
Simplified51.2%
Final simplification51.2%
(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 2024021
(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))))