
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (+ t_0 -1.0)) (t_2 (/ t_1 (/ i n))))
(if (<= t_2 -1e-51)
(/ (+ (* t_0 100.0) -100.0) (/ i n))
(if (<= t_2 1e-263)
(/ (* 100.0 (expm1 (* n (log1p (/ i n))))) (/ i n))
(if (<= t_2 INFINITY)
(* 100.0 (* n (/ t_1 i)))
(/
n
(+ 0.01 (+ (* i -0.005) (* 0.0008333333333333334 (pow i 2.0))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = t_0 + -1.0;
double t_2 = t_1 / (i / n);
double tmp;
if (t_2 <= -1e-51) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else if (t_2 <= 1e-263) {
tmp = (100.0 * expm1((n * log1p((i / n))))) / (i / n);
} else if (t_2 <= ((double) INFINITY)) {
tmp = 100.0 * (n * (t_1 / i));
} else {
tmp = n / (0.01 + ((i * -0.005) + (0.0008333333333333334 * pow(i, 2.0))));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = t_0 + -1.0;
double t_2 = t_1 / (i / n);
double tmp;
if (t_2 <= -1e-51) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else if (t_2 <= 1e-263) {
tmp = (100.0 * Math.expm1((n * Math.log1p((i / n))))) / (i / n);
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (n * (t_1 / i));
} else {
tmp = n / (0.01 + ((i * -0.005) + (0.0008333333333333334 * Math.pow(i, 2.0))));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = t_0 + -1.0 t_2 = t_1 / (i / n) tmp = 0 if t_2 <= -1e-51: tmp = ((t_0 * 100.0) + -100.0) / (i / n) elif t_2 <= 1e-263: tmp = (100.0 * math.expm1((n * math.log1p((i / n))))) / (i / n) elif t_2 <= math.inf: tmp = 100.0 * (n * (t_1 / i)) else: tmp = n / (0.01 + ((i * -0.005) + (0.0008333333333333334 * math.pow(i, 2.0)))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(t_0 + -1.0) t_2 = Float64(t_1 / Float64(i / n)) tmp = 0.0 if (t_2 <= -1e-51) tmp = Float64(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n)); elseif (t_2 <= 1e-263) tmp = Float64(Float64(100.0 * expm1(Float64(n * log1p(Float64(i / n))))) / Float64(i / n)); elseif (t_2 <= Inf) tmp = Float64(100.0 * Float64(n * Float64(t_1 / i))); else tmp = Float64(n / Float64(0.01 + Float64(Float64(i * -0.005) + Float64(0.0008333333333333334 * (i ^ 2.0))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + -1.0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-51], N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e-263], N[(N[(100.0 * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(100.0 * N[(n * N[(t$95$1 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(N[(i * -0.005), $MachinePrecision] + N[(0.0008333333333333334 * N[Power[i, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := t\_0 + -1\\
t_2 := \frac{t\_1}{\frac{i}{n}}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-51}:\\
\;\;\;\;\frac{t\_0 \cdot 100 + -100}{\frac{i}{n}}\\
\mathbf{elif}\;t\_2 \leq 10^{-263}:\\
\;\;\;\;\frac{100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{t\_1}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + \left(i \cdot -0.005 + 0.0008333333333333334 \cdot {i}^{2}\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -1e-51Initial program 99.7%
associate-*r/99.7%
sub-neg99.7%
distribute-lft-in100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-def100.0%
metadata-eval100.0%
Simplified100.0%
fma-udef100.0%
*-commutative100.0%
Applied egg-rr100.0%
if -1e-51 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 1e-263Initial program 24.5%
associate-*r/24.5%
sub-neg24.5%
distribute-lft-in24.5%
metadata-eval24.5%
metadata-eval24.5%
metadata-eval24.5%
fma-def24.5%
metadata-eval24.5%
Simplified24.5%
fma-udef24.5%
metadata-eval24.5%
distribute-lft-in24.5%
metadata-eval24.5%
sub-neg24.5%
*-commutative24.5%
add-exp-log24.5%
expm1-def24.5%
log-pow35.8%
log1p-udef99.7%
Applied egg-rr99.7%
if 1e-263 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.8%
associate-/r/99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-*r/0.0%
sub-neg0.0%
distribute-lft-in0.0%
metadata-eval0.0%
metadata-eval0.0%
metadata-eval0.0%
fma-def0.0%
metadata-eval0.0%
Simplified0.0%
Taylor expanded in n around inf 1.7%
associate-/l*1.7%
*-commutative1.7%
fma-neg1.7%
metadata-eval1.7%
Simplified1.7%
Taylor expanded in i around 0 99.8%
Final simplification99.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 -2e-315)
(* 100.0 (* n (/ t_0 i)))
(if (<= t_1 0.0)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= t_1 INFINITY)
(* t_1 100.0)
(/
n
(+ 0.01 (+ (* i -0.005) (* 0.0008333333333333334 (pow i 2.0))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= -2e-315) {
tmp = 100.0 * (n * (t_0 / i));
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_1 * 100.0;
} else {
tmp = n / (0.01 + ((i * -0.005) + (0.0008333333333333334 * pow(i, 2.0))));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= -2e-315) {
tmp = 100.0 * (n * (t_0 / i));
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1 * 100.0;
} else {
tmp = n / (0.01 + ((i * -0.005) + (0.0008333333333333334 * Math.pow(i, 2.0))));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) + -1.0 t_1 = t_0 / (i / n) tmp = 0 if t_1 <= -2e-315: tmp = 100.0 * (n * (t_0 / i)) elif t_1 <= 0.0: tmp = 100.0 * (n * (math.expm1(i) / i)) elif t_1 <= math.inf: tmp = t_1 * 100.0 else: tmp = n / (0.01 + ((i * -0.005) + (0.0008333333333333334 * math.pow(i, 2.0)))) return tmp
function code(i, n) t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) t_1 = Float64(t_0 / Float64(i / n)) tmp = 0.0 if (t_1 <= -2e-315) tmp = Float64(100.0 * Float64(n * Float64(t_0 / i))); elseif (t_1 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (t_1 <= Inf) tmp = Float64(t_1 * 100.0); else tmp = Float64(n / Float64(0.01 + Float64(Float64(i * -0.005) + Float64(0.0008333333333333334 * (i ^ 2.0))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-315], N[(100.0 * N[(n * N[(t$95$0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(t$95$1 * 100.0), $MachinePrecision], N[(n / N[(0.01 + N[(N[(i * -0.005), $MachinePrecision] + N[(0.0008333333333333334 * N[Power[i, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t\_0}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-315}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{t\_0}{i}\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1 \cdot 100\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + \left(i \cdot -0.005 + 0.0008333333333333334 \cdot {i}^{2}\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -2.0000000019e-315Initial program 95.0%
associate-/r/95.2%
sub-neg95.2%
metadata-eval95.2%
Simplified95.2%
if -2.0000000019e-315 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 22.2%
associate-/r/22.2%
sub-neg22.2%
metadata-eval22.2%
Simplified22.2%
Taylor expanded in n around inf 38.2%
expm1-def76.1%
Simplified76.1%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 96.7%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-*r/0.0%
sub-neg0.0%
distribute-lft-in0.0%
metadata-eval0.0%
metadata-eval0.0%
metadata-eval0.0%
fma-def0.0%
metadata-eval0.0%
Simplified0.0%
Taylor expanded in n around inf 1.7%
associate-/l*1.7%
*-commutative1.7%
fma-neg1.7%
metadata-eval1.7%
Simplified1.7%
Taylor expanded in i around 0 99.8%
Final simplification82.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 -2e-315)
(/ (+ (* t_0 100.0) -100.0) (/ i n))
(if (<= t_1 0.0)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= t_1 INFINITY)
(* t_1 100.0)
(/
n
(+ 0.01 (+ (* i -0.005) (* 0.0008333333333333334 (pow i 2.0))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -2e-315) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_1 * 100.0;
} else {
tmp = n / (0.01 + ((i * -0.005) + (0.0008333333333333334 * pow(i, 2.0))));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -2e-315) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1 * 100.0;
} else {
tmp = n / (0.01 + ((i * -0.005) + (0.0008333333333333334 * Math.pow(i, 2.0))));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= -2e-315: tmp = ((t_0 * 100.0) + -100.0) / (i / n) elif t_1 <= 0.0: tmp = 100.0 * (n * (math.expm1(i) / i)) elif t_1 <= math.inf: tmp = t_1 * 100.0 else: tmp = n / (0.01 + ((i * -0.005) + (0.0008333333333333334 * math.pow(i, 2.0)))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= -2e-315) tmp = Float64(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n)); elseif (t_1 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (t_1 <= Inf) tmp = Float64(t_1 * 100.0); else tmp = Float64(n / Float64(0.01 + Float64(Float64(i * -0.005) + Float64(0.0008333333333333334 * (i ^ 2.0))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-315], N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(t$95$1 * 100.0), $MachinePrecision], N[(n / N[(0.01 + N[(N[(i * -0.005), $MachinePrecision] + N[(0.0008333333333333334 * N[Power[i, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-315}:\\
\;\;\;\;\frac{t\_0 \cdot 100 + -100}{\frac{i}{n}}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1 \cdot 100\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + \left(i \cdot -0.005 + 0.0008333333333333334 \cdot {i}^{2}\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -2.0000000019e-315Initial program 95.0%
associate-*r/95.2%
sub-neg95.2%
distribute-lft-in95.2%
metadata-eval95.2%
metadata-eval95.2%
metadata-eval95.2%
fma-def95.3%
metadata-eval95.3%
Simplified95.3%
fma-udef95.2%
*-commutative95.2%
Applied egg-rr95.2%
if -2.0000000019e-315 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 22.2%
associate-/r/22.2%
sub-neg22.2%
metadata-eval22.2%
Simplified22.2%
Taylor expanded in n around inf 38.2%
expm1-def76.1%
Simplified76.1%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 96.7%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-*r/0.0%
sub-neg0.0%
distribute-lft-in0.0%
metadata-eval0.0%
metadata-eval0.0%
metadata-eval0.0%
fma-def0.0%
metadata-eval0.0%
Simplified0.0%
Taylor expanded in n around inf 1.7%
associate-/l*1.7%
*-commutative1.7%
fma-neg1.7%
metadata-eval1.7%
Simplified1.7%
Taylor expanded in i around 0 99.8%
Final simplification82.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (+ t_0 -1.0)) (t_2 (/ t_1 (/ i n))))
(if (<= t_2 -1e-119)
(/ (+ (* t_0 100.0) -100.0) (/ i n))
(if (<= t_2 1e-263)
(* 100.0 (/ (expm1 (* n (log1p (/ i n)))) (/ i n)))
(if (<= t_2 INFINITY)
(* 100.0 (* n (/ t_1 i)))
(/
n
(+ 0.01 (+ (* i -0.005) (* 0.0008333333333333334 (pow i 2.0))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = t_0 + -1.0;
double t_2 = t_1 / (i / n);
double tmp;
if (t_2 <= -1e-119) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else if (t_2 <= 1e-263) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) / (i / n));
} else if (t_2 <= ((double) INFINITY)) {
tmp = 100.0 * (n * (t_1 / i));
} else {
tmp = n / (0.01 + ((i * -0.005) + (0.0008333333333333334 * pow(i, 2.0))));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = t_0 + -1.0;
double t_2 = t_1 / (i / n);
double tmp;
if (t_2 <= -1e-119) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else if (t_2 <= 1e-263) {
tmp = 100.0 * (Math.expm1((n * Math.log1p((i / n)))) / (i / n));
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (n * (t_1 / i));
} else {
tmp = n / (0.01 + ((i * -0.005) + (0.0008333333333333334 * Math.pow(i, 2.0))));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = t_0 + -1.0 t_2 = t_1 / (i / n) tmp = 0 if t_2 <= -1e-119: tmp = ((t_0 * 100.0) + -100.0) / (i / n) elif t_2 <= 1e-263: tmp = 100.0 * (math.expm1((n * math.log1p((i / n)))) / (i / n)) elif t_2 <= math.inf: tmp = 100.0 * (n * (t_1 / i)) else: tmp = n / (0.01 + ((i * -0.005) + (0.0008333333333333334 * math.pow(i, 2.0)))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(t_0 + -1.0) t_2 = Float64(t_1 / Float64(i / n)) tmp = 0.0 if (t_2 <= -1e-119) tmp = Float64(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n)); elseif (t_2 <= 1e-263) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i / n))); elseif (t_2 <= Inf) tmp = Float64(100.0 * Float64(n * Float64(t_1 / i))); else tmp = Float64(n / Float64(0.01 + Float64(Float64(i * -0.005) + Float64(0.0008333333333333334 * (i ^ 2.0))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + -1.0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-119], N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e-263], N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(100.0 * N[(n * N[(t$95$1 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(N[(i * -0.005), $MachinePrecision] + N[(0.0008333333333333334 * N[Power[i, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := t\_0 + -1\\
t_2 := \frac{t\_1}{\frac{i}{n}}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-119}:\\
\;\;\;\;\frac{t\_0 \cdot 100 + -100}{\frac{i}{n}}\\
\mathbf{elif}\;t\_2 \leq 10^{-263}:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{t\_1}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + \left(i \cdot -0.005 + 0.0008333333333333334 \cdot {i}^{2}\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -1.00000000000000001e-119Initial program 99.4%
associate-*r/99.8%
sub-neg99.8%
distribute-lft-in100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-def100.0%
metadata-eval100.0%
Simplified100.0%
fma-udef100.0%
*-commutative100.0%
Applied egg-rr100.0%
if -1.00000000000000001e-119 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 1e-263Initial program 23.7%
associate-/r/23.7%
sub-neg23.7%
metadata-eval23.7%
Simplified23.7%
metadata-eval23.7%
sub-neg23.7%
associate-/r/23.7%
add-exp-log23.7%
expm1-def23.7%
log-pow35.0%
log1p-udef99.7%
Applied egg-rr99.7%
if 1e-263 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 99.8%
associate-/r/99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) Initial program 0.0%
associate-*r/0.0%
sub-neg0.0%
distribute-lft-in0.0%
metadata-eval0.0%
metadata-eval0.0%
metadata-eval0.0%
fma-def0.0%
metadata-eval0.0%
Simplified0.0%
Taylor expanded in n around inf 1.7%
associate-/l*1.7%
*-commutative1.7%
fma-neg1.7%
metadata-eval1.7%
Simplified1.7%
Taylor expanded in i around 0 99.8%
Final simplification99.7%
(FPCore (i n)
:precision binary64
(if (<= n -1.25e-238)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= n 1.3e-220)
0.0
(if (<= n 1.2e+23)
(/ n (+ 0.01 (+ (* i -0.005) (* 0.0008333333333333334 (pow i 2.0)))))
(/ (* (expm1 i) (* n 100.0)) i)))))
double code(double i, double n) {
double tmp;
if (n <= -1.25e-238) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (n <= 1.3e-220) {
tmp = 0.0;
} else if (n <= 1.2e+23) {
tmp = n / (0.01 + ((i * -0.005) + (0.0008333333333333334 * pow(i, 2.0))));
} else {
tmp = (expm1(i) * (n * 100.0)) / i;
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -1.25e-238) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (n <= 1.3e-220) {
tmp = 0.0;
} else if (n <= 1.2e+23) {
tmp = n / (0.01 + ((i * -0.005) + (0.0008333333333333334 * Math.pow(i, 2.0))));
} else {
tmp = (Math.expm1(i) * (n * 100.0)) / i;
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.25e-238: tmp = 100.0 * (n * (math.expm1(i) / i)) elif n <= 1.3e-220: tmp = 0.0 elif n <= 1.2e+23: tmp = n / (0.01 + ((i * -0.005) + (0.0008333333333333334 * math.pow(i, 2.0)))) else: tmp = (math.expm1(i) * (n * 100.0)) / i return tmp
function code(i, n) tmp = 0.0 if (n <= -1.25e-238) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (n <= 1.3e-220) tmp = 0.0; elseif (n <= 1.2e+23) tmp = Float64(n / Float64(0.01 + Float64(Float64(i * -0.005) + Float64(0.0008333333333333334 * (i ^ 2.0))))); else tmp = Float64(Float64(expm1(i) * Float64(n * 100.0)) / i); end return tmp end
code[i_, n_] := If[LessEqual[n, -1.25e-238], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.3e-220], 0.0, If[LessEqual[n, 1.2e+23], N[(n / N[(0.01 + N[(N[(i * -0.005), $MachinePrecision] + N[(0.0008333333333333334 * N[Power[i, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(Exp[i] - 1), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.25 \cdot 10^{-238}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;n \leq 1.3 \cdot 10^{-220}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 1.2 \cdot 10^{+23}:\\
\;\;\;\;\frac{n}{0.01 + \left(i \cdot -0.005 + 0.0008333333333333334 \cdot {i}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{expm1}\left(i\right) \cdot \left(n \cdot 100\right)}{i}\\
\end{array}
\end{array}
if n < -1.25e-238Initial program 24.5%
associate-/r/24.7%
sub-neg24.7%
metadata-eval24.7%
Simplified24.7%
Taylor expanded in n around inf 31.7%
expm1-def78.0%
Simplified78.1%
if -1.25e-238 < n < 1.3e-220Initial program 71.7%
associate-*r/71.7%
sub-neg71.7%
distribute-lft-in71.7%
metadata-eval71.7%
metadata-eval71.7%
metadata-eval71.7%
fma-def71.7%
metadata-eval71.7%
Simplified71.7%
fma-udef71.7%
*-commutative71.7%
Applied egg-rr71.7%
Taylor expanded in i around 0 80.4%
Taylor expanded in i around 0 80.4%
if 1.3e-220 < n < 1.2e23Initial program 23.5%
associate-*r/23.5%
sub-neg23.5%
distribute-lft-in23.4%
metadata-eval23.4%
metadata-eval23.4%
metadata-eval23.4%
fma-def23.5%
metadata-eval23.5%
Simplified23.5%
Taylor expanded in n around inf 6.8%
associate-/l*6.8%
*-commutative6.8%
fma-neg6.8%
metadata-eval6.8%
Simplified6.8%
Taylor expanded in i around 0 75.3%
if 1.2e23 < n Initial program 17.5%
*-commutative17.5%
associate-/r/17.9%
associate-*l*17.9%
sub-neg17.9%
metadata-eval17.9%
Simplified17.9%
Taylor expanded in n around inf 44.6%
expm1-def95.4%
Simplified95.4%
associate-*l/95.5%
Applied egg-rr95.5%
Final simplification82.4%
(FPCore (i n)
:precision binary64
(if (<= n -1.42e-238)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= n 8.6e-219)
0.0
(if (<= n 2.9)
(/ n (+ 0.01 (+ (* i -0.005) (* (pow i 2.0) 0.0025))))
(/ (* (expm1 i) (* n 100.0)) i)))))
double code(double i, double n) {
double tmp;
if (n <= -1.42e-238) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (n <= 8.6e-219) {
tmp = 0.0;
} else if (n <= 2.9) {
tmp = n / (0.01 + ((i * -0.005) + (pow(i, 2.0) * 0.0025)));
} else {
tmp = (expm1(i) * (n * 100.0)) / i;
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -1.42e-238) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (n <= 8.6e-219) {
tmp = 0.0;
} else if (n <= 2.9) {
tmp = n / (0.01 + ((i * -0.005) + (Math.pow(i, 2.0) * 0.0025)));
} else {
tmp = (Math.expm1(i) * (n * 100.0)) / i;
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.42e-238: tmp = 100.0 * (n * (math.expm1(i) / i)) elif n <= 8.6e-219: tmp = 0.0 elif n <= 2.9: tmp = n / (0.01 + ((i * -0.005) + (math.pow(i, 2.0) * 0.0025))) else: tmp = (math.expm1(i) * (n * 100.0)) / i return tmp
function code(i, n) tmp = 0.0 if (n <= -1.42e-238) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (n <= 8.6e-219) tmp = 0.0; elseif (n <= 2.9) tmp = Float64(n / Float64(0.01 + Float64(Float64(i * -0.005) + Float64((i ^ 2.0) * 0.0025)))); else tmp = Float64(Float64(expm1(i) * Float64(n * 100.0)) / i); end return tmp end
code[i_, n_] := If[LessEqual[n, -1.42e-238], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 8.6e-219], 0.0, If[LessEqual[n, 2.9], N[(n / N[(0.01 + N[(N[(i * -0.005), $MachinePrecision] + N[(N[Power[i, 2.0], $MachinePrecision] * 0.0025), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(Exp[i] - 1), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.42 \cdot 10^{-238}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;n \leq 8.6 \cdot 10^{-219}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 2.9:\\
\;\;\;\;\frac{n}{0.01 + \left(i \cdot -0.005 + {i}^{2} \cdot 0.0025\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{expm1}\left(i\right) \cdot \left(n \cdot 100\right)}{i}\\
\end{array}
\end{array}
if n < -1.4199999999999999e-238Initial program 24.5%
associate-/r/24.7%
sub-neg24.7%
metadata-eval24.7%
Simplified24.7%
Taylor expanded in n around inf 31.7%
expm1-def78.0%
Simplified78.1%
if -1.4199999999999999e-238 < n < 8.6000000000000005e-219Initial program 71.7%
associate-*r/71.7%
sub-neg71.7%
distribute-lft-in71.7%
metadata-eval71.7%
metadata-eval71.7%
metadata-eval71.7%
fma-def71.7%
metadata-eval71.7%
Simplified71.7%
fma-udef71.7%
*-commutative71.7%
Applied egg-rr71.7%
Taylor expanded in i around 0 80.4%
Taylor expanded in i around 0 80.4%
if 8.6000000000000005e-219 < n < 2.89999999999999991Initial program 23.6%
associate-*r/23.6%
sub-neg23.6%
distribute-lft-in23.5%
metadata-eval23.5%
metadata-eval23.5%
metadata-eval23.5%
fma-def23.6%
metadata-eval23.6%
Simplified23.6%
Taylor expanded in n around inf 5.4%
associate-/l*5.4%
*-commutative5.4%
fma-neg5.4%
metadata-eval5.4%
Simplified5.4%
Taylor expanded in i around 0 40.2%
Taylor expanded in i around 0 74.8%
if 2.89999999999999991 < n Initial program 17.8%
*-commutative17.8%
associate-/r/18.2%
associate-*l*18.2%
sub-neg18.2%
metadata-eval18.2%
Simplified18.2%
Taylor expanded in n around inf 42.9%
expm1-def94.3%
Simplified94.3%
associate-*l/94.4%
Applied egg-rr94.4%
Final simplification82.4%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (* n (/ (expm1 i) i)))))
(if (<= n -1.18e-237)
t_0
(if (<= n 3.6e-220) 0.0 (if (<= n 1.7) (/ (* i 100.0) (/ i n)) t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (n * (expm1(i) / i));
double tmp;
if (n <= -1.18e-237) {
tmp = t_0;
} else if (n <= 3.6e-220) {
tmp = 0.0;
} else if (n <= 1.7) {
tmp = (i * 100.0) / (i / n);
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * (n * (Math.expm1(i) / i));
double tmp;
if (n <= -1.18e-237) {
tmp = t_0;
} else if (n <= 3.6e-220) {
tmp = 0.0;
} else if (n <= 1.7) {
tmp = (i * 100.0) / (i / n);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n * (math.expm1(i) / i)) tmp = 0 if n <= -1.18e-237: tmp = t_0 elif n <= 3.6e-220: tmp = 0.0 elif n <= 1.7: tmp = (i * 100.0) / (i / n) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n * Float64(expm1(i) / i))) tmp = 0.0 if (n <= -1.18e-237) tmp = t_0; elseif (n <= 3.6e-220) tmp = 0.0; elseif (n <= 1.7) tmp = Float64(Float64(i * 100.0) / Float64(i / n)); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.18e-237], t$95$0, If[LessEqual[n, 3.6e-220], 0.0, If[LessEqual[n, 1.7], N[(N[(i * 100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{if}\;n \leq -1.18 \cdot 10^{-237}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 3.6 \cdot 10^{-220}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 1.7:\\
\;\;\;\;\frac{i \cdot 100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.18e-237 or 1.69999999999999996 < n Initial program 21.9%
associate-/r/22.2%
sub-neg22.2%
metadata-eval22.2%
Simplified22.2%
Taylor expanded in n around inf 36.1%
expm1-def84.4%
Simplified84.4%
if -1.18e-237 < n < 3.60000000000000021e-220Initial program 71.7%
associate-*r/71.7%
sub-neg71.7%
distribute-lft-in71.7%
metadata-eval71.7%
metadata-eval71.7%
metadata-eval71.7%
fma-def71.7%
metadata-eval71.7%
Simplified71.7%
fma-udef71.7%
*-commutative71.7%
Applied egg-rr71.7%
Taylor expanded in i around 0 80.4%
Taylor expanded in i around 0 80.4%
if 3.60000000000000021e-220 < n < 1.69999999999999996Initial program 23.6%
associate-*r/23.6%
sub-neg23.6%
distribute-lft-in23.5%
metadata-eval23.5%
metadata-eval23.5%
metadata-eval23.5%
fma-def23.6%
metadata-eval23.6%
Simplified23.6%
Taylor expanded in i around 0 66.7%
*-commutative66.7%
Simplified66.7%
Final simplification80.9%
(FPCore (i n)
:precision binary64
(if (<= n -1.08e-238)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= n 4.5e-218)
0.0
(if (<= n 1.75)
(/ (* i 100.0) (/ i n))
(* 100.0 (/ n (/ i (expm1 i))))))))
double code(double i, double n) {
double tmp;
if (n <= -1.08e-238) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (n <= 4.5e-218) {
tmp = 0.0;
} else if (n <= 1.75) {
tmp = (i * 100.0) / (i / n);
} else {
tmp = 100.0 * (n / (i / expm1(i)));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -1.08e-238) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (n <= 4.5e-218) {
tmp = 0.0;
} else if (n <= 1.75) {
tmp = (i * 100.0) / (i / n);
} else {
tmp = 100.0 * (n / (i / Math.expm1(i)));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.08e-238: tmp = 100.0 * (n * (math.expm1(i) / i)) elif n <= 4.5e-218: tmp = 0.0 elif n <= 1.75: tmp = (i * 100.0) / (i / n) else: tmp = 100.0 * (n / (i / math.expm1(i))) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.08e-238) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (n <= 4.5e-218) tmp = 0.0; elseif (n <= 1.75) tmp = Float64(Float64(i * 100.0) / Float64(i / n)); else tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); end return tmp end
code[i_, n_] := If[LessEqual[n, -1.08e-238], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.5e-218], 0.0, If[LessEqual[n, 1.75], N[(N[(i * 100.0), $MachinePrecision] / N[(i / n), $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 -1.08 \cdot 10^{-238}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;n \leq 4.5 \cdot 10^{-218}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 1.75:\\
\;\;\;\;\frac{i \cdot 100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\end{array}
\end{array}
if n < -1.08e-238Initial program 24.5%
associate-/r/24.7%
sub-neg24.7%
metadata-eval24.7%
Simplified24.7%
Taylor expanded in n around inf 31.7%
expm1-def78.0%
Simplified78.1%
if -1.08e-238 < n < 4.49999999999999977e-218Initial program 71.7%
associate-*r/71.7%
sub-neg71.7%
distribute-lft-in71.7%
metadata-eval71.7%
metadata-eval71.7%
metadata-eval71.7%
fma-def71.7%
metadata-eval71.7%
Simplified71.7%
fma-udef71.7%
*-commutative71.7%
Applied egg-rr71.7%
Taylor expanded in i around 0 80.4%
Taylor expanded in i around 0 80.4%
if 4.49999999999999977e-218 < n < 1.75Initial program 23.6%
associate-*r/23.6%
sub-neg23.6%
distribute-lft-in23.5%
metadata-eval23.5%
metadata-eval23.5%
metadata-eval23.5%
fma-def23.6%
metadata-eval23.6%
Simplified23.6%
Taylor expanded in i around 0 66.7%
*-commutative66.7%
Simplified66.7%
if 1.75 < n Initial program 17.8%
associate-/r/18.2%
sub-neg18.2%
metadata-eval18.2%
Simplified18.2%
Taylor expanded in n around inf 43.0%
associate-/l*43.0%
expm1-def94.4%
Simplified94.4%
Final simplification80.9%
(FPCore (i n)
:precision binary64
(if (<= n -2.3e-241)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= n 1.7e-218)
0.0
(if (<= n 1.9) (/ (* i 100.0) (/ i n)) (/ (* (expm1 i) (* n 100.0)) i)))))
double code(double i, double n) {
double tmp;
if (n <= -2.3e-241) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (n <= 1.7e-218) {
tmp = 0.0;
} else if (n <= 1.9) {
tmp = (i * 100.0) / (i / n);
} else {
tmp = (expm1(i) * (n * 100.0)) / i;
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -2.3e-241) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (n <= 1.7e-218) {
tmp = 0.0;
} else if (n <= 1.9) {
tmp = (i * 100.0) / (i / n);
} else {
tmp = (Math.expm1(i) * (n * 100.0)) / i;
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.3e-241: tmp = 100.0 * (n * (math.expm1(i) / i)) elif n <= 1.7e-218: tmp = 0.0 elif n <= 1.9: tmp = (i * 100.0) / (i / n) else: tmp = (math.expm1(i) * (n * 100.0)) / i return tmp
function code(i, n) tmp = 0.0 if (n <= -2.3e-241) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (n <= 1.7e-218) tmp = 0.0; elseif (n <= 1.9) tmp = Float64(Float64(i * 100.0) / Float64(i / n)); else tmp = Float64(Float64(expm1(i) * Float64(n * 100.0)) / i); end return tmp end
code[i_, n_] := If[LessEqual[n, -2.3e-241], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.7e-218], 0.0, If[LessEqual[n, 1.9], N[(N[(i * 100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(N[(N[(Exp[i] - 1), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.3 \cdot 10^{-241}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;n \leq 1.7 \cdot 10^{-218}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 1.9:\\
\;\;\;\;\frac{i \cdot 100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{expm1}\left(i\right) \cdot \left(n \cdot 100\right)}{i}\\
\end{array}
\end{array}
if n < -2.2999999999999999e-241Initial program 24.5%
associate-/r/24.7%
sub-neg24.7%
metadata-eval24.7%
Simplified24.7%
Taylor expanded in n around inf 31.7%
expm1-def78.0%
Simplified78.1%
if -2.2999999999999999e-241 < n < 1.69999999999999993e-218Initial program 71.7%
associate-*r/71.7%
sub-neg71.7%
distribute-lft-in71.7%
metadata-eval71.7%
metadata-eval71.7%
metadata-eval71.7%
fma-def71.7%
metadata-eval71.7%
Simplified71.7%
fma-udef71.7%
*-commutative71.7%
Applied egg-rr71.7%
Taylor expanded in i around 0 80.4%
Taylor expanded in i around 0 80.4%
if 1.69999999999999993e-218 < n < 1.8999999999999999Initial program 23.6%
associate-*r/23.6%
sub-neg23.6%
distribute-lft-in23.5%
metadata-eval23.5%
metadata-eval23.5%
metadata-eval23.5%
fma-def23.6%
metadata-eval23.6%
Simplified23.6%
Taylor expanded in i around 0 66.7%
*-commutative66.7%
Simplified66.7%
if 1.8999999999999999 < n Initial program 17.8%
*-commutative17.8%
associate-/r/18.2%
associate-*l*18.2%
sub-neg18.2%
metadata-eval18.2%
Simplified18.2%
Taylor expanded in n around inf 42.9%
expm1-def94.3%
Simplified94.3%
associate-*l/94.4%
Applied egg-rr94.4%
Final simplification80.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ n (+ 0.01 (* i -0.005)))))
(if (<= n -9e-238)
t_0
(if (<= n 8.6e-218)
0.0
(if (<= n 1.85e+24) t_0 (* n (+ 100.0 (* i 50.0))))))))
double code(double i, double n) {
double t_0 = n / (0.01 + (i * -0.005));
double tmp;
if (n <= -9e-238) {
tmp = t_0;
} else if (n <= 8.6e-218) {
tmp = 0.0;
} else if (n <= 1.85e+24) {
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 = n / (0.01d0 + (i * (-0.005d0)))
if (n <= (-9d-238)) then
tmp = t_0
else if (n <= 8.6d-218) then
tmp = 0.0d0
else if (n <= 1.85d+24) 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 = n / (0.01 + (i * -0.005));
double tmp;
if (n <= -9e-238) {
tmp = t_0;
} else if (n <= 8.6e-218) {
tmp = 0.0;
} else if (n <= 1.85e+24) {
tmp = t_0;
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): t_0 = n / (0.01 + (i * -0.005)) tmp = 0 if n <= -9e-238: tmp = t_0 elif n <= 8.6e-218: tmp = 0.0 elif n <= 1.85e+24: tmp = t_0 else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) t_0 = Float64(n / Float64(0.01 + Float64(i * -0.005))) tmp = 0.0 if (n <= -9e-238) tmp = t_0; elseif (n <= 8.6e-218) tmp = 0.0; elseif (n <= 1.85e+24) 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 = n / (0.01 + (i * -0.005)); tmp = 0.0; if (n <= -9e-238) tmp = t_0; elseif (n <= 8.6e-218) tmp = 0.0; elseif (n <= 1.85e+24) tmp = t_0; else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -9e-238], t$95$0, If[LessEqual[n, 8.6e-218], 0.0, If[LessEqual[n, 1.85e+24], t$95$0, N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{if}\;n \leq -9 \cdot 10^{-238}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 8.6 \cdot 10^{-218}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 1.85 \cdot 10^{+24}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -8.99999999999999992e-238 or 8.6e-218 < n < 1.85e24Initial program 24.6%
associate-*r/24.6%
sub-neg24.6%
distribute-lft-in24.6%
metadata-eval24.6%
metadata-eval24.6%
metadata-eval24.6%
fma-def24.6%
metadata-eval24.6%
Simplified24.6%
Taylor expanded in n around inf 24.6%
associate-/l*24.5%
*-commutative24.5%
fma-neg24.6%
metadata-eval24.6%
Simplified24.6%
Taylor expanded in i around 0 62.0%
*-commutative62.0%
Simplified62.0%
if -8.99999999999999992e-238 < n < 8.6e-218Initial program 71.7%
associate-*r/71.7%
sub-neg71.7%
distribute-lft-in71.7%
metadata-eval71.7%
metadata-eval71.7%
metadata-eval71.7%
fma-def71.7%
metadata-eval71.7%
Simplified71.7%
fma-udef71.7%
*-commutative71.7%
Applied egg-rr71.7%
Taylor expanded in i around 0 80.4%
Taylor expanded in i around 0 80.4%
if 1.85e24 < n Initial program 16.2%
*-commutative16.2%
associate-/r/16.7%
associate-*l*16.7%
sub-neg16.7%
metadata-eval16.7%
Simplified16.7%
Taylor expanded in n around inf 43.8%
expm1-def95.3%
Simplified95.3%
Taylor expanded in i around 0 75.1%
+-commutative75.1%
associate-*r*75.1%
distribute-rgt-out75.1%
Simplified75.1%
Final simplification67.0%
(FPCore (i n)
:precision binary64
(if (<= n -1.12e-243)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 1.1e-219)
0.0
(if (<= n 0.5) (/ (* i 100.0) (/ i n)) (* n (+ 100.0 (* i 50.0)))))))
double code(double i, double n) {
double tmp;
if (n <= -1.12e-243) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 1.1e-219) {
tmp = 0.0;
} else if (n <= 0.5) {
tmp = (i * 100.0) / (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 <= (-1.12d-243)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 1.1d-219) then
tmp = 0.0d0
else if (n <= 0.5d0) then
tmp = (i * 100.0d0) / (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 <= -1.12e-243) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 1.1e-219) {
tmp = 0.0;
} else if (n <= 0.5) {
tmp = (i * 100.0) / (i / n);
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.12e-243: tmp = n / (0.01 + (i * -0.005)) elif n <= 1.1e-219: tmp = 0.0 elif n <= 0.5: tmp = (i * 100.0) / (i / n) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.12e-243) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 1.1e-219) tmp = 0.0; elseif (n <= 0.5) tmp = Float64(Float64(i * 100.0) / 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 <= -1.12e-243) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 1.1e-219) tmp = 0.0; elseif (n <= 0.5) tmp = (i * 100.0) / (i / n); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.12e-243], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.1e-219], 0.0, If[LessEqual[n, 0.5], N[(N[(i * 100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.12 \cdot 10^{-243}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 1.1 \cdot 10^{-219}:\\
\;\;\;\;0\\
\mathbf{elif}\;n \leq 0.5:\\
\;\;\;\;\frac{i \cdot 100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -1.12000000000000005e-243Initial program 24.5%
associate-*r/24.5%
sub-neg24.5%
distribute-lft-in24.5%
metadata-eval24.5%
metadata-eval24.5%
metadata-eval24.5%
fma-def24.5%
metadata-eval24.5%
Simplified24.5%
Taylor expanded in n around inf 31.7%
associate-/l*31.6%
*-commutative31.6%
fma-neg31.6%
metadata-eval31.6%
Simplified31.6%
Taylor expanded in i around 0 60.2%
*-commutative60.2%
Simplified60.2%
if -1.12000000000000005e-243 < n < 1.1e-219Initial program 71.7%
associate-*r/71.7%
sub-neg71.7%
distribute-lft-in71.7%
metadata-eval71.7%
metadata-eval71.7%
metadata-eval71.7%
fma-def71.7%
metadata-eval71.7%
Simplified71.7%
fma-udef71.7%
*-commutative71.7%
Applied egg-rr71.7%
Taylor expanded in i around 0 80.4%
Taylor expanded in i around 0 80.4%
if 1.1e-219 < n < 0.5Initial program 23.6%
associate-*r/23.6%
sub-neg23.6%
distribute-lft-in23.5%
metadata-eval23.5%
metadata-eval23.5%
metadata-eval23.5%
fma-def23.6%
metadata-eval23.6%
Simplified23.6%
Taylor expanded in i around 0 66.7%
*-commutative66.7%
Simplified66.7%
if 0.5 < n Initial program 17.8%
*-commutative17.8%
associate-/r/18.2%
associate-*l*18.2%
sub-neg18.2%
metadata-eval18.2%
Simplified18.2%
Taylor expanded in n around inf 42.9%
expm1-def94.3%
Simplified94.3%
Taylor expanded in i around 0 73.9%
+-commutative73.9%
associate-*r*73.9%
distribute-rgt-out73.9%
Simplified73.9%
Final simplification67.1%
(FPCore (i n) :precision binary64 (if (or (<= n -3.7e-169) (not (<= n 4.6e-42))) (* n (+ 100.0 (* i 50.0))) 0.0))
double code(double i, double n) {
double tmp;
if ((n <= -3.7e-169) || !(n <= 4.6e-42)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-3.7d-169)) .or. (.not. (n <= 4.6d-42))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -3.7e-169) || !(n <= 4.6e-42)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -3.7e-169) or not (n <= 4.6e-42): tmp = n * (100.0 + (i * 50.0)) else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if ((n <= -3.7e-169) || !(n <= 4.6e-42)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -3.7e-169) || ~((n <= 4.6e-42))) tmp = n * (100.0 + (i * 50.0)); else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -3.7e-169], N[Not[LessEqual[n, 4.6e-42]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.7 \cdot 10^{-169} \lor \neg \left(n \leq 4.6 \cdot 10^{-42}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if n < -3.6999999999999997e-169 or 4.60000000000000008e-42 < n Initial program 19.3%
*-commutative19.3%
associate-/r/19.7%
associate-*l*19.7%
sub-neg19.7%
metadata-eval19.7%
Simplified19.7%
Taylor expanded in n around inf 34.8%
expm1-def85.6%
Simplified85.6%
Taylor expanded in i around 0 64.6%
+-commutative64.6%
associate-*r*64.6%
distribute-rgt-out64.6%
Simplified64.6%
if -3.6999999999999997e-169 < n < 4.60000000000000008e-42Initial program 42.5%
associate-*r/42.5%
sub-neg42.5%
distribute-lft-in42.5%
metadata-eval42.5%
metadata-eval42.5%
metadata-eval42.5%
fma-def42.5%
metadata-eval42.5%
Simplified42.5%
fma-udef42.5%
*-commutative42.5%
Applied egg-rr42.5%
Taylor expanded in i around 0 59.8%
Taylor expanded in i around 0 59.8%
Final simplification63.1%
(FPCore (i n) :precision binary64 (if (<= i -165000000000.0) 0.0 (if (<= i 140000000000.0) (* n 100.0) 0.0)))
double code(double i, double n) {
double tmp;
if (i <= -165000000000.0) {
tmp = 0.0;
} else if (i <= 140000000000.0) {
tmp = n * 100.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-165000000000.0d0)) then
tmp = 0.0d0
else if (i <= 140000000000.0d0) then
tmp = n * 100.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -165000000000.0) {
tmp = 0.0;
} else if (i <= 140000000000.0) {
tmp = n * 100.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -165000000000.0: tmp = 0.0 elif i <= 140000000000.0: tmp = n * 100.0 else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if (i <= -165000000000.0) tmp = 0.0; elseif (i <= 140000000000.0) tmp = Float64(n * 100.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -165000000000.0) tmp = 0.0; elseif (i <= 140000000000.0) tmp = n * 100.0; else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -165000000000.0], 0.0, If[LessEqual[i, 140000000000.0], N[(n * 100.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -165000000000:\\
\;\;\;\;0\\
\mathbf{elif}\;i \leq 140000000000:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if i < -1.65e11 or 1.4e11 < i Initial program 48.8%
associate-*r/48.8%
sub-neg48.8%
distribute-lft-in48.8%
metadata-eval48.8%
metadata-eval48.8%
metadata-eval48.8%
fma-def48.8%
metadata-eval48.8%
Simplified48.8%
fma-udef48.8%
*-commutative48.8%
Applied egg-rr48.8%
Taylor expanded in i around 0 36.9%
Taylor expanded in i around 0 36.9%
if -1.65e11 < i < 1.4e11Initial program 11.5%
associate-/r/11.9%
sub-neg11.9%
metadata-eval11.9%
Simplified11.9%
Taylor expanded in i around 0 78.2%
*-commutative78.2%
Simplified78.2%
Final simplification61.4%
(FPCore (i n) :precision binary64 0.0)
double code(double i, double n) {
return 0.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 0.0d0
end function
public static double code(double i, double n) {
return 0.0;
}
def code(i, n): return 0.0
function code(i, n) return 0.0 end
function tmp = code(i, n) tmp = 0.0; end
code[i_, n_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 26.7%
associate-*r/26.7%
sub-neg26.7%
distribute-lft-in26.7%
metadata-eval26.7%
metadata-eval26.7%
metadata-eval26.7%
fma-def26.7%
metadata-eval26.7%
Simplified26.7%
fma-udef26.7%
*-commutative26.7%
Applied egg-rr26.7%
Taylor expanded in i around 0 21.8%
Taylor expanded in i around 0 22.0%
Final simplification22.0%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ 1.0 (/ i n))))
(*
100.0
(/
(-
(exp
(*
n
(if (== t_0 1.0)
(/ i n)
(/ (* (/ i n) (log t_0)) (- (+ (/ i n) 1.0) 1.0)))))
1.0)
(/ i n)))))
double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (i / n)
if (t_0 == 1.0d0) then
tmp = i / n
else
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0d0) - 1.0d0)
end if
code = 100.0d0 * ((exp((n * tmp)) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * Math.log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((Math.exp((n * tmp)) - 1.0) / (i / n));
}
def code(i, n): t_0 = 1.0 + (i / n) tmp = 0 if t_0 == 1.0: tmp = i / n else: tmp = ((i / n) * math.log(t_0)) / (((i / n) + 1.0) - 1.0) return 100.0 * ((math.exp((n * tmp)) - 1.0) / (i / n))
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) tmp = 0.0 if (t_0 == 1.0) tmp = Float64(i / n); else tmp = Float64(Float64(Float64(i / n) * log(t_0)) / Float64(Float64(Float64(i / n) + 1.0) - 1.0)); end return Float64(100.0 * Float64(Float64(exp(Float64(n * tmp)) - 1.0) / Float64(i / n))) end
function tmp_2 = code(i, n) t_0 = 1.0 + (i / n); tmp = 0.0; if (t_0 == 1.0) tmp = i / n; else tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0); end tmp_2 = 100.0 * ((exp((n * tmp)) - 1.0) / (i / n)); end
code[i_, n_] := Block[{t$95$0 = N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision]}, N[(100.0 * N[(N[(N[Exp[N[(n * If[Equal[t$95$0, 1.0], N[(i / n), $MachinePrecision], N[(N[(N[(i / n), $MachinePrecision] * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(i / n), $MachinePrecision] + 1.0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{i}{n}\\
100 \cdot \frac{e^{n \cdot \begin{array}{l}
\mathbf{if}\;t\_0 = 1:\\
\;\;\;\;\frac{i}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{i}{n} \cdot \log t\_0}{\left(\frac{i}{n} + 1\right) - 1}\\
\end{array}} - 1}{\frac{i}{n}}
\end{array}
\end{array}
herbie shell --seed 2024036
(FPCore (i n)
:name "Compound Interest"
:precision binary64
:herbie-target
(* 100.0 (/ (- (exp (* n (if (== (+ 1.0 (/ i n)) 1.0) (/ i n) (/ (* (/ i n) (log (+ 1.0 (/ i n)))) (- (+ (/ i n) 1.0) 1.0))))) 1.0) (/ i n)))
(* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))