
(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 24 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 -2e-117)
(* n (/ (* t_1 100.0) i))
(if (<= t_2 0.0)
(/ 100.0 (/ (/ i n) (expm1 (* n (log1p (/ i n))))))
(if (<= t_2 INFINITY)
(/ (+ (* t_0 100.0) -100.0) (/ i n))
(* 100.0 (* n (/ (expm1 (* i (+ 1.0 (* i (/ -0.5 n))))) i))))))))
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 <= -2e-117) {
tmp = n * ((t_1 * 100.0) / i);
} else if (t_2 <= 0.0) {
tmp = 100.0 / ((i / n) / expm1((n * log1p((i / n)))));
} else if (t_2 <= ((double) INFINITY)) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else {
tmp = 100.0 * (n * (expm1((i * (1.0 + (i * (-0.5 / n))))) / i));
}
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 <= -2e-117) {
tmp = n * ((t_1 * 100.0) / i);
} else if (t_2 <= 0.0) {
tmp = 100.0 / ((i / n) / Math.expm1((n * Math.log1p((i / n)))));
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else {
tmp = 100.0 * (n * (Math.expm1((i * (1.0 + (i * (-0.5 / n))))) / i));
}
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 <= -2e-117: tmp = n * ((t_1 * 100.0) / i) elif t_2 <= 0.0: tmp = 100.0 / ((i / n) / math.expm1((n * math.log1p((i / n))))) elif t_2 <= math.inf: tmp = ((t_0 * 100.0) + -100.0) / (i / n) else: tmp = 100.0 * (n * (math.expm1((i * (1.0 + (i * (-0.5 / n))))) / i)) 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 <= -2e-117) tmp = Float64(n * Float64(Float64(t_1 * 100.0) / i)); elseif (t_2 <= 0.0) tmp = Float64(100.0 / Float64(Float64(i / n) / expm1(Float64(n * log1p(Float64(i / n)))))); elseif (t_2 <= Inf) tmp = Float64(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n)); else tmp = Float64(100.0 * Float64(n * Float64(expm1(Float64(i * Float64(1.0 + Float64(i * Float64(-0.5 / n))))) / i))); 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, -2e-117], N[(n * N[(N[(t$95$1 * 100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(100.0 / N[(N[(i / n), $MachinePrecision] / N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n * N[(N[(Exp[N[(i * N[(1.0 + N[(i * N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $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 -2 \cdot 10^{-117}:\\
\;\;\;\;n \cdot \frac{t\_1 \cdot 100}{i}\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;\frac{100}{\frac{\frac{i}{n}}{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}}\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\frac{t\_0 \cdot 100 + -100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i \cdot \left(1 + i \cdot \frac{-0.5}{n}\right)\right)}{i}\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)) < -2.00000000000000006e-117Initial program 99.6%
associate-/r/99.5%
associate-*r*99.5%
*-commutative99.5%
associate-*r/99.9%
sub-neg99.9%
distribute-lft-in99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
fma-define99.9%
metadata-eval99.9%
Simplified99.9%
fma-undefine99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-lft-in99.9%
sub-neg99.9%
*-commutative99.9%
add-exp-log99.9%
expm1-define99.9%
log-pow61.4%
log1p-define61.4%
Applied egg-rr61.4%
expm1-undefine61.4%
*-commutative61.4%
log1p-undefine61.4%
exp-to-pow99.9%
Applied egg-rr99.9%
if -2.00000000000000006e-117 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -0.0Initial program 19.0%
associate-/r/18.5%
associate-*r*18.4%
*-commutative18.4%
associate-*r/18.5%
sub-neg18.5%
distribute-lft-in18.5%
metadata-eval18.5%
metadata-eval18.5%
metadata-eval18.5%
fma-define18.5%
metadata-eval18.5%
Simplified18.5%
*-commutative18.5%
fma-undefine18.5%
*-commutative18.5%
associate-/r/19.0%
metadata-eval19.0%
metadata-eval19.0%
distribute-rgt-in19.0%
sub-neg19.0%
associate-*r/19.0%
clear-num19.0%
un-div-inv19.0%
add-exp-log19.0%
expm1-define19.0%
log-pow28.4%
log1p-define98.2%
Applied egg-rr98.2%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 92.0%
associate-*r/92.3%
sub-neg92.3%
distribute-rgt-in92.2%
metadata-eval92.2%
metadata-eval92.2%
Simplified92.2%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
add-exp-log1.9%
expm1-define1.9%
log-pow1.9%
log1p-define1.9%
Applied egg-rr1.9%
Taylor expanded in i around 0 99.9%
associate-*r/99.9%
associate-*l/99.9%
*-commutative99.9%
Simplified99.9%
Final simplification98.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n))
(t_1 (/ (+ t_0 -1.0) (/ i n)))
(t_2 (+ (* t_0 100.0) -100.0)))
(if (<= t_1 -2e-129)
(/ t_2 (* i (/ 1.0 n)))
(if (<= t_1 0.0)
(* n (/ (* 100.0 (expm1 (* n (log1p (/ i n))))) i))
(if (<= t_1 INFINITY)
(/ t_2 (/ i n))
(* 100.0 (* n (/ (expm1 (* i (+ 1.0 (* i (/ -0.5 n))))) i))))))))
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 t_2 = (t_0 * 100.0) + -100.0;
double tmp;
if (t_1 <= -2e-129) {
tmp = t_2 / (i * (1.0 / n));
} else if (t_1 <= 0.0) {
tmp = n * ((100.0 * expm1((n * log1p((i / n))))) / i);
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2 / (i / n);
} else {
tmp = 100.0 * (n * (expm1((i * (1.0 + (i * (-0.5 / n))))) / i));
}
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 t_2 = (t_0 * 100.0) + -100.0;
double tmp;
if (t_1 <= -2e-129) {
tmp = t_2 / (i * (1.0 / n));
} else if (t_1 <= 0.0) {
tmp = n * ((100.0 * Math.expm1((n * Math.log1p((i / n))))) / i);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_2 / (i / n);
} else {
tmp = 100.0 * (n * (Math.expm1((i * (1.0 + (i * (-0.5 / n))))) / i));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) t_2 = (t_0 * 100.0) + -100.0 tmp = 0 if t_1 <= -2e-129: tmp = t_2 / (i * (1.0 / n)) elif t_1 <= 0.0: tmp = n * ((100.0 * math.expm1((n * math.log1p((i / n))))) / i) elif t_1 <= math.inf: tmp = t_2 / (i / n) else: tmp = 100.0 * (n * (math.expm1((i * (1.0 + (i * (-0.5 / n))))) / i)) 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)) t_2 = Float64(Float64(t_0 * 100.0) + -100.0) tmp = 0.0 if (t_1 <= -2e-129) tmp = Float64(t_2 / Float64(i * Float64(1.0 / n))); elseif (t_1 <= 0.0) tmp = Float64(n * Float64(Float64(100.0 * expm1(Float64(n * log1p(Float64(i / n))))) / i)); elseif (t_1 <= Inf) tmp = Float64(t_2 / Float64(i / n)); else tmp = Float64(100.0 * Float64(n * Float64(expm1(Float64(i * Float64(1.0 + Float64(i * Float64(-0.5 / n))))) / i))); 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]}, Block[{t$95$2 = N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-129], N[(t$95$2 / N[(i * N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(n * N[(N[(100.0 * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(t$95$2 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n * N[(N[(Exp[N[(i * N[(1.0 + N[(i * N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $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}}\\
t_2 := t\_0 \cdot 100 + -100\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-129}:\\
\;\;\;\;\frac{t\_2}{i \cdot \frac{1}{n}}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{t\_2}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i \cdot \left(1 + i \cdot \frac{-0.5}{n}\right)\right)}{i}\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)) < -1.9999999999999999e-129Initial program 99.7%
associate-*r/99.7%
sub-neg99.7%
distribute-rgt-in99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
clear-num99.8%
associate-/r/99.9%
Applied egg-rr99.9%
if -1.9999999999999999e-129 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -0.0Initial program 18.1%
associate-/r/17.6%
associate-*r*17.6%
*-commutative17.6%
associate-*r/17.6%
sub-neg17.6%
distribute-lft-in17.6%
metadata-eval17.6%
metadata-eval17.6%
metadata-eval17.6%
fma-define17.6%
metadata-eval17.6%
Simplified17.6%
fma-undefine17.6%
metadata-eval17.6%
metadata-eval17.6%
distribute-lft-in17.6%
sub-neg17.6%
*-commutative17.6%
add-exp-log17.6%
expm1-define17.6%
log-pow28.4%
log1p-define97.5%
Applied egg-rr97.5%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 92.0%
associate-*r/92.3%
sub-neg92.3%
distribute-rgt-in92.2%
metadata-eval92.2%
metadata-eval92.2%
Simplified92.2%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
add-exp-log1.9%
expm1-define1.9%
log-pow1.9%
log1p-define1.9%
Applied egg-rr1.9%
Taylor expanded in i around 0 99.9%
associate-*r/99.9%
associate-*l/99.9%
*-commutative99.9%
Simplified99.9%
Final simplification97.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (+ t_0 -1.0)) (t_2 (/ t_1 (/ i n))))
(if (<= t_2 -1e-62)
(* n (/ (* t_1 100.0) i))
(if (<= t_2 0.0)
(* 100.0 (* n (/ (expm1 (* n (log1p (/ i n)))) i)))
(if (<= t_2 INFINITY)
(/ (+ (* t_0 100.0) -100.0) (/ i n))
(* 100.0 (* n (/ (expm1 (* i (+ 1.0 (* i (/ -0.5 n))))) i))))))))
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-62) {
tmp = n * ((t_1 * 100.0) / i);
} else if (t_2 <= 0.0) {
tmp = 100.0 * (n * (expm1((n * log1p((i / n)))) / i));
} else if (t_2 <= ((double) INFINITY)) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else {
tmp = 100.0 * (n * (expm1((i * (1.0 + (i * (-0.5 / n))))) / i));
}
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-62) {
tmp = n * ((t_1 * 100.0) / i);
} else if (t_2 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1((n * Math.log1p((i / n)))) / i));
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else {
tmp = 100.0 * (n * (Math.expm1((i * (1.0 + (i * (-0.5 / n))))) / i));
}
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-62: tmp = n * ((t_1 * 100.0) / i) elif t_2 <= 0.0: tmp = 100.0 * (n * (math.expm1((n * math.log1p((i / n)))) / i)) elif t_2 <= math.inf: tmp = ((t_0 * 100.0) + -100.0) / (i / n) else: tmp = 100.0 * (n * (math.expm1((i * (1.0 + (i * (-0.5 / n))))) / i)) 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-62) tmp = Float64(n * Float64(Float64(t_1 * 100.0) / i)); elseif (t_2 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i))); elseif (t_2 <= Inf) tmp = Float64(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n)); else tmp = Float64(100.0 * Float64(n * Float64(expm1(Float64(i * Float64(1.0 + Float64(i * Float64(-0.5 / n))))) / i))); 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-62], N[(n * N[(N[(t$95$1 * 100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(100.0 * N[(n * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n * N[(N[(Exp[N[(i * N[(1.0 + N[(i * N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $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^{-62}:\\
\;\;\;\;n \cdot \frac{t\_1 \cdot 100}{i}\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\right)\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\frac{t\_0 \cdot 100 + -100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i \cdot \left(1 + i \cdot \frac{-0.5}{n}\right)\right)}{i}\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)) < -1e-62Initial program 99.7%
associate-/r/99.4%
associate-*r*99.6%
*-commutative99.6%
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%
fma-undefine100.0%
metadata-eval100.0%
metadata-eval100.0%
distribute-lft-in100.0%
sub-neg100.0%
*-commutative100.0%
add-exp-log100.0%
expm1-define100.0%
log-pow54.5%
log1p-define54.5%
Applied egg-rr54.5%
expm1-undefine54.5%
*-commutative54.5%
log1p-undefine54.5%
exp-to-pow100.0%
Applied egg-rr100.0%
if -1e-62 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -0.0Initial program 19.9%
associate-/r/19.3%
add-exp-log19.3%
expm1-define19.3%
log-pow29.9%
log1p-define97.5%
Applied egg-rr97.5%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 92.0%
associate-*r/92.3%
sub-neg92.3%
distribute-rgt-in92.2%
metadata-eval92.2%
metadata-eval92.2%
Simplified92.2%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
add-exp-log1.9%
expm1-define1.9%
log-pow1.9%
log1p-define1.9%
Applied egg-rr1.9%
Taylor expanded in i around 0 99.9%
associate-*r/99.9%
associate-*l/99.9%
*-commutative99.9%
Simplified99.9%
Final simplification97.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n))
(t_1 (/ (+ t_0 -1.0) (/ i n)))
(t_2 (+ (* t_0 100.0) -100.0)))
(if (<= t_1 -5e-132)
(/ t_2 (* i (/ 1.0 n)))
(if (<= t_1 0.0)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= t_1 INFINITY)
(/ t_2 (/ i n))
(* 100.0 (* n (/ (expm1 (* i (+ 1.0 (* i (/ -0.5 n))))) i))))))))
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 t_2 = (t_0 * 100.0) + -100.0;
double tmp;
if (t_1 <= -5e-132) {
tmp = t_2 / (i * (1.0 / n));
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2 / (i / n);
} else {
tmp = 100.0 * (n * (expm1((i * (1.0 + (i * (-0.5 / n))))) / i));
}
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 t_2 = (t_0 * 100.0) + -100.0;
double tmp;
if (t_1 <= -5e-132) {
tmp = t_2 / (i * (1.0 / n));
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_2 / (i / n);
} else {
tmp = 100.0 * (n * (Math.expm1((i * (1.0 + (i * (-0.5 / n))))) / i));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) t_2 = (t_0 * 100.0) + -100.0 tmp = 0 if t_1 <= -5e-132: tmp = t_2 / (i * (1.0 / n)) elif t_1 <= 0.0: tmp = 100.0 * (n * (math.expm1(i) / i)) elif t_1 <= math.inf: tmp = t_2 / (i / n) else: tmp = 100.0 * (n * (math.expm1((i * (1.0 + (i * (-0.5 / n))))) / i)) 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)) t_2 = Float64(Float64(t_0 * 100.0) + -100.0) tmp = 0.0 if (t_1 <= -5e-132) tmp = Float64(t_2 / Float64(i * Float64(1.0 / n))); elseif (t_1 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (t_1 <= Inf) tmp = Float64(t_2 / Float64(i / n)); else tmp = Float64(100.0 * Float64(n * Float64(expm1(Float64(i * Float64(1.0 + Float64(i * Float64(-0.5 / n))))) / i))); 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]}, Block[{t$95$2 = N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-132], N[(t$95$2 / N[(i * N[(1.0 / n), $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$2 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n * N[(N[(Exp[N[(i * N[(1.0 + N[(i * N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $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}}\\
t_2 := t\_0 \cdot 100 + -100\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-132}:\\
\;\;\;\;\frac{t\_2}{i \cdot \frac{1}{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:\\
\;\;\;\;\frac{t\_2}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i \cdot \left(1 + i \cdot \frac{-0.5}{n}\right)\right)}{i}\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)) < -4.9999999999999999e-132Initial program 95.6%
associate-*r/95.6%
sub-neg95.6%
distribute-rgt-in95.6%
metadata-eval95.6%
metadata-eval95.6%
Simplified95.6%
clear-num95.7%
associate-/r/95.8%
Applied egg-rr95.8%
if -4.9999999999999999e-132 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -0.0Initial program 18.0%
Taylor expanded in n around inf 40.8%
*-commutative40.8%
associate-/l*40.7%
expm1-define79.4%
Simplified79.4%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 92.0%
associate-*r/92.3%
sub-neg92.3%
distribute-rgt-in92.2%
metadata-eval92.2%
metadata-eval92.2%
Simplified92.2%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
add-exp-log1.9%
expm1-define1.9%
log-pow1.9%
log1p-define1.9%
Applied egg-rr1.9%
Taylor expanded in i around 0 99.9%
associate-*r/99.9%
associate-*l/99.9%
*-commutative99.9%
Simplified99.9%
Final simplification84.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (+ t_0 -1.0)) (t_2 (/ t_1 (/ i n))))
(if (<= t_2 -5e-132)
(* n (/ (* t_1 100.0) i))
(if (<= t_2 0.0)
(* 100.0 (* n (/ (expm1 i) i)))
(if (<= t_2 INFINITY)
(/ (+ (* t_0 100.0) -100.0) (/ i n))
(* 100.0 (* n (/ (expm1 (* i (+ 1.0 (* i (/ -0.5 n))))) i))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = t_0 + -1.0;
double t_2 = t_1 / (i / n);
double tmp;
if (t_2 <= -5e-132) {
tmp = n * ((t_1 * 100.0) / i);
} else if (t_2 <= 0.0) {
tmp = 100.0 * (n * (expm1(i) / i));
} else if (t_2 <= ((double) INFINITY)) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else {
tmp = 100.0 * (n * (expm1((i * (1.0 + (i * (-0.5 / n))))) / i));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = t_0 + -1.0;
double t_2 = t_1 / (i / n);
double tmp;
if (t_2 <= -5e-132) {
tmp = n * ((t_1 * 100.0) / i);
} else if (t_2 <= 0.0) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = ((t_0 * 100.0) + -100.0) / (i / n);
} else {
tmp = 100.0 * (n * (Math.expm1((i * (1.0 + (i * (-0.5 / n))))) / i));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = t_0 + -1.0 t_2 = t_1 / (i / n) tmp = 0 if t_2 <= -5e-132: tmp = n * ((t_1 * 100.0) / i) elif t_2 <= 0.0: tmp = 100.0 * (n * (math.expm1(i) / i)) elif t_2 <= math.inf: tmp = ((t_0 * 100.0) + -100.0) / (i / n) else: tmp = 100.0 * (n * (math.expm1((i * (1.0 + (i * (-0.5 / n))))) / i)) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(t_0 + -1.0) t_2 = Float64(t_1 / Float64(i / n)) tmp = 0.0 if (t_2 <= -5e-132) tmp = Float64(n * Float64(Float64(t_1 * 100.0) / i)); elseif (t_2 <= 0.0) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); elseif (t_2 <= Inf) tmp = Float64(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n)); else tmp = Float64(100.0 * Float64(n * Float64(expm1(Float64(i * Float64(1.0 + Float64(i * Float64(-0.5 / n))))) / i))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + -1.0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-132], N[(n * N[(N[(t$95$1 * 100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n * N[(N[(Exp[N[(i * N[(1.0 + N[(i * N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := t\_0 + -1\\
t_2 := \frac{t\_1}{\frac{i}{n}}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-132}:\\
\;\;\;\;n \cdot \frac{t\_1 \cdot 100}{i}\\
\mathbf{elif}\;t\_2 \leq 0:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\frac{t\_0 \cdot 100 + -100}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i \cdot \left(1 + i \cdot \frac{-0.5}{n}\right)\right)}{i}\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)) < -4.9999999999999999e-132Initial program 95.6%
associate-/r/95.5%
associate-*r*95.4%
*-commutative95.4%
associate-*r/95.7%
sub-neg95.7%
distribute-lft-in95.7%
metadata-eval95.7%
metadata-eval95.7%
metadata-eval95.7%
fma-define95.7%
metadata-eval95.7%
Simplified95.7%
fma-undefine95.7%
metadata-eval95.7%
metadata-eval95.7%
distribute-lft-in95.7%
sub-neg95.7%
*-commutative95.7%
add-exp-log95.7%
expm1-define95.7%
log-pow68.5%
log1p-define68.5%
Applied egg-rr68.5%
expm1-undefine64.4%
*-commutative64.4%
log1p-undefine64.4%
exp-to-pow95.7%
Applied egg-rr95.7%
if -4.9999999999999999e-132 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -0.0Initial program 18.0%
Taylor expanded in n around inf 40.8%
*-commutative40.8%
associate-/l*40.7%
expm1-define79.4%
Simplified79.4%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 92.0%
associate-*r/92.3%
sub-neg92.3%
distribute-rgt-in92.2%
metadata-eval92.2%
metadata-eval92.2%
Simplified92.2%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
add-exp-log1.9%
expm1-define1.9%
log-pow1.9%
log1p-define1.9%
Applied egg-rr1.9%
Taylor expanded in i around 0 99.9%
associate-*r/99.9%
associate-*l/99.9%
*-commutative99.9%
Simplified99.9%
Final simplification84.7%
(FPCore (i n) :precision binary64 (if (or (<= n -5.8e-211) (not (<= n 1.45e-112))) (* 100.0 (* n (/ (expm1 i) i))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -5.8e-211) || !(n <= 1.45e-112)) {
tmp = 100.0 * (n * (expm1(i) / i));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -5.8e-211) || !(n <= 1.45e-112)) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -5.8e-211) or not (n <= 1.45e-112): tmp = 100.0 * (n * (math.expm1(i) / i)) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -5.8e-211) || !(n <= 1.45e-112)) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -5.8e-211], N[Not[LessEqual[n, 1.45e-112]], $MachinePrecision]], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -5.8 \cdot 10^{-211} \lor \neg \left(n \leq 1.45 \cdot 10^{-112}\right):\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -5.80000000000000029e-211 or 1.44999999999999996e-112 < n Initial program 19.1%
Taylor expanded in n around inf 35.4%
*-commutative35.4%
associate-/l*35.3%
expm1-define84.9%
Simplified84.9%
if -5.80000000000000029e-211 < n < 1.44999999999999996e-112Initial program 59.4%
associate-*r/59.4%
sub-neg59.4%
distribute-rgt-in59.4%
metadata-eval59.4%
metadata-eval59.4%
Simplified59.4%
Taylor expanded in i around 0 62.4%
Final simplification81.9%
(FPCore (i n) :precision binary64 (if (or (<= n -1.4e-209) (not (<= n 1.5e-112))) (* n (/ (* 100.0 (expm1 i)) i)) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -1.4e-209) || !(n <= 1.5e-112)) {
tmp = n * ((100.0 * expm1(i)) / i);
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -1.4e-209) || !(n <= 1.5e-112)) {
tmp = n * ((100.0 * Math.expm1(i)) / i);
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.4e-209) or not (n <= 1.5e-112): tmp = n * ((100.0 * math.expm1(i)) / i) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.4e-209) || !(n <= 1.5e-112)) tmp = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -1.4e-209], N[Not[LessEqual[n, 1.5e-112]], $MachinePrecision]], N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.4 \cdot 10^{-209} \lor \neg \left(n \leq 1.5 \cdot 10^{-112}\right):\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -1.40000000000000006e-209 or 1.5e-112 < n Initial program 19.1%
associate-/r/19.0%
associate-*r*19.0%
*-commutative19.0%
associate-*r/19.0%
sub-neg19.0%
distribute-lft-in19.0%
metadata-eval19.0%
metadata-eval19.0%
metadata-eval19.0%
fma-define19.0%
metadata-eval19.0%
Simplified19.0%
Taylor expanded in n around inf 35.3%
sub-neg35.3%
metadata-eval35.3%
metadata-eval35.3%
distribute-lft-in35.3%
metadata-eval35.3%
sub-neg35.3%
expm1-define84.9%
Simplified84.9%
if -1.40000000000000006e-209 < n < 1.5e-112Initial program 59.4%
associate-*r/59.4%
sub-neg59.4%
distribute-rgt-in59.4%
metadata-eval59.4%
metadata-eval59.4%
Simplified59.4%
Taylor expanded in i around 0 62.4%
Final simplification81.9%
(FPCore (i n) :precision binary64 (if (or (<= i -5.6e-9) (not (<= i 1.1e-42))) (* 100.0 (/ (expm1 i) (/ i n))) (* 100.0 (+ n (* (* i n) (- 0.5 (/ 0.5 n)))))))
double code(double i, double n) {
double tmp;
if ((i <= -5.6e-9) || !(i <= 1.1e-42)) {
tmp = 100.0 * (expm1(i) / (i / n));
} else {
tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n))));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((i <= -5.6e-9) || !(i <= 1.1e-42)) {
tmp = 100.0 * (Math.expm1(i) / (i / n));
} else {
tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n))));
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -5.6e-9) or not (i <= 1.1e-42): tmp = 100.0 * (math.expm1(i) / (i / n)) else: tmp = 100.0 * (n + ((i * n) * (0.5 - (0.5 / n)))) return tmp
function code(i, n) tmp = 0.0 if ((i <= -5.6e-9) || !(i <= 1.1e-42)) tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n))); else tmp = Float64(100.0 * Float64(n + Float64(Float64(i * n) * Float64(0.5 - Float64(0.5 / n))))); end return tmp end
code[i_, n_] := If[Or[LessEqual[i, -5.6e-9], N[Not[LessEqual[i, 1.1e-42]], $MachinePrecision]], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n + N[(N[(i * n), $MachinePrecision] * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -5.6 \cdot 10^{-9} \lor \neg \left(i \leq 1.1 \cdot 10^{-42}\right):\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n + \left(i \cdot n\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\\
\end{array}
\end{array}
if i < -5.59999999999999969e-9 or 1.10000000000000003e-42 < i Initial program 43.2%
Taylor expanded in n around inf 66.5%
expm1-define68.3%
Simplified68.3%
if -5.59999999999999969e-9 < i < 1.10000000000000003e-42Initial program 7.7%
Taylor expanded in i around 0 88.1%
associate-*r*88.3%
*-commutative88.3%
associate-*r/88.3%
metadata-eval88.3%
Simplified88.3%
Final simplification78.8%
(FPCore (i n) :precision binary64 (if (<= i 7.6e+36) (* 100.0 (* n (/ (expm1 i) i))) (/ (+ -100.0 (* 100.0 (pow (/ i n) n))) (/ i n))))
double code(double i, double n) {
double tmp;
if (i <= 7.6e+36) {
tmp = 100.0 * (n * (expm1(i) / i));
} else {
tmp = (-100.0 + (100.0 * pow((i / n), n))) / (i / n);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (i <= 7.6e+36) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else {
tmp = (-100.0 + (100.0 * Math.pow((i / n), n))) / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 7.6e+36: tmp = 100.0 * (n * (math.expm1(i) / i)) else: tmp = (-100.0 + (100.0 * math.pow((i / n), n))) / (i / n) return tmp
function code(i, n) tmp = 0.0 if (i <= 7.6e+36) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); else tmp = Float64(Float64(-100.0 + Float64(100.0 * (Float64(i / n) ^ n))) / Float64(i / n)); end return tmp end
code[i_, n_] := If[LessEqual[i, 7.6e+36], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-100.0 + N[(100.0 * N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 7.6 \cdot 10^{+36}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-100 + 100 \cdot {\left(\frac{i}{n}\right)}^{n}}{\frac{i}{n}}\\
\end{array}
\end{array}
if i < 7.6000000000000005e36Initial program 19.5%
Taylor expanded in n around inf 31.2%
*-commutative31.2%
associate-/l*31.2%
expm1-define83.5%
Simplified83.5%
if 7.6000000000000005e36 < i Initial program 46.4%
associate-*r/46.5%
sub-neg46.5%
distribute-rgt-in46.5%
metadata-eval46.5%
metadata-eval46.5%
Simplified46.5%
Taylor expanded in i around inf 71.4%
Final simplification81.3%
(FPCore (i n) :precision binary64 (if (<= i 7e+36) (* 100.0 (* n (/ (expm1 i) i))) (* 100.0 (/ (+ (pow (/ i n) n) -1.0) (/ i n)))))
double code(double i, double n) {
double tmp;
if (i <= 7e+36) {
tmp = 100.0 * (n * (expm1(i) / i));
} else {
tmp = 100.0 * ((pow((i / n), n) + -1.0) / (i / n));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (i <= 7e+36) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else {
tmp = 100.0 * ((Math.pow((i / n), n) + -1.0) / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 7e+36: tmp = 100.0 * (n * (math.expm1(i) / i)) else: tmp = 100.0 * ((math.pow((i / n), n) + -1.0) / (i / n)) return tmp
function code(i, n) tmp = 0.0 if (i <= 7e+36) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); else tmp = Float64(100.0 * Float64(Float64((Float64(i / n) ^ n) + -1.0) / Float64(i / n))); end return tmp end
code[i_, n_] := If[LessEqual[i, 7e+36], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 7 \cdot 10^{+36}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{{\left(\frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
\end{array}
\end{array}
if i < 6.9999999999999996e36Initial program 19.5%
Taylor expanded in n around inf 31.2%
*-commutative31.2%
associate-/l*31.2%
expm1-define83.5%
Simplified83.5%
if 6.9999999999999996e36 < i Initial program 46.4%
Taylor expanded in i around inf 71.3%
Final simplification81.2%
(FPCore (i n)
:precision binary64
(if (<= n -4e-208)
(*
100.0
(*
n
(+
1.0
(*
i
(+
0.5
(-
(-
(* i 0.16666666666666666)
(/ (+ (* (/ i n) -0.3333333333333333) (* i 0.5)) n))
(/ 0.5 n)))))))
(if (<= n 1.45e-112)
(/ 0.0 (/ i n))
(*
100.0
(*
n
(+
1.0
(*
i
(+
0.5
(* i (+ 0.16666666666666666 (* i 0.041666666666666664)))))))))))
double code(double i, double n) {
double tmp;
if (n <= -4e-208) {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (((i * 0.16666666666666666) - ((((i / n) * -0.3333333333333333) + (i * 0.5)) / n)) - (0.5 / n))))));
} else if (n <= 1.45e-112) {
tmp = 0.0 / (i / n);
} else {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-4d-208)) then
tmp = 100.0d0 * (n * (1.0d0 + (i * (0.5d0 + (((i * 0.16666666666666666d0) - ((((i / n) * (-0.3333333333333333d0)) + (i * 0.5d0)) / n)) - (0.5d0 / n))))))
else if (n <= 1.45d-112) then
tmp = 0.0d0 / (i / n)
else
tmp = 100.0d0 * (n * (1.0d0 + (i * (0.5d0 + (i * (0.16666666666666666d0 + (i * 0.041666666666666664d0)))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -4e-208) {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (((i * 0.16666666666666666) - ((((i / n) * -0.3333333333333333) + (i * 0.5)) / n)) - (0.5 / n))))));
} else if (n <= 1.45e-112) {
tmp = 0.0 / (i / n);
} else {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -4e-208: tmp = 100.0 * (n * (1.0 + (i * (0.5 + (((i * 0.16666666666666666) - ((((i / n) * -0.3333333333333333) + (i * 0.5)) / n)) - (0.5 / n)))))) elif n <= 1.45e-112: tmp = 0.0 / (i / n) else: tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664))))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -4e-208) tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * Float64(0.5 + Float64(Float64(Float64(i * 0.16666666666666666) - Float64(Float64(Float64(Float64(i / n) * -0.3333333333333333) + Float64(i * 0.5)) / n)) - Float64(0.5 / n))))))); elseif (n <= 1.45e-112) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * Float64(0.5 + Float64(i * Float64(0.16666666666666666 + Float64(i * 0.041666666666666664)))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -4e-208) tmp = 100.0 * (n * (1.0 + (i * (0.5 + (((i * 0.16666666666666666) - ((((i / n) * -0.3333333333333333) + (i * 0.5)) / n)) - (0.5 / n)))))); elseif (n <= 1.45e-112) tmp = 0.0 / (i / n); else tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664))))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -4e-208], N[(100.0 * N[(n * N[(1.0 + N[(i * N[(0.5 + N[(N[(N[(i * 0.16666666666666666), $MachinePrecision] - N[(N[(N[(N[(i / n), $MachinePrecision] * -0.3333333333333333), $MachinePrecision] + N[(i * 0.5), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.45e-112], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n * 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]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4 \cdot 10^{-208}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot \left(0.5 + \left(\left(i \cdot 0.16666666666666666 - \frac{\frac{i}{n} \cdot -0.3333333333333333 + i \cdot 0.5}{n}\right) - \frac{0.5}{n}\right)\right)\right)\right)\\
\mathbf{elif}\;n \leq 1.45 \cdot 10^{-112}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot \left(0.5 + i \cdot \left(0.16666666666666666 + i \cdot 0.041666666666666664\right)\right)\right)\right)\\
\end{array}
\end{array}
if n < -4.0000000000000004e-208Initial program 23.7%
associate-/r/23.2%
add-exp-log23.2%
expm1-define23.2%
log-pow23.9%
log1p-define79.3%
Applied egg-rr79.3%
Taylor expanded in i around 0 51.9%
associate--l+51.9%
associate--l+51.9%
associate-*r/51.9%
metadata-eval51.9%
associate-*r/51.9%
metadata-eval51.9%
associate-*r/51.9%
metadata-eval51.9%
Simplified51.9%
Taylor expanded in n around -inf 56.1%
if -4.0000000000000004e-208 < n < 1.44999999999999996e-112Initial program 59.4%
associate-*r/59.4%
sub-neg59.4%
distribute-rgt-in59.4%
metadata-eval59.4%
metadata-eval59.4%
Simplified59.4%
Taylor expanded in i around 0 62.4%
if 1.44999999999999996e-112 < n Initial program 12.5%
Taylor expanded in n around inf 26.4%
*-commutative26.4%
associate-/l*26.4%
expm1-define88.1%
Simplified88.1%
Taylor expanded in i around 0 82.4%
*-commutative82.4%
Simplified82.4%
Final simplification66.3%
(FPCore (i n)
:precision binary64
(if (<= n -2.1e-208)
(* 100.0 (* n (+ 1.0 (* i (+ 0.5 (* i 0.16666666666666666))))))
(if (<= n 1.55e-112)
(/ 0.0 (/ i n))
(*
100.0
(*
n
(+
1.0
(*
i
(+
0.5
(* i (+ 0.16666666666666666 (* i 0.041666666666666664)))))))))))
double code(double i, double n) {
double tmp;
if (n <= -2.1e-208) {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666)))));
} else if (n <= 1.55e-112) {
tmp = 0.0 / (i / n);
} else {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.1d-208)) then
tmp = 100.0d0 * (n * (1.0d0 + (i * (0.5d0 + (i * 0.16666666666666666d0)))))
else if (n <= 1.55d-112) then
tmp = 0.0d0 / (i / n)
else
tmp = 100.0d0 * (n * (1.0d0 + (i * (0.5d0 + (i * (0.16666666666666666d0 + (i * 0.041666666666666664d0)))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.1e-208) {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666)))));
} else if (n <= 1.55e-112) {
tmp = 0.0 / (i / n);
} else {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.1e-208: tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666))))) elif n <= 1.55e-112: tmp = 0.0 / (i / n) else: tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664))))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.1e-208) tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * Float64(0.5 + Float64(i * 0.16666666666666666)))))); elseif (n <= 1.55e-112) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * Float64(0.5 + Float64(i * Float64(0.16666666666666666 + Float64(i * 0.041666666666666664)))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.1e-208) tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666))))); elseif (n <= 1.55e-112) tmp = 0.0 / (i / n); else tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664))))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.1e-208], N[(100.0 * N[(n * N[(1.0 + N[(i * N[(0.5 + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.55e-112], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n * 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]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.1 \cdot 10^{-208}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{elif}\;n \leq 1.55 \cdot 10^{-112}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot \left(0.5 + i \cdot \left(0.16666666666666666 + i \cdot 0.041666666666666664\right)\right)\right)\right)\\
\end{array}
\end{array}
if n < -2.10000000000000012e-208Initial program 23.7%
Taylor expanded in n around inf 41.6%
*-commutative41.6%
associate-/l*41.5%
expm1-define82.7%
Simplified82.7%
Taylor expanded in i around 0 56.0%
*-commutative56.0%
Simplified56.0%
if -2.10000000000000012e-208 < n < 1.5499999999999999e-112Initial program 59.4%
associate-*r/59.4%
sub-neg59.4%
distribute-rgt-in59.4%
metadata-eval59.4%
metadata-eval59.4%
Simplified59.4%
Taylor expanded in i around 0 62.4%
if 1.5499999999999999e-112 < n Initial program 12.5%
Taylor expanded in n around inf 26.4%
*-commutative26.4%
associate-/l*26.4%
expm1-define88.1%
Simplified88.1%
Taylor expanded in i around 0 82.4%
*-commutative82.4%
Simplified82.4%
Final simplification66.2%
(FPCore (i n)
:precision binary64
(if (<= n -3.6e-208)
(* 100.0 (* n (+ 1.0 (* i (+ 0.5 (* i 0.16666666666666666))))))
(if (<= n 3.15e-242)
(/ (* n 0.0) i)
(if (<= n 1.52)
(* 100.0 (/ i (/ i n)))
(/ (* n (* i (+ 100.0 (* i 50.0)))) i)))))
double code(double i, double n) {
double tmp;
if (n <= -3.6e-208) {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666)))));
} else if (n <= 3.15e-242) {
tmp = (n * 0.0) / i;
} else if (n <= 1.52) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = (n * (i * (100.0 + (i * 50.0)))) / i;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-3.6d-208)) then
tmp = 100.0d0 * (n * (1.0d0 + (i * (0.5d0 + (i * 0.16666666666666666d0)))))
else if (n <= 3.15d-242) then
tmp = (n * 0.0d0) / i
else if (n <= 1.52d0) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = (n * (i * (100.0d0 + (i * 50.0d0)))) / i
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -3.6e-208) {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666)))));
} else if (n <= 3.15e-242) {
tmp = (n * 0.0) / i;
} else if (n <= 1.52) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = (n * (i * (100.0 + (i * 50.0)))) / i;
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -3.6e-208: tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666))))) elif n <= 3.15e-242: tmp = (n * 0.0) / i elif n <= 1.52: tmp = 100.0 * (i / (i / n)) else: tmp = (n * (i * (100.0 + (i * 50.0)))) / i return tmp
function code(i, n) tmp = 0.0 if (n <= -3.6e-208) tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * Float64(0.5 + Float64(i * 0.16666666666666666)))))); elseif (n <= 3.15e-242) tmp = Float64(Float64(n * 0.0) / i); elseif (n <= 1.52) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(Float64(n * Float64(i * Float64(100.0 + Float64(i * 50.0)))) / i); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -3.6e-208) tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666))))); elseif (n <= 3.15e-242) tmp = (n * 0.0) / i; elseif (n <= 1.52) tmp = 100.0 * (i / (i / n)); else tmp = (n * (i * (100.0 + (i * 50.0)))) / i; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -3.6e-208], N[(100.0 * N[(n * N[(1.0 + N[(i * N[(0.5 + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.15e-242], N[(N[(n * 0.0), $MachinePrecision] / i), $MachinePrecision], If[LessEqual[n, 1.52], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * N[(i * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.6 \cdot 10^{-208}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{elif}\;n \leq 3.15 \cdot 10^{-242}:\\
\;\;\;\;\frac{n \cdot 0}{i}\\
\mathbf{elif}\;n \leq 1.52:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot \left(i \cdot \left(100 + i \cdot 50\right)\right)}{i}\\
\end{array}
\end{array}
if n < -3.5999999999999998e-208Initial program 23.7%
Taylor expanded in n around inf 41.6%
*-commutative41.6%
associate-/l*41.5%
expm1-define82.7%
Simplified82.7%
Taylor expanded in i around 0 56.0%
*-commutative56.0%
Simplified56.0%
if -3.5999999999999998e-208 < n < 3.1500000000000001e-242Initial program 88.2%
associate-/r/88.2%
associate-*r*88.2%
*-commutative88.2%
associate-*r/88.2%
sub-neg88.2%
distribute-lft-in88.2%
metadata-eval88.2%
metadata-eval88.2%
metadata-eval88.2%
fma-define88.2%
metadata-eval88.2%
Simplified88.2%
Taylor expanded in n around inf 82.0%
Taylor expanded in i around 0 88.2%
if 3.1500000000000001e-242 < n < 1.52Initial program 22.1%
Taylor expanded in i around 0 58.7%
if 1.52 < n Initial program 14.0%
associate-/r/14.7%
associate-*r*14.7%
*-commutative14.7%
associate-*r/14.7%
sub-neg14.7%
distribute-lft-in14.7%
metadata-eval14.7%
metadata-eval14.7%
metadata-eval14.7%
fma-define14.7%
metadata-eval14.7%
Simplified14.7%
Taylor expanded in n around inf 30.4%
Taylor expanded in i around 0 84.7%
*-commutative84.7%
Simplified84.7%
Final simplification66.6%
(FPCore (i n)
:precision binary64
(if (<= n -2.2e-208)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n 1.52e-242)
(/ (* n 0.0) i)
(if (<= n 1.6)
(* 100.0 (/ i (/ i n)))
(/ (* n (* i (+ 100.0 (* i 50.0)))) i)))))
double code(double i, double n) {
double tmp;
if (n <= -2.2e-208) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 1.52e-242) {
tmp = (n * 0.0) / i;
} else if (n <= 1.6) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = (n * (i * (100.0 + (i * 50.0)))) / i;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.2d-208)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= 1.52d-242) then
tmp = (n * 0.0d0) / i
else if (n <= 1.6d0) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = (n * (i * (100.0d0 + (i * 50.0d0)))) / i
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.2e-208) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 1.52e-242) {
tmp = (n * 0.0) / i;
} else if (n <= 1.6) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = (n * (i * (100.0 + (i * 50.0)))) / i;
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.2e-208: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= 1.52e-242: tmp = (n * 0.0) / i elif n <= 1.6: tmp = 100.0 * (i / (i / n)) else: tmp = (n * (i * (100.0 + (i * 50.0)))) / i return tmp
function code(i, n) tmp = 0.0 if (n <= -2.2e-208) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= 1.52e-242) tmp = Float64(Float64(n * 0.0) / i); elseif (n <= 1.6) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(Float64(n * Float64(i * Float64(100.0 + Float64(i * 50.0)))) / i); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.2e-208) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= 1.52e-242) tmp = (n * 0.0) / i; elseif (n <= 1.6) tmp = 100.0 * (i / (i / n)); else tmp = (n * (i * (100.0 + (i * 50.0)))) / i; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.2e-208], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.52e-242], N[(N[(n * 0.0), $MachinePrecision] / i), $MachinePrecision], If[LessEqual[n, 1.6], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * N[(i * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.2 \cdot 10^{-208}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq 1.52 \cdot 10^{-242}:\\
\;\;\;\;\frac{n \cdot 0}{i}\\
\mathbf{elif}\;n \leq 1.6:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot \left(i \cdot \left(100 + i \cdot 50\right)\right)}{i}\\
\end{array}
\end{array}
if n < -2.2e-208Initial program 23.7%
associate-/r/23.2%
associate-*r*23.2%
*-commutative23.2%
associate-*r/23.2%
sub-neg23.2%
distribute-lft-in23.2%
metadata-eval23.2%
metadata-eval23.2%
metadata-eval23.2%
fma-define23.2%
metadata-eval23.2%
Simplified23.2%
Taylor expanded in n around inf 41.6%
sub-neg41.6%
metadata-eval41.6%
metadata-eval41.6%
distribute-lft-in41.6%
metadata-eval41.6%
sub-neg41.6%
expm1-define82.7%
Simplified82.7%
Taylor expanded in i around 0 56.0%
*-commutative56.0%
Simplified56.0%
if -2.2e-208 < n < 1.5199999999999999e-242Initial program 88.2%
associate-/r/88.2%
associate-*r*88.2%
*-commutative88.2%
associate-*r/88.2%
sub-neg88.2%
distribute-lft-in88.2%
metadata-eval88.2%
metadata-eval88.2%
metadata-eval88.2%
fma-define88.2%
metadata-eval88.2%
Simplified88.2%
Taylor expanded in n around inf 82.0%
Taylor expanded in i around 0 88.2%
if 1.5199999999999999e-242 < n < 1.6000000000000001Initial program 22.1%
Taylor expanded in i around 0 58.7%
if 1.6000000000000001 < n Initial program 14.0%
associate-/r/14.7%
associate-*r*14.7%
*-commutative14.7%
associate-*r/14.7%
sub-neg14.7%
distribute-lft-in14.7%
metadata-eval14.7%
metadata-eval14.7%
metadata-eval14.7%
fma-define14.7%
metadata-eval14.7%
Simplified14.7%
Taylor expanded in n around inf 30.4%
Taylor expanded in i around 0 84.7%
*-commutative84.7%
Simplified84.7%
Final simplification66.6%
(FPCore (i n)
:precision binary64
(if (<= n -1.2e-210)
(* 100.0 (* n (+ 1.0 (* i (+ 0.5 (* i 0.16666666666666666))))))
(if (<= n 3.2e-109)
(/ 0.0 (/ i n))
(*
n
(+
100.0
(* i (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667))))))))))
double code(double i, double n) {
double tmp;
if (n <= -1.2e-210) {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666)))));
} else if (n <= 3.2e-109) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.2d-210)) then
tmp = 100.0d0 * (n * (1.0d0 + (i * (0.5d0 + (i * 0.16666666666666666d0)))))
else if (n <= 3.2d-109) then
tmp = 0.0d0 / (i / n)
else
tmp = n * (100.0d0 + (i * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.2e-210) {
tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666)))));
} else if (n <= 3.2e-109) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.2e-210: tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666))))) elif n <= 3.2e-109: tmp = 0.0 / (i / n) else: tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.2e-210) tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * Float64(0.5 + Float64(i * 0.16666666666666666)))))); elseif (n <= 3.2e-109) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.2e-210) tmp = 100.0 * (n * (1.0 + (i * (0.5 + (i * 0.16666666666666666))))); elseif (n <= 3.2e-109) tmp = 0.0 / (i / n); else tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.2e-210], N[(100.0 * N[(n * N[(1.0 + N[(i * N[(0.5 + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.2e-109], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.2 \cdot 10^{-210}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{elif}\;n \leq 3.2 \cdot 10^{-109}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\end{array}
\end{array}
if n < -1.20000000000000002e-210Initial program 23.7%
Taylor expanded in n around inf 41.6%
*-commutative41.6%
associate-/l*41.5%
expm1-define82.7%
Simplified82.7%
Taylor expanded in i around 0 56.0%
*-commutative56.0%
Simplified56.0%
if -1.20000000000000002e-210 < n < 3.2000000000000002e-109Initial program 59.4%
associate-*r/59.4%
sub-neg59.4%
distribute-rgt-in59.4%
metadata-eval59.4%
metadata-eval59.4%
Simplified59.4%
Taylor expanded in i around 0 62.4%
if 3.2000000000000002e-109 < n Initial program 12.5%
associate-/r/13.0%
associate-*r*13.0%
*-commutative13.0%
associate-*r/13.0%
sub-neg13.0%
distribute-lft-in13.0%
metadata-eval13.0%
metadata-eval13.0%
metadata-eval13.0%
fma-define13.0%
metadata-eval13.0%
Simplified13.0%
Taylor expanded in n around inf 26.3%
sub-neg26.3%
metadata-eval26.3%
metadata-eval26.3%
distribute-lft-in26.4%
metadata-eval26.4%
sub-neg26.4%
expm1-define88.0%
Simplified88.0%
Taylor expanded in i around 0 82.4%
*-commutative82.4%
Simplified82.4%
Final simplification66.2%
(FPCore (i n) :precision binary64 (if (or (<= n -3.5e-208) (not (<= n 1.45e-112))) (* 100.0 (* n (+ 1.0 (* i 0.5)))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -3.5e-208) || !(n <= 1.45e-112)) {
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 <= (-3.5d-208)) .or. (.not. (n <= 1.45d-112))) 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 <= -3.5e-208) || !(n <= 1.45e-112)) {
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 <= -3.5e-208) or not (n <= 1.45e-112): 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 <= -3.5e-208) || !(n <= 1.45e-112)) 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 <= -3.5e-208) || ~((n <= 1.45e-112))) 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, -3.5e-208], N[Not[LessEqual[n, 1.45e-112]], $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 -3.5 \cdot 10^{-208} \lor \neg \left(n \leq 1.45 \cdot 10^{-112}\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 < -3.49999999999999991e-208 or 1.44999999999999996e-112 < n Initial program 19.1%
Taylor expanded in n around inf 35.4%
*-commutative35.4%
associate-/l*35.3%
expm1-define84.9%
Simplified84.9%
Taylor expanded in i around 0 61.9%
*-commutative61.9%
Simplified61.9%
if -3.49999999999999991e-208 < n < 1.44999999999999996e-112Initial program 59.4%
associate-*r/59.4%
sub-neg59.4%
distribute-rgt-in59.4%
metadata-eval59.4%
metadata-eval59.4%
Simplified59.4%
Taylor expanded in i around 0 62.4%
Final simplification62.0%
(FPCore (i n) :precision binary64 (if (or (<= n -6e-210) (not (<= n 1.45e-112))) (* 100.0 (* n (+ 1.0 (* i 0.5)))) (/ (* n 0.0) i)))
double code(double i, double n) {
double tmp;
if ((n <= -6e-210) || !(n <= 1.45e-112)) {
tmp = 100.0 * (n * (1.0 + (i * 0.5)));
} else {
tmp = (n * 0.0) / i;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-6d-210)) .or. (.not. (n <= 1.45d-112))) then
tmp = 100.0d0 * (n * (1.0d0 + (i * 0.5d0)))
else
tmp = (n * 0.0d0) / i
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -6e-210) || !(n <= 1.45e-112)) {
tmp = 100.0 * (n * (1.0 + (i * 0.5)));
} else {
tmp = (n * 0.0) / i;
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -6e-210) or not (n <= 1.45e-112): tmp = 100.0 * (n * (1.0 + (i * 0.5))) else: tmp = (n * 0.0) / i return tmp
function code(i, n) tmp = 0.0 if ((n <= -6e-210) || !(n <= 1.45e-112)) tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(i * 0.5)))); else tmp = Float64(Float64(n * 0.0) / i); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -6e-210) || ~((n <= 1.45e-112))) tmp = 100.0 * (n * (1.0 + (i * 0.5))); else tmp = (n * 0.0) / i; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -6e-210], N[Not[LessEqual[n, 1.45e-112]], $MachinePrecision]], N[(100.0 * N[(n * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 0.0), $MachinePrecision] / i), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -6 \cdot 10^{-210} \lor \neg \left(n \leq 1.45 \cdot 10^{-112}\right):\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + i \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot 0}{i}\\
\end{array}
\end{array}
if n < -6.0000000000000003e-210 or 1.44999999999999996e-112 < n Initial program 19.1%
Taylor expanded in n around inf 35.4%
*-commutative35.4%
associate-/l*35.3%
expm1-define84.9%
Simplified84.9%
Taylor expanded in i around 0 61.9%
*-commutative61.9%
Simplified61.9%
if -6.0000000000000003e-210 < n < 1.44999999999999996e-112Initial program 59.4%
associate-/r/59.5%
associate-*r*59.5%
*-commutative59.5%
associate-*r/59.5%
sub-neg59.5%
distribute-lft-in59.5%
metadata-eval59.5%
metadata-eval59.5%
metadata-eval59.5%
fma-define59.5%
metadata-eval59.5%
Simplified59.5%
Taylor expanded in n around inf 38.3%
Taylor expanded in i around 0 62.4%
Final simplification62.0%
(FPCore (i n) :precision binary64 (if (or (<= n -5.3e-208) (not (<= n 1.45e-112))) (* n (+ 100.0 (* i 50.0))) (/ (* n 0.0) i)))
double code(double i, double n) {
double tmp;
if ((n <= -5.3e-208) || !(n <= 1.45e-112)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = (n * 0.0) / i;
}
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-208)) .or. (.not. (n <= 1.45d-112))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = (n * 0.0d0) / i
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -5.3e-208) || !(n <= 1.45e-112)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = (n * 0.0) / i;
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -5.3e-208) or not (n <= 1.45e-112): tmp = n * (100.0 + (i * 50.0)) else: tmp = (n * 0.0) / i return tmp
function code(i, n) tmp = 0.0 if ((n <= -5.3e-208) || !(n <= 1.45e-112)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(Float64(n * 0.0) / i); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -5.3e-208) || ~((n <= 1.45e-112))) tmp = n * (100.0 + (i * 50.0)); else tmp = (n * 0.0) / i; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -5.3e-208], N[Not[LessEqual[n, 1.45e-112]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 0.0), $MachinePrecision] / i), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -5.3 \cdot 10^{-208} \lor \neg \left(n \leq 1.45 \cdot 10^{-112}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot 0}{i}\\
\end{array}
\end{array}
if n < -5.29999999999999983e-208 or 1.44999999999999996e-112 < n Initial program 19.1%
Taylor expanded in n around inf 35.4%
*-commutative35.4%
associate-/l*35.3%
expm1-define84.9%
Simplified84.9%
Taylor expanded in i around 0 61.9%
+-commutative61.9%
associate-*r*61.9%
distribute-rgt-in61.9%
*-commutative61.9%
Simplified61.9%
if -5.29999999999999983e-208 < n < 1.44999999999999996e-112Initial program 59.4%
associate-/r/59.5%
associate-*r*59.5%
*-commutative59.5%
associate-*r/59.5%
sub-neg59.5%
distribute-lft-in59.5%
metadata-eval59.5%
metadata-eval59.5%
metadata-eval59.5%
fma-define59.5%
metadata-eval59.5%
Simplified59.5%
Taylor expanded in n around inf 38.3%
Taylor expanded in i around 0 62.4%
Final simplification62.0%
(FPCore (i n) :precision binary64 (if (<= i -9.2e+61) (/ (* n 0.0) i) (* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))))
double code(double i, double n) {
double tmp;
if (i <= -9.2e+61) {
tmp = (n * 0.0) / i;
} else {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-9.2d+61)) then
tmp = (n * 0.0d0) / i
else
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -9.2e+61) {
tmp = (n * 0.0) / i;
} else {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -9.2e+61: tmp = (n * 0.0) / i else: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) return tmp
function code(i, n) tmp = 0.0 if (i <= -9.2e+61) tmp = Float64(Float64(n * 0.0) / i); else tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -9.2e+61) tmp = (n * 0.0) / i; else tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -9.2e+61], N[(N[(n * 0.0), $MachinePrecision] / i), $MachinePrecision], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -9.2 \cdot 10^{+61}:\\
\;\;\;\;\frac{n \cdot 0}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\end{array}
\end{array}
if i < -9.1999999999999998e61Initial program 53.4%
associate-/r/51.2%
associate-*r*51.1%
*-commutative51.1%
associate-*r/51.2%
sub-neg51.2%
distribute-lft-in51.2%
metadata-eval51.2%
metadata-eval51.2%
metadata-eval51.2%
fma-define51.2%
metadata-eval51.2%
Simplified51.2%
Taylor expanded in n around inf 70.2%
Taylor expanded in i around 0 20.6%
if -9.1999999999999998e61 < i Initial program 18.3%
associate-/r/18.7%
associate-*r*18.7%
*-commutative18.7%
associate-*r/18.7%
sub-neg18.7%
distribute-lft-in18.7%
metadata-eval18.7%
metadata-eval18.7%
metadata-eval18.7%
fma-define18.7%
metadata-eval18.7%
Simplified18.7%
Taylor expanded in n around inf 27.0%
sub-neg27.0%
metadata-eval27.0%
metadata-eval27.0%
distribute-lft-in27.1%
metadata-eval27.1%
sub-neg27.1%
expm1-define78.8%
Simplified78.8%
Taylor expanded in i around 0 72.3%
*-commutative72.3%
Simplified72.3%
Final simplification63.2%
(FPCore (i n) :precision binary64 (if (<= i -2e+55) (* 100.0 (/ i (/ i n))) (if (<= i 17000000.0) (* n 100.0) (* (* i n) 50.0))))
double code(double i, double n) {
double tmp;
if (i <= -2e+55) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 17000000.0) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-2d+55)) then
tmp = 100.0d0 * (i / (i / n))
else if (i <= 17000000.0d0) then
tmp = n * 100.0d0
else
tmp = (i * n) * 50.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -2e+55) {
tmp = 100.0 * (i / (i / n));
} else if (i <= 17000000.0) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -2e+55: tmp = 100.0 * (i / (i / n)) elif i <= 17000000.0: tmp = n * 100.0 else: tmp = (i * n) * 50.0 return tmp
function code(i, n) tmp = 0.0 if (i <= -2e+55) tmp = Float64(100.0 * Float64(i / Float64(i / n))); elseif (i <= 17000000.0) tmp = Float64(n * 100.0); else tmp = Float64(Float64(i * n) * 50.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -2e+55) tmp = 100.0 * (i / (i / n)); elseif (i <= 17000000.0) tmp = n * 100.0; else tmp = (i * n) * 50.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -2e+55], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 17000000.0], N[(n * 100.0), $MachinePrecision], N[(N[(i * n), $MachinePrecision] * 50.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2 \cdot 10^{+55}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 17000000:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot n\right) \cdot 50\\
\end{array}
\end{array}
if i < -2.00000000000000002e55Initial program 51.2%
Taylor expanded in i around 0 16.6%
if -2.00000000000000002e55 < i < 1.7e7Initial program 10.5%
associate-/r/11.0%
associate-*r*11.0%
*-commutative11.0%
associate-*r/11.0%
sub-neg11.0%
distribute-lft-in11.0%
metadata-eval11.0%
metadata-eval11.0%
metadata-eval11.0%
fma-define11.0%
metadata-eval11.0%
Simplified11.0%
Taylor expanded in i around 0 79.6%
*-commutative79.6%
Simplified79.6%
if 1.7e7 < i Initial program 42.3%
Taylor expanded in n around inf 58.2%
*-commutative58.2%
associate-/l*58.2%
expm1-define58.2%
Simplified58.2%
Taylor expanded in i around 0 35.5%
+-commutative35.5%
associate-*r*35.5%
distribute-rgt-in35.5%
*-commutative35.5%
Simplified35.5%
Taylor expanded in i around inf 35.5%
Final simplification59.1%
(FPCore (i n) :precision binary64 (if (<= i -1.15) (* 100.0 (/ i (/ i n))) (* n (+ 100.0 (* i 50.0)))))
double code(double i, double n) {
double tmp;
if (i <= -1.15) {
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 (i <= (-1.15d0)) 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 (i <= -1.15) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -1.15: tmp = 100.0 * (i / (i / n)) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (i <= -1.15) 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 (i <= -1.15) tmp = 100.0 * (i / (i / n)); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -1.15], 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}\;i \leq -1.15:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if i < -1.1499999999999999Initial program 46.8%
Taylor expanded in i around 0 15.6%
if -1.1499999999999999 < i Initial program 18.5%
Taylor expanded in n around inf 24.3%
*-commutative24.3%
associate-/l*24.3%
expm1-define78.4%
Simplified78.4%
Taylor expanded in i around 0 71.4%
+-commutative71.4%
associate-*r*71.4%
distribute-rgt-in71.4%
*-commutative71.4%
Simplified71.4%
(FPCore (i n) :precision binary64 (if (<= i 1800000.0) (* n 100.0) (* (* i n) 50.0)))
double code(double i, double n) {
double tmp;
if (i <= 1800000.0) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 1800000.0d0) then
tmp = n * 100.0d0
else
tmp = (i * n) * 50.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 1800000.0) {
tmp = n * 100.0;
} else {
tmp = (i * n) * 50.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 1800000.0: tmp = n * 100.0 else: tmp = (i * n) * 50.0 return tmp
function code(i, n) tmp = 0.0 if (i <= 1800000.0) tmp = Float64(n * 100.0); else tmp = Float64(Float64(i * n) * 50.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 1800000.0) tmp = n * 100.0; else tmp = (i * n) * 50.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 1800000.0], N[(n * 100.0), $MachinePrecision], N[(N[(i * n), $MachinePrecision] * 50.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 1800000:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;\left(i \cdot n\right) \cdot 50\\
\end{array}
\end{array}
if i < 1.8e6Initial program 19.9%
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 i around 0 62.3%
*-commutative62.3%
Simplified62.3%
if 1.8e6 < i Initial program 42.3%
Taylor expanded in n around inf 58.2%
*-commutative58.2%
associate-/l*58.2%
expm1-define58.2%
Simplified58.2%
Taylor expanded in i around 0 35.5%
+-commutative35.5%
associate-*r*35.5%
distribute-rgt-in35.5%
*-commutative35.5%
Simplified35.5%
Taylor expanded in i around inf 35.5%
Final simplification56.9%
(FPCore (i n) :precision binary64 (* n 100.0))
double code(double i, double n) {
return n * 100.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = n * 100.0d0
end function
public static double code(double i, double n) {
return n * 100.0;
}
def code(i, n): return n * 100.0
function code(i, n) return Float64(n * 100.0) end
function tmp = code(i, n) tmp = n * 100.0; end
code[i_, n_] := N[(n * 100.0), $MachinePrecision]
\begin{array}{l}
\\
n \cdot 100
\end{array}
Initial program 24.5%
associate-/r/24.4%
associate-*r*24.4%
*-commutative24.4%
associate-*r/24.4%
sub-neg24.4%
distribute-lft-in24.4%
metadata-eval24.4%
metadata-eval24.4%
metadata-eval24.4%
fma-define24.4%
metadata-eval24.4%
Simplified24.4%
Taylor expanded in i around 0 51.0%
*-commutative51.0%
Simplified51.0%
(FPCore (i n) :precision binary64 (* i -50.0))
double code(double i, double n) {
return i * -50.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = i * (-50.0d0)
end function
public static double code(double i, double n) {
return i * -50.0;
}
def code(i, n): return i * -50.0
function code(i, n) return Float64(i * -50.0) end
function tmp = code(i, n) tmp = i * -50.0; end
code[i_, n_] := N[(i * -50.0), $MachinePrecision]
\begin{array}{l}
\\
i \cdot -50
\end{array}
Initial program 24.5%
associate-/r/24.4%
associate-*r*24.4%
*-commutative24.4%
associate-*r/24.4%
sub-neg24.4%
distribute-lft-in24.4%
metadata-eval24.4%
metadata-eval24.4%
metadata-eval24.4%
fma-define24.4%
metadata-eval24.4%
Simplified24.4%
Taylor expanded in i around 0 57.1%
*-commutative57.1%
associate-*r/57.1%
metadata-eval57.1%
Simplified57.1%
Taylor expanded in n around 0 3.3%
*-commutative3.3%
Simplified3.3%
(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 2024146
(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))))