
(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 4e-322)
(* (/ (expm1 (* n (log1p (/ i n)))) i) (* n 100.0))
(if (<= t_1 INFINITY) (* n (/ (fma 100.0 t_0 -100.0) i)) (* 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 <= 4e-322) {
tmp = (expm1((n * log1p((i / n)))) / i) * (n * 100.0);
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (fma(100.0, t_0, -100.0) / i);
} 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 <= 4e-322) tmp = Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i) * Float64(n * 100.0)); elseif (t_1 <= Inf) tmp = Float64(n * Float64(fma(100.0, t_0, -100.0) / i)); 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, 4e-322], N[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(100.0 * t$95$0 + -100.0), $MachinePrecision] / i), $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 4 \cdot 10^{-322}:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i} \cdot \left(n \cdot 100\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{\mathsf{fma}\left(100, t\_0, -100\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 4.00193e-322Initial program 26.4%
associate-*r/26.4%
sub-neg26.4%
distribute-rgt-in26.4%
metadata-eval26.4%
metadata-eval26.4%
Simplified26.4%
metadata-eval26.4%
metadata-eval26.4%
distribute-rgt-in26.4%
sub-neg26.4%
associate-*r/26.4%
*-commutative26.4%
associate-/r/25.5%
associate-*l*25.5%
add-exp-log25.5%
expm1-define25.5%
log-pow36.4%
log1p-define96.3%
Applied egg-rr96.3%
if 4.00193e-322 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 96.1%
associate-/r/96.5%
associate-*r*96.4%
*-commutative96.4%
associate-*r/96.4%
sub-neg96.4%
distribute-lft-in96.1%
metadata-eval96.1%
metadata-eval96.1%
metadata-eval96.1%
fma-define96.4%
metadata-eval96.4%
Simplified96.4%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
Taylor expanded in i around 0 86.2%
*-commutative86.2%
Simplified86.2%
Final simplification94.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0)) (t_1 (/ t_0 (/ i n))))
(if (<= t_1 4e-322)
(* (/ (expm1 (* n (log1p (/ i n)))) i) (* n 100.0))
(if (<= t_1 INFINITY) (* (* n 100.0) (/ t_0 i)) (* n 100.0)))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= 4e-322) {
tmp = (expm1((n * log1p((i / n)))) / i) * (n * 100.0);
} else if (t_1 <= ((double) INFINITY)) {
tmp = (n * 100.0) * (t_0 / i);
} 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) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= 4e-322) {
tmp = (Math.expm1((n * Math.log1p((i / n)))) / i) * (n * 100.0);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (n * 100.0) * (t_0 / i);
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) + -1.0 t_1 = t_0 / (i / n) tmp = 0 if t_1 <= 4e-322: tmp = (math.expm1((n * math.log1p((i / n)))) / i) * (n * 100.0) elif t_1 <= math.inf: tmp = (n * 100.0) * (t_0 / i) else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) t_1 = Float64(t_0 / Float64(i / n)) tmp = 0.0 if (t_1 <= 4e-322) tmp = Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i) * Float64(n * 100.0)); elseif (t_1 <= Inf) tmp = Float64(Float64(n * 100.0) * Float64(t_0 / i)); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 4e-322], N[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(n * 100.0), $MachinePrecision] * N[(t$95$0 / i), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t\_0}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 4 \cdot 10^{-322}:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i} \cdot \left(n \cdot 100\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{t\_0}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 4.00193e-322Initial program 26.4%
associate-*r/26.4%
sub-neg26.4%
distribute-rgt-in26.4%
metadata-eval26.4%
metadata-eval26.4%
Simplified26.4%
metadata-eval26.4%
metadata-eval26.4%
distribute-rgt-in26.4%
sub-neg26.4%
associate-*r/26.4%
*-commutative26.4%
associate-/r/25.5%
associate-*l*25.5%
add-exp-log25.5%
expm1-define25.5%
log-pow36.4%
log1p-define96.3%
Applied egg-rr96.3%
if 4.00193e-322 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 96.1%
associate-*r/96.4%
sub-neg96.4%
distribute-rgt-in96.0%
metadata-eval96.0%
metadata-eval96.0%
Simplified96.0%
metadata-eval96.0%
metadata-eval96.0%
distribute-rgt-in96.4%
sub-neg96.4%
associate-*r/96.1%
*-commutative96.1%
associate-/r/96.5%
associate-*l*96.2%
add-exp-log95.8%
expm1-define95.8%
log-pow57.3%
log1p-define57.3%
Applied egg-rr57.3%
expm1-undefine54.0%
*-commutative54.0%
log1p-undefine54.0%
exp-to-pow96.2%
Applied egg-rr96.2%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
Taylor expanded in i around 0 86.2%
*-commutative86.2%
Simplified86.2%
Final simplification94.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0)) (t_1 (/ t_0 (/ i n))))
(if (<= t_1 0.0)
(* 100.0 (* (expm1 (* n (log1p (/ i n)))) (/ n i)))
(if (<= t_1 INFINITY) (* (* n 100.0) (/ t_0 i)) (* n 100.0)))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) * (n / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = (n * 100.0) * (t_0 / i);
} 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) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = 100.0 * (Math.expm1((n * Math.log1p((i / n)))) * (n / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (n * 100.0) * (t_0 / i);
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) + -1.0 t_1 = t_0 / (i / n) tmp = 0 if t_1 <= 0.0: tmp = 100.0 * (math.expm1((n * math.log1p((i / n)))) * (n / i)) elif t_1 <= math.inf: tmp = (n * 100.0) * (t_0 / i) else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) t_1 = Float64(t_0 / Float64(i / n)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(n / i))); elseif (t_1 <= Inf) tmp = Float64(Float64(n * 100.0) * Float64(t_0 / i)); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(N[(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 * 100.0), $MachinePrecision] * N[(t$95$0 / i), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t\_0}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;100 \cdot \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(n \cdot 100\right) \cdot \frac{t\_0}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -0.0Initial program 26.0%
associate-*r/26.0%
sub-neg26.0%
distribute-rgt-in26.0%
metadata-eval26.0%
metadata-eval26.0%
Simplified26.0%
metadata-eval26.0%
metadata-eval26.0%
distribute-rgt-in26.0%
sub-neg26.0%
associate-*r/26.0%
*-commutative26.0%
div-inv26.0%
add-exp-log26.0%
expm1-define26.0%
log-pow36.8%
log1p-define96.1%
clear-num95.3%
Applied egg-rr95.3%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 96.0%
associate-*r/96.3%
sub-neg96.3%
distribute-rgt-in95.8%
metadata-eval95.8%
metadata-eval95.8%
Simplified95.8%
metadata-eval95.8%
metadata-eval95.8%
distribute-rgt-in96.3%
sub-neg96.3%
associate-*r/96.0%
*-commutative96.0%
associate-/r/96.4%
associate-*l*96.2%
add-exp-log95.8%
expm1-define95.8%
log-pow59.5%
log1p-define59.5%
Applied egg-rr59.5%
expm1-undefine56.1%
*-commutative56.1%
log1p-undefine56.1%
exp-to-pow96.2%
Applied egg-rr96.2%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
Taylor expanded in i around 0 86.2%
*-commutative86.2%
Simplified86.2%
Final simplification93.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0)) (t_1 (/ t_0 (/ i n))))
(if (<= t_1 4e-322)
(* (expm1 (* n (log1p (/ i n)))) (* 100.0 (/ n i)))
(if (<= t_1 INFINITY) (* (* n 100.0) (/ t_0 i)) (* n 100.0)))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= 4e-322) {
tmp = expm1((n * log1p((i / n)))) * (100.0 * (n / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = (n * 100.0) * (t_0 / i);
} 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) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= 4e-322) {
tmp = Math.expm1((n * Math.log1p((i / n)))) * (100.0 * (n / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (n * 100.0) * (t_0 / i);
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) + -1.0 t_1 = t_0 / (i / n) tmp = 0 if t_1 <= 4e-322: tmp = math.expm1((n * math.log1p((i / n)))) * (100.0 * (n / i)) elif t_1 <= math.inf: tmp = (n * 100.0) * (t_0 / i) else: tmp = n * 100.0 return tmp
function code(i, n) t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) t_1 = Float64(t_0 / Float64(i / n)) tmp = 0.0 if (t_1 <= 4e-322) tmp = Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(100.0 * Float64(n / i))); elseif (t_1 <= Inf) tmp = Float64(Float64(n * 100.0) * Float64(t_0 / i)); else tmp = Float64(n * 100.0); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 4e-322], 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$1, Infinity], N[(N[(n * 100.0), $MachinePrecision] * N[(t$95$0 / i), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t\_0}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 4 \cdot 10^{-322}:\\
\;\;\;\;\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \left(100 \cdot \frac{n}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{t\_0}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 4.00193e-322Initial program 26.4%
associate-*r/26.4%
sub-neg26.4%
distribute-rgt-in26.4%
metadata-eval26.4%
metadata-eval26.4%
Simplified26.4%
metadata-eval26.4%
metadata-eval26.4%
distribute-rgt-in26.4%
sub-neg26.4%
associate-*r/26.4%
*-commutative26.4%
div-inv26.3%
clear-num25.4%
associate-*l*25.4%
add-exp-log25.4%
expm1-define25.4%
log-pow36.3%
log1p-define94.7%
Applied egg-rr94.7%
if 4.00193e-322 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 96.1%
associate-*r/96.4%
sub-neg96.4%
distribute-rgt-in96.0%
metadata-eval96.0%
metadata-eval96.0%
Simplified96.0%
metadata-eval96.0%
metadata-eval96.0%
distribute-rgt-in96.4%
sub-neg96.4%
associate-*r/96.1%
*-commutative96.1%
associate-/r/96.5%
associate-*l*96.2%
add-exp-log95.8%
expm1-define95.8%
log-pow57.3%
log1p-define57.3%
Applied egg-rr57.3%
expm1-undefine54.0%
*-commutative54.0%
log1p-undefine54.0%
exp-to-pow96.2%
Applied egg-rr96.2%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
Taylor expanded in i around 0 86.2%
*-commutative86.2%
Simplified86.2%
Final simplification93.3%
(FPCore (i n) :precision binary64 (if (or (<= n -2.45e-253) (not (<= n 3.5e-144))) (* 100.0 (* n (/ (expm1 i) i))) (/ (* n 0.0) i)))
double code(double i, double n) {
double tmp;
if ((n <= -2.45e-253) || !(n <= 3.5e-144)) {
tmp = 100.0 * (n * (expm1(i) / i));
} else {
tmp = (n * 0.0) / i;
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -2.45e-253) || !(n <= 3.5e-144)) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else {
tmp = (n * 0.0) / i;
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.45e-253) or not (n <= 3.5e-144): tmp = 100.0 * (n * (math.expm1(i) / i)) else: tmp = (n * 0.0) / i return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.45e-253) || !(n <= 3.5e-144)) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); else tmp = Float64(Float64(n * 0.0) / i); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -2.45e-253], N[Not[LessEqual[n, 3.5e-144]], $MachinePrecision]], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 0.0), $MachinePrecision] / i), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.45 \cdot 10^{-253} \lor \neg \left(n \leq 3.5 \cdot 10^{-144}\right):\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot 0}{i}\\
\end{array}
\end{array}
if n < -2.45e-253 or 3.4999999999999998e-144 < n Initial program 22.5%
Taylor expanded in n around inf 36.8%
*-commutative36.8%
associate-/l*36.8%
expm1-define85.3%
Simplified85.3%
if -2.45e-253 < n < 3.4999999999999998e-144Initial program 56.6%
associate-*r/56.6%
sub-neg56.6%
distribute-rgt-in56.6%
metadata-eval56.6%
metadata-eval56.6%
Simplified56.6%
clear-num56.6%
inv-pow56.6%
Applied egg-rr56.6%
unpow-156.6%
Simplified56.6%
Taylor expanded in i around inf 56.4%
Taylor expanded in n around inf 53.9%
Taylor expanded in n around 0 78.5%
Final simplification84.4%
(FPCore (i n) :precision binary64 (if (or (<= n -2.2e-253) (not (<= n 6.2e-142))) (* n (* 100.0 (/ (expm1 i) i))) (/ (* n 0.0) i)))
double code(double i, double n) {
double tmp;
if ((n <= -2.2e-253) || !(n <= 6.2e-142)) {
tmp = n * (100.0 * (expm1(i) / i));
} else {
tmp = (n * 0.0) / i;
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -2.2e-253) || !(n <= 6.2e-142)) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else {
tmp = (n * 0.0) / i;
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.2e-253) or not (n <= 6.2e-142): tmp = n * (100.0 * (math.expm1(i) / i)) else: tmp = (n * 0.0) / i return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.2e-253) || !(n <= 6.2e-142)) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); else tmp = Float64(Float64(n * 0.0) / i); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -2.2e-253], N[Not[LessEqual[n, 6.2e-142]], $MachinePrecision]], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 0.0), $MachinePrecision] / i), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.2 \cdot 10^{-253} \lor \neg \left(n \leq 6.2 \cdot 10^{-142}\right):\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot 0}{i}\\
\end{array}
\end{array}
if n < -2.19999999999999996e-253 or 6.2e-142 < n Initial program 22.5%
associate-/r/22.5%
associate-*r*22.5%
*-commutative22.5%
associate-*r/22.5%
sub-neg22.5%
distribute-lft-in22.4%
metadata-eval22.4%
metadata-eval22.4%
metadata-eval22.4%
fma-define22.5%
metadata-eval22.5%
Simplified22.5%
Taylor expanded in n around inf 36.0%
associate-/l*36.8%
sub-neg36.8%
metadata-eval36.8%
metadata-eval36.8%
distribute-lft-in36.8%
metadata-eval36.8%
sub-neg36.8%
associate-*r/36.8%
*-commutative36.8%
expm1-define85.2%
Simplified85.2%
if -2.19999999999999996e-253 < n < 6.2e-142Initial program 56.6%
associate-*r/56.6%
sub-neg56.6%
distribute-rgt-in56.6%
metadata-eval56.6%
metadata-eval56.6%
Simplified56.6%
clear-num56.6%
inv-pow56.6%
Applied egg-rr56.6%
unpow-156.6%
Simplified56.6%
Taylor expanded in i around inf 56.4%
Taylor expanded in n around inf 53.9%
Taylor expanded in n around 0 78.5%
Final simplification84.4%
(FPCore (i n) :precision binary64 (if (or (<= i -0.017) (not (<= i 2e-19))) (* 100.0 (/ (expm1 i) (/ i n))) (+ (* n 100.0) (* 50.0 (* i n)))))
double code(double i, double n) {
double tmp;
if ((i <= -0.017) || !(i <= 2e-19)) {
tmp = 100.0 * (expm1(i) / (i / n));
} else {
tmp = (n * 100.0) + (50.0 * (i * n));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((i <= -0.017) || !(i <= 2e-19)) {
tmp = 100.0 * (Math.expm1(i) / (i / n));
} else {
tmp = (n * 100.0) + (50.0 * (i * n));
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -0.017) or not (i <= 2e-19): tmp = 100.0 * (math.expm1(i) / (i / n)) else: tmp = (n * 100.0) + (50.0 * (i * n)) return tmp
function code(i, n) tmp = 0.0 if ((i <= -0.017) || !(i <= 2e-19)) tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n))); else tmp = Float64(Float64(n * 100.0) + Float64(50.0 * Float64(i * n))); end return tmp end
code[i_, n_] := If[Or[LessEqual[i, -0.017], N[Not[LessEqual[i, 2e-19]], $MachinePrecision]], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] + N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -0.017 \lor \neg \left(i \leq 2 \cdot 10^{-19}\right):\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100 + 50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < -0.017000000000000001 or 2e-19 < i Initial program 47.7%
Taylor expanded in n around inf 69.6%
expm1-define68.8%
Simplified68.8%
if -0.017000000000000001 < i < 2e-19Initial program 7.6%
Taylor expanded in n around inf 8.2%
*-commutative8.2%
associate-/l*8.2%
expm1-define86.0%
Simplified86.0%
Taylor expanded in i around 0 86.0%
Final simplification77.8%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (expm1 i) i)))
(if (<= n -2.45e-253)
(* (* n 100.0) t_0)
(if (<= n 3.7e-143) (/ (* n 0.0) i) (* 100.0 (* n t_0))))))
double code(double i, double n) {
double t_0 = expm1(i) / i;
double tmp;
if (n <= -2.45e-253) {
tmp = (n * 100.0) * t_0;
} else if (n <= 3.7e-143) {
tmp = (n * 0.0) / i;
} else {
tmp = 100.0 * (n * t_0);
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.expm1(i) / i;
double tmp;
if (n <= -2.45e-253) {
tmp = (n * 100.0) * t_0;
} else if (n <= 3.7e-143) {
tmp = (n * 0.0) / i;
} else {
tmp = 100.0 * (n * t_0);
}
return tmp;
}
def code(i, n): t_0 = math.expm1(i) / i tmp = 0 if n <= -2.45e-253: tmp = (n * 100.0) * t_0 elif n <= 3.7e-143: tmp = (n * 0.0) / i else: tmp = 100.0 * (n * t_0) return tmp
function code(i, n) t_0 = Float64(expm1(i) / i) tmp = 0.0 if (n <= -2.45e-253) tmp = Float64(Float64(n * 100.0) * t_0); elseif (n <= 3.7e-143) tmp = Float64(Float64(n * 0.0) / i); else tmp = Float64(100.0 * Float64(n * t_0)); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]}, If[LessEqual[n, -2.45e-253], N[(N[(n * 100.0), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[n, 3.7e-143], N[(N[(n * 0.0), $MachinePrecision] / i), $MachinePrecision], N[(100.0 * N[(n * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{expm1}\left(i\right)}{i}\\
\mathbf{if}\;n \leq -2.45 \cdot 10^{-253}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot t\_0\\
\mathbf{elif}\;n \leq 3.7 \cdot 10^{-143}:\\
\;\;\;\;\frac{n \cdot 0}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot t\_0\right)\\
\end{array}
\end{array}
if n < -2.45e-253Initial program 26.8%
associate-*r/26.8%
sub-neg26.8%
distribute-rgt-in26.8%
metadata-eval26.8%
metadata-eval26.8%
Simplified26.8%
metadata-eval26.8%
metadata-eval26.8%
distribute-rgt-in26.8%
sub-neg26.8%
associate-*r/26.8%
*-commutative26.8%
associate-/r/26.6%
associate-*l*26.6%
add-exp-log26.6%
expm1-define26.6%
log-pow28.9%
log1p-define75.2%
Applied egg-rr75.2%
Taylor expanded in n around inf 82.8%
if -2.45e-253 < n < 3.7e-143Initial program 56.6%
associate-*r/56.6%
sub-neg56.6%
distribute-rgt-in56.6%
metadata-eval56.6%
metadata-eval56.6%
Simplified56.6%
clear-num56.6%
inv-pow56.6%
Applied egg-rr56.6%
unpow-156.6%
Simplified56.6%
Taylor expanded in i around inf 56.4%
Taylor expanded in n around inf 53.9%
Taylor expanded in n around 0 78.5%
if 3.7e-143 < n Initial program 15.8%
Taylor expanded in n around inf 37.9%
*-commutative37.9%
associate-/l*37.9%
expm1-define89.0%
Simplified89.0%
Final simplification84.4%
(FPCore (i n)
:precision binary64
(if (<= n -1.2e+42)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n -2.45e-253)
(* 100.0 (/ i (/ i n)))
(if (<= n 1.6e-142)
(/ (* n 0.0) i)
(*
n
(+
100.0
(*
i
(+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))))))
double code(double i, double n) {
double tmp;
if (n <= -1.2e+42) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= -2.45e-253) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.6e-142) {
tmp = (n * 0.0) / i;
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.2d+42)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= (-2.45d-253)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 1.6d-142) then
tmp = (n * 0.0d0) / i
else
tmp = n * (100.0d0 + (i * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.2e+42) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= -2.45e-253) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.6e-142) {
tmp = (n * 0.0) / i;
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.2e+42: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= -2.45e-253: tmp = 100.0 * (i / (i / n)) elif n <= 1.6e-142: tmp = (n * 0.0) / i else: tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.2e+42) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= -2.45e-253) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 1.6e-142) tmp = Float64(Float64(n * 0.0) / i); else tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.2e+42) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= -2.45e-253) tmp = 100.0 * (i / (i / n)); elseif (n <= 1.6e-142) tmp = (n * 0.0) / i; else tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.2e+42], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -2.45e-253], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.6e-142], N[(N[(n * 0.0), $MachinePrecision] / i), $MachinePrecision], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.2 \cdot 10^{+42}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq -2.45 \cdot 10^{-253}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 1.6 \cdot 10^{-142}:\\
\;\;\;\;\frac{n \cdot 0}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\end{array}
\end{array}
if n < -1.1999999999999999e42Initial program 22.8%
associate-/r/23.5%
associate-*r*23.5%
*-commutative23.5%
associate-*r/23.5%
sub-neg23.5%
distribute-lft-in23.5%
metadata-eval23.5%
metadata-eval23.5%
metadata-eval23.5%
fma-define23.5%
metadata-eval23.5%
Simplified23.5%
Taylor expanded in n around inf 44.8%
associate-/l*44.7%
sub-neg44.7%
metadata-eval44.7%
metadata-eval44.7%
distribute-lft-in44.7%
metadata-eval44.7%
sub-neg44.7%
associate-*r/44.7%
*-commutative44.7%
expm1-define91.3%
Simplified91.3%
Taylor expanded in i around 0 59.7%
*-commutative59.7%
Simplified59.7%
if -1.1999999999999999e42 < n < -2.45e-253Initial program 32.7%
Taylor expanded in i around 0 67.3%
if -2.45e-253 < n < 1.5999999999999999e-142Initial program 56.6%
associate-*r/56.6%
sub-neg56.6%
distribute-rgt-in56.6%
metadata-eval56.6%
metadata-eval56.6%
Simplified56.6%
clear-num56.6%
inv-pow56.6%
Applied egg-rr56.6%
unpow-156.6%
Simplified56.6%
Taylor expanded in i around inf 56.4%
Taylor expanded in n around inf 53.9%
Taylor expanded in n around 0 78.5%
if 1.5999999999999999e-142 < n Initial program 15.8%
associate-/r/16.1%
associate-*r*16.1%
*-commutative16.1%
associate-*r/16.2%
sub-neg16.2%
distribute-lft-in16.0%
metadata-eval16.0%
metadata-eval16.0%
metadata-eval16.0%
fma-define16.2%
metadata-eval16.2%
Simplified16.2%
Taylor expanded in n around inf 35.8%
associate-/l*37.9%
sub-neg37.9%
metadata-eval37.9%
metadata-eval37.9%
distribute-lft-in37.9%
metadata-eval37.9%
sub-neg37.9%
associate-*r/37.9%
*-commutative37.9%
expm1-define89.0%
Simplified89.0%
Taylor expanded in i around 0 69.1%
*-commutative69.1%
Simplified69.1%
Final simplification66.9%
(FPCore (i n)
:precision binary64
(if (<= n -1.02e+42)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n -2.45e-253)
(* 100.0 (/ i (/ i n)))
(if (<= n 1.9e-143)
(/ (* n 0.0) i)
(* 100.0 (* n (+ 1.0 (* i (+ 0.5 (* i 0.16666666666666666))))))))))
double code(double i, double n) {
double tmp;
if (n <= -1.02e+42) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= -2.45e-253) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.9e-143) {
tmp = (n * 0.0) / i;
} else {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666)))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.02d+42)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= (-2.45d-253)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 1.9d-143) then
tmp = (n * 0.0d0) / i
else
tmp = 100.0d0 * (n * (1.0d0 + (i * (0.5d0 + (i * 0.16666666666666666d0)))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.02e+42) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= -2.45e-253) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.9e-143) {
tmp = (n * 0.0) / i;
} else {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666)))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.02e+42: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= -2.45e-253: tmp = 100.0 * (i / (i / n)) elif n <= 1.9e-143: tmp = (n * 0.0) / i else: tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.02e+42) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= -2.45e-253) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 1.9e-143) tmp = Float64(Float64(n * 0.0) / i); else tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * Float64(0.5 + Float64(i * 0.16666666666666666)))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.02e+42) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= -2.45e-253) tmp = 100.0 * (i / (i / n)); elseif (n <= 1.9e-143) tmp = (n * 0.0) / i; else tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.02e+42], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -2.45e-253], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.9e-143], N[(N[(n * 0.0), $MachinePrecision] / i), $MachinePrecision], N[(100.0 * N[(n * N[(1.0 + N[(i * N[(0.5 + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.02 \cdot 10^{+42}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq -2.45 \cdot 10^{-253}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 1.9 \cdot 10^{-143}:\\
\;\;\;\;\frac{n \cdot 0}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if n < -1.01999999999999996e42Initial program 22.8%
associate-/r/23.5%
associate-*r*23.5%
*-commutative23.5%
associate-*r/23.5%
sub-neg23.5%
distribute-lft-in23.5%
metadata-eval23.5%
metadata-eval23.5%
metadata-eval23.5%
fma-define23.5%
metadata-eval23.5%
Simplified23.5%
Taylor expanded in n around inf 44.8%
associate-/l*44.7%
sub-neg44.7%
metadata-eval44.7%
metadata-eval44.7%
distribute-lft-in44.7%
metadata-eval44.7%
sub-neg44.7%
associate-*r/44.7%
*-commutative44.7%
expm1-define91.3%
Simplified91.3%
Taylor expanded in i around 0 59.7%
*-commutative59.7%
Simplified59.7%
if -1.01999999999999996e42 < n < -2.45e-253Initial program 32.7%
Taylor expanded in i around 0 67.3%
if -2.45e-253 < n < 1.89999999999999991e-143Initial program 56.6%
associate-*r/56.6%
sub-neg56.6%
distribute-rgt-in56.6%
metadata-eval56.6%
metadata-eval56.6%
Simplified56.6%
clear-num56.6%
inv-pow56.6%
Applied egg-rr56.6%
unpow-156.6%
Simplified56.6%
Taylor expanded in i around inf 56.4%
Taylor expanded in n around inf 53.9%
Taylor expanded in n around 0 78.5%
if 1.89999999999999991e-143 < n Initial program 15.8%
Taylor expanded in n around inf 37.9%
*-commutative37.9%
associate-/l*37.9%
expm1-define89.0%
Simplified89.0%
Taylor expanded in i around 0 67.7%
*-commutative67.7%
Simplified67.7%
Final simplification66.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))))
(if (<= n -1.08e+42)
t_0
(if (<= n -2.2e-253)
(* 100.0 (/ i (/ i n)))
(if (<= n 1.85e-144) (/ (* n 0.0) i) t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
double tmp;
if (n <= -1.08e+42) {
tmp = t_0;
} else if (n <= -2.2e-253) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.85e-144) {
tmp = (n * 0.0) / i;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
if (n <= (-1.08d+42)) then
tmp = t_0
else if (n <= (-2.2d-253)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 1.85d-144) then
tmp = (n * 0.0d0) / i
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
double tmp;
if (n <= -1.08e+42) {
tmp = t_0;
} else if (n <= -2.2e-253) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 1.85e-144) {
tmp = (n * 0.0) / i;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) tmp = 0 if n <= -1.08e+42: tmp = t_0 elif n <= -2.2e-253: tmp = 100.0 * (i / (i / n)) elif n <= 1.85e-144: tmp = (n * 0.0) / i else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))) tmp = 0.0 if (n <= -1.08e+42) tmp = t_0; elseif (n <= -2.2e-253) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 1.85e-144) tmp = Float64(Float64(n * 0.0) / i); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); tmp = 0.0; if (n <= -1.08e+42) tmp = t_0; elseif (n <= -2.2e-253) tmp = 100.0 * (i / (i / n)); elseif (n <= 1.85e-144) tmp = (n * 0.0) / i; else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.08e+42], t$95$0, If[LessEqual[n, -2.2e-253], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.85e-144], N[(N[(n * 0.0), $MachinePrecision] / i), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{if}\;n \leq -1.08 \cdot 10^{+42}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -2.2 \cdot 10^{-253}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 1.85 \cdot 10^{-144}:\\
\;\;\;\;\frac{n \cdot 0}{i}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.08e42 or 1.8500000000000001e-144 < n Initial program 19.2%
associate-/r/19.7%
associate-*r*19.7%
*-commutative19.7%
associate-*r/19.7%
sub-neg19.7%
distribute-lft-in19.6%
metadata-eval19.6%
metadata-eval19.6%
metadata-eval19.6%
fma-define19.7%
metadata-eval19.7%
Simplified19.7%
Taylor expanded in n around inf 40.2%
associate-/l*41.2%
sub-neg41.2%
metadata-eval41.2%
metadata-eval41.2%
distribute-lft-in41.2%
metadata-eval41.2%
sub-neg41.2%
associate-*r/41.2%
*-commutative41.2%
expm1-define90.1%
Simplified90.1%
Taylor expanded in i around 0 63.8%
*-commutative63.8%
Simplified63.8%
if -1.08e42 < n < -2.19999999999999996e-253Initial program 32.7%
Taylor expanded in i around 0 67.3%
if -2.19999999999999996e-253 < n < 1.8500000000000001e-144Initial program 56.6%
associate-*r/56.6%
sub-neg56.6%
distribute-rgt-in56.6%
metadata-eval56.6%
metadata-eval56.6%
Simplified56.6%
clear-num56.6%
inv-pow56.6%
Applied egg-rr56.6%
unpow-156.6%
Simplified56.6%
Taylor expanded in i around inf 56.4%
Taylor expanded in n around inf 53.9%
Taylor expanded in n around 0 78.5%
Final simplification66.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i 50.0)))))
(if (<= n -2.8e+43)
t_0
(if (<= n -2.45e-253)
(* 100.0 (/ i (/ i n)))
(if (<= n 9e-142) (/ (* n 0.0) i) t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -2.8e+43) {
tmp = t_0;
} else if (n <= -2.45e-253) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 9e-142) {
tmp = (n * 0.0) / i;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = n * (100.0d0 + (i * 50.0d0))
if (n <= (-2.8d+43)) then
tmp = t_0
else if (n <= (-2.45d-253)) then
tmp = 100.0d0 * (i / (i / n))
else if (n <= 9d-142) then
tmp = (n * 0.0d0) / i
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -2.8e+43) {
tmp = t_0;
} else if (n <= -2.45e-253) {
tmp = 100.0 * (i / (i / n));
} else if (n <= 9e-142) {
tmp = (n * 0.0) / i;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + (i * 50.0)) tmp = 0 if n <= -2.8e+43: tmp = t_0 elif n <= -2.45e-253: tmp = 100.0 * (i / (i / n)) elif n <= 9e-142: tmp = (n * 0.0) / i else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 + Float64(i * 50.0))) tmp = 0.0 if (n <= -2.8e+43) tmp = t_0; elseif (n <= -2.45e-253) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (n <= 9e-142) tmp = Float64(Float64(n * 0.0) / i); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = n * (100.0 + (i * 50.0)); tmp = 0.0; if (n <= -2.8e+43) tmp = t_0; elseif (n <= -2.45e-253) tmp = 100.0 * (i / (i / n)); elseif (n <= 9e-142) tmp = (n * 0.0) / i; else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -2.8e+43], t$95$0, If[LessEqual[n, -2.45e-253], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 9e-142], N[(N[(n * 0.0), $MachinePrecision] / i), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{if}\;n \leq -2.8 \cdot 10^{+43}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -2.45 \cdot 10^{-253}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 9 \cdot 10^{-142}:\\
\;\;\;\;\frac{n \cdot 0}{i}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.80000000000000019e43 or 9.00000000000000037e-142 < n Initial program 19.2%
associate-/r/19.7%
associate-*r*19.7%
*-commutative19.7%
associate-*r/19.7%
sub-neg19.7%
distribute-lft-in19.6%
metadata-eval19.6%
metadata-eval19.6%
metadata-eval19.6%
fma-define19.7%
metadata-eval19.7%
Simplified19.7%
Taylor expanded in n around inf 40.2%
associate-/l*41.2%
sub-neg41.2%
metadata-eval41.2%
metadata-eval41.2%
distribute-lft-in41.2%
metadata-eval41.2%
sub-neg41.2%
associate-*r/41.2%
*-commutative41.2%
expm1-define90.1%
Simplified90.1%
Taylor expanded in i around 0 60.9%
*-commutative60.9%
Simplified60.9%
if -2.80000000000000019e43 < n < -2.45e-253Initial program 32.7%
Taylor expanded in i around 0 67.3%
if -2.45e-253 < n < 9.00000000000000037e-142Initial program 56.6%
associate-*r/56.6%
sub-neg56.6%
distribute-rgt-in56.6%
metadata-eval56.6%
metadata-eval56.6%
Simplified56.6%
clear-num56.6%
inv-pow56.6%
Applied egg-rr56.6%
unpow-156.6%
Simplified56.6%
Taylor expanded in i around inf 56.4%
Taylor expanded in n around inf 53.9%
Taylor expanded in n around 0 78.5%
Final simplification64.4%
(FPCore (i n) :precision binary64 (if (or (<= n -1.16e+42) (not (<= n 4.4e+95))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -1.16e+42) || !(n <= 4.4e+95)) {
tmp = n * (100.0 + (i * 50.0));
} 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 <= (-1.16d+42)) .or. (.not. (n <= 4.4d+95))) then
tmp = n * (100.0d0 + (i * 50.0d0))
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 <= -1.16e+42) || !(n <= 4.4e+95)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.16e+42) or not (n <= 4.4e+95): tmp = n * (100.0 + (i * 50.0)) else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.16e+42) || !(n <= 4.4e+95)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); 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 <= -1.16e+42) || ~((n <= 4.4e+95))) tmp = n * (100.0 + (i * 50.0)); else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1.16e+42], N[Not[LessEqual[n, 4.4e+95]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.16 \cdot 10^{+42} \lor \neg \left(n \leq 4.4 \cdot 10^{+95}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -1.15999999999999995e42 or 4.3999999999999998e95 < n Initial program 19.0%
associate-/r/19.6%
associate-*r*19.6%
*-commutative19.6%
associate-*r/19.6%
sub-neg19.6%
distribute-lft-in19.6%
metadata-eval19.6%
metadata-eval19.6%
metadata-eval19.6%
fma-define19.6%
metadata-eval19.6%
Simplified19.6%
Taylor expanded in n around inf 44.9%
associate-/l*46.2%
sub-neg46.2%
metadata-eval46.2%
metadata-eval46.2%
distribute-lft-in46.2%
metadata-eval46.2%
sub-neg46.2%
associate-*r/46.2%
*-commutative46.2%
expm1-define94.1%
Simplified94.1%
Taylor expanded in i around 0 61.8%
*-commutative61.8%
Simplified61.8%
if -1.15999999999999995e42 < n < 4.3999999999999998e95Initial program 35.9%
Taylor expanded in i around 0 58.8%
Final simplification60.4%
(FPCore (i n) :precision binary64 (if (or (<= i -1000000000.0) (not (<= i 5e-5))) (* 100.0 (/ i (/ i n))) (* n 100.0)))
double code(double i, double n) {
double tmp;
if ((i <= -1000000000.0) || !(i <= 5e-5)) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * 100.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((i <= (-1000000000.0d0)) .or. (.not. (i <= 5d-5))) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = n * 100.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((i <= -1000000000.0) || !(i <= 5e-5)) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -1000000000.0) or not (i <= 5e-5): tmp = 100.0 * (i / (i / n)) else: tmp = n * 100.0 return tmp
function code(i, n) tmp = 0.0 if ((i <= -1000000000.0) || !(i <= 5e-5)) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(n * 100.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((i <= -1000000000.0) || ~((i <= 5e-5))) tmp = 100.0 * (i / (i / n)); else tmp = n * 100.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[i, -1000000000.0], N[Not[LessEqual[i, 5e-5]], $MachinePrecision]], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1000000000 \lor \neg \left(i \leq 5 \cdot 10^{-5}\right):\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if i < -1e9 or 5.00000000000000024e-5 < i Initial program 48.0%
Taylor expanded in i around 0 21.4%
if -1e9 < i < 5.00000000000000024e-5Initial program 8.3%
Taylor expanded in i around 0 84.4%
*-commutative84.4%
Simplified84.4%
Final simplification55.1%
(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 26.7%
Taylor expanded in i around 0 47.8%
*-commutative47.8%
Simplified47.8%
(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 26.7%
Taylor expanded in i around 0 52.3%
associate-*r*52.3%
associate-*r/52.3%
metadata-eval52.3%
Simplified52.3%
Taylor expanded in n around 0 2.8%
*-commutative2.8%
Simplified2.8%
(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 2024135
(FPCore (i n)
:name "Compound Interest"
:precision binary64
:alt
(! :herbie-platform default (let ((lnbase (if (== (+ 1 (/ i n)) 1) (/ i n) (/ (* (/ i n) (log (+ 1 (/ i n)))) (- (+ (/ i n) 1) 1))))) (* 100 (/ (- (exp (* n lnbase)) 1) (/ i n)))))
(* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))