
(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 23 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 0.0)
(/ (* (expm1 (* n (log1p (/ i n)))) 100.0) (/ i n))
(if (<= t_1 INFINITY)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(* 100.0 (/ n (+ 1.0 (* i (- (* i 0.08333333333333333) 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 <= 0.0) {
tmp = (expm1((n * log1p((i / n)))) * 100.0) / (i / n);
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 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 <= 0.0) {
tmp = (Math.expm1((n * Math.log1p((i / n)))) * 100.0) / (i / n);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 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 <= 0.0: tmp = (math.expm1((n * math.log1p((i / n)))) * 100.0) / (i / n) elif t_1 <= math.inf: tmp = n * (((t_0 * 100.0) + -100.0) / i) else: tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 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 <= 0.0) tmp = Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) * 100.0) / Float64(i / n)); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * Float64(Float64(i * 0.08333333333333333) - 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, 0.0], N[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * 100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(i * N[(N[(i * 0.08333333333333333), $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 0:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{\frac{i}{n}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{t\_0 \cdot 100 + -100}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot \left(i \cdot 0.08333333333333333 - 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)) < -0.0Initial program 24.6%
*-commutative24.6%
frac-2neg24.6%
associate-*l/24.5%
add-exp-log24.5%
expm1-define24.5%
log-pow36.5%
log1p-define98.4%
distribute-neg-frac298.4%
Applied egg-rr98.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 99.6%
associate-/r/99.4%
associate-*r*99.8%
*-commutative99.8%
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%
*-commutative99.9%
Applied egg-rr99.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%
Taylor expanded in n around inf 1.9%
*-commutative1.9%
associate-/l*1.9%
expm1-define78.1%
Simplified78.1%
expm1-define1.9%
clear-num1.9%
un-div-inv1.9%
expm1-define78.1%
Applied egg-rr78.1%
Taylor expanded in i around 0 100.0%
Final simplification98.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n))))
(if (<= t_0 0.0)
(/ 100.0 (/ (/ i (expm1 i)) n))
(if (<= t_0 INFINITY)
(* t_0 100.0)
(* 100.0 (/ n (+ 1.0 (* i (- (* i 0.08333333333333333) 0.5)))))))))
double code(double i, double n) {
double t_0 = (pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= 0.0) {
tmp = 100.0 / ((i / expm1(i)) / n);
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_0 * 100.0;
} else {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5))));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = (Math.pow((1.0 + (i / n)), n) + -1.0) / (i / n);
double tmp;
if (t_0 <= 0.0) {
tmp = 100.0 / ((i / Math.expm1(i)) / n);
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0 * 100.0;
} else {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5))));
}
return tmp;
}
def code(i, n): t_0 = (math.pow((1.0 + (i / n)), n) + -1.0) / (i / n) tmp = 0 if t_0 <= 0.0: tmp = 100.0 / ((i / math.expm1(i)) / n) elif t_0 <= math.inf: tmp = t_0 * 100.0 else: tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5)))) return tmp
function code(i, n) t_0 = Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(100.0 / Float64(Float64(i / expm1(i)) / n)); elseif (t_0 <= Inf) tmp = Float64(t_0 * 100.0); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * Float64(Float64(i * 0.08333333333333333) - 0.5))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(100.0 / N[(N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(t$95$0 * 100.0), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(i * N[(N[(i * 0.08333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\frac{100}{\frac{\frac{i}{\mathsf{expm1}\left(i\right)}}{n}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0 \cdot 100\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot \left(i \cdot 0.08333333333333333 - 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)) < -0.0Initial program 24.6%
Taylor expanded in n around inf 38.2%
*-commutative38.2%
associate-/l*38.2%
expm1-define78.9%
Simplified78.9%
expm1-define38.2%
clear-num38.2%
un-div-inv38.2%
expm1-define78.9%
Applied egg-rr78.9%
*-commutative78.9%
clear-num79.1%
un-div-inv79.0%
Applied egg-rr79.0%
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.6%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
Taylor expanded in n around inf 1.9%
*-commutative1.9%
associate-/l*1.9%
expm1-define78.1%
Simplified78.1%
expm1-define1.9%
clear-num1.9%
un-div-inv1.9%
expm1-define78.1%
Applied egg-rr78.1%
Taylor expanded in i around 0 100.0%
Final simplification85.1%
(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 0.0)
(/ 100.0 (/ (/ i (expm1 i)) n))
(if (<= t_1 INFINITY)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(* 100.0 (/ n (+ 1.0 (* i (- (* i 0.08333333333333333) 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 <= 0.0) {
tmp = 100.0 / ((i / expm1(i)) / n);
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 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 <= 0.0) {
tmp = 100.0 / ((i / Math.expm1(i)) / n);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 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 <= 0.0: tmp = 100.0 / ((i / math.expm1(i)) / n) elif t_1 <= math.inf: tmp = n * (((t_0 * 100.0) + -100.0) / i) else: tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 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 <= 0.0) tmp = Float64(100.0 / Float64(Float64(i / expm1(i)) / n)); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * Float64(Float64(i * 0.08333333333333333) - 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, 0.0], N[(100.0 / N[(N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(i * N[(N[(i * 0.08333333333333333), $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 0:\\
\;\;\;\;\frac{100}{\frac{\frac{i}{\mathsf{expm1}\left(i\right)}}{n}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{t\_0 \cdot 100 + -100}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot \left(i \cdot 0.08333333333333333 - 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)) < -0.0Initial program 24.6%
Taylor expanded in n around inf 38.2%
*-commutative38.2%
associate-/l*38.2%
expm1-define78.9%
Simplified78.9%
expm1-define38.2%
clear-num38.2%
un-div-inv38.2%
expm1-define78.9%
Applied egg-rr78.9%
*-commutative78.9%
clear-num79.1%
un-div-inv79.0%
Applied egg-rr79.0%
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.6%
associate-/r/99.4%
associate-*r*99.8%
*-commutative99.8%
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%
*-commutative99.9%
Applied egg-rr99.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%
Taylor expanded in n around inf 1.9%
*-commutative1.9%
associate-/l*1.9%
expm1-define78.1%
Simplified78.1%
expm1-define1.9%
clear-num1.9%
un-div-inv1.9%
expm1-define78.1%
Applied egg-rr78.1%
Taylor expanded in i around 0 100.0%
Final simplification85.1%
(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 0.0)
(* (expm1 (* n (log1p (/ i n)))) (* 100.0 (/ n i)))
(if (<= t_1 INFINITY)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(* 100.0 (/ n (+ 1.0 (* i (- (* i 0.08333333333333333) 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 <= 0.0) {
tmp = expm1((n * log1p((i / n)))) * (100.0 * (n / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 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 <= 0.0) {
tmp = Math.expm1((n * Math.log1p((i / n)))) * (100.0 * (n / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 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 <= 0.0: tmp = math.expm1((n * math.log1p((i / n)))) * (100.0 * (n / i)) elif t_1 <= math.inf: tmp = n * (((t_0 * 100.0) + -100.0) / i) else: tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 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 <= 0.0) tmp = Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(100.0 * Float64(n / i))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * Float64(Float64(i * 0.08333333333333333) - 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, 0.0], N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(100.0 * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(i * N[(N[(i * 0.08333333333333333), $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 0:\\
\;\;\;\;\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \left(100 \cdot \frac{n}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{t\_0 \cdot 100 + -100}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot \left(i \cdot 0.08333333333333333 - 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)) < -0.0Initial program 24.6%
associate-*r/24.5%
sub-neg24.5%
distribute-rgt-in24.5%
metadata-eval24.5%
metadata-eval24.5%
Simplified24.5%
metadata-eval24.5%
metadata-eval24.5%
distribute-rgt-in24.5%
sub-neg24.5%
associate-*r/24.6%
*-commutative24.6%
div-inv24.5%
clear-num24.4%
associate-*l*24.3%
add-exp-log24.3%
expm1-define24.3%
log-pow36.4%
log1p-define97.2%
Applied egg-rr97.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 99.6%
associate-/r/99.4%
associate-*r*99.8%
*-commutative99.8%
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%
*-commutative99.9%
Applied egg-rr99.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%
Taylor expanded in n around inf 1.9%
*-commutative1.9%
associate-/l*1.9%
expm1-define78.1%
Simplified78.1%
expm1-define1.9%
clear-num1.9%
un-div-inv1.9%
expm1-define78.1%
Applied egg-rr78.1%
Taylor expanded in i around 0 100.0%
Final simplification98.0%
(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 0.0)
(* (/ n i) (* (expm1 (* n (log1p (/ i n)))) 100.0))
(if (<= t_1 INFINITY)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(* 100.0 (/ n (+ 1.0 (* i (- (* i 0.08333333333333333) 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 <= 0.0) {
tmp = (n / i) * (expm1((n * log1p((i / n)))) * 100.0);
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 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 <= 0.0) {
tmp = (n / i) * (Math.expm1((n * Math.log1p((i / n)))) * 100.0);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 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 <= 0.0: tmp = (n / i) * (math.expm1((n * math.log1p((i / n)))) * 100.0) elif t_1 <= math.inf: tmp = n * (((t_0 * 100.0) + -100.0) / i) else: tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 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 <= 0.0) tmp = Float64(Float64(n / i) * Float64(expm1(Float64(n * log1p(Float64(i / n)))) * 100.0)); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * Float64(Float64(i * 0.08333333333333333) - 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, 0.0], N[(N[(n / i), $MachinePrecision] * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(i * N[(N[(i * 0.08333333333333333), $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 0:\\
\;\;\;\;\frac{n}{i} \cdot \left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{t\_0 \cdot 100 + -100}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot \left(i \cdot 0.08333333333333333 - 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)) < -0.0Initial program 24.6%
associate-*r/24.5%
sub-neg24.5%
distribute-rgt-in24.5%
metadata-eval24.5%
metadata-eval24.5%
Simplified24.5%
metadata-eval24.5%
metadata-eval24.5%
distribute-rgt-in24.5%
sub-neg24.5%
associate-*r/24.6%
*-commutative24.6%
div-inv24.5%
add-exp-log24.5%
expm1-define24.5%
log-pow36.5%
log1p-define98.0%
clear-num97.8%
Applied egg-rr97.8%
*-commutative97.8%
associate-*r/84.8%
associate-*r/84.6%
*-commutative84.6%
Applied egg-rr84.6%
associate-/l*84.8%
*-commutative84.8%
associate-*r/97.8%
associate-*r*97.7%
Simplified97.7%
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.6%
associate-/r/99.4%
associate-*r*99.8%
*-commutative99.8%
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%
*-commutative99.9%
Applied egg-rr99.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%
Taylor expanded in n around inf 1.9%
*-commutative1.9%
associate-/l*1.9%
expm1-define78.1%
Simplified78.1%
expm1-define1.9%
clear-num1.9%
un-div-inv1.9%
expm1-define78.1%
Applied egg-rr78.1%
Taylor expanded in i around 0 100.0%
Final simplification98.4%
(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 0.0)
(* 100.0 (* (expm1 (* n (log1p (/ i n)))) (/ n i)))
(if (<= t_1 INFINITY)
(* n (/ (+ (* t_0 100.0) -100.0) i))
(* 100.0 (/ n (+ 1.0 (* i (- (* i 0.08333333333333333) 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 <= 0.0) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) * (n / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 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 <= 0.0) {
tmp = 100.0 * (Math.expm1((n * Math.log1p((i / n)))) * (n / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = n * (((t_0 * 100.0) + -100.0) / i);
} else {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 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 <= 0.0: tmp = 100.0 * (math.expm1((n * math.log1p((i / n)))) * (n / i)) elif t_1 <= math.inf: tmp = n * (((t_0 * 100.0) + -100.0) / i) else: tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 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 <= 0.0) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(n / i))); elseif (t_1 <= Inf) tmp = Float64(n * Float64(Float64(Float64(t_0 * 100.0) + -100.0) / i)); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * Float64(Float64(i * 0.08333333333333333) - 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, 0.0], N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(n * N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(i * N[(N[(i * 0.08333333333333333), $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 0:\\
\;\;\;\;100 \cdot \left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{n}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;n \cdot \frac{t\_0 \cdot 100 + -100}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot \left(i \cdot 0.08333333333333333 - 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)) < -0.0Initial program 24.6%
associate-*r/24.5%
sub-neg24.5%
distribute-rgt-in24.5%
metadata-eval24.5%
metadata-eval24.5%
Simplified24.5%
metadata-eval24.5%
metadata-eval24.5%
distribute-rgt-in24.5%
sub-neg24.5%
associate-*r/24.6%
*-commutative24.6%
div-inv24.5%
add-exp-log24.5%
expm1-define24.5%
log-pow36.5%
log1p-define98.0%
clear-num97.8%
Applied egg-rr97.8%
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.6%
associate-/r/99.4%
associate-*r*99.8%
*-commutative99.8%
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%
*-commutative99.9%
Applied egg-rr99.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%
Taylor expanded in n around inf 1.9%
*-commutative1.9%
associate-/l*1.9%
expm1-define78.1%
Simplified78.1%
expm1-define1.9%
clear-num1.9%
un-div-inv1.9%
expm1-define78.1%
Applied egg-rr78.1%
Taylor expanded in i around 0 100.0%
Final simplification98.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ (expm1 i) (/ i n)))))
(if (<= i -9.2e-119)
t_0
(if (<= i 1e-46)
(fma 100.0 n (* i -50.0))
(if (<= i 1.52e+91)
t_0
(if (<= i 2.9e+175)
(/ 0.0 (/ i n))
(* 100.0 (+ n (* i (* n (+ 0.5 (* i 0.16666666666666666))))))))))))
double code(double i, double n) {
double t_0 = 100.0 * (expm1(i) / (i / n));
double tmp;
if (i <= -9.2e-119) {
tmp = t_0;
} else if (i <= 1e-46) {
tmp = fma(100.0, n, (i * -50.0));
} else if (i <= 1.52e+91) {
tmp = t_0;
} else if (i <= 2.9e+175) {
tmp = 0.0 / (i / n);
} else {
tmp = 100.0 * (n + (i * (n * (0.5 + (i * 0.16666666666666666)))));
}
return tmp;
}
function code(i, n) t_0 = Float64(100.0 * Float64(expm1(i) / Float64(i / n))) tmp = 0.0 if (i <= -9.2e-119) tmp = t_0; elseif (i <= 1e-46) tmp = fma(100.0, n, Float64(i * -50.0)); elseif (i <= 1.52e+91) tmp = t_0; elseif (i <= 2.9e+175) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(100.0 * Float64(n + Float64(i * Float64(n * Float64(0.5 + Float64(i * 0.16666666666666666)))))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -9.2e-119], t$95$0, If[LessEqual[i, 1e-46], N[(100.0 * n + N[(i * -50.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1.52e+91], t$95$0, If[LessEqual[i, 2.9e+175], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n + N[(i * N[(n * N[(0.5 + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{if}\;i \leq -9.2 \cdot 10^{-119}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;i \leq 10^{-46}:\\
\;\;\;\;\mathsf{fma}\left(100, n, i \cdot -50\right)\\
\mathbf{elif}\;i \leq 1.52 \cdot 10^{+91}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;i \leq 2.9 \cdot 10^{+175}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n + i \cdot \left(n \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if i < -9.19999999999999973e-119 or 1.00000000000000002e-46 < i < 1.52e91Initial program 40.2%
Taylor expanded in n around inf 63.5%
expm1-define76.3%
Simplified76.3%
if -9.19999999999999973e-119 < i < 1.00000000000000002e-46Initial program 4.6%
associate-/r/5.3%
associate-*r*5.3%
*-commutative5.3%
associate-*r/5.3%
sub-neg5.3%
distribute-lft-in5.3%
metadata-eval5.3%
metadata-eval5.3%
metadata-eval5.3%
fma-define5.3%
metadata-eval5.3%
Simplified5.3%
Taylor expanded in i around 0 91.2%
*-commutative91.2%
associate-*r/91.2%
metadata-eval91.2%
Simplified91.2%
Taylor expanded in n around 0 91.2%
Taylor expanded in n around 0 91.2%
+-commutative91.2%
fma-define91.2%
*-commutative91.2%
Simplified91.2%
if 1.52e91 < i < 2.9e175Initial program 36.7%
associate-*r/37.0%
sub-neg37.0%
distribute-rgt-in37.0%
metadata-eval37.0%
metadata-eval37.0%
Simplified37.0%
Taylor expanded in i around 0 52.1%
if 2.9e175 < i Initial program 62.0%
Taylor expanded in n around inf 35.4%
*-commutative35.4%
associate-/l*35.4%
expm1-define35.4%
Simplified35.4%
Taylor expanded in i around 0 35.5%
associate-*r*35.5%
distribute-rgt-out35.5%
+-commutative35.5%
*-commutative35.5%
Simplified35.5%
Final simplification77.8%
(FPCore (i n) :precision binary64 (if (or (<= n -4e-36) (not (<= n 2.9e+23))) (* 100.0 (* n (/ (expm1 i) i))) (* 100.0 (/ n (+ 1.0 (* i (- (* i 0.08333333333333333) 0.5)))))))
double code(double i, double n) {
double tmp;
if ((n <= -4e-36) || !(n <= 2.9e+23)) {
tmp = 100.0 * (n * (expm1(i) / i));
} else {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5))));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -4e-36) || !(n <= 2.9e+23)) {
tmp = 100.0 * (n * (Math.expm1(i) / i));
} else {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -4e-36) or not (n <= 2.9e+23): tmp = 100.0 * (n * (math.expm1(i) / i)) else: tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5)))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -4e-36) || !(n <= 2.9e+23)) tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); else tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * Float64(Float64(i * 0.08333333333333333) - 0.5))))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -4e-36], N[Not[LessEqual[n, 2.9e+23]], $MachinePrecision]], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(1.0 + N[(i * N[(N[(i * 0.08333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4 \cdot 10^{-36} \lor \neg \left(n \leq 2.9 \cdot 10^{+23}\right):\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot \left(i \cdot 0.08333333333333333 - 0.5\right)}\\
\end{array}
\end{array}
if n < -3.9999999999999998e-36 or 2.90000000000000013e23 < n Initial program 24.6%
Taylor expanded in n around inf 38.7%
*-commutative38.7%
associate-/l*38.6%
expm1-define88.8%
Simplified88.8%
if -3.9999999999999998e-36 < n < 2.90000000000000013e23Initial program 27.0%
Taylor expanded in n around inf 17.8%
*-commutative17.8%
associate-/l*17.8%
expm1-define54.3%
Simplified54.3%
expm1-define17.8%
clear-num17.8%
un-div-inv17.8%
expm1-define54.3%
Applied egg-rr54.3%
Taylor expanded in i around 0 70.2%
Final simplification81.6%
(FPCore (i n)
:precision binary64
(if (<= n -1.02e-35)
(* 100.0 (/ n (/ i (expm1 i))))
(if (<= n 2.9e+23)
(* 100.0 (/ n (+ 1.0 (* i (- (* i 0.08333333333333333) 0.5)))))
(* 100.0 (* n (/ (expm1 i) i))))))
double code(double i, double n) {
double tmp;
if (n <= -1.02e-35) {
tmp = 100.0 * (n / (i / expm1(i)));
} else if (n <= 2.9e+23) {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5))));
} else {
tmp = 100.0 * (n * (expm1(i) / i));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (n <= -1.02e-35) {
tmp = 100.0 * (n / (i / Math.expm1(i)));
} else if (n <= 2.9e+23) {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5))));
} else {
tmp = 100.0 * (n * (Math.expm1(i) / i));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.02e-35: tmp = 100.0 * (n / (i / math.expm1(i))) elif n <= 2.9e+23: tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5)))) else: tmp = 100.0 * (n * (math.expm1(i) / i)) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.02e-35) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); elseif (n <= 2.9e+23) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * Float64(Float64(i * 0.08333333333333333) - 0.5))))); else tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i))); end return tmp end
code[i_, n_] := If[LessEqual[n, -1.02e-35], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.9e+23], N[(100.0 * N[(n / N[(1.0 + N[(i * N[(N[(i * 0.08333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.02 \cdot 10^{-35}:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{elif}\;n \leq 2.9 \cdot 10^{+23}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot \left(i \cdot 0.08333333333333333 - 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\end{array}
\end{array}
if n < -1.01999999999999995e-35Initial program 31.8%
Taylor expanded in n around inf 33.4%
*-commutative33.4%
associate-/l*33.4%
expm1-define81.8%
Simplified81.8%
expm1-define33.4%
clear-num33.4%
un-div-inv33.4%
expm1-define81.8%
Applied egg-rr81.8%
if -1.01999999999999995e-35 < n < 2.90000000000000013e23Initial program 27.0%
Taylor expanded in n around inf 17.8%
*-commutative17.8%
associate-/l*17.8%
expm1-define54.3%
Simplified54.3%
expm1-define17.8%
clear-num17.8%
un-div-inv17.8%
expm1-define54.3%
Applied egg-rr54.3%
Taylor expanded in i around 0 70.2%
if 2.90000000000000013e23 < n Initial program 14.7%
Taylor expanded in n around inf 45.9%
*-commutative45.9%
associate-/l*45.9%
expm1-define98.4%
Simplified98.4%
Final simplification81.6%
(FPCore (i n) :precision binary64 (if (<= i 1.52e+91) (* 100.0 (/ n (/ i (expm1 i)))) (* 100.0 (- (pow (/ i n) (+ n -1.0)) (/ n i)))))
double code(double i, double n) {
double tmp;
if (i <= 1.52e+91) {
tmp = 100.0 * (n / (i / expm1(i)));
} else {
tmp = 100.0 * (pow((i / n), (n + -1.0)) - (n / i));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (i <= 1.52e+91) {
tmp = 100.0 * (n / (i / Math.expm1(i)));
} else {
tmp = 100.0 * (Math.pow((i / n), (n + -1.0)) - (n / i));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 1.52e+91: tmp = 100.0 * (n / (i / math.expm1(i))) else: tmp = 100.0 * (math.pow((i / n), (n + -1.0)) - (n / i)) return tmp
function code(i, n) tmp = 0.0 if (i <= 1.52e+91) tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i)))); else tmp = Float64(100.0 * Float64((Float64(i / n) ^ Float64(n + -1.0)) - Float64(n / i))); end return tmp end
code[i_, n_] := If[LessEqual[i, 1.52e+91], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[Power[N[(i / n), $MachinePrecision], N[(n + -1.0), $MachinePrecision]], $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 1.52 \cdot 10^{+91}:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left({\left(\frac{i}{n}\right)}^{\left(n + -1\right)} - \frac{n}{i}\right)\\
\end{array}
\end{array}
if i < 1.52e91Initial program 20.4%
Taylor expanded in n around inf 31.0%
*-commutative31.0%
associate-/l*31.0%
expm1-define84.1%
Simplified84.1%
expm1-define31.0%
clear-num31.0%
un-div-inv31.0%
expm1-define84.1%
Applied egg-rr84.1%
if 1.52e91 < i Initial program 53.2%
Taylor expanded in i around inf 55.6%
div-sub55.6%
pow155.6%
pow-div78.1%
clear-num73.3%
Applied egg-rr73.3%
Final simplification82.4%
(FPCore (i n)
:precision binary64
(if (<= n -6.2e+148)
(* 100.0 (+ n (* i (* n (+ 0.5 (* i 0.16666666666666666))))))
(if (<= n 1.22)
(* 100.0 (/ n (+ 1.0 (* i (- (* i 0.08333333333333333) 0.5)))))
(*
100.0
(/
(*
n
(*
i
(+
1.0
(*
i
(+ 0.5 (* i (+ 0.16666666666666666 (* i 0.041666666666666664))))))))
i)))))
double code(double i, double n) {
double tmp;
if (n <= -6.2e+148) {
tmp = 100.0 * (n + (i * (n * (0.5 + (i * 0.16666666666666666)))));
} else if (n <= 1.22) {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5))));
} else {
tmp = 100.0 * ((n * (i * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))))) / i);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-6.2d+148)) then
tmp = 100.0d0 * (n + (i * (n * (0.5d0 + (i * 0.16666666666666666d0)))))
else if (n <= 1.22d0) then
tmp = 100.0d0 * (n / (1.0d0 + (i * ((i * 0.08333333333333333d0) - 0.5d0))))
else
tmp = 100.0d0 * ((n * (i * (1.0d0 + (i * (0.5d0 + (i * (0.16666666666666666d0 + (i * 0.041666666666666664d0)))))))) / i)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -6.2e+148) {
tmp = 100.0 * (n + (i * (n * (0.5 + (i * 0.16666666666666666)))));
} else if (n <= 1.22) {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5))));
} else {
tmp = 100.0 * ((n * (i * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))))) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -6.2e+148: tmp = 100.0 * (n + (i * (n * (0.5 + (i * 0.16666666666666666))))) elif n <= 1.22: tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5)))) else: tmp = 100.0 * ((n * (i * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))))) / i) return tmp
function code(i, n) tmp = 0.0 if (n <= -6.2e+148) tmp = Float64(100.0 * Float64(n + Float64(i * Float64(n * Float64(0.5 + Float64(i * 0.16666666666666666)))))); elseif (n <= 1.22) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * Float64(Float64(i * 0.08333333333333333) - 0.5))))); else tmp = Float64(100.0 * Float64(Float64(n * Float64(i * Float64(1.0 + Float64(i * Float64(0.5 + Float64(i * Float64(0.16666666666666666 + Float64(i * 0.041666666666666664)))))))) / i)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -6.2e+148) tmp = 100.0 * (n + (i * (n * (0.5 + (i * 0.16666666666666666))))); elseif (n <= 1.22) tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5)))); else tmp = 100.0 * ((n * (i * (1.0 + (i * (0.5 + (i * (0.16666666666666666 + (i * 0.041666666666666664)))))))) / i); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -6.2e+148], N[(100.0 * N[(n + N[(i * N[(n * N[(0.5 + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.22], N[(100.0 * N[(n / N[(1.0 + N[(i * N[(N[(i * 0.08333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(n * N[(i * N[(1.0 + N[(i * N[(0.5 + N[(i * N[(0.16666666666666666 + N[(i * 0.041666666666666664), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -6.2 \cdot 10^{+148}:\\
\;\;\;\;100 \cdot \left(n + i \cdot \left(n \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{elif}\;n \leq 1.22:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot \left(i \cdot 0.08333333333333333 - 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n \cdot \left(i \cdot \left(1 + i \cdot \left(0.5 + i \cdot \left(0.16666666666666666 + i \cdot 0.041666666666666664\right)\right)\right)\right)}{i}\\
\end{array}
\end{array}
if n < -6.19999999999999951e148Initial program 14.4%
Taylor expanded in n around inf 38.9%
*-commutative38.9%
associate-/l*38.8%
expm1-define91.8%
Simplified91.8%
Taylor expanded in i around 0 68.9%
associate-*r*68.9%
distribute-rgt-out68.9%
+-commutative68.9%
*-commutative68.9%
Simplified68.9%
if -6.19999999999999951e148 < n < 1.21999999999999997Initial program 33.7%
Taylor expanded in n around inf 22.9%
*-commutative22.9%
associate-/l*22.9%
expm1-define60.4%
Simplified60.4%
expm1-define22.9%
clear-num22.9%
un-div-inv22.9%
expm1-define60.4%
Applied egg-rr60.4%
Taylor expanded in i around 0 62.3%
if 1.21999999999999997 < n Initial program 14.9%
Taylor expanded in n around inf 41.7%
Taylor expanded in i around 0 85.8%
*-commutative85.8%
Simplified85.8%
Final simplification70.0%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (+ n (* i (* n (+ 0.5 (* i 0.16666666666666666))))))))
(if (<= n -9e+149)
t_0
(if (<= n 0.8)
(* 100.0 (/ n (+ 1.0 (* i (- (* i 0.08333333333333333) 0.5)))))
(if (<= n 1.9e+83)
(* 100.0 (/ (* n (* i (+ 1.0 (* i 0.5)))) i))
t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * (n + (i * (n * (0.5 + (i * 0.16666666666666666)))));
double tmp;
if (n <= -9e+149) {
tmp = t_0;
} else if (n <= 0.8) {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5))));
} else if (n <= 1.9e+83) {
tmp = 100.0 * ((n * (i * (1.0 + (i * 0.5)))) / i);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 100.0d0 * (n + (i * (n * (0.5d0 + (i * 0.16666666666666666d0)))))
if (n <= (-9d+149)) then
tmp = t_0
else if (n <= 0.8d0) then
tmp = 100.0d0 * (n / (1.0d0 + (i * ((i * 0.08333333333333333d0) - 0.5d0))))
else if (n <= 1.9d+83) then
tmp = 100.0d0 * ((n * (i * (1.0d0 + (i * 0.5d0)))) / i)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = 100.0 * (n + (i * (n * (0.5 + (i * 0.16666666666666666)))));
double tmp;
if (n <= -9e+149) {
tmp = t_0;
} else if (n <= 0.8) {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5))));
} else if (n <= 1.9e+83) {
tmp = 100.0 * ((n * (i * (1.0 + (i * 0.5)))) / i);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n + (i * (n * (0.5 + (i * 0.16666666666666666))))) tmp = 0 if n <= -9e+149: tmp = t_0 elif n <= 0.8: tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5)))) elif n <= 1.9e+83: tmp = 100.0 * ((n * (i * (1.0 + (i * 0.5)))) / i) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n + Float64(i * Float64(n * Float64(0.5 + Float64(i * 0.16666666666666666)))))) tmp = 0.0 if (n <= -9e+149) tmp = t_0; elseif (n <= 0.8) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * Float64(Float64(i * 0.08333333333333333) - 0.5))))); elseif (n <= 1.9e+83) tmp = Float64(100.0 * Float64(Float64(n * Float64(i * Float64(1.0 + Float64(i * 0.5)))) / i)); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = 100.0 * (n + (i * (n * (0.5 + (i * 0.16666666666666666))))); tmp = 0.0; if (n <= -9e+149) tmp = t_0; elseif (n <= 0.8) tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5)))); elseif (n <= 1.9e+83) tmp = 100.0 * ((n * (i * (1.0 + (i * 0.5)))) / i); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n + N[(i * N[(n * N[(0.5 + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -9e+149], t$95$0, If[LessEqual[n, 0.8], N[(100.0 * N[(n / N[(1.0 + N[(i * N[(N[(i * 0.08333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.9e+83], N[(100.0 * N[(N[(n * N[(i * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \left(n + i \cdot \left(n \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\\
\mathbf{if}\;n \leq -9 \cdot 10^{+149}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 0.8:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot \left(i \cdot 0.08333333333333333 - 0.5\right)}\\
\mathbf{elif}\;n \leq 1.9 \cdot 10^{+83}:\\
\;\;\;\;100 \cdot \frac{n \cdot \left(i \cdot \left(1 + i \cdot 0.5\right)\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -8.99999999999999965e149 or 1.9000000000000001e83 < n Initial program 12.2%
Taylor expanded in n around inf 42.5%
*-commutative42.5%
associate-/l*42.4%
expm1-define95.9%
Simplified95.9%
Taylor expanded in i around 0 73.1%
associate-*r*73.1%
distribute-rgt-out73.1%
+-commutative73.1%
*-commutative73.1%
Simplified73.1%
if -8.99999999999999965e149 < n < 0.80000000000000004Initial program 33.7%
Taylor expanded in n around inf 22.9%
*-commutative22.9%
associate-/l*22.9%
expm1-define60.4%
Simplified60.4%
expm1-define22.9%
clear-num22.9%
un-div-inv22.9%
expm1-define60.4%
Applied egg-rr60.4%
Taylor expanded in i around 0 62.3%
if 0.80000000000000004 < n < 1.9000000000000001e83Initial program 35.3%
Taylor expanded in n around inf 27.1%
Taylor expanded in i around 0 91.8%
*-commutative91.8%
Simplified91.8%
Final simplification67.8%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ 0.5 (* i 0.16666666666666666))))
(if (<= n -1.45e+146)
(* 100.0 (+ n (* i (* n t_0))))
(if (<= n 2.9e+23)
(* 100.0 (/ n (+ 1.0 (* i (- (* i 0.08333333333333333) 0.5)))))
(* 100.0 (/ (* n (* i (+ 1.0 (* i t_0)))) i))))))
double code(double i, double n) {
double t_0 = 0.5 + (i * 0.16666666666666666);
double tmp;
if (n <= -1.45e+146) {
tmp = 100.0 * (n + (i * (n * t_0)));
} else if (n <= 2.9e+23) {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5))));
} else {
tmp = 100.0 * ((n * (i * (1.0 + (i * t_0)))) / i);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 + (i * 0.16666666666666666d0)
if (n <= (-1.45d+146)) then
tmp = 100.0d0 * (n + (i * (n * t_0)))
else if (n <= 2.9d+23) then
tmp = 100.0d0 * (n / (1.0d0 + (i * ((i * 0.08333333333333333d0) - 0.5d0))))
else
tmp = 100.0d0 * ((n * (i * (1.0d0 + (i * t_0)))) / i)
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = 0.5 + (i * 0.16666666666666666);
double tmp;
if (n <= -1.45e+146) {
tmp = 100.0 * (n + (i * (n * t_0)));
} else if (n <= 2.9e+23) {
tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5))));
} else {
tmp = 100.0 * ((n * (i * (1.0 + (i * t_0)))) / i);
}
return tmp;
}
def code(i, n): t_0 = 0.5 + (i * 0.16666666666666666) tmp = 0 if n <= -1.45e+146: tmp = 100.0 * (n + (i * (n * t_0))) elif n <= 2.9e+23: tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5)))) else: tmp = 100.0 * ((n * (i * (1.0 + (i * t_0)))) / i) return tmp
function code(i, n) t_0 = Float64(0.5 + Float64(i * 0.16666666666666666)) tmp = 0.0 if (n <= -1.45e+146) tmp = Float64(100.0 * Float64(n + Float64(i * Float64(n * t_0)))); elseif (n <= 2.9e+23) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * Float64(Float64(i * 0.08333333333333333) - 0.5))))); else tmp = Float64(100.0 * Float64(Float64(n * Float64(i * Float64(1.0 + Float64(i * t_0)))) / i)); end return tmp end
function tmp_2 = code(i, n) t_0 = 0.5 + (i * 0.16666666666666666); tmp = 0.0; if (n <= -1.45e+146) tmp = 100.0 * (n + (i * (n * t_0))); elseif (n <= 2.9e+23) tmp = 100.0 * (n / (1.0 + (i * ((i * 0.08333333333333333) - 0.5)))); else tmp = 100.0 * ((n * (i * (1.0 + (i * t_0)))) / i); end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(0.5 + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.45e+146], N[(100.0 * N[(n + N[(i * N[(n * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.9e+23], N[(100.0 * N[(n / N[(1.0 + N[(i * N[(N[(i * 0.08333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(n * N[(i * N[(1.0 + N[(i * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 + i \cdot 0.16666666666666666\\
\mathbf{if}\;n \leq -1.45 \cdot 10^{+146}:\\
\;\;\;\;100 \cdot \left(n + i \cdot \left(n \cdot t\_0\right)\right)\\
\mathbf{elif}\;n \leq 2.9 \cdot 10^{+23}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot \left(i \cdot 0.08333333333333333 - 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n \cdot \left(i \cdot \left(1 + i \cdot t\_0\right)\right)}{i}\\
\end{array}
\end{array}
if n < -1.4499999999999999e146Initial program 14.4%
Taylor expanded in n around inf 38.9%
*-commutative38.9%
associate-/l*38.8%
expm1-define91.8%
Simplified91.8%
Taylor expanded in i around 0 68.9%
associate-*r*68.9%
distribute-rgt-out68.9%
+-commutative68.9%
*-commutative68.9%
Simplified68.9%
if -1.4499999999999999e146 < n < 2.90000000000000013e23Initial program 32.9%
Taylor expanded in n around inf 22.0%
*-commutative22.0%
associate-/l*22.0%
expm1-define61.5%
Simplified61.5%
expm1-define22.0%
clear-num22.0%
un-div-inv22.0%
expm1-define61.6%
Applied egg-rr61.6%
Taylor expanded in i around 0 63.4%
if 2.90000000000000013e23 < n Initial program 14.7%
Taylor expanded in n around inf 45.9%
Taylor expanded in i around 0 80.1%
*-commutative80.1%
Simplified80.1%
Final simplification68.5%
(FPCore (i n) :precision binary64 (if (<= n -3.3e+45) (* 100.0 (/ (* i n) i)) (if (<= n 0.22) (* 100.0 (/ i (/ i n))) (* 100.0 (+ n (* n (* i 0.5)))))))
double code(double i, double n) {
double tmp;
if (n <= -3.3e+45) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= 0.22) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = 100.0 * (n + (n * (i * 0.5)));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-3.3d+45)) then
tmp = 100.0d0 * ((i * n) / i)
else if (n <= 0.22d0) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = 100.0d0 * (n + (n * (i * 0.5d0)))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -3.3e+45) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= 0.22) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = 100.0 * (n + (n * (i * 0.5)));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -3.3e+45: tmp = 100.0 * ((i * n) / i) elif n <= 0.22: tmp = 100.0 * (i / (i / n)) else: tmp = 100.0 * (n + (n * (i * 0.5))) return tmp
function code(i, n) tmp = 0.0 if (n <= -3.3e+45) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); elseif (n <= 0.22) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(100.0 * Float64(n + Float64(n * Float64(i * 0.5)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -3.3e+45) tmp = 100.0 * ((i * n) / i); elseif (n <= 0.22) tmp = 100.0 * (i / (i / n)); else tmp = 100.0 * (n + (n * (i * 0.5))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -3.3e+45], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.22], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n + N[(n * N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.3 \cdot 10^{+45}:\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{elif}\;n \leq 0.22:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n + n \cdot \left(i \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if n < -3.3000000000000001e45Initial program 30.8%
Taylor expanded in n around inf 36.7%
Taylor expanded in i around 0 55.0%
if -3.3000000000000001e45 < n < 0.220000000000000001Initial program 29.1%
Taylor expanded in i around 0 63.1%
if 0.220000000000000001 < n Initial program 14.9%
Taylor expanded in n around inf 41.7%
*-commutative41.7%
associate-/l*41.7%
expm1-define97.2%
Simplified97.2%
Taylor expanded in i around 0 71.9%
associate-*r*71.9%
*-commutative71.9%
Simplified71.9%
Final simplification63.4%
(FPCore (i n) :precision binary64 (if (<= n 2.65e-40) (/ 100.0 (/ (+ 1.0 (* i -0.5)) n)) (* 100.0 (/ (* n (* i (+ 1.0 (* i 0.5)))) i))))
double code(double i, double n) {
double tmp;
if (n <= 2.65e-40) {
tmp = 100.0 / ((1.0 + (i * -0.5)) / n);
} else {
tmp = 100.0 * ((n * (i * (1.0 + (i * 0.5)))) / 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.65d-40) then
tmp = 100.0d0 / ((1.0d0 + (i * (-0.5d0))) / n)
else
tmp = 100.0d0 * ((n * (i * (1.0d0 + (i * 0.5d0)))) / i)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= 2.65e-40) {
tmp = 100.0 / ((1.0 + (i * -0.5)) / n);
} else {
tmp = 100.0 * ((n * (i * (1.0 + (i * 0.5)))) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= 2.65e-40: tmp = 100.0 / ((1.0 + (i * -0.5)) / n) else: tmp = 100.0 * ((n * (i * (1.0 + (i * 0.5)))) / i) return tmp
function code(i, n) tmp = 0.0 if (n <= 2.65e-40) tmp = Float64(100.0 / Float64(Float64(1.0 + Float64(i * -0.5)) / n)); else tmp = Float64(100.0 * Float64(Float64(n * Float64(i * Float64(1.0 + Float64(i * 0.5)))) / i)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= 2.65e-40) tmp = 100.0 / ((1.0 + (i * -0.5)) / n); else tmp = 100.0 * ((n * (i * (1.0 + (i * 0.5)))) / i); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, 2.65e-40], N[(100.0 / N[(N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(n * N[(i * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 2.65 \cdot 10^{-40}:\\
\;\;\;\;\frac{100}{\frac{1 + i \cdot -0.5}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n \cdot \left(i \cdot \left(1 + i \cdot 0.5\right)\right)}{i}\\
\end{array}
\end{array}
if n < 2.6500000000000001e-40Initial program 30.8%
Taylor expanded in n around inf 27.0%
*-commutative27.0%
associate-/l*27.0%
expm1-define66.5%
Simplified66.5%
expm1-define27.0%
clear-num27.0%
un-div-inv27.0%
expm1-define66.5%
Applied egg-rr66.5%
*-commutative66.5%
clear-num66.7%
un-div-inv66.6%
Applied egg-rr66.6%
Taylor expanded in i around 0 61.0%
*-commutative60.3%
Simplified61.0%
if 2.6500000000000001e-40 < n Initial program 13.9%
Taylor expanded in n around inf 38.4%
Taylor expanded in i around 0 77.7%
*-commutative77.7%
Simplified77.7%
Final simplification66.2%
(FPCore (i n) :precision binary64 (if (or (<= i -5e-6) (not (<= i 1.2e-46))) (* 100.0 (/ i (/ i n))) (* n 100.0)))
double code(double i, double n) {
double tmp;
if ((i <= -5e-6) || !(i <= 1.2e-46)) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * 100.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((i <= (-5d-6)) .or. (.not. (i <= 1.2d-46))) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = n * 100.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((i <= -5e-6) || !(i <= 1.2e-46)) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * 100.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -5e-6) or not (i <= 1.2e-46): tmp = 100.0 * (i / (i / n)) else: tmp = n * 100.0 return tmp
function code(i, n) tmp = 0.0 if ((i <= -5e-6) || !(i <= 1.2e-46)) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(n * 100.0); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((i <= -5e-6) || ~((i <= 1.2e-46))) tmp = 100.0 * (i / (i / n)); else tmp = n * 100.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[i, -5e-6], N[Not[LessEqual[i, 1.2e-46]], $MachinePrecision]], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -5 \cdot 10^{-6} \lor \neg \left(i \leq 1.2 \cdot 10^{-46}\right):\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100\\
\end{array}
\end{array}
if i < -5.00000000000000041e-6 or 1.20000000000000007e-46 < i Initial program 46.7%
Taylor expanded in i around 0 26.6%
if -5.00000000000000041e-6 < i < 1.20000000000000007e-46Initial program 5.9%
Taylor expanded in i around 0 88.9%
*-commutative88.9%
Simplified88.9%
Final simplification58.9%
(FPCore (i n) :precision binary64 (if (or (<= n -5e+46) (not (<= n 5.6e-84))) (* 100.0 (/ (* i n) i)) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -5e+46) || !(n <= 5.6e-84)) {
tmp = 100.0 * ((i * n) / i);
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-5d+46)) .or. (.not. (n <= 5.6d-84))) then
tmp = 100.0d0 * ((i * n) / i)
else
tmp = 100.0d0 * (i / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -5e+46) || !(n <= 5.6e-84)) {
tmp = 100.0 * ((i * n) / i);
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -5e+46) or not (n <= 5.6e-84): tmp = 100.0 * ((i * n) / i) else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -5e+46) || !(n <= 5.6e-84)) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); else tmp = Float64(100.0 * Float64(i / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -5e+46) || ~((n <= 5.6e-84))) tmp = 100.0 * ((i * n) / i); else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -5e+46], N[Not[LessEqual[n, 5.6e-84]], $MachinePrecision]], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -5 \cdot 10^{+46} \lor \neg \left(n \leq 5.6 \cdot 10^{-84}\right):\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -5.0000000000000002e46 or 5.59999999999999964e-84 < n Initial program 21.1%
Taylor expanded in n around inf 36.0%
Taylor expanded in i around 0 62.3%
if -5.0000000000000002e46 < n < 5.59999999999999964e-84Initial program 32.6%
Taylor expanded in i around 0 63.7%
Final simplification62.9%
(FPCore (i n) :precision binary64 (if (<= n -6.5e+43) (* 100.0 (/ (* i n) i)) (if (<= n 0.22) (* 100.0 (/ i (/ i n))) (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -6.5e+43) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= 0.22) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-6.5d+43)) then
tmp = 100.0d0 * ((i * n) / i)
else if (n <= 0.22d0) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -6.5e+43) {
tmp = 100.0 * ((i * n) / i);
} else if (n <= 0.22) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -6.5e+43: tmp = 100.0 * ((i * n) / i) elif n <= 0.22: tmp = 100.0 * (i / (i / n)) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -6.5e+43) tmp = Float64(100.0 * Float64(Float64(i * n) / i)); elseif (n <= 0.22) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -6.5e+43) tmp = 100.0 * ((i * n) / i); elseif (n <= 0.22) tmp = 100.0 * (i / (i / n)); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -6.5e+43], N[(100.0 * N[(N[(i * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.22], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -6.5 \cdot 10^{+43}:\\
\;\;\;\;100 \cdot \frac{i \cdot n}{i}\\
\mathbf{elif}\;n \leq 0.22:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -6.4999999999999998e43Initial program 30.8%
Taylor expanded in n around inf 36.7%
Taylor expanded in i around 0 55.0%
if -6.4999999999999998e43 < n < 0.220000000000000001Initial program 29.1%
Taylor expanded in i around 0 63.1%
if 0.220000000000000001 < n Initial program 14.9%
Taylor expanded in n around inf 41.7%
*-commutative41.7%
associate-/l*41.7%
expm1-define97.2%
Simplified97.2%
Taylor expanded in i around 0 71.9%
+-commutative71.9%
associate-*r*71.9%
distribute-rgt-in71.9%
*-commutative71.9%
Simplified71.9%
Final simplification63.4%
(FPCore (i n) :precision binary64 (if (<= n 8e+138) (* 100.0 (/ n (+ 1.0 (* i -0.5)))) (* 100.0 (+ n (* n (* i 0.5))))))
double code(double i, double n) {
double tmp;
if (n <= 8e+138) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else {
tmp = 100.0 * (n + (n * (i * 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 <= 8d+138) then
tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
else
tmp = 100.0d0 * (n + (n * (i * 0.5d0)))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= 8e+138) {
tmp = 100.0 * (n / (1.0 + (i * -0.5)));
} else {
tmp = 100.0 * (n + (n * (i * 0.5)));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= 8e+138: tmp = 100.0 * (n / (1.0 + (i * -0.5))) else: tmp = 100.0 * (n + (n * (i * 0.5))) return tmp
function code(i, n) tmp = 0.0 if (n <= 8e+138) tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5)))); else tmp = Float64(100.0 * Float64(n + Float64(n * Float64(i * 0.5)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= 8e+138) tmp = 100.0 * (n / (1.0 + (i * -0.5))); else tmp = 100.0 * (n + (n * (i * 0.5))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, 8e+138], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n + N[(n * N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 8 \cdot 10^{+138}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n + n \cdot \left(i \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if n < 8.0000000000000003e138Initial program 28.2%
Taylor expanded in n around inf 26.9%
*-commutative26.9%
associate-/l*26.9%
expm1-define70.4%
Simplified70.4%
expm1-define26.9%
clear-num26.9%
un-div-inv26.9%
expm1-define70.4%
Applied egg-rr70.4%
Taylor expanded in i around 0 61.7%
*-commutative61.7%
Simplified61.7%
if 8.0000000000000003e138 < n Initial program 13.5%
Taylor expanded in n around inf 46.9%
*-commutative46.9%
associate-/l*46.9%
expm1-define97.9%
Simplified97.9%
Taylor expanded in i around 0 74.8%
associate-*r*74.8%
*-commutative74.8%
Simplified74.8%
Final simplification64.1%
(FPCore (i n) :precision binary64 (if (<= n 8e+138) (/ 100.0 (/ (+ 1.0 (* i -0.5)) n)) (* 100.0 (+ n (* n (* i 0.5))))))
double code(double i, double n) {
double tmp;
if (n <= 8e+138) {
tmp = 100.0 / ((1.0 + (i * -0.5)) / n);
} else {
tmp = 100.0 * (n + (n * (i * 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 <= 8d+138) then
tmp = 100.0d0 / ((1.0d0 + (i * (-0.5d0))) / n)
else
tmp = 100.0d0 * (n + (n * (i * 0.5d0)))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= 8e+138) {
tmp = 100.0 / ((1.0 + (i * -0.5)) / n);
} else {
tmp = 100.0 * (n + (n * (i * 0.5)));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= 8e+138: tmp = 100.0 / ((1.0 + (i * -0.5)) / n) else: tmp = 100.0 * (n + (n * (i * 0.5))) return tmp
function code(i, n) tmp = 0.0 if (n <= 8e+138) tmp = Float64(100.0 / Float64(Float64(1.0 + Float64(i * -0.5)) / n)); else tmp = Float64(100.0 * Float64(n + Float64(n * Float64(i * 0.5)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= 8e+138) tmp = 100.0 / ((1.0 + (i * -0.5)) / n); else tmp = 100.0 * (n + (n * (i * 0.5))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, 8e+138], N[(100.0 / N[(N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n + N[(n * N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 8 \cdot 10^{+138}:\\
\;\;\;\;\frac{100}{\frac{1 + i \cdot -0.5}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n + n \cdot \left(i \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if n < 8.0000000000000003e138Initial program 28.2%
Taylor expanded in n around inf 26.9%
*-commutative26.9%
associate-/l*26.9%
expm1-define70.4%
Simplified70.4%
expm1-define26.9%
clear-num26.9%
un-div-inv26.9%
expm1-define70.4%
Applied egg-rr70.4%
*-commutative70.4%
clear-num70.5%
un-div-inv70.4%
Applied egg-rr70.4%
Taylor expanded in i around 0 62.3%
*-commutative61.7%
Simplified62.3%
if 8.0000000000000003e138 < n Initial program 13.5%
Taylor expanded in n around inf 46.9%
*-commutative46.9%
associate-/l*46.9%
expm1-define97.9%
Simplified97.9%
Taylor expanded in i around 0 74.8%
associate-*r*74.8%
*-commutative74.8%
Simplified74.8%
Final simplification64.6%
(FPCore (i n) :precision binary64 (if (<= i 2.75e+51) (* n 100.0) (* 50.0 (* i n))))
double code(double i, double n) {
double tmp;
if (i <= 2.75e+51) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 2.75d+51) then
tmp = n * 100.0d0
else
tmp = 50.0d0 * (i * n)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 2.75e+51) {
tmp = n * 100.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 2.75e+51: tmp = n * 100.0 else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= 2.75e+51) tmp = Float64(n * 100.0); else tmp = Float64(50.0 * Float64(i * n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 2.75e+51) tmp = n * 100.0; else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 2.75e+51], N[(n * 100.0), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 2.75 \cdot 10^{+51}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < 2.75e51Initial program 21.5%
Taylor expanded in i around 0 62.7%
*-commutative62.7%
Simplified62.7%
if 2.75e51 < i Initial program 41.4%
Taylor expanded in n around inf 41.2%
*-commutative41.2%
associate-/l*41.2%
expm1-define41.2%
Simplified41.2%
Taylor expanded in i around 0 23.9%
Taylor expanded in i around inf 23.9%
Final simplification54.8%
(FPCore (i n) :precision binary64 (* i -50.0))
double code(double i, double n) {
return i * -50.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = i * (-50.0d0)
end function
public static double code(double i, double n) {
return i * -50.0;
}
def code(i, n): return i * -50.0
function code(i, n) return Float64(i * -50.0) end
function tmp = code(i, n) tmp = i * -50.0; end
code[i_, n_] := N[(i * -50.0), $MachinePrecision]
\begin{array}{l}
\\
i \cdot -50
\end{array}
Initial program 25.5%
associate-/r/25.8%
associate-*r*25.8%
*-commutative25.8%
associate-*r/25.8%
sub-neg25.8%
distribute-lft-in25.8%
metadata-eval25.8%
metadata-eval25.8%
metadata-eval25.8%
fma-define25.8%
metadata-eval25.8%
Simplified25.8%
Taylor expanded in i around 0 54.7%
*-commutative54.7%
associate-*r/54.7%
metadata-eval54.7%
Simplified54.7%
Taylor expanded in n around 0 2.8%
*-commutative2.8%
Simplified2.8%
Final simplification2.8%
(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 25.5%
Taylor expanded in i around 0 50.9%
*-commutative50.9%
Simplified50.9%
Final simplification50.9%
(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 2024130
(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))))