
(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) -1.0)) (t_1 (/ t_0 (/ i n))))
(if (<= t_1 -2e-40)
(/ (* n (- (* 100.0 (pow (/ i n) n)) 100.0)) i)
(if (<= t_1 0.0)
(/ (* 100.0 (expm1 (* n (log1p (/ i n))))) (/ i n))
(if (<= t_1 INFINITY)
(* 100.0 (* n (/ t_0 i)))
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005)))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= -2e-40) {
tmp = (n * ((100.0 * pow((i / n), n)) - 100.0)) / i;
} else if (t_1 <= 0.0) {
tmp = (100.0 * expm1((n * log1p((i / n))))) / (i / n);
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (n * (t_0 / i));
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= -2e-40) {
tmp = (n * ((100.0 * Math.pow((i / n), n)) - 100.0)) / i;
} else if (t_1 <= 0.0) {
tmp = (100.0 * Math.expm1((n * Math.log1p((i / n))))) / (i / n);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * (n * (t_0 / i));
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) + -1.0 t_1 = t_0 / (i / n) tmp = 0 if t_1 <= -2e-40: tmp = (n * ((100.0 * math.pow((i / n), n)) - 100.0)) / i elif t_1 <= 0.0: tmp = (100.0 * math.expm1((n * math.log1p((i / n))))) / (i / n) elif t_1 <= math.inf: tmp = 100.0 * (n * (t_0 / i)) else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) return tmp
function code(i, n) t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) t_1 = Float64(t_0 / Float64(i / n)) tmp = 0.0 if (t_1 <= -2e-40) tmp = Float64(Float64(n * Float64(Float64(100.0 * (Float64(i / n) ^ n)) - 100.0)) / i); elseif (t_1 <= 0.0) tmp = Float64(Float64(100.0 * expm1(Float64(n * log1p(Float64(i / n))))) / Float64(i / n)); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(n * Float64(t_0 / i))); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-40], N[(N[(n * N[(N[(100.0 * N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision] - 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(100.0 * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(n * N[(t$95$0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t\_0}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-40}:\\
\;\;\;\;\frac{n \cdot \left(100 \cdot {\left(\frac{i}{n}\right)}^{n} - 100\right)}{i}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{t\_0}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -1.9999999999999999e-40Initial program 99.9%
associate-*r/99.9%
sub-neg99.9%
distribute-rgt-in99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in i around inf 99.9%
Taylor expanded in n around inf 100.0%
if -1.9999999999999999e-40 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 27.3%
associate-/r/27.3%
associate-*r*27.3%
*-commutative27.3%
associate-*r/27.3%
sub-neg27.3%
distribute-lft-in27.3%
metadata-eval27.3%
metadata-eval27.3%
metadata-eval27.3%
fma-define27.3%
metadata-eval27.3%
Simplified27.3%
*-commutative27.3%
fma-undefine27.3%
*-commutative27.3%
associate-/r/27.3%
metadata-eval27.3%
metadata-eval27.3%
distribute-rgt-in27.3%
sub-neg27.3%
associate-*r/27.3%
*-commutative27.3%
frac-2neg27.3%
associate-*l/27.3%
Applied egg-rr99.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.4%
associate-/r/98.5%
add-exp-log98.5%
expm1-define98.5%
log-pow58.5%
log1p-define58.5%
Applied egg-rr58.5%
expm1-undefine57.4%
*-commutative57.4%
log1p-undefine57.4%
exp-to-pow98.5%
Applied egg-rr98.5%
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-define90.4%
Simplified90.4%
clear-num90.6%
un-div-inv90.4%
associate-/r*90.4%
Applied egg-rr90.4%
Taylor expanded in i around 0 99.8%
Final simplification99.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0)) (t_1 (/ t_0 (/ i n))))
(if (<= t_1 -2e-40)
(/ (* n (- (* 100.0 (pow (/ i n) n)) 100.0)) i)
(if (<= t_1 0.0)
(/ 100.0 (/ (/ i n) (expm1 (* n (log1p (/ i n))))))
(if (<= t_1 INFINITY)
(* 100.0 (* n (/ t_0 i)))
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005)))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= -2e-40) {
tmp = (n * ((100.0 * pow((i / n), n)) - 100.0)) / i;
} else if (t_1 <= 0.0) {
tmp = 100.0 / ((i / n) / expm1((n * log1p((i / n)))));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (n * (t_0 / i));
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= -2e-40) {
tmp = (n * ((100.0 * Math.pow((i / n), n)) - 100.0)) / i;
} else 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 = 100.0 * (n * (t_0 / i));
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) + -1.0 t_1 = t_0 / (i / n) tmp = 0 if t_1 <= -2e-40: tmp = (n * ((100.0 * math.pow((i / n), n)) - 100.0)) / i elif t_1 <= 0.0: tmp = 100.0 / ((i / n) / math.expm1((n * math.log1p((i / n))))) elif t_1 <= math.inf: tmp = 100.0 * (n * (t_0 / i)) else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) return tmp
function code(i, n) t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) t_1 = Float64(t_0 / Float64(i / n)) tmp = 0.0 if (t_1 <= -2e-40) tmp = Float64(Float64(n * Float64(Float64(100.0 * (Float64(i / n) ^ n)) - 100.0)) / i); elseif (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(100.0 * Float64(n * Float64(t_0 / i))); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-40], N[(N[(n * N[(N[(100.0 * N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision] - 100.0), $MachinePrecision]), $MachinePrecision] / i), $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[(100.0 * N[(n * N[(t$95$0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t\_0}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-40}:\\
\;\;\;\;\frac{n \cdot \left(100 \cdot {\left(\frac{i}{n}\right)}^{n} - 100\right)}{i}\\
\mathbf{elif}\;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:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{t\_0}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -1.9999999999999999e-40Initial program 99.9%
associate-*r/99.9%
sub-neg99.9%
distribute-rgt-in99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in i around inf 99.9%
Taylor expanded in n around inf 100.0%
if -1.9999999999999999e-40 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 27.3%
associate-/r/27.3%
associate-*r*27.3%
*-commutative27.3%
associate-*r/27.3%
sub-neg27.3%
distribute-lft-in27.3%
metadata-eval27.3%
metadata-eval27.3%
metadata-eval27.3%
fma-define27.3%
metadata-eval27.3%
Simplified27.3%
*-commutative27.3%
fma-undefine27.3%
*-commutative27.3%
associate-/r/27.3%
metadata-eval27.3%
metadata-eval27.3%
distribute-rgt-in27.3%
sub-neg27.3%
associate-*r/27.3%
clear-num27.3%
un-div-inv27.3%
add-exp-log27.3%
expm1-define27.3%
log-pow35.8%
log1p-define99.2%
Applied egg-rr99.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 98.4%
associate-/r/98.5%
add-exp-log98.5%
expm1-define98.5%
log-pow58.5%
log1p-define58.5%
Applied egg-rr58.5%
expm1-undefine57.4%
*-commutative57.4%
log1p-undefine57.4%
exp-to-pow98.5%
Applied egg-rr98.5%
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-define90.4%
Simplified90.4%
clear-num90.6%
un-div-inv90.4%
associate-/r*90.4%
Applied egg-rr90.4%
Taylor expanded in i around 0 99.8%
Final simplification99.3%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0)) (t_1 (/ t_0 (/ i n))))
(if (<= t_1 -1e-67)
(* 100.0 (/ (+ (pow (/ i n) n) -1.0) (/ i n)))
(if (<= t_1 0.0)
(* 100.0 (* n (/ (expm1 (* n (log1p (/ i n)))) i)))
(if (<= t_1 INFINITY)
(* 100.0 (* n (/ t_0 i)))
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005)))))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= -1e-67) {
tmp = 100.0 * ((pow((i / n), n) + -1.0) / (i / n));
} else if (t_1 <= 0.0) {
tmp = 100.0 * (n * (expm1((n * log1p((i / n)))) / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * (n * (t_0 / i));
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n) + -1.0;
double t_1 = t_0 / (i / n);
double tmp;
if (t_1 <= -1e-67) {
tmp = 100.0 * ((Math.pow((i / n), n) + -1.0) / (i / n));
} else 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 = 100.0 * (n * (t_0 / i));
} else {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) + -1.0 t_1 = t_0 / (i / n) tmp = 0 if t_1 <= -1e-67: tmp = 100.0 * ((math.pow((i / n), n) + -1.0) / (i / n)) elif t_1 <= 0.0: tmp = 100.0 * (n * (math.expm1((n * math.log1p((i / n)))) / i)) elif t_1 <= math.inf: tmp = 100.0 * (n * (t_0 / i)) else: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) return tmp
function code(i, n) t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) t_1 = Float64(t_0 / Float64(i / n)) tmp = 0.0 if (t_1 <= -1e-67) tmp = Float64(100.0 * Float64(Float64((Float64(i / n) ^ n) + -1.0) / Float64(i / n))); elseif (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(100.0 * Float64(n * Float64(t_0 / i))); else tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-67], N[(100.0 * N[(N[(N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $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[(100.0 * N[(n * N[(t$95$0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t\_0}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-67}:\\
\;\;\;\;100 \cdot \frac{{\left(\frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
\mathbf{elif}\;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:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{t\_0}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\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)) < -9.99999999999999943e-68Initial program 99.9%
Taylor expanded in i around inf 99.9%
if -9.99999999999999943e-68 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 0.0Initial program 25.6%
associate-/r/25.6%
add-exp-log25.6%
expm1-define25.6%
log-pow34.7%
log1p-define97.9%
Applied egg-rr97.9%
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.4%
associate-/r/98.5%
add-exp-log98.5%
expm1-define98.5%
log-pow58.5%
log1p-define58.5%
Applied egg-rr58.5%
expm1-undefine57.4%
*-commutative57.4%
log1p-undefine57.4%
exp-to-pow98.5%
Applied egg-rr98.5%
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-define90.4%
Simplified90.4%
clear-num90.6%
un-div-inv90.4%
associate-/r*90.4%
Applied egg-rr90.4%
Taylor expanded in i around 0 99.8%
Final simplification98.4%
(FPCore (i n) :precision binary64 (if (or (<= i -1.4e+60) (not (<= i 1350000000000.0))) (* 100.0 (/ (+ (pow (/ i n) n) -1.0) (/ i n))) (* n (/ (* 100.0 (expm1 i)) i))))
double code(double i, double n) {
double tmp;
if ((i <= -1.4e+60) || !(i <= 1350000000000.0)) {
tmp = 100.0 * ((pow((i / n), n) + -1.0) / (i / n));
} else {
tmp = n * ((100.0 * expm1(i)) / i);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((i <= -1.4e+60) || !(i <= 1350000000000.0)) {
tmp = 100.0 * ((Math.pow((i / n), n) + -1.0) / (i / n));
} else {
tmp = n * ((100.0 * Math.expm1(i)) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -1.4e+60) or not (i <= 1350000000000.0): tmp = 100.0 * ((math.pow((i / n), n) + -1.0) / (i / n)) else: tmp = n * ((100.0 * math.expm1(i)) / i) return tmp
function code(i, n) tmp = 0.0 if ((i <= -1.4e+60) || !(i <= 1350000000000.0)) tmp = Float64(100.0 * Float64(Float64((Float64(i / n) ^ n) + -1.0) / Float64(i / n))); else tmp = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)); end return tmp end
code[i_, n_] := If[Or[LessEqual[i, -1.4e+60], N[Not[LessEqual[i, 1350000000000.0]], $MachinePrecision]], N[(100.0 * N[(N[(N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.4 \cdot 10^{+60} \lor \neg \left(i \leq 1350000000000\right):\\
\;\;\;\;100 \cdot \frac{{\left(\frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\end{array}
\end{array}
if i < -1.4e60 or 1.35e12 < i Initial program 68.6%
Taylor expanded in i around inf 80.7%
if -1.4e60 < i < 1.35e12Initial program 9.0%
associate-/r/9.6%
associate-*r*9.6%
*-commutative9.6%
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 15.0%
sub-neg15.0%
metadata-eval15.0%
metadata-eval15.0%
distribute-lft-in15.1%
metadata-eval15.1%
sub-neg15.1%
expm1-define88.6%
Simplified88.6%
Final simplification85.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (pow (/ i n) n))))
(if (<= i -4.7e+55)
(/ (+ t_0 -100.0) (/ i n))
(if (<= i 1350000000000.0)
(* n (/ (* 100.0 (expm1 i)) i))
(/ (* n (- t_0 100.0)) i)))))
double code(double i, double n) {
double t_0 = 100.0 * pow((i / n), n);
double tmp;
if (i <= -4.7e+55) {
tmp = (t_0 + -100.0) / (i / n);
} else if (i <= 1350000000000.0) {
tmp = n * ((100.0 * expm1(i)) / i);
} else {
tmp = (n * (t_0 - 100.0)) / i;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * Math.pow((i / n), n);
double tmp;
if (i <= -4.7e+55) {
tmp = (t_0 + -100.0) / (i / n);
} else if (i <= 1350000000000.0) {
tmp = n * ((100.0 * Math.expm1(i)) / i);
} else {
tmp = (n * (t_0 - 100.0)) / i;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * math.pow((i / n), n) tmp = 0 if i <= -4.7e+55: tmp = (t_0 + -100.0) / (i / n) elif i <= 1350000000000.0: tmp = n * ((100.0 * math.expm1(i)) / i) else: tmp = (n * (t_0 - 100.0)) / i return tmp
function code(i, n) t_0 = Float64(100.0 * (Float64(i / n) ^ n)) tmp = 0.0 if (i <= -4.7e+55) tmp = Float64(Float64(t_0 + -100.0) / Float64(i / n)); elseif (i <= 1350000000000.0) tmp = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)); else tmp = Float64(Float64(n * Float64(t_0 - 100.0)) / i); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -4.7e+55], N[(N[(t$95$0 + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1350000000000.0], N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(N[(n * N[(t$95$0 - 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot {\left(\frac{i}{n}\right)}^{n}\\
\mathbf{if}\;i \leq -4.7 \cdot 10^{+55}:\\
\;\;\;\;\frac{t\_0 + -100}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 1350000000000:\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot \left(t\_0 - 100\right)}{i}\\
\end{array}
\end{array}
if i < -4.7000000000000001e55Initial program 85.2%
associate-*r/85.3%
sub-neg85.3%
distribute-rgt-in85.4%
metadata-eval85.4%
metadata-eval85.4%
Simplified85.4%
Taylor expanded in i around inf 91.3%
if -4.7000000000000001e55 < i < 1.35e12Initial program 9.0%
associate-/r/9.6%
associate-*r*9.6%
*-commutative9.6%
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 15.0%
sub-neg15.0%
metadata-eval15.0%
metadata-eval15.0%
distribute-lft-in15.1%
metadata-eval15.1%
sub-neg15.1%
expm1-define88.6%
Simplified88.6%
if 1.35e12 < i Initial program 49.2%
associate-*r/49.2%
sub-neg49.2%
distribute-rgt-in49.2%
metadata-eval49.2%
metadata-eval49.2%
Simplified49.2%
Taylor expanded in i around inf 68.3%
Taylor expanded in n around inf 68.5%
Final simplification85.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (/ i n) n)))
(if (<= i -1.08e+58)
(* 100.0 (/ (+ t_0 -1.0) (/ i n)))
(if (<= i 1350000000000.0)
(* n (/ (* 100.0 (expm1 i)) i))
(/ (* n (- (* 100.0 t_0) 100.0)) i)))))
double code(double i, double n) {
double t_0 = pow((i / n), n);
double tmp;
if (i <= -1.08e+58) {
tmp = 100.0 * ((t_0 + -1.0) / (i / n));
} else if (i <= 1350000000000.0) {
tmp = n * ((100.0 * expm1(i)) / i);
} else {
tmp = (n * ((100.0 * t_0) - 100.0)) / i;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((i / n), n);
double tmp;
if (i <= -1.08e+58) {
tmp = 100.0 * ((t_0 + -1.0) / (i / n));
} else if (i <= 1350000000000.0) {
tmp = n * ((100.0 * Math.expm1(i)) / i);
} else {
tmp = (n * ((100.0 * t_0) - 100.0)) / i;
}
return tmp;
}
def code(i, n): t_0 = math.pow((i / n), n) tmp = 0 if i <= -1.08e+58: tmp = 100.0 * ((t_0 + -1.0) / (i / n)) elif i <= 1350000000000.0: tmp = n * ((100.0 * math.expm1(i)) / i) else: tmp = (n * ((100.0 * t_0) - 100.0)) / i return tmp
function code(i, n) t_0 = Float64(i / n) ^ n tmp = 0.0 if (i <= -1.08e+58) tmp = Float64(100.0 * Float64(Float64(t_0 + -1.0) / Float64(i / n))); elseif (i <= 1350000000000.0) tmp = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)); else tmp = Float64(Float64(n * Float64(Float64(100.0 * t_0) - 100.0)) / i); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]}, If[LessEqual[i, -1.08e+58], N[(100.0 * N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1350000000000.0], N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(N[(n * N[(N[(100.0 * t$95$0), $MachinePrecision] - 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{i}{n}\right)}^{n}\\
\mathbf{if}\;i \leq -1.08 \cdot 10^{+58}:\\
\;\;\;\;100 \cdot \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 1350000000000:\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot \left(100 \cdot t\_0 - 100\right)}{i}\\
\end{array}
\end{array}
if i < -1.0799999999999999e58Initial program 85.2%
Taylor expanded in i around inf 91.2%
if -1.0799999999999999e58 < i < 1.35e12Initial program 9.0%
associate-/r/9.6%
associate-*r*9.6%
*-commutative9.6%
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 15.0%
sub-neg15.0%
metadata-eval15.0%
metadata-eval15.0%
distribute-lft-in15.1%
metadata-eval15.1%
sub-neg15.1%
expm1-define88.6%
Simplified88.6%
if 1.35e12 < i Initial program 49.2%
associate-*r/49.2%
sub-neg49.2%
distribute-rgt-in49.2%
metadata-eval49.2%
metadata-eval49.2%
Simplified49.2%
Taylor expanded in i around inf 68.3%
Taylor expanded in n around inf 68.5%
Final simplification85.9%
(FPCore (i n) :precision binary64 (if (or (<= n -1.15e-243) (not (<= n 9.5e-213))) (* n (/ (* 100.0 (expm1 i)) i)) 0.0))
double code(double i, double n) {
double tmp;
if ((n <= -1.15e-243) || !(n <= 9.5e-213)) {
tmp = n * ((100.0 * expm1(i)) / i);
} else {
tmp = 0.0;
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -1.15e-243) || !(n <= 9.5e-213)) {
tmp = n * ((100.0 * Math.expm1(i)) / i);
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.15e-243) or not (n <= 9.5e-213): tmp = n * ((100.0 * math.expm1(i)) / i) else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.15e-243) || !(n <= 9.5e-213)) tmp = Float64(n * Float64(Float64(100.0 * expm1(i)) / i)); else tmp = 0.0; end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -1.15e-243], N[Not[LessEqual[n, 9.5e-213]], $MachinePrecision]], N[(n * N[(N[(100.0 * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.15 \cdot 10^{-243} \lor \neg \left(n \leq 9.5 \cdot 10^{-213}\right):\\
\;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if n < -1.15e-243 or 9.50000000000000055e-213 < n Initial program 25.3%
associate-/r/25.7%
associate-*r*25.6%
*-commutative25.6%
associate-*r/25.7%
sub-neg25.7%
distribute-lft-in25.7%
metadata-eval25.7%
metadata-eval25.7%
metadata-eval25.7%
fma-define25.7%
metadata-eval25.7%
Simplified25.7%
Taylor expanded in n around inf 28.1%
sub-neg28.1%
metadata-eval28.1%
metadata-eval28.1%
distribute-lft-in28.1%
metadata-eval28.1%
sub-neg28.1%
expm1-define83.1%
Simplified83.1%
if -1.15e-243 < n < 9.50000000000000055e-213Initial program 68.0%
associate-*r/68.0%
sub-neg68.0%
distribute-rgt-in68.0%
metadata-eval68.0%
metadata-eval68.0%
Simplified68.0%
Taylor expanded in i around 0 82.8%
Taylor expanded in i around 0 82.8%
Final simplification83.0%
(FPCore (i n) :precision binary64 (if (or (<= i -2e-7) (not (<= i 0.00125))) (* 100.0 (/ (expm1 i) (/ i n))) (+ (* 50.0 (* i n)) (* n 100.0))))
double code(double i, double n) {
double tmp;
if ((i <= -2e-7) || !(i <= 0.00125)) {
tmp = 100.0 * (expm1(i) / (i / n));
} else {
tmp = (50.0 * (i * n)) + (n * 100.0);
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((i <= -2e-7) || !(i <= 0.00125)) {
tmp = 100.0 * (Math.expm1(i) / (i / n));
} else {
tmp = (50.0 * (i * n)) + (n * 100.0);
}
return tmp;
}
def code(i, n): tmp = 0 if (i <= -2e-7) or not (i <= 0.00125): tmp = 100.0 * (math.expm1(i) / (i / n)) else: tmp = (50.0 * (i * n)) + (n * 100.0) return tmp
function code(i, n) tmp = 0.0 if ((i <= -2e-7) || !(i <= 0.00125)) tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n))); else tmp = Float64(Float64(50.0 * Float64(i * n)) + Float64(n * 100.0)); end return tmp end
code[i_, n_] := If[Or[LessEqual[i, -2e-7], N[Not[LessEqual[i, 0.00125]], $MachinePrecision]], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision] + N[(n * 100.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -2 \cdot 10^{-7} \lor \neg \left(i \leq 0.00125\right):\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right) + n \cdot 100\\
\end{array}
\end{array}
if i < -1.9999999999999999e-7 or 0.00125000000000000003 < i Initial program 62.2%
Taylor expanded in n around inf 63.0%
expm1-define63.2%
Simplified63.2%
if -1.9999999999999999e-7 < i < 0.00125000000000000003Initial program 7.9%
associate-/r/8.5%
associate-*r*8.5%
*-commutative8.5%
associate-*r/8.5%
sub-neg8.5%
distribute-lft-in8.5%
metadata-eval8.5%
metadata-eval8.5%
metadata-eval8.5%
fma-define8.5%
metadata-eval8.5%
Simplified8.5%
Taylor expanded in n around inf 8.5%
sub-neg8.5%
metadata-eval8.5%
metadata-eval8.5%
distribute-lft-in8.6%
metadata-eval8.6%
sub-neg8.6%
expm1-define88.8%
Simplified88.8%
Taylor expanded in i around 0 89.0%
Final simplification78.6%
(FPCore (i n)
:precision binary64
(if (<= n -4.5e+217)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n 7.6e-5)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
(*
n
(/
(*
i
(+
100.0
(* i (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))
i)))))
double code(double i, double n) {
double tmp;
if (n <= -4.5e+217) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 7.6e-5) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = n * ((i * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))))) / i);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-4.5d+217)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= 7.6d-5) then
tmp = n / (0.01d0 + (i * ((i * 0.0008333333333333334d0) - 0.005d0)))
else
tmp = n * ((i * (100.0d0 + (i * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))) / i)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -4.5e+217) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 7.6e-5) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = n * ((i * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))))) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -4.5e+217: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= 7.6e-5: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = n * ((i * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))))) / i) return tmp
function code(i, n) tmp = 0.0 if (n <= -4.5e+217) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= 7.6e-5) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); else tmp = Float64(n * Float64(Float64(i * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))) / i)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -4.5e+217) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= 7.6e-5) tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))); else tmp = n * ((i * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))))) / i); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -4.5e+217], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7.6e-5], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(N[(i * N[(100.0 + N[(i * N[(50.0 + N[(i * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.5 \cdot 10^{+217}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq 7.6 \cdot 10^{-5}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{i \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)}{i}\\
\end{array}
\end{array}
if n < -4.49999999999999988e217Initial program 19.7%
associate-/r/20.4%
associate-*r*20.4%
*-commutative20.4%
associate-*r/20.5%
sub-neg20.5%
distribute-lft-in20.5%
metadata-eval20.5%
metadata-eval20.5%
metadata-eval20.5%
fma-define20.5%
metadata-eval20.5%
Simplified20.5%
Taylor expanded in n around inf 50.8%
sub-neg50.8%
metadata-eval50.8%
metadata-eval50.8%
distribute-lft-in50.8%
metadata-eval50.8%
sub-neg50.8%
expm1-define99.8%
Simplified99.8%
Taylor expanded in i around 0 81.7%
*-commutative81.7%
Simplified81.7%
if -4.49999999999999988e217 < n < 7.6000000000000004e-5Initial program 36.7%
associate-/r/36.8%
associate-*r*36.8%
*-commutative36.8%
associate-*r/36.9%
sub-neg36.9%
distribute-lft-in36.9%
metadata-eval36.9%
metadata-eval36.9%
metadata-eval36.9%
fma-define36.9%
metadata-eval36.9%
Simplified36.9%
Taylor expanded in n around inf 27.1%
sub-neg27.1%
metadata-eval27.1%
metadata-eval27.1%
distribute-lft-in27.2%
metadata-eval27.2%
sub-neg27.2%
expm1-define67.7%
Simplified67.7%
clear-num67.7%
un-div-inv67.6%
associate-/r*67.6%
Applied egg-rr67.6%
Taylor expanded in i around 0 67.2%
if 7.6000000000000004e-5 < n Initial program 21.0%
associate-/r/21.7%
associate-*r*21.7%
*-commutative21.7%
associate-*r/21.7%
sub-neg21.7%
distribute-lft-in21.7%
metadata-eval21.7%
metadata-eval21.7%
metadata-eval21.7%
fma-define21.7%
metadata-eval21.7%
Simplified21.7%
Taylor expanded in n around inf 30.0%
sub-neg30.0%
metadata-eval30.0%
metadata-eval30.0%
distribute-lft-in30.0%
metadata-eval30.0%
sub-neg30.0%
expm1-define90.4%
Simplified90.4%
Taylor expanded in i around 0 82.0%
*-commutative82.0%
Simplified82.0%
Final simplification73.6%
(FPCore (i n)
:precision binary64
(if (<= n -1.8e+217)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n 7.6e-5)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
(+
(* n 100.0)
(*
i
(* n (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667))))))))))
double code(double i, double n) {
double tmp;
if (n <= -1.8e+217) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 7.6e-5) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = (n * 100.0) + (i * (n * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.8d+217)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= 7.6d-5) then
tmp = n / (0.01d0 + (i * ((i * 0.0008333333333333334d0) - 0.005d0)))
else
tmp = (n * 100.0d0) + (i * (n * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.8e+217) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 7.6e-5) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = (n * 100.0) + (i * (n * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.8e+217: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= 7.6e-5: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = (n * 100.0) + (i * (n * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.8e+217) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= 7.6e-5) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); else tmp = Float64(Float64(n * 100.0) + Float64(i * Float64(n * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.8e+217) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= 7.6e-5) tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))); else tmp = (n * 100.0) + (i * (n * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.8e+217], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7.6e-5], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] + N[(i * N[(n * N[(50.0 + N[(i * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.8 \cdot 10^{+217}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq 7.6 \cdot 10^{-5}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;n \cdot 100 + i \cdot \left(n \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\end{array}
\end{array}
if n < -1.8000000000000001e217Initial program 19.7%
associate-/r/20.4%
associate-*r*20.4%
*-commutative20.4%
associate-*r/20.5%
sub-neg20.5%
distribute-lft-in20.5%
metadata-eval20.5%
metadata-eval20.5%
metadata-eval20.5%
fma-define20.5%
metadata-eval20.5%
Simplified20.5%
Taylor expanded in n around inf 50.8%
sub-neg50.8%
metadata-eval50.8%
metadata-eval50.8%
distribute-lft-in50.8%
metadata-eval50.8%
sub-neg50.8%
expm1-define99.8%
Simplified99.8%
Taylor expanded in i around 0 81.7%
*-commutative81.7%
Simplified81.7%
if -1.8000000000000001e217 < n < 7.6000000000000004e-5Initial program 36.7%
associate-/r/36.8%
associate-*r*36.8%
*-commutative36.8%
associate-*r/36.9%
sub-neg36.9%
distribute-lft-in36.9%
metadata-eval36.9%
metadata-eval36.9%
metadata-eval36.9%
fma-define36.9%
metadata-eval36.9%
Simplified36.9%
Taylor expanded in n around inf 27.1%
sub-neg27.1%
metadata-eval27.1%
metadata-eval27.1%
distribute-lft-in27.2%
metadata-eval27.2%
sub-neg27.2%
expm1-define67.7%
Simplified67.7%
clear-num67.7%
un-div-inv67.6%
associate-/r*67.6%
Applied egg-rr67.6%
Taylor expanded in i around 0 67.2%
if 7.6000000000000004e-5 < n Initial program 21.0%
associate-/r/21.7%
associate-*r*21.7%
*-commutative21.7%
associate-*r/21.7%
sub-neg21.7%
distribute-lft-in21.7%
metadata-eval21.7%
metadata-eval21.7%
metadata-eval21.7%
fma-define21.7%
metadata-eval21.7%
Simplified21.7%
Taylor expanded in n around inf 30.0%
sub-neg30.0%
metadata-eval30.0%
metadata-eval30.0%
distribute-lft-in30.0%
metadata-eval30.0%
sub-neg30.0%
expm1-define90.4%
Simplified90.4%
Taylor expanded in i around 0 81.1%
Taylor expanded in n around 0 81.1%
Final simplification73.3%
(FPCore (i n)
:precision binary64
(if (<= n -2.5e+217)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n -3.6e-243)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 1.6e-212) 0.0 (* n (/ (* i (+ 100.0 (* i 50.0))) i))))))
double code(double i, double n) {
double tmp;
if (n <= -2.5e+217) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= -3.6e-243) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 1.6e-212) {
tmp = 0.0;
} else {
tmp = n * ((i * (100.0 + (i * 50.0))) / i);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-2.5d+217)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= (-3.6d-243)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 1.6d-212) then
tmp = 0.0d0
else
tmp = n * ((i * (100.0d0 + (i * 50.0d0))) / i)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -2.5e+217) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= -3.6e-243) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 1.6e-212) {
tmp = 0.0;
} else {
tmp = n * ((i * (100.0 + (i * 50.0))) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -2.5e+217: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= -3.6e-243: tmp = n / (0.01 + (i * -0.005)) elif n <= 1.6e-212: tmp = 0.0 else: tmp = n * ((i * (100.0 + (i * 50.0))) / i) return tmp
function code(i, n) tmp = 0.0 if (n <= -2.5e+217) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= -3.6e-243) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 1.6e-212) tmp = 0.0; else tmp = Float64(n * Float64(Float64(i * Float64(100.0 + Float64(i * 50.0))) / i)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -2.5e+217) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= -3.6e-243) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 1.6e-212) tmp = 0.0; else tmp = n * ((i * (100.0 + (i * 50.0))) / i); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -2.5e+217], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -3.6e-243], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.6e-212], 0.0, N[(n * N[(N[(i * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.5 \cdot 10^{+217}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq -3.6 \cdot 10^{-243}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 1.6 \cdot 10^{-212}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{i \cdot \left(100 + i \cdot 50\right)}{i}\\
\end{array}
\end{array}
if n < -2.50000000000000021e217Initial program 19.7%
associate-/r/20.4%
associate-*r*20.4%
*-commutative20.4%
associate-*r/20.5%
sub-neg20.5%
distribute-lft-in20.5%
metadata-eval20.5%
metadata-eval20.5%
metadata-eval20.5%
fma-define20.5%
metadata-eval20.5%
Simplified20.5%
Taylor expanded in n around inf 50.8%
sub-neg50.8%
metadata-eval50.8%
metadata-eval50.8%
distribute-lft-in50.8%
metadata-eval50.8%
sub-neg50.8%
expm1-define99.8%
Simplified99.8%
Taylor expanded in i around 0 81.7%
*-commutative81.7%
Simplified81.7%
if -2.50000000000000021e217 < n < -3.6000000000000001e-243Initial program 34.7%
associate-/r/34.8%
associate-*r*34.7%
*-commutative34.7%
associate-*r/34.8%
sub-neg34.8%
distribute-lft-in34.9%
metadata-eval34.9%
metadata-eval34.9%
metadata-eval34.9%
fma-define34.8%
metadata-eval34.8%
Simplified34.8%
Taylor expanded in n around inf 28.4%
sub-neg28.4%
metadata-eval28.4%
metadata-eval28.4%
distribute-lft-in28.5%
metadata-eval28.5%
sub-neg28.5%
expm1-define79.0%
Simplified79.0%
clear-num79.0%
un-div-inv78.9%
associate-/r*79.0%
Applied egg-rr79.0%
Taylor expanded in i around 0 68.9%
*-commutative68.9%
Simplified68.9%
if -3.6000000000000001e-243 < n < 1.5999999999999999e-212Initial program 68.0%
associate-*r/68.0%
sub-neg68.0%
distribute-rgt-in68.0%
metadata-eval68.0%
metadata-eval68.0%
Simplified68.0%
Taylor expanded in i around 0 82.8%
Taylor expanded in i around 0 82.8%
if 1.5999999999999999e-212 < n 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 22.7%
sub-neg22.7%
metadata-eval22.7%
metadata-eval22.7%
distribute-lft-in22.8%
metadata-eval22.8%
sub-neg22.8%
expm1-define82.3%
Simplified82.3%
Taylor expanded in i around 0 71.7%
*-commutative71.7%
Simplified71.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))))
(if (<= n -4.5e+217)
t_0
(if (<= n -4.3e-237)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 1.09e-212) 0.0 t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
double tmp;
if (n <= -4.5e+217) {
tmp = t_0;
} else if (n <= -4.3e-237) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 1.09e-212) {
tmp = 0.0;
} 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 <= (-4.5d+217)) then
tmp = t_0
else if (n <= (-4.3d-237)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 1.09d-212) then
tmp = 0.0d0
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 <= -4.5e+217) {
tmp = t_0;
} else if (n <= -4.3e-237) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 1.09e-212) {
tmp = 0.0;
} 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 <= -4.5e+217: tmp = t_0 elif n <= -4.3e-237: tmp = n / (0.01 + (i * -0.005)) elif n <= 1.09e-212: tmp = 0.0 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 <= -4.5e+217) tmp = t_0; elseif (n <= -4.3e-237) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 1.09e-212) tmp = 0.0; 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 <= -4.5e+217) tmp = t_0; elseif (n <= -4.3e-237) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 1.09e-212) tmp = 0.0; 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, -4.5e+217], t$95$0, If[LessEqual[n, -4.3e-237], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.09e-212], 0.0, 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 -4.5 \cdot 10^{+217}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -4.3 \cdot 10^{-237}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 1.09 \cdot 10^{-212}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -4.49999999999999988e217 or 1.09e-212 < n Initial program 19.6%
associate-/r/20.2%
associate-*r*20.2%
*-commutative20.2%
associate-*r/20.2%
sub-neg20.2%
distribute-lft-in20.2%
metadata-eval20.2%
metadata-eval20.2%
metadata-eval20.2%
fma-define20.2%
metadata-eval20.2%
Simplified20.2%
Taylor expanded in n around inf 27.8%
sub-neg27.8%
metadata-eval27.8%
metadata-eval27.8%
distribute-lft-in27.9%
metadata-eval27.9%
sub-neg27.9%
expm1-define85.5%
Simplified85.5%
Taylor expanded in i around 0 72.6%
*-commutative72.6%
Simplified72.6%
if -4.49999999999999988e217 < n < -4.29999999999999982e-237Initial program 34.7%
associate-/r/34.8%
associate-*r*34.7%
*-commutative34.7%
associate-*r/34.8%
sub-neg34.8%
distribute-lft-in34.9%
metadata-eval34.9%
metadata-eval34.9%
metadata-eval34.9%
fma-define34.8%
metadata-eval34.8%
Simplified34.8%
Taylor expanded in n around inf 28.4%
sub-neg28.4%
metadata-eval28.4%
metadata-eval28.4%
distribute-lft-in28.5%
metadata-eval28.5%
sub-neg28.5%
expm1-define79.0%
Simplified79.0%
clear-num79.0%
un-div-inv78.9%
associate-/r*79.0%
Applied egg-rr79.0%
Taylor expanded in i around 0 68.9%
*-commutative68.9%
Simplified68.9%
if -4.29999999999999982e-237 < n < 1.09e-212Initial program 68.0%
associate-*r/68.0%
sub-neg68.0%
distribute-rgt-in68.0%
metadata-eval68.0%
metadata-eval68.0%
Simplified68.0%
Taylor expanded in i around 0 82.8%
Taylor expanded in i around 0 82.8%
(FPCore (i n)
:precision binary64
(if (<= n -1.85e+217)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n 7.5e-5)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
(*
n
(+
100.0
(* i (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667))))))))))
double code(double i, double n) {
double tmp;
if (n <= -1.85e+217) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 7.5e-5) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.85d+217)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= 7.5d-5) then
tmp = n / (0.01d0 + (i * ((i * 0.0008333333333333334d0) - 0.005d0)))
else
tmp = n * (100.0d0 + (i * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.85e+217) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 7.5e-5) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.85e+217: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= 7.5e-5: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.85e+217) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= 7.5e-5) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); else tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.85e+217) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= 7.5e-5) tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))); else tmp = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667)))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.85e+217], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7.5e-5], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.85 \cdot 10^{+217}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq 7.5 \cdot 10^{-5}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\end{array}
\end{array}
if n < -1.85000000000000005e217Initial program 19.7%
associate-/r/20.4%
associate-*r*20.4%
*-commutative20.4%
associate-*r/20.5%
sub-neg20.5%
distribute-lft-in20.5%
metadata-eval20.5%
metadata-eval20.5%
metadata-eval20.5%
fma-define20.5%
metadata-eval20.5%
Simplified20.5%
Taylor expanded in n around inf 50.8%
sub-neg50.8%
metadata-eval50.8%
metadata-eval50.8%
distribute-lft-in50.8%
metadata-eval50.8%
sub-neg50.8%
expm1-define99.8%
Simplified99.8%
Taylor expanded in i around 0 81.7%
*-commutative81.7%
Simplified81.7%
if -1.85000000000000005e217 < n < 7.49999999999999934e-5Initial program 36.7%
associate-/r/36.8%
associate-*r*36.8%
*-commutative36.8%
associate-*r/36.9%
sub-neg36.9%
distribute-lft-in36.9%
metadata-eval36.9%
metadata-eval36.9%
metadata-eval36.9%
fma-define36.9%
metadata-eval36.9%
Simplified36.9%
Taylor expanded in n around inf 27.1%
sub-neg27.1%
metadata-eval27.1%
metadata-eval27.1%
distribute-lft-in27.2%
metadata-eval27.2%
sub-neg27.2%
expm1-define67.7%
Simplified67.7%
clear-num67.7%
un-div-inv67.6%
associate-/r*67.6%
Applied egg-rr67.6%
Taylor expanded in i around 0 67.2%
if 7.49999999999999934e-5 < n Initial program 21.0%
associate-/r/21.7%
associate-*r*21.7%
*-commutative21.7%
associate-*r/21.7%
sub-neg21.7%
distribute-lft-in21.7%
metadata-eval21.7%
metadata-eval21.7%
metadata-eval21.7%
fma-define21.7%
metadata-eval21.7%
Simplified21.7%
Taylor expanded in n around inf 30.0%
sub-neg30.0%
metadata-eval30.0%
metadata-eval30.0%
distribute-lft-in30.0%
metadata-eval30.0%
sub-neg30.0%
expm1-define90.4%
Simplified90.4%
Taylor expanded in i around 0 81.0%
*-commutative81.0%
Simplified81.0%
Final simplification73.3%
(FPCore (i n)
:precision binary64
(if (<= n -3.7e+217)
(* n (+ 100.0 (* i 50.0)))
(if (<= n -3.1e-242)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 1.6e-212) 0.0 (+ (* 50.0 (* i n)) (* n 100.0))))))
double code(double i, double n) {
double tmp;
if (n <= -3.7e+217) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= -3.1e-242) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 1.6e-212) {
tmp = 0.0;
} else {
tmp = (50.0 * (i * n)) + (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 (n <= (-3.7d+217)) then
tmp = n * (100.0d0 + (i * 50.0d0))
else if (n <= (-3.1d-242)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 1.6d-212) then
tmp = 0.0d0
else
tmp = (50.0d0 * (i * n)) + (n * 100.0d0)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -3.7e+217) {
tmp = n * (100.0 + (i * 50.0));
} else if (n <= -3.1e-242) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 1.6e-212) {
tmp = 0.0;
} else {
tmp = (50.0 * (i * n)) + (n * 100.0);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -3.7e+217: tmp = n * (100.0 + (i * 50.0)) elif n <= -3.1e-242: tmp = n / (0.01 + (i * -0.005)) elif n <= 1.6e-212: tmp = 0.0 else: tmp = (50.0 * (i * n)) + (n * 100.0) return tmp
function code(i, n) tmp = 0.0 if (n <= -3.7e+217) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); elseif (n <= -3.1e-242) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 1.6e-212) tmp = 0.0; else tmp = Float64(Float64(50.0 * Float64(i * n)) + Float64(n * 100.0)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -3.7e+217) tmp = n * (100.0 + (i * 50.0)); elseif (n <= -3.1e-242) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 1.6e-212) tmp = 0.0; else tmp = (50.0 * (i * n)) + (n * 100.0); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -3.7e+217], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -3.1e-242], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.6e-212], 0.0, N[(N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision] + N[(n * 100.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.7 \cdot 10^{+217}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{elif}\;n \leq -3.1 \cdot 10^{-242}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 1.6 \cdot 10^{-212}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right) + n \cdot 100\\
\end{array}
\end{array}
if n < -3.70000000000000011e217Initial program 19.7%
associate-/r/20.4%
associate-*r*20.4%
*-commutative20.4%
associate-*r/20.5%
sub-neg20.5%
distribute-lft-in20.5%
metadata-eval20.5%
metadata-eval20.5%
metadata-eval20.5%
fma-define20.5%
metadata-eval20.5%
Simplified20.5%
Taylor expanded in n around inf 50.8%
sub-neg50.8%
metadata-eval50.8%
metadata-eval50.8%
distribute-lft-in50.8%
metadata-eval50.8%
sub-neg50.8%
expm1-define99.8%
Simplified99.8%
Taylor expanded in i around 0 77.9%
+-commutative77.9%
associate-*r*77.9%
distribute-rgt-in77.9%
*-commutative77.9%
Simplified77.9%
if -3.70000000000000011e217 < n < -3.10000000000000015e-242Initial program 34.7%
associate-/r/34.8%
associate-*r*34.7%
*-commutative34.7%
associate-*r/34.8%
sub-neg34.8%
distribute-lft-in34.9%
metadata-eval34.9%
metadata-eval34.9%
metadata-eval34.9%
fma-define34.8%
metadata-eval34.8%
Simplified34.8%
Taylor expanded in n around inf 28.4%
sub-neg28.4%
metadata-eval28.4%
metadata-eval28.4%
distribute-lft-in28.5%
metadata-eval28.5%
sub-neg28.5%
expm1-define79.0%
Simplified79.0%
clear-num79.0%
un-div-inv78.9%
associate-/r*79.0%
Applied egg-rr79.0%
Taylor expanded in i around 0 68.9%
*-commutative68.9%
Simplified68.9%
if -3.10000000000000015e-242 < n < 1.5999999999999999e-212Initial program 68.0%
associate-*r/68.0%
sub-neg68.0%
distribute-rgt-in68.0%
metadata-eval68.0%
metadata-eval68.0%
Simplified68.0%
Taylor expanded in i around 0 82.8%
Taylor expanded in i around 0 82.8%
if 1.5999999999999999e-212 < n 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 22.7%
sub-neg22.7%
metadata-eval22.7%
metadata-eval22.7%
distribute-lft-in22.8%
metadata-eval22.8%
sub-neg22.8%
expm1-define82.3%
Simplified82.3%
Taylor expanded in i around 0 68.0%
Final simplification70.9%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* n (+ 100.0 (* i 50.0)))))
(if (<= n -5.2e+217)
t_0
(if (<= n -1.3e-242)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 4.2e-213) 0.0 t_0)))))
double code(double i, double n) {
double t_0 = n * (100.0 + (i * 50.0));
double tmp;
if (n <= -5.2e+217) {
tmp = t_0;
} else if (n <= -1.3e-242) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 4.2e-213) {
tmp = 0.0;
} 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))
if (n <= (-5.2d+217)) then
tmp = t_0
else if (n <= (-1.3d-242)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 4.2d-213) then
tmp = 0.0d0
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));
double tmp;
if (n <= -5.2e+217) {
tmp = t_0;
} else if (n <= -1.3e-242) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 4.2e-213) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = n * (100.0 + (i * 50.0)) tmp = 0 if n <= -5.2e+217: tmp = t_0 elif n <= -1.3e-242: tmp = n / (0.01 + (i * -0.005)) elif n <= 4.2e-213: tmp = 0.0 else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(n * Float64(100.0 + Float64(i * 50.0))) tmp = 0.0 if (n <= -5.2e+217) tmp = t_0; elseif (n <= -1.3e-242) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 4.2e-213) tmp = 0.0; else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = n * (100.0 + (i * 50.0)); tmp = 0.0; if (n <= -5.2e+217) tmp = t_0; elseif (n <= -1.3e-242) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 4.2e-213) tmp = 0.0; else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -5.2e+217], t$95$0, If[LessEqual[n, -1.3e-242], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.2e-213], 0.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{if}\;n \leq -5.2 \cdot 10^{+217}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -1.3 \cdot 10^{-242}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 4.2 \cdot 10^{-213}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -5.20000000000000023e217 or 4.1999999999999997e-213 < n Initial program 19.6%
associate-/r/20.2%
associate-*r*20.2%
*-commutative20.2%
associate-*r/20.2%
sub-neg20.2%
distribute-lft-in20.2%
metadata-eval20.2%
metadata-eval20.2%
metadata-eval20.2%
fma-define20.2%
metadata-eval20.2%
Simplified20.2%
Taylor expanded in n around inf 27.8%
sub-neg27.8%
metadata-eval27.8%
metadata-eval27.8%
distribute-lft-in27.9%
metadata-eval27.9%
sub-neg27.9%
expm1-define85.5%
Simplified85.5%
Taylor expanded in i around 0 69.8%
+-commutative69.8%
associate-*r*69.8%
distribute-rgt-in69.8%
*-commutative69.8%
Simplified69.8%
if -5.20000000000000023e217 < n < -1.30000000000000009e-242Initial program 34.7%
associate-/r/34.8%
associate-*r*34.7%
*-commutative34.7%
associate-*r/34.8%
sub-neg34.8%
distribute-lft-in34.9%
metadata-eval34.9%
metadata-eval34.9%
metadata-eval34.9%
fma-define34.8%
metadata-eval34.8%
Simplified34.8%
Taylor expanded in n around inf 28.4%
sub-neg28.4%
metadata-eval28.4%
metadata-eval28.4%
distribute-lft-in28.5%
metadata-eval28.5%
sub-neg28.5%
expm1-define79.0%
Simplified79.0%
clear-num79.0%
un-div-inv78.9%
associate-/r*79.0%
Applied egg-rr79.0%
Taylor expanded in i around 0 68.9%
*-commutative68.9%
Simplified68.9%
if -1.30000000000000009e-242 < n < 4.1999999999999997e-213Initial program 68.0%
associate-*r/68.0%
sub-neg68.0%
distribute-rgt-in68.0%
metadata-eval68.0%
metadata-eval68.0%
Simplified68.0%
Taylor expanded in i around 0 82.8%
Taylor expanded in i around 0 82.8%
(FPCore (i n)
:precision binary64
(if (<= n -1.3e+217)
(* n (+ 100.0 (* i (+ 50.0 (* i 16.666666666666668)))))
(if (<= n 2.25e+16)
(/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
(* n (/ (* i (+ 100.0 (* i 50.0))) i)))))
double code(double i, double n) {
double tmp;
if (n <= -1.3e+217) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 2.25e+16) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = n * ((i * (100.0 + (i * 50.0))) / i);
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-1.3d+217)) then
tmp = n * (100.0d0 + (i * (50.0d0 + (i * 16.666666666666668d0))))
else if (n <= 2.25d+16) then
tmp = n / (0.01d0 + (i * ((i * 0.0008333333333333334d0) - 0.005d0)))
else
tmp = n * ((i * (100.0d0 + (i * 50.0d0))) / i)
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -1.3e+217) {
tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668))));
} else if (n <= 2.25e+16) {
tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
} else {
tmp = n * ((i * (100.0 + (i * 50.0))) / i);
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -1.3e+217: tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))) elif n <= 2.25e+16: tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))) else: tmp = n * ((i * (100.0 + (i * 50.0))) / i) return tmp
function code(i, n) tmp = 0.0 if (n <= -1.3e+217) tmp = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * 16.666666666666668))))); elseif (n <= 2.25e+16) tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005)))); else tmp = Float64(n * Float64(Float64(i * Float64(100.0 + Float64(i * 50.0))) / i)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -1.3e+217) tmp = n * (100.0 + (i * (50.0 + (i * 16.666666666666668)))); elseif (n <= 2.25e+16) tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005))); else tmp = n * ((i * (100.0 + (i * 50.0))) / i); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -1.3e+217], N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * 16.666666666666668), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.25e+16], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(N[(i * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.3 \cdot 10^{+217}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\
\mathbf{elif}\;n \leq 2.25 \cdot 10^{+16}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \frac{i \cdot \left(100 + i \cdot 50\right)}{i}\\
\end{array}
\end{array}
if n < -1.30000000000000006e217Initial program 19.7%
associate-/r/20.4%
associate-*r*20.4%
*-commutative20.4%
associate-*r/20.5%
sub-neg20.5%
distribute-lft-in20.5%
metadata-eval20.5%
metadata-eval20.5%
metadata-eval20.5%
fma-define20.5%
metadata-eval20.5%
Simplified20.5%
Taylor expanded in n around inf 50.8%
sub-neg50.8%
metadata-eval50.8%
metadata-eval50.8%
distribute-lft-in50.8%
metadata-eval50.8%
sub-neg50.8%
expm1-define99.8%
Simplified99.8%
Taylor expanded in i around 0 81.7%
*-commutative81.7%
Simplified81.7%
if -1.30000000000000006e217 < n < 2.25e16Initial program 36.7%
associate-/r/36.8%
associate-*r*36.8%
*-commutative36.8%
associate-*r/36.8%
sub-neg36.8%
distribute-lft-in36.8%
metadata-eval36.8%
metadata-eval36.8%
metadata-eval36.8%
fma-define36.8%
metadata-eval36.8%
Simplified36.8%
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-define68.4%
Simplified68.4%
clear-num68.4%
un-div-inv68.3%
associate-/r*68.3%
Applied egg-rr68.3%
Taylor expanded in i around 0 67.2%
if 2.25e16 < n Initial program 20.4%
associate-/r/21.2%
associate-*r*21.2%
*-commutative21.2%
associate-*r/21.2%
sub-neg21.2%
distribute-lft-in21.2%
metadata-eval21.2%
metadata-eval21.2%
metadata-eval21.2%
fma-define21.2%
metadata-eval21.2%
Simplified21.2%
Taylor expanded in n around inf 29.1%
sub-neg29.1%
metadata-eval29.1%
metadata-eval29.1%
distribute-lft-in29.2%
metadata-eval29.2%
sub-neg29.2%
expm1-define90.1%
Simplified90.1%
Taylor expanded in i around 0 76.1%
*-commutative76.1%
Simplified76.1%
Final simplification71.5%
(FPCore (i n) :precision binary64 (if (<= i -0.0225) 0.0 (if (<= i 6.8e-9) (* n 100.0) (if (<= i 1.55e+117) 0.0 (* 50.0 (* i n))))))
double code(double i, double n) {
double tmp;
if (i <= -0.0225) {
tmp = 0.0;
} else if (i <= 6.8e-9) {
tmp = n * 100.0;
} else if (i <= 1.55e+117) {
tmp = 0.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 <= (-0.0225d0)) then
tmp = 0.0d0
else if (i <= 6.8d-9) then
tmp = n * 100.0d0
else if (i <= 1.55d+117) then
tmp = 0.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 <= -0.0225) {
tmp = 0.0;
} else if (i <= 6.8e-9) {
tmp = n * 100.0;
} else if (i <= 1.55e+117) {
tmp = 0.0;
} else {
tmp = 50.0 * (i * n);
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -0.0225: tmp = 0.0 elif i <= 6.8e-9: tmp = n * 100.0 elif i <= 1.55e+117: tmp = 0.0 else: tmp = 50.0 * (i * n) return tmp
function code(i, n) tmp = 0.0 if (i <= -0.0225) tmp = 0.0; elseif (i <= 6.8e-9) tmp = Float64(n * 100.0); elseif (i <= 1.55e+117) tmp = 0.0; else tmp = Float64(50.0 * Float64(i * n)); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -0.0225) tmp = 0.0; elseif (i <= 6.8e-9) tmp = n * 100.0; elseif (i <= 1.55e+117) tmp = 0.0; else tmp = 50.0 * (i * n); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -0.0225], 0.0, If[LessEqual[i, 6.8e-9], N[(n * 100.0), $MachinePrecision], If[LessEqual[i, 1.55e+117], 0.0, N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -0.0225:\\
\;\;\;\;0\\
\mathbf{elif}\;i \leq 6.8 \cdot 10^{-9}:\\
\;\;\;\;n \cdot 100\\
\mathbf{elif}\;i \leq 1.55 \cdot 10^{+117}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\
\end{array}
\end{array}
if i < -0.022499999999999999 or 6.7999999999999997e-9 < i < 1.54999999999999988e117Initial program 66.0%
associate-*r/66.1%
sub-neg66.1%
distribute-rgt-in66.1%
metadata-eval66.1%
metadata-eval66.1%
Simplified66.1%
Taylor expanded in i around 0 35.9%
Taylor expanded in i around 0 35.9%
if -0.022499999999999999 < i < 6.7999999999999997e-9Initial program 7.3%
associate-/r/7.9%
associate-*r*7.9%
*-commutative7.9%
associate-*r/7.9%
sub-neg7.9%
distribute-lft-in7.9%
metadata-eval7.9%
metadata-eval7.9%
metadata-eval7.9%
fma-define7.9%
metadata-eval7.9%
Simplified7.9%
Taylor expanded in i around 0 89.5%
*-commutative89.5%
Simplified89.5%
if 1.54999999999999988e117 < i Initial program 52.0%
associate-/r/52.2%
associate-*r*52.1%
*-commutative52.1%
associate-*r/52.2%
sub-neg52.2%
distribute-lft-in52.1%
metadata-eval52.1%
metadata-eval52.1%
metadata-eval52.1%
fma-define52.2%
metadata-eval52.2%
Simplified52.2%
Taylor expanded in n around inf 52.7%
sub-neg52.7%
metadata-eval52.7%
metadata-eval52.7%
distribute-lft-in52.7%
metadata-eval52.7%
sub-neg52.7%
expm1-define52.7%
Simplified52.7%
Taylor expanded in i around 0 38.6%
Taylor expanded in i around inf 38.6%
*-commutative38.6%
Simplified38.6%
Final simplification68.0%
(FPCore (i n) :precision binary64 (if (<= i -0.023) 0.0 (if (<= i 6.8e-9) (* n 100.0) 0.0)))
double code(double i, double n) {
double tmp;
if (i <= -0.023) {
tmp = 0.0;
} else if (i <= 6.8e-9) {
tmp = n * 100.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-0.023d0)) then
tmp = 0.0d0
else if (i <= 6.8d-9) then
tmp = n * 100.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -0.023) {
tmp = 0.0;
} else if (i <= 6.8e-9) {
tmp = n * 100.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -0.023: tmp = 0.0 elif i <= 6.8e-9: tmp = n * 100.0 else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if (i <= -0.023) tmp = 0.0; elseif (i <= 6.8e-9) tmp = Float64(n * 100.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -0.023) tmp = 0.0; elseif (i <= 6.8e-9) tmp = n * 100.0; else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -0.023], 0.0, If[LessEqual[i, 6.8e-9], N[(n * 100.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -0.023:\\
\;\;\;\;0\\
\mathbf{elif}\;i \leq 6.8 \cdot 10^{-9}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if i < -0.023 or 6.7999999999999997e-9 < i Initial program 62.7%
associate-*r/62.7%
sub-neg62.7%
distribute-rgt-in62.7%
metadata-eval62.7%
metadata-eval62.7%
Simplified62.7%
Taylor expanded in i around 0 31.7%
Taylor expanded in i around 0 31.7%
if -0.023 < i < 6.7999999999999997e-9Initial program 7.3%
associate-/r/7.9%
associate-*r*7.9%
*-commutative7.9%
associate-*r/7.9%
sub-neg7.9%
distribute-lft-in7.9%
metadata-eval7.9%
metadata-eval7.9%
metadata-eval7.9%
fma-define7.9%
metadata-eval7.9%
Simplified7.9%
Taylor expanded in i around 0 89.5%
*-commutative89.5%
Simplified89.5%
(FPCore (i n) :precision binary64 (if (<= i -0.031) 0.0 (* n (+ 100.0 (* i 50.0)))))
double code(double i, double n) {
double tmp;
if (i <= -0.031) {
tmp = 0.0;
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (i <= (-0.031d0)) then
tmp = 0.0d0
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (i <= -0.031) {
tmp = 0.0;
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -0.031: tmp = 0.0 else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (i <= -0.031) tmp = 0.0; else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -0.031) tmp = 0.0; else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -0.031], 0.0, N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -0.031:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if i < -0.031Initial program 75.6%
associate-*r/75.6%
sub-neg75.6%
distribute-rgt-in75.7%
metadata-eval75.7%
metadata-eval75.7%
Simplified75.7%
Taylor expanded in i around 0 36.1%
Taylor expanded in i around 0 36.1%
if -0.031 < i Initial program 16.3%
associate-/r/16.9%
associate-*r*16.8%
*-commutative16.8%
associate-*r/16.9%
sub-neg16.9%
distribute-lft-in16.9%
metadata-eval16.9%
metadata-eval16.9%
metadata-eval16.9%
fma-define16.9%
metadata-eval16.9%
Simplified16.9%
Taylor expanded in n around inf 18.3%
sub-neg18.3%
metadata-eval18.3%
metadata-eval18.3%
distribute-lft-in18.3%
metadata-eval18.3%
sub-neg18.3%
expm1-define80.4%
Simplified80.4%
Taylor expanded in i around 0 75.5%
+-commutative75.5%
associate-*r*75.5%
distribute-rgt-in75.5%
*-commutative75.5%
Simplified75.5%
(FPCore (i n) :precision binary64 0.0)
double code(double i, double n) {
return 0.0;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 0.0d0
end function
public static double code(double i, double n) {
return 0.0;
}
def code(i, n): return 0.0
function code(i, n) return 0.0 end
function tmp = code(i, n) tmp = 0.0; end
code[i_, n_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 29.8%
associate-*r/29.8%
sub-neg29.8%
distribute-rgt-in29.8%
metadata-eval29.8%
metadata-eval29.8%
Simplified29.8%
Taylor expanded in i around 0 17.2%
Taylor expanded in i around 0 17.6%
(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 2024186
(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))))