
(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 20 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)
(/ 100.0 (/ (/ i n) (expm1 (* n (log1p (/ i n))))))
(if (<= t_1 INFINITY)
(* (+ (/ t_0 i) (/ -1.0 i)) (* n 100.0))
(/ (/ n 0.01) (+ 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 / n) / expm1((n * log1p((i / n)))));
} else if (t_1 <= ((double) INFINITY)) {
tmp = ((t_0 / i) + (-1.0 / i)) * (n * 100.0);
} else {
tmp = (n / 0.01) / (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 / n) / Math.expm1((n * Math.log1p((i / n)))));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = ((t_0 / i) + (-1.0 / i)) * (n * 100.0);
} else {
tmp = (n / 0.01) / (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 / n) / math.expm1((n * math.log1p((i / n))))) elif t_1 <= math.inf: tmp = ((t_0 / i) + (-1.0 / i)) * (n * 100.0) else: tmp = (n / 0.01) / (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 / n) / expm1(Float64(n * log1p(Float64(i / n)))))); elseif (t_1 <= Inf) tmp = Float64(Float64(Float64(t_0 / i) + Float64(-1.0 / i)) * Float64(n * 100.0)); else tmp = Float64(Float64(n / 0.01) / 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), $MachinePrecision] / N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $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 / 0.01), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(i * 0.08333333333333333), $MachinePrecision] - 0.5), $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}{n}}{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\left(\frac{t\_0}{i} + \frac{-1}{i}\right) \cdot \left(n \cdot 100\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{n}{0.01}}{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 20.4%
associate-/r/20.0%
associate-*r*20.0%
*-commutative20.0%
associate-*r/20.0%
sub-neg20.0%
distribute-lft-in20.0%
metadata-eval20.0%
metadata-eval20.0%
metadata-eval20.0%
fma-define20.0%
metadata-eval20.0%
Simplified20.0%
*-commutative20.0%
fma-undefine20.0%
*-commutative20.0%
associate-/r/20.4%
metadata-eval20.4%
metadata-eval20.4%
distribute-rgt-in20.4%
sub-neg20.4%
associate-*r/20.4%
clear-num20.4%
un-div-inv20.4%
add-exp-log20.4%
expm1-define20.4%
log-pow31.4%
log1p-define98.7%
Applied egg-rr98.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 98.8%
associate-*r/98.9%
sub-neg98.9%
distribute-rgt-in98.9%
metadata-eval98.9%
metadata-eval98.9%
Simplified98.9%
metadata-eval98.9%
metadata-eval98.9%
distribute-rgt-in98.9%
sub-neg98.9%
associate-*r/98.8%
*-commutative98.8%
associate-/r/99.0%
associate-*l*99.1%
add-exp-log99.1%
expm1-define99.1%
log-pow34.5%
log1p-define34.5%
Applied egg-rr34.5%
expm1-undefine33.9%
div-sub34.0%
*-commutative34.0%
log1p-undefine34.0%
exp-to-pow99.2%
Applied egg-rr99.2%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
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%
Taylor expanded in n around inf 1.9%
sub-neg1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
metadata-eval1.9%
sub-neg1.9%
expm1-define77.3%
Simplified77.3%
clear-num77.4%
un-div-inv77.2%
*-un-lft-identity77.2%
times-frac77.2%
metadata-eval77.2%
Applied egg-rr77.2%
associate-/r*77.2%
Simplified77.2%
Taylor expanded in i around 0 99.8%
Final simplification98.9%
(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)))) i) (* n 100.0))
(if (<= t_1 INFINITY)
(* (+ (/ t_0 i) (/ -1.0 i)) (* n 100.0))
(/ (/ n 0.01) (+ 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)))) / i) * (n * 100.0);
} else if (t_1 <= ((double) INFINITY)) {
tmp = ((t_0 / i) + (-1.0 / i)) * (n * 100.0);
} else {
tmp = (n / 0.01) / (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)))) / i) * (n * 100.0);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = ((t_0 / i) + (-1.0 / i)) * (n * 100.0);
} else {
tmp = (n / 0.01) / (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)))) / i) * (n * 100.0) elif t_1 <= math.inf: tmp = ((t_0 / i) + (-1.0 / i)) * (n * 100.0) else: tmp = (n / 0.01) / (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)))) / i) * Float64(n * 100.0)); elseif (t_1 <= Inf) tmp = Float64(Float64(Float64(t_0 / i) + Float64(-1.0 / i)) * Float64(n * 100.0)); else tmp = Float64(Float64(n / 0.01) / 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] / i), $MachinePrecision] * N[(n * 100.0), $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 / 0.01), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(i * 0.08333333333333333), $MachinePrecision] - 0.5), $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)}{i} \cdot \left(n \cdot 100\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\left(\frac{t\_0}{i} + \frac{-1}{i}\right) \cdot \left(n \cdot 100\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{n}{0.01}}{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 20.4%
associate-*r/20.4%
sub-neg20.4%
distribute-rgt-in20.4%
metadata-eval20.4%
metadata-eval20.4%
Simplified20.4%
metadata-eval20.4%
metadata-eval20.4%
distribute-rgt-in20.4%
sub-neg20.4%
associate-*r/20.4%
*-commutative20.4%
associate-/r/20.0%
associate-*l*20.0%
add-exp-log20.0%
expm1-define20.0%
log-pow31.5%
log1p-define98.7%
Applied egg-rr98.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 98.8%
associate-*r/98.9%
sub-neg98.9%
distribute-rgt-in98.9%
metadata-eval98.9%
metadata-eval98.9%
Simplified98.9%
metadata-eval98.9%
metadata-eval98.9%
distribute-rgt-in98.9%
sub-neg98.9%
associate-*r/98.8%
*-commutative98.8%
associate-/r/99.0%
associate-*l*99.1%
add-exp-log99.1%
expm1-define99.1%
log-pow34.5%
log1p-define34.5%
Applied egg-rr34.5%
expm1-undefine33.9%
div-sub34.0%
*-commutative34.0%
log1p-undefine34.0%
exp-to-pow99.2%
Applied egg-rr99.2%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
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%
Taylor expanded in n around inf 1.9%
sub-neg1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
metadata-eval1.9%
sub-neg1.9%
expm1-define77.3%
Simplified77.3%
clear-num77.4%
un-div-inv77.2%
*-un-lft-identity77.2%
times-frac77.2%
metadata-eval77.2%
Applied egg-rr77.2%
associate-/r*77.2%
Simplified77.2%
Taylor expanded in i around 0 99.8%
Final simplification98.9%
(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 (* n (/ (expm1 (* n (log1p (/ i n)))) i)))
(if (<= t_1 INFINITY)
(* (+ (/ t_0 i) (/ -1.0 i)) (* n 100.0))
(/ (/ n 0.01) (+ 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 * (n * (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 / 0.01) / (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 * (n * (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 / 0.01) / (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 * (n * (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 / 0.01) / (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(n * Float64(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(Float64(n / 0.01) / 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 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[(t$95$0 / i), $MachinePrecision] + N[(-1.0 / i), $MachinePrecision]), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], N[(N[(n / 0.01), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(i * 0.08333333333333333), $MachinePrecision] - 0.5), $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(n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\left(\frac{t\_0}{i} + \frac{-1}{i}\right) \cdot \left(n \cdot 100\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{n}{0.01}}{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 20.4%
associate-/r/20.0%
add-exp-log20.0%
expm1-define20.0%
log-pow31.3%
log1p-define98.5%
Applied egg-rr98.5%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 98.8%
associate-*r/98.9%
sub-neg98.9%
distribute-rgt-in98.9%
metadata-eval98.9%
metadata-eval98.9%
Simplified98.9%
metadata-eval98.9%
metadata-eval98.9%
distribute-rgt-in98.9%
sub-neg98.9%
associate-*r/98.8%
*-commutative98.8%
associate-/r/99.0%
associate-*l*99.1%
add-exp-log99.1%
expm1-define99.1%
log-pow34.5%
log1p-define34.5%
Applied egg-rr34.5%
expm1-undefine33.9%
div-sub34.0%
*-commutative34.0%
log1p-undefine34.0%
exp-to-pow99.2%
Applied egg-rr99.2%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
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%
Taylor expanded in n around inf 1.9%
sub-neg1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
metadata-eval1.9%
sub-neg1.9%
expm1-define77.3%
Simplified77.3%
clear-num77.4%
un-div-inv77.2%
*-un-lft-identity77.2%
times-frac77.2%
metadata-eval77.2%
Applied egg-rr77.2%
associate-/r*77.2%
Simplified77.2%
Taylor expanded in i around 0 99.8%
Final simplification98.8%
(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 i) (/ i n)))
(if (<= t_1 INFINITY)
(* (+ (/ t_0 i) (/ -1.0 i)) (* n 100.0))
(/ (/ n 0.01) (+ 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(i) / (i / n));
} else if (t_1 <= ((double) INFINITY)) {
tmp = ((t_0 / i) + (-1.0 / i)) * (n * 100.0);
} else {
tmp = (n / 0.01) / (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(i) / (i / n));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = ((t_0 / i) + (-1.0 / i)) * (n * 100.0);
} else {
tmp = (n / 0.01) / (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(i) / (i / n)) elif t_1 <= math.inf: tmp = ((t_0 / i) + (-1.0 / i)) * (n * 100.0) else: tmp = (n / 0.01) / (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(i) / Float64(i / n))); elseif (t_1 <= Inf) tmp = Float64(Float64(Float64(t_0 / i) + Float64(-1.0 / i)) * Float64(n * 100.0)); else tmp = Float64(Float64(n / 0.01) / 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[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $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 / 0.01), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(i * 0.08333333333333333), $MachinePrecision] - 0.5), $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 \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\left(\frac{t\_0}{i} + \frac{-1}{i}\right) \cdot \left(n \cdot 100\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{n}{0.01}}{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 20.4%
Taylor expanded in n around inf 38.1%
expm1-define79.5%
Simplified79.5%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 98.8%
associate-*r/98.9%
sub-neg98.9%
distribute-rgt-in98.9%
metadata-eval98.9%
metadata-eval98.9%
Simplified98.9%
metadata-eval98.9%
metadata-eval98.9%
distribute-rgt-in98.9%
sub-neg98.9%
associate-*r/98.8%
*-commutative98.8%
associate-/r/99.0%
associate-*l*99.1%
add-exp-log99.1%
expm1-define99.1%
log-pow34.5%
log1p-define34.5%
Applied egg-rr34.5%
expm1-undefine33.9%
div-sub34.0%
*-commutative34.0%
log1p-undefine34.0%
exp-to-pow99.2%
Applied egg-rr99.2%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) Initial program 0.0%
associate-/r/1.9%
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%
Taylor expanded in n around inf 1.9%
sub-neg1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
metadata-eval1.9%
sub-neg1.9%
expm1-define77.3%
Simplified77.3%
clear-num77.4%
un-div-inv77.2%
*-un-lft-identity77.2%
times-frac77.2%
metadata-eval77.2%
Applied egg-rr77.2%
associate-/r*77.2%
Simplified77.2%
Taylor expanded in i around 0 99.8%
Final simplification85.3%
(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 (/ (expm1 i) (/ i n)))
(if (<= t_0 INFINITY)
(/ (* (* n 100.0) (+ (pow (/ i n) n) -1.0)) i)
(/ (/ n 0.01) (+ 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 * (expm1(i) / (i / n));
} else if (t_0 <= ((double) INFINITY)) {
tmp = ((n * 100.0) * (pow((i / n), n) + -1.0)) / i;
} else {
tmp = (n / 0.01) / (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 * (Math.expm1(i) / (i / n));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = ((n * 100.0) * (Math.pow((i / n), n) + -1.0)) / i;
} else {
tmp = (n / 0.01) / (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 * (math.expm1(i) / (i / n)) elif t_0 <= math.inf: tmp = ((n * 100.0) * (math.pow((i / n), n) + -1.0)) / i else: tmp = (n / 0.01) / (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(expm1(i) / Float64(i / n))); elseif (t_0 <= Inf) tmp = Float64(Float64(Float64(n * 100.0) * Float64((Float64(i / n) ^ n) + -1.0)) / i); else tmp = Float64(Float64(n / 0.01) / 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[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(N[(n * 100.0), $MachinePrecision] * N[(N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], N[(N[(n / 0.01), $MachinePrecision] / N[(1.0 + N[(i * N[(N[(i * 0.08333333333333333), $MachinePrecision] - 0.5), $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:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{\left(n \cdot 100\right) \cdot \left({\left(\frac{i}{n}\right)}^{n} + -1\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{n}{0.01}}{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 20.4%
Taylor expanded in n around inf 38.1%
expm1-define79.5%
Simplified79.5%
if -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0Initial program 98.8%
associate-*r/98.9%
sub-neg98.9%
distribute-rgt-in98.9%
metadata-eval98.9%
metadata-eval98.9%
Simplified98.9%
metadata-eval98.9%
metadata-eval98.9%
distribute-rgt-in98.9%
sub-neg98.9%
associate-*r/98.8%
*-commutative98.8%
associate-/r/99.0%
associate-*l*99.1%
add-exp-log99.1%
expm1-define99.1%
log-pow34.5%
log1p-define34.5%
Applied egg-rr34.5%
Taylor expanded in i around inf 33.9%
associate-*r/33.9%
Simplified99.1%
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%
Taylor expanded in n around inf 1.9%
sub-neg1.9%
metadata-eval1.9%
metadata-eval1.9%
distribute-lft-in1.9%
metadata-eval1.9%
sub-neg1.9%
expm1-define77.3%
Simplified77.3%
clear-num77.4%
un-div-inv77.2%
*-un-lft-identity77.2%
times-frac77.2%
metadata-eval77.2%
Applied egg-rr77.2%
associate-/r*77.2%
Simplified77.2%
Taylor expanded in i around 0 99.8%
Final simplification85.3%
(FPCore (i n) :precision binary64 (if (or (<= n -2.3e-213) (not (<= n 8.2e-196))) (* n (* 100.0 (/ (expm1 i) i))) (/ 0.0 (/ i n))))
double code(double i, double n) {
double tmp;
if ((n <= -2.3e-213) || !(n <= 8.2e-196)) {
tmp = n * (100.0 * (expm1(i) / i));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -2.3e-213) || !(n <= 8.2e-196)) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else {
tmp = 0.0 / (i / n);
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -2.3e-213) or not (n <= 8.2e-196): tmp = n * (100.0 * (math.expm1(i) / i)) else: tmp = 0.0 / (i / n) return tmp
function code(i, n) tmp = 0.0 if ((n <= -2.3e-213) || !(n <= 8.2e-196)) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); else tmp = Float64(0.0 / Float64(i / n)); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -2.3e-213], N[Not[LessEqual[n, 8.2e-196]], $MachinePrecision]], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.3 \cdot 10^{-213} \lor \neg \left(n \leq 8.2 \cdot 10^{-196}\right):\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -2.30000000000000003e-213 or 8.20000000000000043e-196 < n Initial program 22.3%
associate-/r/22.4%
associate-*r*22.4%
*-commutative22.4%
associate-*r/22.4%
sub-neg22.4%
distribute-lft-in22.4%
metadata-eval22.4%
metadata-eval22.4%
metadata-eval22.4%
fma-define22.4%
metadata-eval22.4%
Simplified22.4%
Taylor expanded in n around inf 29.8%
sub-neg29.8%
metadata-eval29.8%
metadata-eval29.8%
distribute-lft-in29.8%
metadata-eval29.8%
sub-neg29.8%
expm1-define81.4%
Simplified81.4%
associate-/l*81.4%
Applied egg-rr81.4%
if -2.30000000000000003e-213 < n < 8.20000000000000043e-196Initial program 40.6%
associate-*r/40.6%
sub-neg40.6%
distribute-rgt-in40.6%
metadata-eval40.6%
metadata-eval40.6%
Simplified40.6%
Taylor expanded in i around 0 72.8%
Final simplification80.4%
(FPCore (i n) :precision binary64 (if (<= i 4.8e+87) (* n (* 100.0 (/ (expm1 i) i))) (* 100.0 (/ (+ (pow (/ i n) n) -1.0) (/ i n)))))
double code(double i, double n) {
double tmp;
if (i <= 4.8e+87) {
tmp = n * (100.0 * (expm1(i) / i));
} else {
tmp = 100.0 * ((pow((i / n), n) + -1.0) / (i / n));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (i <= 4.8e+87) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else {
tmp = 100.0 * ((Math.pow((i / n), n) + -1.0) / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 4.8e+87: tmp = n * (100.0 * (math.expm1(i) / i)) else: tmp = 100.0 * ((math.pow((i / n), n) + -1.0) / (i / n)) return tmp
function code(i, n) tmp = 0.0 if (i <= 4.8e+87) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); else tmp = Float64(100.0 * Float64(Float64((Float64(i / n) ^ n) + -1.0) / Float64(i / n))); end return tmp end
code[i_, n_] := If[LessEqual[i, 4.8e+87], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 4.8 \cdot 10^{+87}:\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{{\left(\frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
\end{array}
\end{array}
if i < 4.79999999999999963e87Initial program 18.1%
associate-/r/18.1%
associate-*r*18.2%
*-commutative18.2%
associate-*r/18.2%
sub-neg18.2%
distribute-lft-in18.2%
metadata-eval18.2%
metadata-eval18.2%
metadata-eval18.2%
fma-define18.2%
metadata-eval18.2%
Simplified18.2%
Taylor expanded in n around inf 29.2%
sub-neg29.2%
metadata-eval29.2%
metadata-eval29.2%
distribute-lft-in29.2%
metadata-eval29.2%
sub-neg29.2%
expm1-define81.5%
Simplified81.5%
associate-/l*81.6%
Applied egg-rr81.6%
if 4.79999999999999963e87 < i Initial program 57.3%
Taylor expanded in i around inf 68.9%
Final simplification79.5%
(FPCore (i n)
:precision binary64
(if (<= i -1.75e-6)
(* 100.0 (/ (expm1 i) (/ i n)))
(+
(* n 100.0)
(*
i
(+
(* n 50.0)
(* i (+ (* 4.166666666666667 (* i n)) (* n 16.666666666666668))))))))
double code(double i, double n) {
double tmp;
if (i <= -1.75e-6) {
tmp = 100.0 * (expm1(i) / (i / n));
} else {
tmp = (n * 100.0) + (i * ((n * 50.0) + (i * ((4.166666666666667 * (i * n)) + (n * 16.666666666666668)))));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if (i <= -1.75e-6) {
tmp = 100.0 * (Math.expm1(i) / (i / n));
} else {
tmp = (n * 100.0) + (i * ((n * 50.0) + (i * ((4.166666666666667 * (i * n)) + (n * 16.666666666666668)))));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -1.75e-6: tmp = 100.0 * (math.expm1(i) / (i / n)) else: tmp = (n * 100.0) + (i * ((n * 50.0) + (i * ((4.166666666666667 * (i * n)) + (n * 16.666666666666668))))) return tmp
function code(i, n) tmp = 0.0 if (i <= -1.75e-6) tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n))); else tmp = Float64(Float64(n * 100.0) + Float64(i * Float64(Float64(n * 50.0) + Float64(i * Float64(Float64(4.166666666666667 * Float64(i * n)) + Float64(n * 16.666666666666668)))))); end return tmp end
code[i_, n_] := If[LessEqual[i, -1.75e-6], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] + N[(i * N[(N[(n * 50.0), $MachinePrecision] + N[(i * N[(N[(4.166666666666667 * N[(i * n), $MachinePrecision]), $MachinePrecision] + N[(n * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.75 \cdot 10^{-6}:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100 + i \cdot \left(n \cdot 50 + i \cdot \left(4.166666666666667 \cdot \left(i \cdot n\right) + n \cdot 16.666666666666668\right)\right)\\
\end{array}
\end{array}
if i < -1.74999999999999997e-6Initial program 45.8%
Taylor expanded in n around inf 81.6%
expm1-define82.1%
Simplified82.1%
if -1.74999999999999997e-6 < i Initial program 19.6%
associate-/r/20.1%
associate-*r*20.1%
*-commutative20.1%
associate-*r/20.1%
sub-neg20.1%
distribute-lft-in20.1%
metadata-eval20.1%
metadata-eval20.1%
metadata-eval20.1%
fma-define20.1%
metadata-eval20.1%
Simplified20.1%
Taylor expanded in n around inf 18.9%
sub-neg18.9%
metadata-eval18.9%
metadata-eval18.9%
distribute-lft-in18.9%
metadata-eval18.9%
sub-neg18.9%
expm1-define72.5%
Simplified72.5%
Taylor expanded in i around 0 71.8%
Final simplification73.7%
(FPCore (i n)
:precision binary64
(if (<= n -9.5e+219)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n -2.2e-213)
(/ (/ n 0.01) (+ 1.0 (* i -0.5)))
(if (<= n 3.3e-196)
(/ 0.0 (/ i n))
(+
(* n 100.0)
(*
i
(+
(* n 50.0)
(*
i
(+ (* 4.166666666666667 (* i n)) (* n 16.666666666666668))))))))))
double code(double i, double n) {
double tmp;
if (n <= -9.5e+219) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= -2.2e-213) {
tmp = (n / 0.01) / (1.0 + (i * -0.5));
} else if (n <= 3.3e-196) {
tmp = 0.0 / (i / n);
} else {
tmp = (n * 100.0) + (i * ((n * 50.0) + (i * ((4.166666666666667 * (i * n)) + (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 <= (-9.5d+219)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= (-2.2d-213)) then
tmp = (n / 0.01d0) / (1.0d0 + (i * (-0.5d0)))
else if (n <= 3.3d-196) then
tmp = 0.0d0 / (i / n)
else
tmp = (n * 100.0d0) + (i * ((n * 50.0d0) + (i * ((4.166666666666667d0 * (i * n)) + (n * 16.666666666666668d0)))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -9.5e+219) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= -2.2e-213) {
tmp = (n / 0.01) / (1.0 + (i * -0.5));
} else if (n <= 3.3e-196) {
tmp = 0.0 / (i / n);
} else {
tmp = (n * 100.0) + (i * ((n * 50.0) + (i * ((4.166666666666667 * (i * n)) + (n * 16.666666666666668)))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -9.5e+219: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= -2.2e-213: tmp = (n / 0.01) / (1.0 + (i * -0.5)) elif n <= 3.3e-196: tmp = 0.0 / (i / n) else: tmp = (n * 100.0) + (i * ((n * 50.0) + (i * ((4.166666666666667 * (i * n)) + (n * 16.666666666666668))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -9.5e+219) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= -2.2e-213) tmp = Float64(Float64(n / 0.01) / Float64(1.0 + Float64(i * -0.5))); elseif (n <= 3.3e-196) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(Float64(n * 100.0) + Float64(i * Float64(Float64(n * 50.0) + Float64(i * Float64(Float64(4.166666666666667 * Float64(i * n)) + Float64(n * 16.666666666666668)))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -9.5e+219) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= -2.2e-213) tmp = (n / 0.01) / (1.0 + (i * -0.5)); elseif (n <= 3.3e-196) tmp = 0.0 / (i / n); else tmp = (n * 100.0) + (i * ((n * 50.0) + (i * ((4.166666666666667 * (i * n)) + (n * 16.666666666666668))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -9.5e+219], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -2.2e-213], N[(N[(n / 0.01), $MachinePrecision] / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.3e-196], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] + N[(i * N[(N[(n * 50.0), $MachinePrecision] + N[(i * N[(N[(4.166666666666667 * N[(i * n), $MachinePrecision]), $MachinePrecision] + N[(n * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -9.5 \cdot 10^{+219}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq -2.2 \cdot 10^{-213}:\\
\;\;\;\;\frac{\frac{n}{0.01}}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 3.3 \cdot 10^{-196}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100 + i \cdot \left(n \cdot 50 + i \cdot \left(4.166666666666667 \cdot \left(i \cdot n\right) + n \cdot 16.666666666666668\right)\right)\\
\end{array}
\end{array}
if n < -9.49999999999999959e219Initial program 8.6%
associate-/r/9.5%
associate-*r*9.5%
*-commutative9.5%
associate-*r/9.6%
sub-neg9.6%
distribute-lft-in9.6%
metadata-eval9.6%
metadata-eval9.6%
metadata-eval9.6%
fma-define9.6%
metadata-eval9.6%
Simplified9.6%
Taylor expanded in n around inf 40.0%
sub-neg40.0%
metadata-eval40.0%
metadata-eval40.0%
distribute-lft-in40.0%
metadata-eval40.0%
sub-neg40.0%
expm1-define96.0%
Simplified96.0%
Taylor expanded in i around 0 81.0%
*-commutative81.0%
Simplified81.0%
if -9.49999999999999959e219 < n < -2.2000000000000001e-213Initial program 34.7%
associate-/r/34.4%
associate-*r*34.4%
*-commutative34.4%
associate-*r/34.4%
sub-neg34.4%
distribute-lft-in34.4%
metadata-eval34.4%
metadata-eval34.4%
metadata-eval34.4%
fma-define34.4%
metadata-eval34.4%
Simplified34.4%
Taylor expanded in n around inf 23.0%
sub-neg23.0%
metadata-eval23.0%
metadata-eval23.0%
distribute-lft-in23.0%
metadata-eval23.0%
sub-neg23.0%
expm1-define73.5%
Simplified73.5%
clear-num73.6%
un-div-inv73.5%
*-un-lft-identity73.5%
times-frac73.5%
metadata-eval73.5%
Applied egg-rr73.5%
associate-/r*73.5%
Simplified73.5%
Taylor expanded in i around 0 62.5%
*-commutative62.5%
Simplified62.5%
if -2.2000000000000001e-213 < n < 3.29999999999999999e-196Initial program 40.6%
associate-*r/40.6%
sub-neg40.6%
distribute-rgt-in40.6%
metadata-eval40.6%
metadata-eval40.6%
Simplified40.6%
Taylor expanded in i around 0 72.8%
if 3.29999999999999999e-196 < n Initial program 13.1%
associate-/r/13.3%
associate-*r*13.3%
*-commutative13.3%
associate-*r/13.3%
sub-neg13.3%
distribute-lft-in13.3%
metadata-eval13.3%
metadata-eval13.3%
metadata-eval13.3%
fma-define13.3%
metadata-eval13.3%
Simplified13.3%
Taylor expanded in n around inf 34.1%
sub-neg34.1%
metadata-eval34.1%
metadata-eval34.1%
distribute-lft-in34.1%
metadata-eval34.1%
sub-neg34.1%
expm1-define85.7%
Simplified85.7%
Taylor expanded in i around 0 71.9%
Final simplification69.2%
(FPCore (i n)
:precision binary64
(if (<= n -7e+219)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n -2.3e-211)
(/ (/ n 0.01) (+ 1.0 (* i -0.5)))
(if (<= n 8.6e-196)
(/ 0.0 (/ i n))
(*
n
(+
100.0
(*
i
(+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))))))
double code(double i, double n) {
double tmp;
if (n <= -7e+219) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= -2.3e-211) {
tmp = (n / 0.01) / (1.0 + (i * -0.5));
} else if (n <= 8.6e-196) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-7d+219)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= (-2.3d-211)) then
tmp = (n / 0.01d0) / (1.0d0 + (i * (-0.5d0)))
else if (n <= 8.6d-196) then
tmp = 0.0d0 / (i / n)
else
tmp = n * (100.0d0 + (i * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -7e+219) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= -2.3e-211) {
tmp = (n / 0.01) / (1.0 + (i * -0.5));
} else if (n <= 8.6e-196) {
tmp = 0.0 / (i / n);
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -7e+219: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= -2.3e-211: tmp = (n / 0.01) / (1.0 + (i * -0.5)) elif n <= 8.6e-196: tmp = 0.0 / (i / n) else: tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -7e+219) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= -2.3e-211) tmp = Float64(Float64(n / 0.01) / Float64(1.0 + Float64(i * -0.5))); elseif (n <= 8.6e-196) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -7e+219) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= -2.3e-211) tmp = (n / 0.01) / (1.0 + (i * -0.5)); elseif (n <= 8.6e-196) tmp = 0.0 / (i / n); else tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -7e+219], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -2.3e-211], N[(N[(n / 0.01), $MachinePrecision] / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 8.6e-196], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -7 \cdot 10^{+219}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq -2.3 \cdot 10^{-211}:\\
\;\;\;\;\frac{\frac{n}{0.01}}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 8.6 \cdot 10^{-196}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\end{array}
\end{array}
if n < -7.0000000000000002e219Initial program 8.6%
associate-/r/9.5%
associate-*r*9.5%
*-commutative9.5%
associate-*r/9.6%
sub-neg9.6%
distribute-lft-in9.6%
metadata-eval9.6%
metadata-eval9.6%
metadata-eval9.6%
fma-define9.6%
metadata-eval9.6%
Simplified9.6%
Taylor expanded in n around inf 40.0%
sub-neg40.0%
metadata-eval40.0%
metadata-eval40.0%
distribute-lft-in40.0%
metadata-eval40.0%
sub-neg40.0%
expm1-define96.0%
Simplified96.0%
Taylor expanded in i around 0 81.0%
*-commutative81.0%
Simplified81.0%
if -7.0000000000000002e219 < n < -2.29999999999999988e-211Initial program 34.7%
associate-/r/34.4%
associate-*r*34.4%
*-commutative34.4%
associate-*r/34.4%
sub-neg34.4%
distribute-lft-in34.4%
metadata-eval34.4%
metadata-eval34.4%
metadata-eval34.4%
fma-define34.4%
metadata-eval34.4%
Simplified34.4%
Taylor expanded in n around inf 23.0%
sub-neg23.0%
metadata-eval23.0%
metadata-eval23.0%
distribute-lft-in23.0%
metadata-eval23.0%
sub-neg23.0%
expm1-define73.5%
Simplified73.5%
clear-num73.6%
un-div-inv73.5%
*-un-lft-identity73.5%
times-frac73.5%
metadata-eval73.5%
Applied egg-rr73.5%
associate-/r*73.5%
Simplified73.5%
Taylor expanded in i around 0 62.5%
*-commutative62.5%
Simplified62.5%
if -2.29999999999999988e-211 < n < 8.59999999999999959e-196Initial program 40.6%
associate-*r/40.6%
sub-neg40.6%
distribute-rgt-in40.6%
metadata-eval40.6%
metadata-eval40.6%
Simplified40.6%
Taylor expanded in i around 0 72.8%
if 8.59999999999999959e-196 < n Initial program 13.1%
associate-/r/13.3%
associate-*r*13.3%
*-commutative13.3%
associate-*r/13.3%
sub-neg13.3%
distribute-lft-in13.3%
metadata-eval13.3%
metadata-eval13.3%
metadata-eval13.3%
fma-define13.3%
metadata-eval13.3%
Simplified13.3%
Taylor expanded in n around inf 34.1%
sub-neg34.1%
metadata-eval34.1%
metadata-eval34.1%
distribute-lft-in34.1%
metadata-eval34.1%
sub-neg34.1%
expm1-define85.7%
Simplified85.7%
Taylor expanded in i around 0 71.9%
*-commutative71.9%
Simplified71.9%
Final simplification69.2%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))))
(if (<= n -7e+219)
t_0
(if (<= n -5.1e-214)
(/ (/ n 0.01) (+ 1.0 (* i -0.5)))
(if (<= n 5e-196) (/ 0.0 (/ i n)) t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
double tmp;
if (n <= -7e+219) {
tmp = t_0;
} else if (n <= -5.1e-214) {
tmp = (n / 0.01) / (1.0 + (i * -0.5));
} else if (n <= 5e-196) {
tmp = 0.0 / (i / n);
} 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 = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
if (n <= (-7d+219)) then
tmp = t_0
else if (n <= (-5.1d-214)) then
tmp = (n / 0.01d0) / (1.0d0 + (i * (-0.5d0)))
else if (n <= 5d-196) then
tmp = 0.0d0 / (i / n)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
double tmp;
if (n <= -7e+219) {
tmp = t_0;
} else if (n <= -5.1e-214) {
tmp = (n / 0.01) / (1.0 + (i * -0.5));
} else if (n <= 5e-196) {
tmp = 0.0 / (i / n);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) tmp = 0 if n <= -7e+219: tmp = t_0 elif n <= -5.1e-214: tmp = (n / 0.01) / (1.0 + (i * -0.5)) elif n <= 5e-196: tmp = 0.0 / (i / n) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))) tmp = 0.0 if (n <= -7e+219) tmp = t_0; elseif (n <= -5.1e-214) tmp = Float64(Float64(n / 0.01) / Float64(1.0 + Float64(i * -0.5))); elseif (n <= 5e-196) tmp = Float64(0.0 / Float64(i / n)); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); tmp = 0.0; if (n <= -7e+219) tmp = t_0; elseif (n <= -5.1e-214) tmp = (n / 0.01) / (1.0 + (i * -0.5)); elseif (n <= 5e-196) tmp = 0.0 / (i / n); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -7e+219], t$95$0, If[LessEqual[n, -5.1e-214], N[(N[(n / 0.01), $MachinePrecision] / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5e-196], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{if}\;n \leq -7 \cdot 10^{+219}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -5.1 \cdot 10^{-214}:\\
\;\;\;\;\frac{\frac{n}{0.01}}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 5 \cdot 10^{-196}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -7.0000000000000002e219 or 5.0000000000000005e-196 < n Initial program 12.2%
associate-/r/12.6%
associate-*r*12.6%
*-commutative12.6%
associate-*r/12.6%
sub-neg12.6%
distribute-lft-in12.6%
metadata-eval12.6%
metadata-eval12.6%
metadata-eval12.6%
fma-define12.6%
metadata-eval12.6%
Simplified12.6%
Taylor expanded in n around inf 35.3%
sub-neg35.3%
metadata-eval35.3%
metadata-eval35.3%
distribute-lft-in35.3%
metadata-eval35.3%
sub-neg35.3%
expm1-define87.8%
Simplified87.8%
Taylor expanded in i around 0 72.7%
*-commutative72.7%
Simplified72.7%
if -7.0000000000000002e219 < n < -5.09999999999999987e-214Initial program 34.7%
associate-/r/34.4%
associate-*r*34.4%
*-commutative34.4%
associate-*r/34.4%
sub-neg34.4%
distribute-lft-in34.4%
metadata-eval34.4%
metadata-eval34.4%
metadata-eval34.4%
fma-define34.4%
metadata-eval34.4%
Simplified34.4%
Taylor expanded in n around inf 23.0%
sub-neg23.0%
metadata-eval23.0%
metadata-eval23.0%
distribute-lft-in23.0%
metadata-eval23.0%
sub-neg23.0%
expm1-define73.5%
Simplified73.5%
clear-num73.6%
un-div-inv73.5%
*-un-lft-identity73.5%
times-frac73.5%
metadata-eval73.5%
Applied egg-rr73.5%
associate-/r*73.5%
Simplified73.5%
Taylor expanded in i around 0 62.5%
*-commutative62.5%
Simplified62.5%
if -5.09999999999999987e-214 < n < 5.0000000000000005e-196Initial program 40.6%
associate-*r/40.6%
sub-neg40.6%
distribute-rgt-in40.6%
metadata-eval40.6%
metadata-eval40.6%
Simplified40.6%
Taylor expanded in i around 0 72.8%
Final simplification68.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* (* n 100.0) (+ 1.0 (* i 0.5)))))
(if (<= n -2.3e+221)
t_0
(if (<= n -1.4e-213)
(/ (/ n 0.01) (+ 1.0 (* i -0.5)))
(if (<= n 2.7e-196) (/ 0.0 (/ i n)) t_0)))))
double code(double i, double n) {
double t_0 = (n * 100.0) * (1.0 + (i * 0.5));
double tmp;
if (n <= -2.3e+221) {
tmp = t_0;
} else if (n <= -1.4e-213) {
tmp = (n / 0.01) / (1.0 + (i * -0.5));
} else if (n <= 2.7e-196) {
tmp = 0.0 / (i / n);
} 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 = (n * 100.0d0) * (1.0d0 + (i * 0.5d0))
if (n <= (-2.3d+221)) then
tmp = t_0
else if (n <= (-1.4d-213)) then
tmp = (n / 0.01d0) / (1.0d0 + (i * (-0.5d0)))
else if (n <= 2.7d-196) then
tmp = 0.0d0 / (i / n)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = (n * 100.0) * (1.0 + (i * 0.5));
double tmp;
if (n <= -2.3e+221) {
tmp = t_0;
} else if (n <= -1.4e-213) {
tmp = (n / 0.01) / (1.0 + (i * -0.5));
} else if (n <= 2.7e-196) {
tmp = 0.0 / (i / n);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = (n * 100.0) * (1.0 + (i * 0.5)) tmp = 0 if n <= -2.3e+221: tmp = t_0 elif n <= -1.4e-213: tmp = (n / 0.01) / (1.0 + (i * -0.5)) elif n <= 2.7e-196: tmp = 0.0 / (i / n) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(Float64(n * 100.0) * Float64(1.0 + Float64(i * 0.5))) tmp = 0.0 if (n <= -2.3e+221) tmp = t_0; elseif (n <= -1.4e-213) tmp = Float64(Float64(n / 0.01) / Float64(1.0 + Float64(i * -0.5))); elseif (n <= 2.7e-196) tmp = Float64(0.0 / Float64(i / n)); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = (n * 100.0) * (1.0 + (i * 0.5)); tmp = 0.0; if (n <= -2.3e+221) tmp = t_0; elseif (n <= -1.4e-213) tmp = (n / 0.01) / (1.0 + (i * -0.5)); elseif (n <= 2.7e-196) tmp = 0.0 / (i / n); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(N[(n * 100.0), $MachinePrecision] * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -2.3e+221], t$95$0, If[LessEqual[n, -1.4e-213], N[(N[(n / 0.01), $MachinePrecision] / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.7e-196], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(n \cdot 100\right) \cdot \left(1 + i \cdot 0.5\right)\\
\mathbf{if}\;n \leq -2.3 \cdot 10^{+221}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -1.4 \cdot 10^{-213}:\\
\;\;\;\;\frac{\frac{n}{0.01}}{1 + i \cdot -0.5}\\
\mathbf{elif}\;n \leq 2.7 \cdot 10^{-196}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.29999999999999987e221 or 2.69999999999999982e-196 < n Initial program 12.2%
Taylor expanded in i around 0 65.8%
associate-*r*65.8%
*-commutative65.8%
associate-*r/65.8%
metadata-eval65.8%
Simplified65.8%
Taylor expanded in n around inf 66.0%
associate-*r*66.0%
*-commutative66.0%
Simplified66.0%
if -2.29999999999999987e221 < n < -1.4e-213Initial program 34.7%
associate-/r/34.4%
associate-*r*34.4%
*-commutative34.4%
associate-*r/34.4%
sub-neg34.4%
distribute-lft-in34.4%
metadata-eval34.4%
metadata-eval34.4%
metadata-eval34.4%
fma-define34.4%
metadata-eval34.4%
Simplified34.4%
Taylor expanded in n around inf 23.0%
sub-neg23.0%
metadata-eval23.0%
metadata-eval23.0%
distribute-lft-in23.0%
metadata-eval23.0%
sub-neg23.0%
expm1-define73.5%
Simplified73.5%
clear-num73.6%
un-div-inv73.5%
*-un-lft-identity73.5%
times-frac73.5%
metadata-eval73.5%
Applied egg-rr73.5%
associate-/r*73.5%
Simplified73.5%
Taylor expanded in i around 0 62.5%
*-commutative62.5%
Simplified62.5%
if -1.4e-213 < n < 2.69999999999999982e-196Initial program 40.6%
associate-*r/40.6%
sub-neg40.6%
distribute-rgt-in40.6%
metadata-eval40.6%
metadata-eval40.6%
Simplified40.6%
Taylor expanded in i around 0 72.8%
Final simplification65.5%
(FPCore (i n)
:precision binary64
(if (<= i 3.6e-165)
(/ (/ n 0.01) (+ 1.0 (* i -0.5)))
(if (<= i 1.95e-13)
(* 100.0 (* (/ 1.0 i) (/ i (/ 1.0 n))))
(* 16.666666666666668 (* n (* i i))))))
double code(double i, double n) {
double tmp;
if (i <= 3.6e-165) {
tmp = (n / 0.01) / (1.0 + (i * -0.5));
} else if (i <= 1.95e-13) {
tmp = 100.0 * ((1.0 / i) * (i / (1.0 / n)));
} else {
tmp = 16.666666666666668 * (n * (i * i));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 3.6d-165) then
tmp = (n / 0.01d0) / (1.0d0 + (i * (-0.5d0)))
else if (i <= 1.95d-13) then
tmp = 100.0d0 * ((1.0d0 / i) * (i / (1.0d0 / n)))
else
tmp = 16.666666666666668d0 * (n * (i * i))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 3.6e-165) {
tmp = (n / 0.01) / (1.0 + (i * -0.5));
} else if (i <= 1.95e-13) {
tmp = 100.0 * ((1.0 / i) * (i / (1.0 / n)));
} else {
tmp = 16.666666666666668 * (n * (i * i));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 3.6e-165: tmp = (n / 0.01) / (1.0 + (i * -0.5)) elif i <= 1.95e-13: tmp = 100.0 * ((1.0 / i) * (i / (1.0 / n))) else: tmp = 16.666666666666668 * (n * (i * i)) return tmp
function code(i, n) tmp = 0.0 if (i <= 3.6e-165) tmp = Float64(Float64(n / 0.01) / Float64(1.0 + Float64(i * -0.5))); elseif (i <= 1.95e-13) tmp = Float64(100.0 * Float64(Float64(1.0 / i) * Float64(i / Float64(1.0 / n)))); else tmp = Float64(16.666666666666668 * Float64(n * Float64(i * i))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 3.6e-165) tmp = (n / 0.01) / (1.0 + (i * -0.5)); elseif (i <= 1.95e-13) tmp = 100.0 * ((1.0 / i) * (i / (1.0 / n))); else tmp = 16.666666666666668 * (n * (i * i)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 3.6e-165], N[(N[(n / 0.01), $MachinePrecision] / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1.95e-13], N[(100.0 * N[(N[(1.0 / i), $MachinePrecision] * N[(i / N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(16.666666666666668 * N[(n * N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 3.6 \cdot 10^{-165}:\\
\;\;\;\;\frac{\frac{n}{0.01}}{1 + i \cdot -0.5}\\
\mathbf{elif}\;i \leq 1.95 \cdot 10^{-13}:\\
\;\;\;\;100 \cdot \left(\frac{1}{i} \cdot \frac{i}{\frac{1}{n}}\right)\\
\mathbf{else}:\\
\;\;\;\;16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)\\
\end{array}
\end{array}
if i < 3.59999999999999984e-165Initial program 17.1%
associate-/r/17.1%
associate-*r*17.2%
*-commutative17.2%
associate-*r/17.1%
sub-neg17.1%
distribute-lft-in17.1%
metadata-eval17.1%
metadata-eval17.1%
metadata-eval17.1%
fma-define17.1%
metadata-eval17.1%
Simplified17.1%
Taylor expanded in n around inf 27.7%
sub-neg27.7%
metadata-eval27.7%
metadata-eval27.7%
distribute-lft-in27.7%
metadata-eval27.7%
sub-neg27.7%
expm1-define87.9%
Simplified87.9%
clear-num88.0%
un-div-inv87.9%
*-un-lft-identity87.9%
times-frac87.9%
metadata-eval87.9%
Applied egg-rr87.9%
associate-/r*88.0%
Simplified88.0%
Taylor expanded in i around 0 71.2%
*-commutative71.2%
Simplified71.2%
if 3.59999999999999984e-165 < i < 1.95000000000000002e-13Initial program 23.9%
Taylor expanded in i around 0 24.3%
+-commutative24.3%
Simplified24.3%
*-un-lft-identity24.3%
div-inv24.3%
times-frac24.6%
associate--l+75.4%
metadata-eval75.4%
+-rgt-identity75.4%
Applied egg-rr75.4%
if 1.95000000000000002e-13 < i Initial program 46.7%
associate-/r/47.1%
associate-*r*47.1%
*-commutative47.1%
associate-*r/47.1%
sub-neg47.1%
distribute-lft-in47.1%
metadata-eval47.1%
metadata-eval47.1%
metadata-eval47.1%
fma-define47.1%
metadata-eval47.1%
Simplified47.1%
Taylor expanded in n around inf 41.9%
sub-neg41.9%
metadata-eval41.9%
metadata-eval41.9%
distribute-lft-in41.9%
metadata-eval41.9%
sub-neg41.9%
expm1-define41.9%
Simplified41.9%
Taylor expanded in i around 0 37.2%
*-commutative37.2%
Simplified37.2%
Taylor expanded in i around inf 37.2%
unpow237.2%
Applied egg-rr37.2%
Final simplification64.3%
(FPCore (i n) :precision binary64 (if (<= n -1.5e-210) (+ (* n 100.0) (* 50.0 (* i n))) (if (<= n 3.1e-196) (/ 0.0 (/ i n)) (* (* n 100.0) (+ 1.0 (* i 0.5))))))
double code(double i, double n) {
double tmp;
if (n <= -1.5e-210) {
tmp = (n * 100.0) + (50.0 * (i * n));
} else if (n <= 3.1e-196) {
tmp = 0.0 / (i / n);
} else {
tmp = (n * 100.0) * (1.0 + (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 <= (-1.5d-210)) then
tmp = (n * 100.0d0) + (50.0d0 * (i * n))
else if (n <= 3.1d-196) then
tmp = 0.0d0 / (i / n)
else
tmp = (n * 100.0d0) * (1.0d0 + (i * 0.5d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.5e-210) {
tmp = (n * 100.0) + (50.0 * (i * n));
} else if (n <= 3.1e-196) {
tmp = 0.0 / (i / n);
} else {
tmp = (n * 100.0) * (1.0 + (i * 0.5));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.5e-210: tmp = (n * 100.0) + (50.0 * (i * n)) elif n <= 3.1e-196: tmp = 0.0 / (i / n) else: tmp = (n * 100.0) * (1.0 + (i * 0.5)) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.5e-210) tmp = Float64(Float64(n * 100.0) + Float64(50.0 * Float64(i * n))); elseif (n <= 3.1e-196) tmp = Float64(0.0 / Float64(i / n)); else tmp = Float64(Float64(n * 100.0) * Float64(1.0 + Float64(i * 0.5))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.5e-210) tmp = (n * 100.0) + (50.0 * (i * n)); elseif (n <= 3.1e-196) tmp = 0.0 / (i / n); else tmp = (n * 100.0) * (1.0 + (i * 0.5)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.5e-210], N[(N[(n * 100.0), $MachinePrecision] + N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.1e-196], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.5 \cdot 10^{-210}:\\
\;\;\;\;n \cdot 100 + 50 \cdot \left(i \cdot n\right)\\
\mathbf{elif}\;n \leq 3.1 \cdot 10^{-196}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \left(1 + i \cdot 0.5\right)\\
\end{array}
\end{array}
if n < -1.5000000000000001e-210Initial program 29.5%
associate-/r/29.4%
associate-*r*29.5%
*-commutative29.5%
associate-*r/29.5%
sub-neg29.5%
distribute-lft-in29.5%
metadata-eval29.5%
metadata-eval29.5%
metadata-eval29.5%
fma-define29.5%
metadata-eval29.5%
Simplified29.5%
Taylor expanded in n around inf 26.4%
sub-neg26.4%
metadata-eval26.4%
metadata-eval26.4%
distribute-lft-in26.4%
metadata-eval26.4%
sub-neg26.4%
expm1-define78.0%
Simplified78.0%
Taylor expanded in i around 0 59.4%
if -1.5000000000000001e-210 < n < 3.09999999999999993e-196Initial program 40.6%
associate-*r/40.6%
sub-neg40.6%
distribute-rgt-in40.6%
metadata-eval40.6%
metadata-eval40.6%
Simplified40.6%
Taylor expanded in i around 0 72.8%
if 3.09999999999999993e-196 < n Initial program 13.1%
Taylor expanded in i around 0 62.4%
associate-*r*62.4%
*-commutative62.4%
associate-*r/62.4%
metadata-eval62.4%
Simplified62.4%
Taylor expanded in n around inf 62.6%
associate-*r*62.6%
*-commutative62.6%
Simplified62.6%
Final simplification62.3%
(FPCore (i n) :precision binary64 (if (<= n -2.3e+31) (+ (* n 100.0) (* 50.0 (* i n))) (if (<= n 1.5) (* 100.0 (/ i (/ i n))) (* (* n 100.0) (+ 1.0 (* i 0.5))))))
double code(double i, double n) {
double tmp;
if (n <= -2.3e+31) {
tmp = (n * 100.0) + (50.0 * (i * n));
} else if (n <= 1.5) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = (n * 100.0) * (1.0 + (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 <= (-2.3d+31)) then
tmp = (n * 100.0d0) + (50.0d0 * (i * n))
else if (n <= 1.5d0) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = (n * 100.0d0) * (1.0d0 + (i * 0.5d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.3e+31) {
tmp = (n * 100.0) + (50.0 * (i * n));
} else if (n <= 1.5) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = (n * 100.0) * (1.0 + (i * 0.5));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.3e+31: tmp = (n * 100.0) + (50.0 * (i * n)) elif n <= 1.5: tmp = 100.0 * (i / (i / n)) else: tmp = (n * 100.0) * (1.0 + (i * 0.5)) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.3e+31) tmp = Float64(Float64(n * 100.0) + Float64(50.0 * Float64(i * n))); elseif (n <= 1.5) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(Float64(n * 100.0) * Float64(1.0 + Float64(i * 0.5))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.3e+31) tmp = (n * 100.0) + (50.0 * (i * n)); elseif (n <= 1.5) tmp = 100.0 * (i / (i / n)); else tmp = (n * 100.0) * (1.0 + (i * 0.5)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.3e+31], N[(N[(n * 100.0), $MachinePrecision] + N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.5], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.3 \cdot 10^{+31}:\\
\;\;\;\;n \cdot 100 + 50 \cdot \left(i \cdot n\right)\\
\mathbf{elif}\;n \leq 1.5:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \left(1 + i \cdot 0.5\right)\\
\end{array}
\end{array}
if n < -2.3e31Initial program 30.9%
associate-/r/31.4%
associate-*r*31.5%
*-commutative31.5%
associate-*r/31.5%
sub-neg31.5%
distribute-lft-in31.5%
metadata-eval31.5%
metadata-eval31.5%
metadata-eval31.5%
fma-define31.5%
metadata-eval31.5%
Simplified31.5%
Taylor expanded in n around inf 31.5%
sub-neg31.5%
metadata-eval31.5%
metadata-eval31.5%
distribute-lft-in31.4%
metadata-eval31.4%
sub-neg31.4%
expm1-define79.5%
Simplified79.5%
Taylor expanded in i around 0 58.0%
if -2.3e31 < n < 1.5Initial program 25.1%
Taylor expanded in i around 0 63.3%
if 1.5 < n Initial program 15.4%
Taylor expanded in i around 0 62.9%
associate-*r*62.9%
*-commutative62.9%
associate-*r/62.9%
metadata-eval62.9%
Simplified62.9%
Taylor expanded in n around inf 62.9%
associate-*r*62.9%
*-commutative62.9%
Simplified62.9%
Final simplification61.5%
(FPCore (i n) :precision binary64 (if (<= n -4.65e+30) (* n (+ 100.0 (* i 50.0))) (if (<= n 1.5) (* 100.0 (/ i (/ i n))) (* (* n 100.0) (+ 1.0 (* i 0.5))))))
double code(double i, double n) {
double tmp;
if (n <= -4.65e+30) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= 1.5) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = (n * 100.0) * (1.0 + (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 <= (-4.65d+30)) then
tmp = n * (100.0d0 + (i * 50.0d0))
else if (n <= 1.5d0) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = (n * 100.0d0) * (1.0d0 + (i * 0.5d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -4.65e+30) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= 1.5) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = (n * 100.0) * (1.0 + (i * 0.5));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -4.65e+30: tmp = n * (100.0 + (i * 50.0)) elif n <= 1.5: tmp = 100.0 * (i / (i / n)) else: tmp = (n * 100.0) * (1.0 + (i * 0.5)) return tmp
function code(i, n) tmp = 0.0 if (n <= -4.65e+30) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); elseif (n <= 1.5) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(Float64(n * 100.0) * Float64(1.0 + Float64(i * 0.5))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -4.65e+30) tmp = n * (100.0 + (i * 50.0)); elseif (n <= 1.5) tmp = 100.0 * (i / (i / n)); else tmp = (n * 100.0) * (1.0 + (i * 0.5)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -4.65e+30], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.5], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.65 \cdot 10^{+30}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{elif}\;n \leq 1.5:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot \left(1 + i \cdot 0.5\right)\\
\end{array}
\end{array}
if n < -4.65000000000000019e30Initial program 30.9%
associate-/r/31.4%
associate-*r*31.5%
*-commutative31.5%
associate-*r/31.5%
sub-neg31.5%
distribute-lft-in31.5%
metadata-eval31.5%
metadata-eval31.5%
metadata-eval31.5%
fma-define31.5%
metadata-eval31.5%
Simplified31.5%
Taylor expanded in n around inf 31.5%
sub-neg31.5%
metadata-eval31.5%
metadata-eval31.5%
distribute-lft-in31.4%
metadata-eval31.4%
sub-neg31.4%
expm1-define79.5%
Simplified79.5%
Taylor expanded in i around 0 58.0%
*-commutative58.0%
Simplified58.0%
if -4.65000000000000019e30 < n < 1.5Initial program 25.1%
Taylor expanded in i around 0 63.3%
if 1.5 < n Initial program 15.4%
Taylor expanded in i around 0 62.9%
associate-*r*62.9%
*-commutative62.9%
associate-*r/62.9%
metadata-eval62.9%
Simplified62.9%
Taylor expanded in n around inf 62.9%
associate-*r*62.9%
*-commutative62.9%
Simplified62.9%
Final simplification61.5%
(FPCore (i n) :precision binary64 (if (or (<= n -3.6e+30) (not (<= n 1.5))) (* n (+ 100.0 (* i 50.0))) (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
double tmp;
if ((n <= -3.6e+30) || !(n <= 1.5)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-3.6d+30)) .or. (.not. (n <= 1.5d0))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 100.0d0 * (i / (i / n))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -3.6e+30) || !(n <= 1.5)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 100.0 * (i / (i / n));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -3.6e+30) or not (n <= 1.5): tmp = n * (100.0 + (i * 50.0)) else: tmp = 100.0 * (i / (i / n)) return tmp
function code(i, n) tmp = 0.0 if ((n <= -3.6e+30) || !(n <= 1.5)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = Float64(100.0 * Float64(i / Float64(i / n))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -3.6e+30) || ~((n <= 1.5))) tmp = n * (100.0 + (i * 50.0)); else tmp = 100.0 * (i / (i / n)); end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -3.6e+30], N[Not[LessEqual[n, 1.5]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.6 \cdot 10^{+30} \lor \neg \left(n \leq 1.5\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\end{array}
\end{array}
if n < -3.6000000000000002e30 or 1.5 < n Initial program 24.1%
associate-/r/24.5%
associate-*r*24.6%
*-commutative24.6%
associate-*r/24.6%
sub-neg24.6%
distribute-lft-in24.6%
metadata-eval24.6%
metadata-eval24.6%
metadata-eval24.6%
fma-define24.6%
metadata-eval24.6%
Simplified24.6%
Taylor expanded in n around inf 39.1%
sub-neg39.1%
metadata-eval39.1%
metadata-eval39.1%
distribute-lft-in39.0%
metadata-eval39.0%
sub-neg39.0%
expm1-define87.8%
Simplified87.8%
Taylor expanded in i around 0 60.1%
*-commutative60.1%
Simplified60.1%
if -3.6000000000000002e30 < n < 1.5Initial program 25.1%
Taylor expanded in i around 0 63.3%
Final simplification61.5%
(FPCore (i n) :precision binary64 (if (<= i 1.95e-13) (* n 100.0) (* 16.666666666666668 (* n (* i i)))))
double code(double i, double n) {
double tmp;
if (i <= 1.95e-13) {
tmp = n * 100.0;
} else {
tmp = 16.666666666666668 * (n * (i * i));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= 1.95d-13) then
tmp = n * 100.0d0
else
tmp = 16.666666666666668d0 * (n * (i * i))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= 1.95e-13) {
tmp = n * 100.0;
} else {
tmp = 16.666666666666668 * (n * (i * i));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= 1.95e-13: tmp = n * 100.0 else: tmp = 16.666666666666668 * (n * (i * i)) return tmp
function code(i, n) tmp = 0.0 if (i <= 1.95e-13) tmp = Float64(n * 100.0); else tmp = Float64(16.666666666666668 * Float64(n * Float64(i * i))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= 1.95e-13) tmp = n * 100.0; else tmp = 16.666666666666668 * (n * (i * i)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, 1.95e-13], N[(n * 100.0), $MachinePrecision], N[(16.666666666666668 * N[(n * N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq 1.95 \cdot 10^{-13}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)\\
\end{array}
\end{array}
if i < 1.95000000000000002e-13Initial program 18.3%
associate-/r/18.3%
associate-*r*18.4%
*-commutative18.4%
associate-*r/18.4%
sub-neg18.4%
distribute-lft-in18.4%
metadata-eval18.4%
metadata-eval18.4%
metadata-eval18.4%
fma-define18.4%
metadata-eval18.4%
Simplified18.4%
Taylor expanded in i around 0 65.1%
*-commutative65.1%
Simplified65.1%
if 1.95000000000000002e-13 < i Initial program 46.7%
associate-/r/47.1%
associate-*r*47.1%
*-commutative47.1%
associate-*r/47.1%
sub-neg47.1%
distribute-lft-in47.1%
metadata-eval47.1%
metadata-eval47.1%
metadata-eval47.1%
fma-define47.1%
metadata-eval47.1%
Simplified47.1%
Taylor expanded in n around inf 41.9%
sub-neg41.9%
metadata-eval41.9%
metadata-eval41.9%
distribute-lft-in41.9%
metadata-eval41.9%
sub-neg41.9%
expm1-define41.9%
Simplified41.9%
Taylor expanded in i around 0 37.2%
*-commutative37.2%
Simplified37.2%
Taylor expanded in i around inf 37.2%
unpow237.2%
Applied egg-rr37.2%
Final simplification59.0%
(FPCore (i n) :precision binary64 (* n 100.0))
double code(double i, double n) {
return n * 100.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = n * 100.0d0
end function
public static double code(double i, double n) {
return n * 100.0;
}
def code(i, n): return n * 100.0
function code(i, n) return Float64(n * 100.0) end
function tmp = code(i, n) tmp = n * 100.0; end
code[i_, n_] := N[(n * 100.0), $MachinePrecision]
\begin{array}{l}
\\
n \cdot 100
\end{array}
Initial program 24.5%
associate-/r/24.6%
associate-*r*24.7%
*-commutative24.7%
associate-*r/24.7%
sub-neg24.7%
distribute-lft-in24.6%
metadata-eval24.6%
metadata-eval24.6%
metadata-eval24.6%
fma-define24.7%
metadata-eval24.7%
Simplified24.7%
Taylor expanded in i around 0 51.9%
*-commutative51.9%
Simplified51.9%
(FPCore (i n) :precision binary64 (* i -50.0))
double code(double i, double n) {
return i * -50.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = i * (-50.0d0)
end function
public static double code(double i, double n) {
return i * -50.0;
}
def code(i, n): return i * -50.0
function code(i, n) return Float64(i * -50.0) end
function tmp = code(i, n) tmp = i * -50.0; end
code[i_, n_] := N[(i * -50.0), $MachinePrecision]
\begin{array}{l}
\\
i \cdot -50
\end{array}
Initial program 24.5%
Taylor expanded in i around 0 55.5%
associate-*r*55.4%
*-commutative55.4%
associate-*r/55.4%
metadata-eval55.4%
Simplified55.4%
Taylor expanded in n around 0 3.0%
*-commutative3.0%
Simplified3.0%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ 1.0 (/ i n))))
(*
100.0
(/
(-
(exp
(*
n
(if (== t_0 1.0)
(/ i n)
(/ (* (/ i n) (log t_0)) (- (+ (/ i n) 1.0) 1.0)))))
1.0)
(/ i n)))))
double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (i / n)
if (t_0 == 1.0d0) then
tmp = i / n
else
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0d0) - 1.0d0)
end if
code = 100.0d0 * ((exp((n * tmp)) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * Math.log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((Math.exp((n * tmp)) - 1.0) / (i / n));
}
def code(i, n): t_0 = 1.0 + (i / n) tmp = 0 if t_0 == 1.0: tmp = i / n else: tmp = ((i / n) * math.log(t_0)) / (((i / n) + 1.0) - 1.0) return 100.0 * ((math.exp((n * tmp)) - 1.0) / (i / n))
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) tmp = 0.0 if (t_0 == 1.0) tmp = Float64(i / n); else tmp = Float64(Float64(Float64(i / n) * log(t_0)) / Float64(Float64(Float64(i / n) + 1.0) - 1.0)); end return Float64(100.0 * Float64(Float64(exp(Float64(n * tmp)) - 1.0) / Float64(i / n))) end
function tmp_2 = code(i, n) t_0 = 1.0 + (i / n); tmp = 0.0; if (t_0 == 1.0) tmp = i / n; else tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0); end tmp_2 = 100.0 * ((exp((n * tmp)) - 1.0) / (i / n)); end
code[i_, n_] := Block[{t$95$0 = N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision]}, N[(100.0 * N[(N[(N[Exp[N[(n * If[Equal[t$95$0, 1.0], N[(i / n), $MachinePrecision], N[(N[(N[(i / n), $MachinePrecision] * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(i / n), $MachinePrecision] + 1.0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{i}{n}\\
100 \cdot \frac{e^{n \cdot \begin{array}{l}
\mathbf{if}\;t\_0 = 1:\\
\;\;\;\;\frac{i}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{i}{n} \cdot \log t\_0}{\left(\frac{i}{n} + 1\right) - 1}\\
\end{array}} - 1}{\frac{i}{n}}
\end{array}
\end{array}
herbie shell --seed 2024144
(FPCore (i n)
:name "Compound Interest"
:precision binary64
:alt
(! :herbie-platform default (let ((lnbase (if (== (+ 1 (/ i n)) 1) (/ i n) (/ (* (/ i n) (log (+ 1 (/ i n)))) (- (+ (/ i n) 1) 1))))) (* 100 (/ (- (exp (* n lnbase)) 1) (/ i n)))))
(* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))