
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 (- INFINITY))
(*
n
(+
100.0
(* i (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))
(if (<= t_1 1e-238)
(* 100.0 (/ (expm1 (* n (log1p (/ i n)))) (/ i n)))
(if (<= t_1 INFINITY)
(/ n (/ i (fma t_0 100.0 -100.0)))
(* n (/ 100.0 (+ 1.0 (* i (+ (/ 0.5 n) -0.5))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
} else if (t_1 <= 1e-238) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) / (i / n));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n / (i / fma(t_0, 100.0, -100.0));
} else {
tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5))));
}
return tmp;
}
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))); elseif (t_1 <= 1e-238) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i / n))); elseif (t_1 <= Inf) tmp = Float64(n / Float64(i / fma(t_0, 100.0, -100.0))); else tmp = Float64(n * Float64(100.0 / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(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], If[LessEqual[t$95$1, 1e-238], 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$1, Infinity], N[(n / N[(i / N[(t$95$0 * 100.0 + -100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $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 -\infty:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\mathbf{elif}\;t\_1 \leq 10^{-238}:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{n}{\frac{i}{\mathsf{fma}\left(t\_0, 100, -100\right)}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\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)) < -inf.0Initial program 100.0%
associate-/r/100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r/100.0%
sub-neg100.0%
distribute-lft-in100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-define100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in n around inf 33.9%
sub-neg33.9%
metadata-eval33.9%
metadata-eval33.9%
distribute-lft-in33.9%
metadata-eval33.9%
sub-neg33.9%
expm1-define33.9%
Simplified33.9%
Taylor expanded in i around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 9.9999999999999999e-239Initial program 26.4%
sub-neg26.4%
metadata-eval26.4%
Applied egg-rr26.4%
metadata-eval26.4%
sub-neg26.4%
exp-to-pow26.4%
log1p-undefine50.6%
*-commutative50.6%
expm1-undefine99.6%
Simplified99.6%
if 9.9999999999999999e-239 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 99.3%
associate-*r/99.6%
sub-neg99.6%
distribute-rgt-in99.6%
metadata-eval99.6%
metadata-eval99.6%
associate-/r/99.6%
*-commutative99.6%
fma-undefine99.6%
clear-num99.7%
associate-*l/99.7%
*-un-lft-identity99.7%
fma-undefine99.7%
*-commutative99.7%
fma-define99.7%
Applied egg-rr99.7%
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%
associate-*r/0.0%
sub-neg0.0%
distribute-rgt-in0.0%
metadata-eval0.0%
metadata-eval0.0%
Simplified0.0%
metadata-eval0.0%
metadata-eval0.0%
distribute-rgt-in0.0%
sub-neg0.0%
associate-*r/0.0%
associate-/r/1.9%
associate-*r*1.9%
add-exp-log1.9%
expm1-define1.9%
log-pow1.9%
log1p-define1.9%
Applied egg-rr1.9%
clear-num1.9%
un-div-inv1.9%
Applied egg-rr1.9%
Taylor expanded in i around 0 99.4%
sub-neg99.4%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Final simplification99.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 (- INFINITY))
(*
n
(+
100.0
(* i (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))
(if (<= t_1 1e-238)
(* 100.0 (/ (expm1 (* n (log1p (/ i n)))) (/ i n)))
(if (<= t_1 INFINITY)
(* n (/ (+ -100.0 (* t_0 100.0)) i))
(* n (/ 100.0 (+ 1.0 (* i (+ (/ 0.5 n) -0.5))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
} else if (t_1 <= 1e-238) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) / (i / n));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * ((-100.0 + (t_0 * 100.0)) / i);
} else {
tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5))));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
} else if (t_1 <= 1e-238) {
tmp = 100.0 * (Math.expm1((n * Math.log1p((i / n)))) / (i / n));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * ((-100.0 + (t_0 * 100.0)) / i);
} else {
tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5))));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= -math.inf: tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))) elif t_1 <= 1e-238: tmp = 100.0 * (math.expm1((n * math.log1p((i / n)))) / (i / n)) elif t_1 <= math.inf: tmp = n * ((-100.0 + (t_0 * 100.0)) / i) else: tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5)))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))); elseif (t_1 <= 1e-238) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i / n))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(-100.0 + Float64(t_0 * 100.0)) / i)); else tmp = Float64(n * Float64(100.0 / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(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], If[LessEqual[t$95$1, 1e-238], 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$1, Infinity], N[(n * N[(N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $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 -\infty:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\mathbf{elif}\;t\_1 \leq 10^{-238}:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{-100 + t\_0 \cdot 100}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\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)) < -inf.0Initial program 100.0%
associate-/r/100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r/100.0%
sub-neg100.0%
distribute-lft-in100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-define100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in n around inf 33.9%
sub-neg33.9%
metadata-eval33.9%
metadata-eval33.9%
distribute-lft-in33.9%
metadata-eval33.9%
sub-neg33.9%
expm1-define33.9%
Simplified33.9%
Taylor expanded in i around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 9.9999999999999999e-239Initial program 26.4%
sub-neg26.4%
metadata-eval26.4%
Applied egg-rr26.4%
metadata-eval26.4%
sub-neg26.4%
exp-to-pow26.4%
log1p-undefine50.6%
*-commutative50.6%
expm1-undefine99.6%
Simplified99.6%
if 9.9999999999999999e-239 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 99.3%
associate-/r/99.6%
associate-*r*99.6%
*-commutative99.6%
associate-*r/99.6%
sub-neg99.6%
distribute-lft-in99.6%
metadata-eval99.6%
metadata-eval99.6%
metadata-eval99.6%
fma-define99.6%
metadata-eval99.6%
Simplified99.6%
fma-undefine99.6%
*-commutative99.6%
Applied egg-rr99.6%
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%
associate-*r/0.0%
sub-neg0.0%
distribute-rgt-in0.0%
metadata-eval0.0%
metadata-eval0.0%
Simplified0.0%
metadata-eval0.0%
metadata-eval0.0%
distribute-rgt-in0.0%
sub-neg0.0%
associate-*r/0.0%
associate-/r/1.9%
associate-*r*1.9%
add-exp-log1.9%
expm1-define1.9%
log-pow1.9%
log1p-define1.9%
Applied egg-rr1.9%
clear-num1.9%
un-div-inv1.9%
Applied egg-rr1.9%
Taylor expanded in i around 0 99.4%
sub-neg99.4%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Final simplification99.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 (- INFINITY))
(*
n
(+
100.0
(* i (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))
(if (<= t_1 1e-238)
(* 100.0 (* n (/ (expm1 (* n (log1p (/ i n)))) i)))
(if (<= t_1 INFINITY)
(* n (/ (+ -100.0 (* t_0 100.0)) i))
(* n (/ 100.0 (+ 1.0 (* i (+ (/ 0.5 n) -0.5))))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
} else if (t_1 <= 1e-238) {
tmp = 100.0 * (n * (expm1((n * log1p((i / n)))) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * ((-100.0 + (t_0 * 100.0)) / i);
} else {
tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5))));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
} else if (t_1 <= 1e-238) {
tmp = 100.0 * (n * (Math.expm1((n * Math.log1p((i / n)))) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * ((-100.0 + (t_0 * 100.0)) / i);
} else {
tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5))));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= -math.inf: tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))) elif t_1 <= 1e-238: tmp = 100.0 * (n * (math.expm1((n * math.log1p((i / n)))) / i)) elif t_1 <= math.inf: tmp = n * ((-100.0 + (t_0 * 100.0)) / i) else: tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5)))) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))); elseif (t_1 <= 1e-238) tmp = Float64(100.0 * Float64(n * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(-100.0 + Float64(t_0 * 100.0)) / i)); else tmp = Float64(n * Float64(100.0 / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(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], If[LessEqual[t$95$1, 1e-238], N[(100.0 * N[(n * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $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 -\infty:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\mathbf{elif}\;t\_1 \leq 10^{-238}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{-100 + t\_0 \cdot 100}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\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)) < -inf.0Initial program 100.0%
associate-/r/100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*r/100.0%
sub-neg100.0%
distribute-lft-in100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
fma-define100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in n around inf 33.9%
sub-neg33.9%
metadata-eval33.9%
metadata-eval33.9%
distribute-lft-in33.9%
metadata-eval33.9%
sub-neg33.9%
expm1-define33.9%
Simplified33.9%
Taylor expanded in i around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 9.9999999999999999e-239Initial program 26.4%
associate-/r/25.7%
add-exp-log25.7%
expm1-define25.7%
log-pow36.8%
log1p-define98.3%
Applied egg-rr98.3%
if 9.9999999999999999e-239 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 99.3%
associate-/r/99.6%
associate-*r*99.6%
*-commutative99.6%
associate-*r/99.6%
sub-neg99.6%
distribute-lft-in99.6%
metadata-eval99.6%
metadata-eval99.6%
metadata-eval99.6%
fma-define99.6%
metadata-eval99.6%
Simplified99.6%
fma-undefine99.6%
*-commutative99.6%
Applied egg-rr99.6%
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%
associate-*r/0.0%
sub-neg0.0%
distribute-rgt-in0.0%
metadata-eval0.0%
metadata-eval0.0%
Simplified0.0%
metadata-eval0.0%
metadata-eval0.0%
distribute-rgt-in0.0%
sub-neg0.0%
associate-*r/0.0%
associate-/r/1.9%
associate-*r*1.9%
add-exp-log1.9%
expm1-define1.9%
log-pow1.9%
log1p-define1.9%
Applied egg-rr1.9%
clear-num1.9%
un-div-inv1.9%
Applied egg-rr1.9%
Taylor expanded in i around 0 99.4%
sub-neg99.4%
associate-*r/99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
Final simplification98.6%
(FPCore (i n) :precision binary64 (if (or (<= n -4.8e-5) (not (<= n 900000000.0))) (* n (/ (* 100.0 (expm1 i)) i)) (* n (/ 100.0 (+ 1.0 (* i (+ (/ 0.5 n) -0.5)))))))
double code(double i, double n) {
double tmp;
if ((n <= -4.8e-5) || !(n <= 900000000.0)) {
tmp = n * ((100.0 * expm1(i)) / i);
} else {
tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5))));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -4.8e-5) || !(n <= 900000000.0)) {
tmp = n * ((100.0 * Math.expm1(i)) / i);
} else {
tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -4.8e-5) or not (n <= 900000000.0): tmp = n * ((100.0 * math.expm1(i)) / i) else: tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5)))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -4.8e-5) || !(n <= 900000000.0)) tmp = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)); else tmp = Float64(n * Float64(100.0 / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5))))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -4.8e-5], N[Not[LessEqual[n, 900000000.0]], $MachinePrecision]], N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.8 \cdot 10^{-5} \lor \neg \left(n \leq 900000000\right):\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\end{array}
\end{array}
if n < -4.8000000000000001e-5 or 9e8 < n Initial program 25.4%
associate-/r/26.0%
associate-*r*26.0%
*-commutative26.0%
associate-*r/26.0%
sub-neg26.0%
distribute-lft-in26.0%
metadata-eval26.0%
metadata-eval26.0%
metadata-eval26.0%
fma-define26.0%
metadata-eval26.0%
Simplified26.0%
Taylor expanded in n around inf 41.4%
sub-neg41.4%
metadata-eval41.4%
metadata-eval41.4%
distribute-lft-in41.5%
metadata-eval41.5%
sub-neg41.5%
expm1-define88.7%
Simplified88.7%
if -4.8000000000000001e-5 < n < 9e8Initial program 36.1%
associate-*r/36.1%
sub-neg36.1%
distribute-rgt-in36.1%
metadata-eval36.1%
metadata-eval36.1%
Simplified36.1%
metadata-eval36.1%
metadata-eval36.1%
distribute-rgt-in36.1%
sub-neg36.1%
associate-*r/36.1%
associate-/r/35.0%
associate-*r*35.0%
add-exp-log35.0%
expm1-define35.0%
log-pow55.7%
log1p-define90.1%
Applied egg-rr90.1%
clear-num90.1%
un-div-inv90.1%
Applied egg-rr90.1%
Taylor expanded in i around 0 80.0%
sub-neg80.0%
associate-*r/80.0%
metadata-eval80.0%
metadata-eval80.0%
Simplified80.0%
Final simplification85.5%
(FPCore (i n)
:precision binary64
(if (or (<= n -7.5e+150) (not (<= n 1.3)))
(/
(*
(* n 100.0)
(*
i
(+
1.0
(*
i
(+ 0.5 (* i (+ 0.16666666666666666 (* i 0.041666666666666664))))))))
i)
(* n (/ 100.0 (+ 1.0 (* i (+ (/ 0.5 n) -0.5)))))))
double code(double i, double n) {
double tmp;
if ((n <= -7.5e+150) || !(n <= 1.3)) {
tmp = ((n * 100.0) * (i * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))))) / i;
} else {
tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-7.5d+150)) .or. (.not. (n <= 1.3d0))) then
tmp = ((n * 100.0d0) * (i * (1.0d0 + (i * (0.5d0 + (i * (0.16666666666666666d0 + (i * 0.041666666666666664d0)))))))) / i
else
tmp = n * (100.0d0 / (1.0d0 + (i * ((0.5d0 / n) + (-0.5d0)))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -7.5e+150) || !(n <= 1.3)) {
tmp = ((n * 100.0) * (i * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))))) / i;
} else {
tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -7.5e+150) or not (n <= 1.3): tmp = ((n * 100.0) * (i * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))))) / i else: tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5)))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -7.5e+150) || !(n <= 1.3)) tmp = Float64(Float64(Float64(n * 100.0) * Float64(i * Float64(1.0 + Float64(i * Float64(0.5 + Float64(i * Float64(0.16666666666666666 + Float64(i * 0.041666666666666664)))))))) / i); else tmp = Float64(n * Float64(100.0 / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -7.5e+150) || ~((n <= 1.3))) tmp = ((n * 100.0) * (i * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))))) / i; else tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5)))); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -7.5e+150], N[Not[LessEqual[n, 1.3]], $MachinePrecision]], N[(N[(N[(n * 100.0), $MachinePrecision] * N[(i * N[(1.0 + N[(i * N[(0.5 + N[(i * N[(0.16666666666666666 + N[(i * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], N[(n * N[(100.0 / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -7.5 \cdot 10^{+150} \lor \neg \left(n \leq 1.3\right):\\
\;\;\;\;\frac{\left(n \cdot 100\right) \cdot \left(i \cdot \left(1 + i \cdot \left(0.5 + i \cdot \left(0.16666666666666666 + i \cdot 0.041666666666666664\right)\right)\right)\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\end{array}
\end{array}
if n < -7.4999999999999998e150 or 1.30000000000000004 < n Initial program 19.3%
associate-/r/19.8%
associate-*r*19.8%
*-commutative19.8%
associate-*r/19.8%
sub-neg19.8%
distribute-lft-in19.8%
metadata-eval19.8%
metadata-eval19.8%
metadata-eval19.8%
fma-define19.8%
metadata-eval19.8%
Simplified19.8%
Taylor expanded in n around inf 45.1%
sub-neg45.1%
metadata-eval45.1%
metadata-eval45.1%
distribute-lft-in45.1%
metadata-eval45.1%
sub-neg45.1%
expm1-define92.5%
Simplified92.5%
associate-*r/92.4%
associate-*r*92.5%
*-commutative92.5%
Applied egg-rr92.5%
Taylor expanded in i around 0 77.9%
*-commutative77.9%
Simplified77.9%
if -7.4999999999999998e150 < n < 1.30000000000000004Initial program 38.5%
associate-*r/38.5%
sub-neg38.5%
distribute-rgt-in38.5%
metadata-eval38.5%
metadata-eval38.5%
Simplified38.5%
metadata-eval38.5%
metadata-eval38.5%
distribute-rgt-in38.5%
sub-neg38.5%
associate-*r/38.5%
associate-/r/37.9%
associate-*r*37.9%
add-exp-log37.8%
expm1-define37.8%
log-pow46.6%
log1p-define82.0%
Applied egg-rr82.0%
clear-num82.0%
un-div-inv82.0%
Applied egg-rr82.0%
Taylor expanded in i around 0 73.7%
sub-neg73.7%
associate-*r/73.7%
metadata-eval73.7%
metadata-eval73.7%
Simplified73.7%
Final simplification75.7%
(FPCore (i n)
:precision binary64
(if (or (<= n -3.8e+150) (not (<= n 1.0)))
(*
n
(+
100.0
(* i (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))
(* n (/ 100.0 (+ 1.0 (* i (+ (/ 0.5 n) -0.5)))))))
double code(double i, double n) {
double tmp;
if ((n <= -3.8e+150) || !(n <= 1.0)) {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
} else {
tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-3.8d+150)) .or. (.not. (n <= 1.0d0))) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))
else
tmp = n * (100.0d0 / (1.0d0 + (i * ((0.5d0 / n) + (-0.5d0)))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -3.8e+150) || !(n <= 1.0)) {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
} else {
tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -3.8e+150) or not (n <= 1.0): tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))) else: tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5)))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -3.8e+150) || !(n <= 1.0)) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))); else tmp = Float64(n * Float64(100.0 / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -3.8e+150) || ~((n <= 1.0))) tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))); else tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5)))); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -3.8e+150], N[Not[LessEqual[n, 1.0]], $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], N[(n * N[(100.0 / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.8 \cdot 10^{+150} \lor \neg \left(n \leq 1\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\end{array}
\end{array}
if n < -3.79999999999999989e150 or 1 < n Initial program 19.3%
associate-/r/19.8%
associate-*r*19.8%
*-commutative19.8%
associate-*r/19.8%
sub-neg19.8%
distribute-lft-in19.8%
metadata-eval19.8%
metadata-eval19.8%
metadata-eval19.8%
fma-define19.8%
metadata-eval19.8%
Simplified19.8%
Taylor expanded in n around inf 45.1%
sub-neg45.1%
metadata-eval45.1%
metadata-eval45.1%
distribute-lft-in45.1%
metadata-eval45.1%
sub-neg45.1%
expm1-define92.5%
Simplified92.5%
Taylor expanded in i around 0 76.4%
*-commutative76.4%
Simplified76.4%
if -3.79999999999999989e150 < n < 1Initial program 38.5%
associate-*r/38.5%
sub-neg38.5%
distribute-rgt-in38.5%
metadata-eval38.5%
metadata-eval38.5%
Simplified38.5%
metadata-eval38.5%
metadata-eval38.5%
distribute-rgt-in38.5%
sub-neg38.5%
associate-*r/38.5%
associate-/r/37.9%
associate-*r*37.9%
add-exp-log37.8%
expm1-define37.8%
log-pow46.6%
log1p-define82.0%
Applied egg-rr82.0%
clear-num82.0%
un-div-inv82.0%
Applied egg-rr82.0%
Taylor expanded in i around 0 73.7%
sub-neg73.7%
associate-*r/73.7%
metadata-eval73.7%
metadata-eval73.7%
Simplified73.7%
Final simplification75.0%
(FPCore (i n) :precision binary64 (if (or (<= n -3.4e+152) (not (<= n 8e+59))) (* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668))))) (* n (/ 100.0 (+ 1.0 (* i (+ (/ 0.5 n) -0.5)))))))
double code(double i, double n) {
double tmp;
if ((n <= -3.4e+152) || !(n <= 8e+59)) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else {
tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-3.4d+152)) .or. (.not. (n <= 8d+59))) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else
tmp = n * (100.0d0 / (1.0d0 + (i * ((0.5d0 / n) + (-0.5d0)))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -3.4e+152) || !(n <= 8e+59)) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else {
tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -3.4e+152) or not (n <= 8e+59): tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) else: tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5)))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -3.4e+152) || !(n <= 8e+59)) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); else tmp = Float64(n * Float64(100.0 / Float64(1.0 + Float64(i * Float64(Float64(0.5 / n) + -0.5))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -3.4e+152) || ~((n <= 8e+59))) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); else tmp = n * (100.0 / (1.0 + (i * ((0.5 / n) + -0.5)))); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -3.4e+152], N[Not[LessEqual[n, 8e+59]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 / N[(1.0 + N[(i * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.4 \cdot 10^{+152} \lor \neg \left(n \leq 8 \cdot 10^{+59}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{100}{1 + i \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\end{array}
\end{array}
if n < -3.4000000000000002e152 or 7.99999999999999977e59 < n Initial program 18.1%
associate-/r/18.7%
associate-*r*18.7%
*-commutative18.7%
associate-*r/18.8%
sub-neg18.8%
distribute-lft-in18.8%
metadata-eval18.8%
metadata-eval18.8%
metadata-eval18.8%
fma-define18.8%
metadata-eval18.8%
Simplified18.8%
Taylor expanded in n around inf 47.2%
sub-neg47.2%
metadata-eval47.2%
metadata-eval47.2%
distribute-lft-in47.2%
metadata-eval47.2%
sub-neg47.2%
expm1-define92.7%
Simplified92.7%
Taylor expanded in i around 0 72.1%
*-commutative72.1%
Simplified72.1%
if -3.4000000000000002e152 < n < 7.99999999999999977e59Initial program 38.0%
associate-*r/38.1%
sub-neg38.1%
distribute-rgt-in38.0%
metadata-eval38.0%
metadata-eval38.0%
Simplified38.0%
metadata-eval38.0%
metadata-eval38.0%
distribute-rgt-in38.1%
sub-neg38.1%
associate-*r/38.0%
associate-/r/37.5%
associate-*r*37.5%
add-exp-log37.4%
expm1-define37.4%
log-pow44.9%
log1p-define82.5%
Applied egg-rr82.5%
clear-num82.5%
un-div-inv82.5%
Applied egg-rr82.5%
Taylor expanded in i around 0 73.6%
sub-neg73.6%
associate-*r/73.6%
metadata-eval73.6%
metadata-eval73.6%
Simplified73.6%
Final simplification73.0%
(FPCore (i n) :precision binary64 (if (or (<= n -1e-132) (not (<= n 6.3e-142))) (* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668))))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -1e-132) || !(n <= 6.3e-142)) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-1d-132)) .or. (.not. (n <= 6.3d-142))) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else
tmp = 0.0d0 / (i / n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -1e-132) || !(n <= 6.3e-142)) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1e-132) or not (n <= 6.3e-142): tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1e-132) || !(n <= 6.3e-142)) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -1e-132) || ~((n <= 6.3e-142))) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); else tmp = 0.0 / (i / n); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1e-132], N[Not[LessEqual[n, 6.3e-142]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1 \cdot 10^{-132} \lor \neg \left(n \leq 6.3 \cdot 10^{-142}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -9.9999999999999999e-133 or 6.2999999999999998e-142 < n Initial program 22.3%
associate-/r/22.8%
associate-*r*22.8%
*-commutative22.8%
associate-*r/22.8%
sub-neg22.8%
distribute-lft-in22.8%
metadata-eval22.8%
metadata-eval22.8%
metadata-eval22.8%
fma-define22.8%
metadata-eval22.8%
Simplified22.8%
Taylor expanded in n around inf 33.5%
sub-neg33.5%
metadata-eval33.5%
metadata-eval33.5%
distribute-lft-in33.5%
metadata-eval33.5%
sub-neg33.5%
expm1-define83.7%
Simplified83.7%
Taylor expanded in i around 0 66.4%
*-commutative66.4%
Simplified66.4%
if -9.9999999999999999e-133 < n < 6.2999999999999998e-142Initial program 57.0%
associate-*r/57.0%
sub-neg57.0%
distribute-rgt-in57.0%
metadata-eval57.0%
metadata-eval57.0%
Simplified57.0%
Taylor expanded in i around 0 68.6%
Final simplification66.8%
(FPCore (i n) :precision binary64 (if (or (<= n -6e-140) (not (<= n 1.15e-140))) (* 100.0 (* n (+ 1.0 (* i 0.5)))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -6e-140) || !(n <= 1.15e-140)) {
tmp = 100.0 * (n * (1.0 + (i * 0.5)));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-6d-140)) .or. (.not. (n <= 1.15d-140))) then
tmp = 100.0d0 * (n * (1.0d0 + (i * 0.5d0)))
else
tmp = 0.0d0 / (i / n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -6e-140) || !(n <= 1.15e-140)) {
tmp = 100.0 * (n * (1.0 + (i * 0.5)));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -6e-140) or not (n <= 1.15e-140): tmp = 100.0 * (n * (1.0 + (i * 0.5))) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -6e-140) || !(n <= 1.15e-140)) tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * 0.5)))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -6e-140) || ~((n <= 1.15e-140))) tmp = 100.0 * (n * (1.0 + (i * 0.5))); else tmp = 0.0 / (i / n); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -6e-140], N[Not[LessEqual[n, 1.15e-140]], $MachinePrecision]], N[(100.0 * N[(n * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -6 \cdot 10^{-140} \lor \neg \left(n \leq 1.15 \cdot 10^{-140}\right):\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -6.00000000000000037e-140 or 1.1500000000000001e-140 < n Initial program 22.3%
Taylor expanded in i around 0 61.4%
Taylor expanded in n around inf 61.5%
if -6.00000000000000037e-140 < n < 1.1500000000000001e-140Initial program 57.0%
associate-*r/57.0%
sub-neg57.0%
distribute-rgt-in57.0%
metadata-eval57.0%
metadata-eval57.0%
Simplified57.0%
Taylor expanded in i around 0 68.6%
Final simplification62.9%
(FPCore (i n) :precision binary64 (if (or (<= n -2.8e+41) (not (<= n 1.5))) (* 100.0 (* n (+ 1.0 (* i 0.5)))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -2.8e+41) || !(n <= 1.5)) {
tmp = 100.0 * (n * (1.0 + (i * 0.5)));
} 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 <= (-2.8d+41)) .or. (.not. (n <= 1.5d0))) then
tmp = 100.0d0 * (n * (1.0d0 + (i * 0.5d0)))
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 <= -2.8e+41) || !(n <= 1.5)) {
tmp = 100.0 * (n * (1.0 + (i * 0.5)));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.8e+41) or not (n <= 1.5): tmp = 100.0 * (n * (1.0 + (i * 0.5))) else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.8e+41) || !(n <= 1.5)) tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * 0.5)))); 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 <= -2.8e+41) || ~((n <= 1.5))) tmp = 100.0 * (n * (1.0 + (i * 0.5))); else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -2.8e+41], N[Not[LessEqual[n, 1.5]], $MachinePrecision]], N[(100.0 * N[(n * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.8 \cdot 10^{+41} \lor \neg \left(n \leq 1.5\right):\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -2.7999999999999999e41 or 1.5 < n Initial program 24.2%
Taylor expanded in i around 0 61.6%
Taylor expanded in n around inf 61.6%
if -2.7999999999999999e41 < n < 1.5Initial program 37.4%
Taylor expanded in i around 0 62.5%
Final simplification61.9%
(FPCore (i n) :precision binary64 (if (or (<= n -5.3e+39) (not (<= n 1.55))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -5.3e+39) || !(n <= 1.55)) {
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 <= (-5.3d+39)) .or. (.not. (n <= 1.55d0))) 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 <= -5.3e+39) || !(n <= 1.55)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -5.3e+39) or not (n <= 1.55): 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 <= -5.3e+39) || !(n <= 1.55)) 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 <= -5.3e+39) || ~((n <= 1.55))) 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, -5.3e+39], N[Not[LessEqual[n, 1.55]], $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 -5.3 \cdot 10^{+39} \lor \neg \left(n \leq 1.55\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -5.29999999999999979e39 or 1.55000000000000004 < n Initial program 24.2%
associate-/r/24.8%
associate-*r*24.8%
*-commutative24.8%
associate-*r/24.8%
sub-neg24.8%
distribute-lft-in24.8%
metadata-eval24.8%
metadata-eval24.8%
metadata-eval24.8%
fma-define24.8%
metadata-eval24.8%
Simplified24.8%
Taylor expanded in n around inf 41.7%
sub-neg41.7%
metadata-eval41.7%
metadata-eval41.7%
distribute-lft-in41.8%
metadata-eval41.8%
sub-neg41.8%
expm1-define89.6%
Simplified89.6%
Taylor expanded in i around 0 61.5%
if -5.29999999999999979e39 < n < 1.55000000000000004Initial program 37.4%
Taylor expanded in i around 0 62.5%
Final simplification61.9%
(FPCore (i n) :precision binary64 (if (<= n -1e+56) (/ (* i (* n 100.0)) i) (if (<= n 1.5) (* 100.0 (/ i (/ i n))) (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -1e+56) {
tmp = (i * (n * 100.0)) / i;
} else if (n <= 1.5) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1d+56)) then
tmp = (i * (n * 100.0d0)) / i
else if (n <= 1.5d0) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1e+56) {
tmp = (i * (n * 100.0)) / i;
} else if (n <= 1.5) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1e+56: tmp = (i * (n * 100.0)) / i elif n <= 1.5: tmp = 100.0 * (i / (i / n)) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -1e+56) tmp = Float64(Float64(i * Float64(n * 100.0)) / i); elseif (n <= 1.5) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1e+56) tmp = (i * (n * 100.0)) / i; elseif (n <= 1.5) tmp = 100.0 * (i / (i / n)); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1e+56], N[(N[(i * N[(n * 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], If[LessEqual[n, 1.5], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1 \cdot 10^{+56}:\\
\;\;\;\;\frac{i \cdot \left(n \cdot 100\right)}{i}\\
\mathbf{elif}\;n \leq 1.5:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -1.00000000000000009e56Initial program 25.8%
associate-/r/26.4%
associate-*r*26.4%
*-commutative26.4%
associate-*r/26.5%
sub-neg26.5%
distribute-lft-in26.5%
metadata-eval26.5%
metadata-eval26.5%
metadata-eval26.5%
fma-define26.5%
metadata-eval26.5%
Simplified26.5%
Taylor expanded in n around inf 39.7%
sub-neg39.7%
metadata-eval39.7%
metadata-eval39.7%
distribute-lft-in39.8%
metadata-eval39.8%
sub-neg39.8%
expm1-define86.3%
Simplified86.3%
associate-*r/86.2%
associate-*r*86.3%
*-commutative86.3%
Applied egg-rr86.3%
Taylor expanded in i around 0 57.7%
if -1.00000000000000009e56 < n < 1.5Initial program 37.7%
Taylor expanded in i around 0 62.1%
if 1.5 < n Initial program 21.2%
associate-/r/21.7%
associate-*r*21.7%
*-commutative21.7%
associate-*r/21.7%
sub-neg21.7%
distribute-lft-in21.7%
metadata-eval21.7%
metadata-eval21.7%
metadata-eval21.7%
fma-define21.7%
metadata-eval21.7%
Simplified21.7%
Taylor expanded in n around inf 43.4%
sub-neg43.4%
metadata-eval43.4%
metadata-eval43.4%
distribute-lft-in43.4%
metadata-eval43.4%
sub-neg43.4%
expm1-define93.8%
Simplified93.8%
Taylor expanded in i around 0 67.4%
Final simplification61.9%
(FPCore (i n) :precision binary64 (if (<= i -7e-56) (* 100.0 (/ i (/ i n))) (if (<= i 0.7) (* 100.0 (+ n (* i -0.5))) (* 50.0 (* i n)))))
double code(double i, double n) {
double tmp;
if (i <= -7e-56) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 0.7) {
tmp = 100.0 * (n + (i * -0.5));
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-7d-56)) then
tmp = 100.0d0 * (i / (i / n))
else if (i <= 0.7d0) then
tmp = 100.0d0 * (n + (i * (-0.5d0)))
else
tmp = 50.0d0 * (i * n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -7e-56) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 0.7) {
tmp = 100.0 * (n + (i * -0.5));
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -7e-56: tmp = 100.0 * (i / (i / n)) elif i <= 0.7: tmp = 100.0 * (n + (i * -0.5)) else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= -7e-56) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (i <= 0.7) tmp = Float64(100.0 * Float64(n + Float64(i * -0.5))); else tmp = Float64(50.0 * Float64(i * n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -7e-56) tmp = 100.0 * (i / (i / n)); elseif (i <= 0.7) tmp = 100.0 * (n + (i * -0.5)); else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -7e-56], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 0.7], N[(100.0 * N[(n + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -7 \cdot 10^{-56}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 0.7:\\
\;\;\;\;100 \cdot \left(n + i \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < -6.9999999999999996e-56Initial program 55.2%
Taylor expanded in i around 0 35.0%
if -6.9999999999999996e-56 < i < 0.69999999999999996Initial program 5.9%
Taylor expanded in i around 0 90.3%
Taylor expanded in n around 0 89.8%
if 0.69999999999999996 < i Initial program 46.0%
associate-/r/46.3%
associate-*r*46.3%
*-commutative46.3%
associate-*r/46.3%
sub-neg46.3%
distribute-lft-in46.3%
metadata-eval46.3%
metadata-eval46.3%
metadata-eval46.3%
fma-define46.3%
metadata-eval46.3%
Simplified46.3%
Taylor expanded in n around inf 52.9%
sub-neg52.9%
metadata-eval52.9%
metadata-eval52.9%
distribute-lft-in52.9%
metadata-eval52.9%
sub-neg52.9%
expm1-define52.9%
Simplified52.9%
Taylor expanded in i around 0 27.7%
Taylor expanded in i around inf 26.3%
(FPCore (i n) :precision binary64 (if (<= i 1200000000000.0) (* n 100.0) (* 50.0 (* i n))))
double code(double i, double n) {
double tmp;
if (i <= 1200000000000.0) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 1200000000000.0d0) then
tmp = n * 100.0d0
else
tmp = 50.0d0 * (i * n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 1200000000000.0) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 1200000000000.0: tmp = n * 100.0 else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= 1200000000000.0) tmp = Float64(n * 100.0); else tmp = Float64(50.0 * Float64(i * n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 1200000000000.0) tmp = n * 100.0; else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 1200000000000.0], N[(n * 100.0), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 1200000000000:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < 1.2e12Initial program 24.1%
Taylor expanded in i around 0 61.7%
*-commutative61.7%
Simplified61.7%
if 1.2e12 < i Initial program 45.2%
associate-/r/45.5%
associate-*r*45.5%
*-commutative45.5%
associate-*r/45.5%
sub-neg45.5%
distribute-lft-in45.5%
metadata-eval45.5%
metadata-eval45.5%
metadata-eval45.5%
fma-define45.5%
metadata-eval45.5%
Simplified45.5%
Taylor expanded in n around inf 53.7%
sub-neg53.7%
metadata-eval53.7%
metadata-eval53.7%
distribute-lft-in53.7%
metadata-eval53.7%
sub-neg53.7%
expm1-define53.7%
Simplified53.7%
Taylor expanded in i around 0 28.1%
Taylor expanded in i around inf 26.7%
(FPCore (i n) :precision binary64 (* n 100.0))
double code(double i, double n) {
return n * 100.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = n * 100.0d0
end function
public static double code(double i, double n) {
return n * 100.0;
}
def code(i, n): return n * 100.0
function code(i, n) return Float64(n * 100.0) end
function tmp = code(i, n) tmp = n * 100.0; end
code[i_, n_] := N[(n * 100.0), $MachinePrecision]
\begin{array}{l}
\\
n \cdot 100
\end{array}
Initial program 29.4%
Taylor expanded in i around 0 47.4%
*-commutative47.4%
Simplified47.4%
(FPCore (i n) :precision binary64 (* i -50.0))
double code(double i, double n) {
return i * -50.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = i * (-50.0d0)
end function
public static double code(double i, double n) {
return i * -50.0;
}
def code(i, n): return i * -50.0
function code(i, n) return Float64(i * -50.0) end
function tmp = code(i, n) tmp = i * -50.0; end
code[i_, n_] := N[(i * -50.0), $MachinePrecision]
\begin{array}{l}
\\
i \cdot -50
\end{array}
Initial program 29.4%
Taylor expanded in i around 0 52.8%
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 2024116
(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))))