
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 -4e-153)
(/ (* n (fma t_0 100.0 -100.0)) i)
(if (<= t_1 0.0)
(* n (/ (* 100.0 (expm1 (* n (log1p (/ i n))))) i))
(if (<= t_1 INFINITY)
(* n (/ (fma 100.0 t_0 -100.0) i))
(* n (/ 1.0 (+ 0.01 (* (* i 0.01) (+ (/ 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 <= -4e-153) {
tmp = (n * fma(t_0, 100.0, -100.0)) / i;
} else if (t_1 <= 0.0) {
tmp = n * ((100.0 * expm1((n * log1p((i / n))))) / i);
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (fma(100.0, t_0, -100.0) / i);
} else {
tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((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 <= -4e-153) tmp = Float64(Float64(n * fma(t_0, 100.0, -100.0)) / i); 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(n * Float64(fma(100.0, t_0, -100.0) / i)); else tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(Float64(i * 0.01) * 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, -4e-153], N[(N[(n * N[(t$95$0 * 100.0 + -100.0), $MachinePrecision]), $MachinePrecision] / i), $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[(n * N[(N[(100.0 * t$95$0 + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n * N[(1.0 / N[(0.01 + N[(N[(i * 0.01), $MachinePrecision] * 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 -4 \cdot 10^{-153}:\\
\;\;\;\;\frac{n \cdot \mathsf{fma}\left(t\_0, 100, -100\right)}{i}\\
\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:\\
\;\;\;\;n \cdot \frac{\mathsf{fma}\left(100, t\_0, -100\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + \left(i \cdot 0.01\right) \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)) < -4.00000000000000016e-153Initial program 99.7%
associate-*r/99.7%
sub-neg99.7%
distribute-rgt-in99.7%
metadata-eval99.7%
metadata-eval99.7%
associate-/r/99.8%
*-commutative99.8%
fma-undefine99.8%
*-commutative99.8%
associate-*r/99.9%
fma-undefine99.9%
*-commutative99.9%
fma-define99.9%
Applied egg-rr99.9%
if -4.00000000000000016e-153 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 19.6%
associate-/r/19.6%
associate-*r*19.6%
*-commutative19.6%
associate-*r/19.6%
sub-neg19.6%
distribute-lft-in19.6%
metadata-eval19.6%
metadata-eval19.6%
metadata-eval19.6%
fma-define19.6%
metadata-eval19.6%
Simplified19.6%
fma-undefine19.6%
metadata-eval19.6%
metadata-eval19.6%
distribute-lft-in19.6%
sub-neg19.6%
*-commutative19.6%
add-exp-log19.6%
expm1-define19.6%
log-pow30.2%
log1p-define99.3%
Applied egg-rr99.3%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 99.5%
associate-/r/99.8%
associate-*r*99.9%
*-commutative99.9%
associate-*r/99.9%
sub-neg99.9%
distribute-lft-in99.7%
metadata-eval99.7%
metadata-eval99.7%
metadata-eval99.7%
fma-define99.9%
metadata-eval99.9%
Simplified99.9%
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%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
metadata-eval1.9%
metadata-eval1.9%
metadata-eval1.9%
fma-define1.9%
metadata-eval1.9%
Simplified1.9%
fma-undefine1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
sub-neg1.9%
*-commutative1.9%
add-exp-log1.9%
expm1-define1.9%
log-pow1.9%
log1p-define1.9%
Applied egg-rr1.9%
clear-num1.9%
inv-pow1.9%
Applied egg-rr1.9%
unpow-11.9%
*-commutative1.9%
Simplified1.9%
Taylor expanded in i around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
sub-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification99.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 (- INFINITY))
(*
(/ 100.0 i)
(*
i
(+
n
(*
i
(+
(* n 0.5)
(*
i
(+ (* 0.041666666666666664 (* i n)) (* n 0.16666666666666666))))))))
(if (<= t_1 0.0)
(* n (/ (* 100.0 (expm1 (* n (log1p (/ i n))))) i))
(if (<= t_1 INFINITY)
(* n (/ (fma 100.0 t_0 -100.0) i))
(* n (/ 1.0 (+ 0.01 (* (* i 0.01) (+ (/ 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 = (100.0 / i) * (i * (n + (i * ((n * 0.5) + (i * ((0.041666666666666664 * (i * n)) + (n * 0.16666666666666666)))))));
} else if (t_1 <= 0.0) {
tmp = n * ((100.0 * expm1((n * log1p((i / n))))) / i);
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (fma(100.0, t_0, -100.0) / i);
} else {
tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((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(Float64(100.0 / i) * Float64(i * Float64(n + Float64(i * Float64(Float64(n * 0.5) + Float64(i * Float64(Float64(0.041666666666666664 * Float64(i * n)) + Float64(n * 0.16666666666666666)))))))); 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(n * Float64(fma(100.0, t_0, -100.0) / i)); else tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(Float64(i * 0.01) * 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[(100.0 / i), $MachinePrecision] * N[(i * N[(n + N[(i * N[(N[(n * 0.5), $MachinePrecision] + N[(i * N[(N[(0.041666666666666664 * N[(i * n), $MachinePrecision]), $MachinePrecision] + N[(n * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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[(n * N[(N[(100.0 * t$95$0 + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(n * N[(1.0 / N[(0.01 + N[(N[(i * 0.01), $MachinePrecision] * 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:\\
\;\;\;\;\frac{100}{i} \cdot \left(i \cdot \left(n + i \cdot \left(n \cdot 0.5 + i \cdot \left(0.041666666666666664 \cdot \left(i \cdot n\right) + n \cdot 0.16666666666666666\right)\right)\right)\right)\\
\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:\\
\;\;\;\;n \cdot \frac{\mathsf{fma}\left(100, t\_0, -100\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + \left(i \cdot 0.01\right) \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%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in n around inf 44.9%
Taylor expanded in i around inf 44.9%
sub-neg44.9%
metadata-eval44.9%
metadata-eval44.9%
distribute-lft-in44.9%
metadata-eval44.9%
sub-neg44.9%
expm1-define44.9%
Simplified44.9%
div-inv44.9%
times-frac44.9%
Applied egg-rr44.9%
Taylor expanded in i around 0 100.0%
if -inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 22.2%
associate-/r/22.3%
associate-*r*22.3%
*-commutative22.3%
associate-*r/22.3%
sub-neg22.3%
distribute-lft-in22.2%
metadata-eval22.2%
metadata-eval22.2%
metadata-eval22.2%
fma-define22.3%
metadata-eval22.3%
Simplified22.3%
fma-undefine22.2%
metadata-eval22.2%
metadata-eval22.2%
distribute-lft-in22.3%
sub-neg22.3%
*-commutative22.3%
add-exp-log22.3%
expm1-define22.3%
log-pow32.5%
log1p-define99.3%
Applied egg-rr99.3%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 99.5%
associate-/r/99.8%
associate-*r*99.9%
*-commutative99.9%
associate-*r/99.9%
sub-neg99.9%
distribute-lft-in99.7%
metadata-eval99.7%
metadata-eval99.7%
metadata-eval99.7%
fma-define99.9%
metadata-eval99.9%
Simplified99.9%
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%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
metadata-eval1.9%
metadata-eval1.9%
metadata-eval1.9%
fma-define1.9%
metadata-eval1.9%
Simplified1.9%
fma-undefine1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
sub-neg1.9%
*-commutative1.9%
add-exp-log1.9%
expm1-define1.9%
log-pow1.9%
log1p-define1.9%
Applied egg-rr1.9%
clear-num1.9%
inv-pow1.9%
Applied egg-rr1.9%
unpow-11.9%
*-commutative1.9%
Simplified1.9%
Taylor expanded in i around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
sub-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification99.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 (- INFINITY))
(*
(/ 100.0 i)
(*
i
(+
n
(*
i
(+
(* n 0.5)
(*
i
(+ (* 0.041666666666666664 (* i n)) (* n 0.16666666666666666))))))))
(if (<= t_1 0.0)
(* n (/ (* 100.0 (expm1 (* n (log1p (/ i n))))) i))
(if (<= t_1 INFINITY)
(* (+ (/ t_0 i) (/ -1.0 i)) (* n 100.0))
(* n (/ 1.0 (+ 0.01 (* (* i 0.01) (+ (/ 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 = (100.0 / i) * (i * (n + (i * ((n * 0.5) + (i * ((0.041666666666666664 * (i * n)) + (n * 0.16666666666666666)))))));
} else if (t_1 <= 0.0) {
tmp = n * ((100.0 * expm1((n * log1p((i / n))))) / i);
} else if (t_1 <= ((double) INFINITY)) {
tmp = ((t_0 / i) + (-1.0 / i)) * (n * 100.0);
} else {
tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((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 = (100.0 / i) * (i * (n + (i * ((n * 0.5) + (i * ((0.041666666666666664 * (i * n)) + (n * 0.16666666666666666)))))));
} 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_0 / i) + (-1.0 / i)) * (n * 100.0);
} else {
tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((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 = (100.0 / i) * (i * (n + (i * ((n * 0.5) + (i * ((0.041666666666666664 * (i * n)) + (n * 0.16666666666666666))))))) elif t_1 <= 0.0: tmp = n * ((100.0 * math.expm1((n * math.log1p((i / n))))) / i) elif t_1 <= math.inf: tmp = ((t_0 / i) + (-1.0 / i)) * (n * 100.0) else: tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((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(Float64(100.0 / i) * Float64(i * Float64(n + Float64(i * Float64(Float64(n * 0.5) + Float64(i * Float64(Float64(0.041666666666666664 * Float64(i * n)) + Float64(n * 0.16666666666666666)))))))); 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(Float64(Float64(t_0 / i) + Float64(-1.0 / i)) * Float64(n * 100.0)); else tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(Float64(i * 0.01) * 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[(100.0 / i), $MachinePrecision] * N[(i * N[(n + N[(i * N[(N[(n * 0.5), $MachinePrecision] + N[(i * N[(N[(0.041666666666666664 * N[(i * n), $MachinePrecision]), $MachinePrecision] + N[(n * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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[(N[(N[(t$95$0 / i), $MachinePrecision] + N[(-1.0 / i), $MachinePrecision]), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], N[(n * N[(1.0 / N[(0.01 + N[(N[(i * 0.01), $MachinePrecision] * 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:\\
\;\;\;\;\frac{100}{i} \cdot \left(i \cdot \left(n + i \cdot \left(n \cdot 0.5 + i \cdot \left(0.041666666666666664 \cdot \left(i \cdot n\right) + n \cdot 0.16666666666666666\right)\right)\right)\right)\\
\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:\\
\;\;\;\;\left(\frac{t\_0}{i} + \frac{-1}{i}\right) \cdot \left(n \cdot 100\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + \left(i \cdot 0.01\right) \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%
sub-neg100.0%
distribute-rgt-in100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in n around inf 44.9%
Taylor expanded in i around inf 44.9%
sub-neg44.9%
metadata-eval44.9%
metadata-eval44.9%
distribute-lft-in44.9%
metadata-eval44.9%
sub-neg44.9%
expm1-define44.9%
Simplified44.9%
div-inv44.9%
times-frac44.9%
Applied egg-rr44.9%
Taylor expanded in i around 0 100.0%
if -inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 22.2%
associate-/r/22.3%
associate-*r*22.3%
*-commutative22.3%
associate-*r/22.3%
sub-neg22.3%
distribute-lft-in22.2%
metadata-eval22.2%
metadata-eval22.2%
metadata-eval22.2%
fma-define22.3%
metadata-eval22.3%
Simplified22.3%
fma-undefine22.2%
metadata-eval22.2%
metadata-eval22.2%
distribute-lft-in22.3%
sub-neg22.3%
*-commutative22.3%
add-exp-log22.3%
expm1-define22.3%
log-pow32.5%
log1p-define99.3%
Applied egg-rr99.3%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 99.5%
associate-*r/99.6%
sub-neg99.6%
distribute-rgt-in99.4%
metadata-eval99.4%
metadata-eval99.4%
Simplified99.4%
metadata-eval99.4%
metadata-eval99.4%
distribute-rgt-in99.6%
sub-neg99.6%
associate-*r/99.5%
*-commutative99.5%
associate-/r/99.8%
associate-*l*99.8%
add-exp-log99.8%
expm1-define99.8%
log-pow60.0%
log1p-define60.0%
Applied egg-rr60.0%
expm1-undefine59.9%
div-sub59.9%
*-commutative59.9%
log1p-undefine59.9%
exp-to-pow99.8%
+-commutative99.8%
Applied egg-rr99.8%
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%
associate-*r*1.9%
*-commutative1.9%
associate-*r/1.9%
sub-neg1.9%
distribute-lft-in1.9%
metadata-eval1.9%
metadata-eval1.9%
metadata-eval1.9%
fma-define1.9%
metadata-eval1.9%
Simplified1.9%
fma-undefine1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
sub-neg1.9%
*-commutative1.9%
add-exp-log1.9%
expm1-define1.9%
log-pow1.9%
log1p-define1.9%
Applied egg-rr1.9%
clear-num1.9%
inv-pow1.9%
Applied egg-rr1.9%
unpow-11.9%
*-commutative1.9%
Simplified1.9%
Taylor expanded in i around 0 100.0%
associate-*r*100.0%
*-commutative100.0%
sub-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification99.5%
(FPCore (i n) :precision binary64 (if (or (<= n -600000000.0) (not (<= n 1.0))) (* n (* 100.0 (/ (expm1 i) i))) (* n (/ 1.0 (+ 0.01 (* (* i 0.01) (+ (/ 0.5 n) -0.5)))))))
double code(double i, double n) {
double tmp;
if ((n <= -600000000.0) || !(n <= 1.0)) {
tmp = n * (100.0 * (expm1(i) / i));
} else {
tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -600000000.0) || !(n <= 1.0)) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else {
tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -600000000.0) or not (n <= 1.0): tmp = n * (100.0 * (math.expm1(i) / i)) else: tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5)))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -600000000.0) || !(n <= 1.0)) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); else tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(Float64(i * 0.01) * Float64(Float64(0.5 / n) + -0.5))))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -600000000.0], N[Not[LessEqual[n, 1.0]], $MachinePrecision]], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(1.0 / N[(0.01 + N[(N[(i * 0.01), $MachinePrecision] * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -600000000 \lor \neg \left(n \leq 1\right):\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + \left(i \cdot 0.01\right) \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\end{array}
\end{array}
if n < -6e8 or 1 < n Initial program 25.1%
associate-/r/25.7%
associate-*r*25.7%
*-commutative25.7%
associate-*r/25.7%
sub-neg25.7%
distribute-lft-in25.7%
metadata-eval25.7%
metadata-eval25.7%
metadata-eval25.7%
fma-define25.7%
metadata-eval25.7%
Simplified25.7%
Taylor expanded in n around inf 35.7%
div-sub36.1%
associate-*r/36.2%
metadata-eval36.2%
associate-*r/36.1%
distribute-lft-out--36.1%
div-sub35.7%
*-commutative35.7%
expm1-define91.2%
Simplified91.2%
if -6e8 < n < 1Initial program 29.4%
associate-/r/29.5%
associate-*r*29.5%
*-commutative29.5%
associate-*r/29.5%
sub-neg29.5%
distribute-lft-in29.4%
metadata-eval29.4%
metadata-eval29.4%
metadata-eval29.4%
fma-define29.5%
metadata-eval29.5%
Simplified29.5%
fma-undefine29.4%
metadata-eval29.4%
metadata-eval29.4%
distribute-lft-in29.5%
sub-neg29.5%
*-commutative29.5%
add-exp-log29.5%
expm1-define29.5%
log-pow46.8%
log1p-define94.3%
Applied egg-rr94.3%
clear-num94.2%
inv-pow94.2%
Applied egg-rr94.2%
unpow-194.2%
*-commutative94.2%
Simplified94.2%
Taylor expanded in i around 0 84.3%
associate-*r*84.3%
*-commutative84.3%
sub-neg84.3%
associate-*r/84.3%
metadata-eval84.3%
metadata-eval84.3%
Simplified84.3%
Final simplification88.3%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (expm1 i) i)))
(if (<= n -600000000.0)
(* n (* 100.0 t_0))
(if (<= n 1.0)
(* n (/ 1.0 (+ 0.01 (* (* i 0.01) (+ (/ 0.5 n) -0.5)))))
(* 100.0 (* n t_0))))))
double code(double i, double n) {
double t_0 = expm1(i) / i;
double tmp;
if (n <= -600000000.0) {
tmp = n * (100.0 * t_0);
} else if (n <= 1.0) {
tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))));
} else {
tmp = 100.0 * (n * t_0);
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.expm1(i) / i;
double tmp;
if (n <= -600000000.0) {
tmp = n * (100.0 * t_0);
} else if (n <= 1.0) {
tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))));
} else {
tmp = 100.0 * (n * t_0);
}
return tmp;
}
def code(i, n): t_0 = math.expm1(i) / i tmp = 0 if n <= -600000000.0: tmp = n * (100.0 * t_0) elif n <= 1.0: tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5)))) else: tmp = 100.0 * (n * t_0) return tmp
function code(i, n) t_0 = Float64(expm1(i) / i) tmp = 0.0 if (n <= -600000000.0) tmp = Float64(n * Float64(100.0 * t_0)); elseif (n <= 1.0) tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(Float64(i * 0.01) * Float64(Float64(0.5 / n) + -0.5))))); else tmp = Float64(100.0 * Float64(n * t_0)); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]}, If[LessEqual[n, -600000000.0], N[(n * N[(100.0 * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.0], N[(n * N[(1.0 / N[(0.01 + N[(N[(i * 0.01), $MachinePrecision] * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{expm1}\left(i\right)}{i}\\
\mathbf{if}\;n \leq -600000000:\\
\;\;\;\;n \cdot \left(100 \cdot t\_0\right)\\
\mathbf{elif}\;n \leq 1:\\
\;\;\;\;n \cdot \frac{1}{0.01 + \left(i \cdot 0.01\right) \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot t\_0\right)\\
\end{array}
\end{array}
if n < -6e8Initial program 30.7%
associate-/r/31.2%
associate-*r*31.2%
*-commutative31.2%
associate-*r/31.2%
sub-neg31.2%
distribute-lft-in31.2%
metadata-eval31.2%
metadata-eval31.2%
metadata-eval31.2%
fma-define31.2%
metadata-eval31.2%
Simplified31.2%
Taylor expanded in n around inf 34.5%
div-sub35.4%
associate-*r/35.7%
metadata-eval35.7%
associate-*r/35.4%
distribute-lft-out--35.4%
div-sub34.5%
*-commutative34.5%
expm1-define88.1%
Simplified88.1%
if -6e8 < n < 1Initial program 29.4%
associate-/r/29.5%
associate-*r*29.5%
*-commutative29.5%
associate-*r/29.5%
sub-neg29.5%
distribute-lft-in29.4%
metadata-eval29.4%
metadata-eval29.4%
metadata-eval29.4%
fma-define29.5%
metadata-eval29.5%
Simplified29.5%
fma-undefine29.4%
metadata-eval29.4%
metadata-eval29.4%
distribute-lft-in29.5%
sub-neg29.5%
*-commutative29.5%
add-exp-log29.5%
expm1-define29.5%
log-pow46.8%
log1p-define94.3%
Applied egg-rr94.3%
clear-num94.2%
inv-pow94.2%
Applied egg-rr94.2%
unpow-194.2%
*-commutative94.2%
Simplified94.2%
Taylor expanded in i around 0 84.3%
associate-*r*84.3%
*-commutative84.3%
sub-neg84.3%
associate-*r/84.3%
metadata-eval84.3%
metadata-eval84.3%
Simplified84.3%
if 1 < n Initial program 20.6%
Taylor expanded in n around inf 36.6%
*-commutative36.6%
associate-/l*36.6%
expm1-define93.9%
Simplified93.9%
Final simplification88.3%
(FPCore (i n)
:precision binary64
(if (or (<= n -5.4e+76) (not (<= n 3.0)))
(*
(/ 100.0 i)
(*
i
(+
n
(*
i
(+
(* n 0.5)
(*
i
(+ (* 0.041666666666666664 (* i n)) (* n 0.16666666666666666))))))))
(* n (/ 1.0 (+ 0.01 (* (* i 0.01) (+ (/ 0.5 n) -0.5)))))))
double code(double i, double n) {
double tmp;
if ((n <= -5.4e+76) || !(n <= 3.0)) {
tmp = (100.0 / i) * (i * (n + (i * ((n * 0.5) + (i * ((0.041666666666666664 * (i * n)) + (n * 0.16666666666666666)))))));
} else {
tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((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 <= (-5.4d+76)) .or. (.not. (n <= 3.0d0))) then
tmp = (100.0d0 / i) * (i * (n + (i * ((n * 0.5d0) + (i * ((0.041666666666666664d0 * (i * n)) + (n * 0.16666666666666666d0)))))))
else
tmp = n * (1.0d0 / (0.01d0 + ((i * 0.01d0) * ((0.5d0 / n) + (-0.5d0)))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -5.4e+76) || !(n <= 3.0)) {
tmp = (100.0 / i) * (i * (n + (i * ((n * 0.5) + (i * ((0.041666666666666664 * (i * n)) + (n * 0.16666666666666666)))))));
} else {
tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -5.4e+76) or not (n <= 3.0): tmp = (100.0 / i) * (i * (n + (i * ((n * 0.5) + (i * ((0.041666666666666664 * (i * n)) + (n * 0.16666666666666666))))))) else: tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5)))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -5.4e+76) || !(n <= 3.0)) tmp = Float64(Float64(100.0 / i) * Float64(i * Float64(n + Float64(i * Float64(Float64(n * 0.5) + Float64(i * Float64(Float64(0.041666666666666664 * Float64(i * n)) + Float64(n * 0.16666666666666666)))))))); else tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(Float64(i * 0.01) * Float64(Float64(0.5 / n) + -0.5))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -5.4e+76) || ~((n <= 3.0))) tmp = (100.0 / i) * (i * (n + (i * ((n * 0.5) + (i * ((0.041666666666666664 * (i * n)) + (n * 0.16666666666666666))))))); else tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5)))); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -5.4e+76], N[Not[LessEqual[n, 3.0]], $MachinePrecision]], N[(N[(100.0 / i), $MachinePrecision] * N[(i * N[(n + N[(i * N[(N[(n * 0.5), $MachinePrecision] + N[(i * N[(N[(0.041666666666666664 * N[(i * n), $MachinePrecision]), $MachinePrecision] + N[(n * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(1.0 / N[(0.01 + N[(N[(i * 0.01), $MachinePrecision] * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -5.4 \cdot 10^{+76} \lor \neg \left(n \leq 3\right):\\
\;\;\;\;\frac{100}{i} \cdot \left(i \cdot \left(n + i \cdot \left(n \cdot 0.5 + i \cdot \left(0.041666666666666664 \cdot \left(i \cdot n\right) + n \cdot 0.16666666666666666\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + \left(i \cdot 0.01\right) \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\end{array}
\end{array}
if n < -5.3999999999999998e76 or 3 < n Initial program 23.4%
associate-*r/23.4%
sub-neg23.4%
distribute-rgt-in23.4%
metadata-eval23.4%
metadata-eval23.4%
Simplified23.4%
Taylor expanded in n around inf 34.9%
Taylor expanded in i around inf 34.9%
sub-neg34.9%
metadata-eval34.9%
metadata-eval34.9%
distribute-lft-in34.9%
metadata-eval34.9%
sub-neg34.9%
expm1-define61.2%
Simplified61.2%
div-inv61.1%
times-frac91.0%
Applied egg-rr91.0%
Taylor expanded in i around 0 79.9%
if -5.3999999999999998e76 < n < 3Initial program 30.5%
associate-/r/30.6%
associate-*r*30.6%
*-commutative30.6%
associate-*r/30.6%
sub-neg30.6%
distribute-lft-in30.5%
metadata-eval30.5%
metadata-eval30.5%
metadata-eval30.5%
fma-define30.6%
metadata-eval30.6%
Simplified30.6%
fma-undefine30.5%
metadata-eval30.5%
metadata-eval30.5%
distribute-lft-in30.6%
sub-neg30.6%
*-commutative30.6%
add-exp-log30.6%
expm1-define30.6%
log-pow43.6%
log1p-define93.6%
Applied egg-rr93.6%
clear-num93.5%
inv-pow93.5%
Applied egg-rr93.5%
unpow-193.5%
*-commutative93.5%
Simplified93.5%
Taylor expanded in i around 0 80.7%
associate-*r*80.7%
*-commutative80.7%
sub-neg80.7%
associate-*r/80.7%
metadata-eval80.7%
metadata-eval80.7%
Simplified80.7%
Final simplification80.3%
(FPCore (i n)
:precision binary64
(if (or (<= n -5.6e+109) (not (<= n 1.0)))
(+
(* n 100.0)
(*
i
(+
(* n 50.0)
(* i (+ (* (* i n) 4.166666666666667) (* n 16.666666666666668))))))
(* n (/ 1.0 (+ 0.01 (* (* i 0.01) (+ (/ 0.5 n) -0.5)))))))
double code(double i, double n) {
double tmp;
if ((n <= -5.6e+109) || !(n <= 1.0)) {
tmp = (n * 100.0) + (i * ((n * 50.0) + (i * (((i * n) * 4.166666666666667) + (n * 16.666666666666668)))));
} else {
tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((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 <= (-5.6d+109)) .or. (.not. (n <= 1.0d0))) then
tmp = (n * 100.0d0) + (i * ((n * 50.0d0) + (i * (((i * n) * 4.166666666666667d0) + (n * 16.666666666666668d0)))))
else
tmp = n * (1.0d0 / (0.01d0 + ((i * 0.01d0) * ((0.5d0 / n) + (-0.5d0)))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -5.6e+109) || !(n <= 1.0)) {
tmp = (n * 100.0) + (i * ((n * 50.0) + (i * (((i * n) * 4.166666666666667) + (n * 16.666666666666668)))));
} else {
tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -5.6e+109) or not (n <= 1.0): tmp = (n * 100.0) + (i * ((n * 50.0) + (i * (((i * n) * 4.166666666666667) + (n * 16.666666666666668))))) else: tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5)))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -5.6e+109) || !(n <= 1.0)) tmp = Float64(Float64(n * 100.0) + Float64(i * Float64(Float64(n * 50.0) + Float64(i * Float64(Float64(Float64(i * n) * 4.166666666666667) + Float64(n * 16.666666666666668)))))); else tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(Float64(i * 0.01) * Float64(Float64(0.5 / n) + -0.5))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -5.6e+109) || ~((n <= 1.0))) tmp = (n * 100.0) + (i * ((n * 50.0) + (i * (((i * n) * 4.166666666666667) + (n * 16.666666666666668))))); else tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5)))); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -5.6e+109], N[Not[LessEqual[n, 1.0]], $MachinePrecision]], N[(N[(n * 100.0), $MachinePrecision] + N[(i * N[(N[(n * 50.0), $MachinePrecision] + N[(i * N[(N[(N[(i * n), $MachinePrecision] * 4.166666666666667), $MachinePrecision] + N[(n * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(1.0 / N[(0.01 + N[(N[(i * 0.01), $MachinePrecision] * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -5.6 \cdot 10^{+109} \lor \neg \left(n \leq 1\right):\\
\;\;\;\;n \cdot 100 + i \cdot \left(n \cdot 50 + i \cdot \left(\left(i \cdot n\right) \cdot 4.166666666666667 + n \cdot 16.666666666666668\right)\right)\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + \left(i \cdot 0.01\right) \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\end{array}
\end{array}
if n < -5.6000000000000004e109 or 1 < n Initial program 20.8%
Taylor expanded in n around inf 35.3%
*-commutative35.3%
associate-/l*35.4%
expm1-define92.5%
Simplified92.5%
Taylor expanded in i around 0 80.6%
if -5.6000000000000004e109 < n < 1Initial program 32.4%
associate-/r/32.5%
associate-*r*32.5%
*-commutative32.5%
associate-*r/32.6%
sub-neg32.6%
distribute-lft-in32.5%
metadata-eval32.5%
metadata-eval32.5%
metadata-eval32.5%
fma-define32.6%
metadata-eval32.6%
Simplified32.6%
fma-undefine32.5%
metadata-eval32.5%
metadata-eval32.5%
distribute-lft-in32.6%
sub-neg32.6%
*-commutative32.6%
add-exp-log32.6%
expm1-define32.6%
log-pow43.3%
log1p-define92.4%
Applied egg-rr92.4%
clear-num92.4%
inv-pow92.4%
Applied egg-rr92.4%
unpow-192.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in i around 0 78.7%
associate-*r*78.7%
*-commutative78.7%
sub-neg78.7%
associate-*r/78.7%
metadata-eval78.7%
metadata-eval78.7%
Simplified78.7%
Final simplification79.6%
(FPCore (i n)
:precision binary64
(if (<= i 9e+47)
(* n (/ 1.0 (+ 0.01 (* (* i 0.01) (+ (/ 0.5 n) -0.5)))))
(/
(*
i
(+
100.0
(* i (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))
(/ i n))))
double code(double i, double n) {
double tmp;
if (i <= 9e+47) {
tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))));
} else {
tmp = (i * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))))) / (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 <= 9d+47) then
tmp = n * (1.0d0 / (0.01d0 + ((i * 0.01d0) * ((0.5d0 / n) + (-0.5d0)))))
else
tmp = (i * (100.0d0 + (i * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))) / (i / n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 9e+47) {
tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))));
} else {
tmp = (i * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))))) / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 9e+47: tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5)))) else: tmp = (i * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))))) / (i / n) return tmp
function code(i, n) tmp = 0.0 if (i <= 9e+47) tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(Float64(i * 0.01) * Float64(Float64(0.5 / n) + -0.5))))); else tmp = Float64(Float64(i * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))) / Float64(i / n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 9e+47) tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5)))); else tmp = (i * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))))) / (i / n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 9e+47], N[(n * N[(1.0 / N[(0.01 + N[(N[(i * 0.01), $MachinePrecision] * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(i * 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[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 9 \cdot 10^{+47}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + \left(i \cdot 0.01\right) \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{i \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)}{\frac{i}{n}}\\
\end{array}
\end{array}
if i < 8.99999999999999958e47Initial program 21.1%
associate-/r/21.5%
associate-*r*21.5%
*-commutative21.5%
associate-*r/21.5%
sub-neg21.5%
distribute-lft-in21.4%
metadata-eval21.4%
metadata-eval21.4%
metadata-eval21.4%
fma-define21.5%
metadata-eval21.5%
Simplified21.5%
fma-undefine21.4%
metadata-eval21.4%
metadata-eval21.4%
distribute-lft-in21.5%
sub-neg21.5%
*-commutative21.5%
add-exp-log21.5%
expm1-define21.5%
log-pow26.5%
log1p-define78.1%
Applied egg-rr78.1%
clear-num78.1%
inv-pow78.1%
Applied egg-rr78.1%
unpow-178.1%
*-commutative78.1%
Simplified78.1%
Taylor expanded in i around 0 80.6%
associate-*r*80.6%
*-commutative80.6%
sub-neg80.6%
associate-*r/80.6%
metadata-eval80.6%
metadata-eval80.6%
Simplified80.6%
if 8.99999999999999958e47 < i Initial program 55.0%
associate-*r/55.0%
sub-neg55.0%
distribute-rgt-in55.0%
metadata-eval55.0%
metadata-eval55.0%
Simplified55.0%
Taylor expanded in n around inf 57.2%
Taylor expanded in i around 0 50.9%
*-commutative50.9%
Simplified50.9%
Final simplification75.5%
(FPCore (i n) :precision binary64 (if (or (<= n -1e-156) (not (<= n 8e-247))) (* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668))))) 0.0))
double code(double i, double n) {
double tmp;
if ((n <= -1e-156) || !(n <= 8e-247)) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-1d-156)) .or. (.not. (n <= 8d-247))) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -1e-156) || !(n <= 8e-247)) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1e-156) or not (n <= 8e-247): tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if ((n <= -1e-156) || !(n <= 8e-247)) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -1e-156) || ~((n <= 8e-247))) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1e-156], N[Not[LessEqual[n, 8e-247]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1 \cdot 10^{-156} \lor \neg \left(n \leq 8 \cdot 10^{-247}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if n < -1.00000000000000004e-156 or 8.0000000000000002e-247 < n Initial program 21.5%
Taylor expanded in n around inf 26.1%
*-commutative26.1%
associate-/l*26.1%
expm1-define83.5%
Simplified83.5%
Taylor expanded in i around 0 68.7%
Taylor expanded in n around 0 68.7%
if -1.00000000000000004e-156 < n < 8.0000000000000002e-247Initial program 69.1%
associate-*r/69.1%
sub-neg69.1%
distribute-rgt-in69.1%
metadata-eval69.1%
metadata-eval69.1%
Simplified69.1%
Taylor expanded in i around 0 79.5%
Taylor expanded in i around 0 79.5%
Final simplification69.9%
(FPCore (i n)
:precision binary64
(if (<= n -1e-156)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n 8e-247)
0.0
(+ (* n 100.0) (* i (* (* i n) 16.666666666666668))))))
double code(double i, double n) {
double tmp;
if (n <= -1e-156) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 8e-247) {
tmp = 0.0;
} else {
tmp = (n * 100.0) + (i * ((i * n) * 16.666666666666668));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1d-156)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= 8d-247) then
tmp = 0.0d0
else
tmp = (n * 100.0d0) + (i * ((i * n) * 16.666666666666668d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1e-156) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 8e-247) {
tmp = 0.0;
} else {
tmp = (n * 100.0) + (i * ((i * n) * 16.666666666666668));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1e-156: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= 8e-247: tmp = 0.0 else: tmp = (n * 100.0) + (i * ((i * n) * 16.666666666666668)) return tmp
function code(i, n) tmp = 0.0 if (n <= -1e-156) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= 8e-247) tmp = 0.0; else tmp = Float64(Float64(n * 100.0) + Float64(i * Float64(Float64(i * n) * 16.666666666666668))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1e-156) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= 8e-247) tmp = 0.0; else tmp = (n * 100.0) + (i * ((i * n) * 16.666666666666668)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1e-156], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 8e-247], 0.0, N[(N[(n * 100.0), $MachinePrecision] + N[(i * N[(N[(i * n), $MachinePrecision] * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1 \cdot 10^{-156}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq 8 \cdot 10^{-247}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100 + i \cdot \left(\left(i \cdot n\right) \cdot 16.666666666666668\right)\\
\end{array}
\end{array}
if n < -1.00000000000000004e-156Initial program 25.2%
Taylor expanded in n around inf 27.1%
*-commutative27.1%
associate-/l*27.1%
expm1-define84.2%
Simplified84.2%
Taylor expanded in i around 0 66.2%
Taylor expanded in n around 0 66.2%
if -1.00000000000000004e-156 < n < 8.0000000000000002e-247Initial program 69.1%
associate-*r/69.1%
sub-neg69.1%
distribute-rgt-in69.1%
metadata-eval69.1%
metadata-eval69.1%
Simplified69.1%
Taylor expanded in i around 0 79.5%
Taylor expanded in i around 0 79.5%
if 8.0000000000000002e-247 < n Initial program 18.8%
Taylor expanded in n around inf 25.4%
*-commutative25.4%
associate-/l*25.4%
expm1-define82.9%
Simplified82.9%
Taylor expanded in i around 0 70.7%
Taylor expanded in i around inf 70.7%
*-commutative70.7%
*-commutative70.7%
Simplified70.7%
Final simplification70.0%
(FPCore (i n) :precision binary64 (if (<= i 2.7e+48) (* n (/ 1.0 (+ 0.01 (* (* i 0.01) (+ (/ 0.5 n) -0.5))))) (+ (* n 100.0) (* i (* (* i n) 16.666666666666668)))))
double code(double i, double n) {
double tmp;
if (i <= 2.7e+48) {
tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))));
} else {
tmp = (n * 100.0) + (i * ((i * n) * 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 <= 2.7d+48) then
tmp = n * (1.0d0 / (0.01d0 + ((i * 0.01d0) * ((0.5d0 / n) + (-0.5d0)))))
else
tmp = (n * 100.0d0) + (i * ((i * n) * 16.666666666666668d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 2.7e+48) {
tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))));
} else {
tmp = (n * 100.0) + (i * ((i * n) * 16.666666666666668));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 2.7e+48: tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5)))) else: tmp = (n * 100.0) + (i * ((i * n) * 16.666666666666668)) return tmp
function code(i, n) tmp = 0.0 if (i <= 2.7e+48) tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(Float64(i * 0.01) * Float64(Float64(0.5 / n) + -0.5))))); else tmp = Float64(Float64(n * 100.0) + Float64(i * Float64(Float64(i * n) * 16.666666666666668))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 2.7e+48) tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5)))); else tmp = (n * 100.0) + (i * ((i * n) * 16.666666666666668)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 2.7e+48], N[(n * N[(1.0 / N[(0.01 + N[(N[(i * 0.01), $MachinePrecision] * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] + N[(i * N[(N[(i * n), $MachinePrecision] * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 2.7 \cdot 10^{+48}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + \left(i \cdot 0.01\right) \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100 + i \cdot \left(\left(i \cdot n\right) \cdot 16.666666666666668\right)\\
\end{array}
\end{array}
if i < 2.70000000000000004e48Initial program 21.1%
associate-/r/21.5%
associate-*r*21.5%
*-commutative21.5%
associate-*r/21.5%
sub-neg21.5%
distribute-lft-in21.4%
metadata-eval21.4%
metadata-eval21.4%
metadata-eval21.4%
fma-define21.5%
metadata-eval21.5%
Simplified21.5%
fma-undefine21.4%
metadata-eval21.4%
metadata-eval21.4%
distribute-lft-in21.5%
sub-neg21.5%
*-commutative21.5%
add-exp-log21.5%
expm1-define21.5%
log-pow26.5%
log1p-define78.1%
Applied egg-rr78.1%
clear-num78.1%
inv-pow78.1%
Applied egg-rr78.1%
unpow-178.1%
*-commutative78.1%
Simplified78.1%
Taylor expanded in i around 0 80.6%
associate-*r*80.6%
*-commutative80.6%
sub-neg80.6%
associate-*r/80.6%
metadata-eval80.6%
metadata-eval80.6%
Simplified80.6%
if 2.70000000000000004e48 < i Initial program 55.0%
Taylor expanded in n around inf 57.4%
*-commutative57.4%
associate-/l*57.4%
expm1-define57.4%
Simplified57.4%
Taylor expanded in i around 0 43.1%
Taylor expanded in i around inf 43.1%
*-commutative43.1%
*-commutative43.1%
Simplified43.1%
Final simplification74.1%
(FPCore (i n) :precision binary64 (if (<= i 9e+47) (* n (/ 1.0 (+ 0.01 (* (* i 0.01) (+ (/ 0.5 n) -0.5))))) (/ (* i (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668))))) (/ i n))))
double code(double i, double n) {
double tmp;
if (i <= 9e+47) {
tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))));
} else {
tmp = (i * (100.0 + (i * (50.0 + (i * 16.666666666666668))))) / (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 <= 9d+47) then
tmp = n * (1.0d0 / (0.01d0 + ((i * 0.01d0) * ((0.5d0 / n) + (-0.5d0)))))
else
tmp = (i * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))) / (i / n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 9e+47) {
tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5))));
} else {
tmp = (i * (100.0 + (i * (50.0 + (i * 16.666666666666668))))) / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 9e+47: tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5)))) else: tmp = (i * (100.0 + (i * (50.0 + (i * 16.666666666666668))))) / (i / n) return tmp
function code(i, n) tmp = 0.0 if (i <= 9e+47) tmp = Float64(n * Float64(1.0 / Float64(0.01 + Float64(Float64(i * 0.01) * Float64(Float64(0.5 / n) + -0.5))))); else tmp = Float64(Float64(i * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))) / Float64(i / n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 9e+47) tmp = n * (1.0 / (0.01 + ((i * 0.01) * ((0.5 / n) + -0.5)))); else tmp = (i * (100.0 + (i * (50.0 + (i * 16.666666666666668))))) / (i / n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 9e+47], N[(n * N[(1.0 / N[(0.01 + N[(N[(i * 0.01), $MachinePrecision] * N[(N[(0.5 / n), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(i * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 9 \cdot 10^{+47}:\\
\;\;\;\;n \cdot \frac{1}{0.01 + \left(i \cdot 0.01\right) \cdot \left(\frac{0.5}{n} + -0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{i \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)}{\frac{i}{n}}\\
\end{array}
\end{array}
if i < 8.99999999999999958e47Initial program 21.1%
associate-/r/21.5%
associate-*r*21.5%
*-commutative21.5%
associate-*r/21.5%
sub-neg21.5%
distribute-lft-in21.4%
metadata-eval21.4%
metadata-eval21.4%
metadata-eval21.4%
fma-define21.5%
metadata-eval21.5%
Simplified21.5%
fma-undefine21.4%
metadata-eval21.4%
metadata-eval21.4%
distribute-lft-in21.5%
sub-neg21.5%
*-commutative21.5%
add-exp-log21.5%
expm1-define21.5%
log-pow26.5%
log1p-define78.1%
Applied egg-rr78.1%
clear-num78.1%
inv-pow78.1%
Applied egg-rr78.1%
unpow-178.1%
*-commutative78.1%
Simplified78.1%
Taylor expanded in i around 0 80.6%
associate-*r*80.6%
*-commutative80.6%
sub-neg80.6%
associate-*r/80.6%
metadata-eval80.6%
metadata-eval80.6%
Simplified80.6%
if 8.99999999999999958e47 < i Initial program 55.0%
associate-*r/55.0%
sub-neg55.0%
distribute-rgt-in55.0%
metadata-eval55.0%
metadata-eval55.0%
Simplified55.0%
Taylor expanded in n around inf 57.2%
Taylor expanded in i around 0 46.5%
*-commutative46.5%
Simplified46.5%
Final simplification74.7%
(FPCore (i n) :precision binary64 (if (or (<= n -1.02e-156) (not (<= n 8e-247))) (* n (+ 100.0 (* i 50.0))) 0.0))
double code(double i, double n) {
double tmp;
if ((n <= -1.02e-156) || !(n <= 8e-247)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-1.02d-156)) .or. (.not. (n <= 8d-247))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -1.02e-156) || !(n <= 8e-247)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.02e-156) or not (n <= 8e-247): tmp = n * (100.0 + (i * 50.0)) else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.02e-156) || !(n <= 8e-247)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -1.02e-156) || ~((n <= 8e-247))) tmp = n * (100.0 + (i * 50.0)); else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1.02e-156], N[Not[LessEqual[n, 8e-247]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.02 \cdot 10^{-156} \lor \neg \left(n \leq 8 \cdot 10^{-247}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if n < -1.02e-156 or 8.0000000000000002e-247 < n Initial program 21.5%
Taylor expanded in n around inf 26.1%
*-commutative26.1%
associate-/l*26.1%
expm1-define83.5%
Simplified83.5%
Taylor expanded in i around 0 67.3%
+-commutative67.3%
associate-*r*67.3%
distribute-rgt-in67.3%
*-commutative67.3%
Simplified67.3%
if -1.02e-156 < n < 8.0000000000000002e-247Initial program 69.1%
associate-*r/69.1%
sub-neg69.1%
distribute-rgt-in69.1%
metadata-eval69.1%
metadata-eval69.1%
Simplified69.1%
Taylor expanded in i around 0 79.5%
Taylor expanded in i around 0 79.5%
Final simplification68.6%
(FPCore (i n) :precision binary64 (if (<= i -2.05e+26) 0.0 (if (<= i 9e+47) (* n 100.0) (* n (* i 50.0)))))
double code(double i, double n) {
double tmp;
if (i <= -2.05e+26) {
tmp = 0.0;
} else if (i <= 9e+47) {
tmp = n * 100.0;
} else {
tmp = n * (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 <= (-2.05d+26)) then
tmp = 0.0d0
else if (i <= 9d+47) then
tmp = n * 100.0d0
else
tmp = n * (i * 50.0d0)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -2.05e+26) {
tmp = 0.0;
} else if (i <= 9e+47) {
tmp = n * 100.0;
} else {
tmp = n * (i * 50.0);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -2.05e+26: tmp = 0.0 elif i <= 9e+47: tmp = n * 100.0 else: tmp = n * (i * 50.0) return tmp
function code(i, n) tmp = 0.0 if (i <= -2.05e+26) tmp = 0.0; elseif (i <= 9e+47) tmp = Float64(n * 100.0); else tmp = Float64(n * Float64(i * 50.0)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -2.05e+26) tmp = 0.0; elseif (i <= 9e+47) tmp = n * 100.0; else tmp = n * (i * 50.0); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -2.05e+26], 0.0, If[LessEqual[i, 9e+47], N[(n * 100.0), $MachinePrecision], N[(n * N[(i * 50.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2.05 \cdot 10^{+26}:\\
\;\;\;\;0\\
\mathbf{elif}\;i \leq 9 \cdot 10^{+47}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(i \cdot 50\right)\\
\end{array}
\end{array}
if i < -2.04999999999999992e26Initial program 62.8%
associate-*r/62.8%
sub-neg62.8%
distribute-rgt-in62.7%
metadata-eval62.7%
metadata-eval62.7%
Simplified62.7%
Taylor expanded in i around 0 26.1%
Taylor expanded in i around 0 26.1%
if -2.04999999999999992e26 < i < 8.99999999999999958e47Initial program 11.7%
Taylor expanded in i around 0 81.7%
*-commutative81.7%
Simplified81.7%
if 8.99999999999999958e47 < i Initial program 55.0%
Taylor expanded in n around inf 57.4%
*-commutative57.4%
associate-/l*57.4%
expm1-define57.4%
Simplified57.4%
Taylor expanded in i around 0 32.2%
Taylor expanded in i around inf 32.2%
*-commutative32.2%
*-commutative32.2%
Simplified32.2%
Taylor expanded in n around 0 32.2%
associate-*r*32.2%
Simplified32.2%
Final simplification64.7%
(FPCore (i n) :precision binary64 (if (or (<= n -1e-156) (not (<= n 8e-247))) (* n 100.0) 0.0))
double code(double i, double n) {
double tmp;
if ((n <= -1e-156) || !(n <= 8e-247)) {
tmp = n * 100.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-1d-156)) .or. (.not. (n <= 8d-247))) then
tmp = n * 100.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -1e-156) || !(n <= 8e-247)) {
tmp = n * 100.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1e-156) or not (n <= 8e-247): tmp = n * 100.0 else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if ((n <= -1e-156) || !(n <= 8e-247)) tmp = Float64(n * 100.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -1e-156) || ~((n <= 8e-247))) tmp = n * 100.0; else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1e-156], N[Not[LessEqual[n, 8e-247]], $MachinePrecision]], N[(n * 100.0), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1 \cdot 10^{-156} \lor \neg \left(n \leq 8 \cdot 10^{-247}\right):\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if n < -1.00000000000000004e-156 or 8.0000000000000002e-247 < n Initial program 21.5%
Taylor expanded in i around 0 61.5%
*-commutative61.5%
Simplified61.5%
if -1.00000000000000004e-156 < n < 8.0000000000000002e-247Initial program 69.1%
associate-*r/69.1%
sub-neg69.1%
distribute-rgt-in69.1%
metadata-eval69.1%
metadata-eval69.1%
Simplified69.1%
Taylor expanded in i around 0 79.5%
Taylor expanded in i around 0 79.5%
Final simplification63.5%
(FPCore (i n) :precision binary64 0.0)
double code(double i, double n) {
return 0.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 0.0d0
end function
public static double code(double i, double n) {
return 0.0;
}
def code(i, n): return 0.0
function code(i, n) return 0.0 end
function tmp = code(i, n) tmp = 0.0; end
code[i_, n_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 26.9%
associate-*r/26.9%
sub-neg26.9%
distribute-rgt-in26.9%
metadata-eval26.9%
metadata-eval26.9%
Simplified26.9%
Taylor expanded in i around 0 15.0%
Taylor expanded in i around 0 15.3%
Final simplification15.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 2024075
(FPCore (i n)
:name "Compound Interest"
:precision binary64
:alt
(* 100.0 (/ (- (exp (* n (if (== (+ 1.0 (/ i n)) 1.0) (/ i n) (/ (* (/ i n) (log (+ 1.0 (/ i n)))) (- (+ (/ i n) 1.0) 1.0))))) 1.0) (/ i n)))
(* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))