
(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 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n)
:precision binary64
(let* ((t_0 (pow (+ 1.0 (/ i n)) n)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
(if (<= t_1 0.0)
(/ (* (expm1 (* n (log1p (/ i n)))) 100.0) (/ i n))
(if (<= t_1 INFINITY)
(* 100.0 (- (* t_0 (/ n i)) (/ n i)))
(/ n (+ 0.01 (* i -0.005)))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = (expm1((n * log1p((i / n)))) * 100.0) / (i / n);
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * ((t_0 * (n / i)) - (n / i));
} else {
tmp = n / (0.01 + (i * -0.005));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = (Math.expm1((n * Math.log1p((i / n)))) * 100.0) / (i / n);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * ((t_0 * (n / i)) - (n / i));
} else {
tmp = n / (0.01 + (i * -0.005));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 0.0: tmp = (math.expm1((n * math.log1p((i / n)))) * 100.0) / (i / n) elif t_1 <= math.inf: tmp = 100.0 * ((t_0 * (n / i)) - (n / i)) else: tmp = n / (0.01 + (i * -0.005)) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) * 100.0) / Float64(i / n)); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(Float64(t_0 * Float64(n / i)) - Float64(n / i))); else tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * 100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(N[(t$95$0 * N[(n / i), $MachinePrecision]), $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{\frac{i}{n}}\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(t_0 \cdot \frac{n}{i} - \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 24.2%
associate-*r/24.2%
sub-neg24.2%
distribute-lft-in24.3%
fma-def24.2%
metadata-eval24.2%
metadata-eval24.2%
Simplified24.2%
fma-udef24.3%
metadata-eval24.3%
metadata-eval24.3%
distribute-lft-in24.2%
sub-neg24.2%
*-commutative24.2%
pow-to-exp23.7%
expm1-def36.9%
*-commutative36.9%
log1p-udef99.1%
Applied egg-rr99.1%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 92.3%
div-sub92.1%
clear-num92.1%
sub-neg92.1%
div-inv92.6%
clear-num92.6%
Applied egg-rr92.6%
sub-neg92.6%
Simplified92.6%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.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%
fma-def1.9%
metadata-eval1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in n around inf 1.9%
associate-/l*1.9%
*-commutative1.9%
fma-neg1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in i around 0 99.7%
*-commutative99.7%
Simplified99.7%
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 (* n (log1p (/ i n)))) (/ n i)))
(if (<= t_1 INFINITY)
(* 100.0 (- (* t_0 (/ n i)) (/ n i)))
(/ n (+ 0.01 (* i -0.005)))))))
double code(double i, double n) {
double t_0 = pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = 100.0 * (expm1((n * log1p((i / n)))) * (n / i));
} else if (t_1 <= ((double) INFINITY)) {
tmp = 100.0 * ((t_0 * (n / i)) - (n / i));
} else {
tmp = n / (0.01 + (i * -0.005));
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = Math.pow((1.0 + (i / n)), n);
double t_1 = (t_0 + -1.0) / (i / n);
double tmp;
if (t_1 <= 0.0) {
tmp = 100.0 * (Math.expm1((n * Math.log1p((i / n)))) * (n / i));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = 100.0 * ((t_0 * (n / i)) - (n / i));
} else {
tmp = n / (0.01 + (i * -0.005));
}
return tmp;
}
def code(i, n): t_0 = math.pow((1.0 + (i / n)), n) t_1 = (t_0 + -1.0) / (i / n) tmp = 0 if t_1 <= 0.0: tmp = 100.0 * (math.expm1((n * math.log1p((i / n)))) * (n / i)) elif t_1 <= math.inf: tmp = 100.0 * ((t_0 * (n / i)) - (n / i)) else: tmp = n / (0.01 + (i * -0.005)) return tmp
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) ^ n t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(n / i))); elseif (t_1 <= Inf) tmp = Float64(100.0 * Float64(Float64(t_0 * Float64(n / i)) - Float64(n / i))); else tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(100.0 * N[(N[(t$95$0 * N[(n / i), $MachinePrecision]), $MachinePrecision] - N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq 0:\\
\;\;\;\;100 \cdot \left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{n}{i}\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(t_0 \cdot \frac{n}{i} - \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0Initial program 24.2%
clear-num24.2%
associate-/r/24.1%
clear-num24.0%
pow-to-exp23.5%
expm1-def36.6%
*-commutative36.6%
log1p-udef96.4%
Applied egg-rr96.4%
if 0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0Initial program 92.3%
div-sub92.1%
clear-num92.1%
sub-neg92.1%
div-inv92.6%
clear-num92.6%
Applied egg-rr92.6%
sub-neg92.6%
Simplified92.6%
if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.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%
fma-def1.9%
metadata-eval1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in n around inf 1.9%
associate-/l*1.9%
*-commutative1.9%
fma-neg1.9%
metadata-eval1.9%
Simplified1.9%
Taylor expanded in i around 0 99.7%
*-commutative99.7%
Simplified99.7%
Final simplification96.8%
(FPCore (i n)
:precision binary64
(if (or (<= n -1.35e-11) (not (<= n 0.09)))
(* n (* 100.0 (/ (expm1 i) i)))
(/
(* 10000.0 (pow n 2.0))
(- (* n 100.0) (* n (* i (+ 50.0 (* 100.0 (/ -0.5 n)))))))))
double code(double i, double n) {
double tmp;
if ((n <= -1.35e-11) || !(n <= 0.09)) {
tmp = n * (100.0 * (expm1(i) / i));
} else {
tmp = (10000.0 * pow(n, 2.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n))))));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -1.35e-11) || !(n <= 0.09)) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else {
tmp = (10000.0 * Math.pow(n, 2.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n))))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.35e-11) or not (n <= 0.09): tmp = n * (100.0 * (math.expm1(i) / i)) else: tmp = (10000.0 * math.pow(n, 2.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n)))))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.35e-11) || !(n <= 0.09)) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); else tmp = Float64(Float64(10000.0 * (n ^ 2.0)) / Float64(Float64(n * 100.0) - Float64(n * Float64(i * Float64(50.0 + Float64(100.0 * Float64(-0.5 / n))))))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -1.35e-11], N[Not[LessEqual[n, 0.09]], $MachinePrecision]], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(10000.0 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision] / N[(N[(n * 100.0), $MachinePrecision] - N[(n * N[(i * N[(50.0 + N[(100.0 * N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.35 \cdot 10^{-11} \lor \neg \left(n \leq 0.09\right):\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{10000 \cdot {n}^{2}}{n \cdot 100 - n \cdot \left(i \cdot \left(50 + 100 \cdot \frac{-0.5}{n}\right)\right)}\\
\end{array}
\end{array}
if n < -1.35000000000000002e-11 or 0.089999999999999997 < n Initial program 17.3%
Taylor expanded in n around inf 39.9%
expm1-def67.9%
Simplified67.9%
associate-*r/67.9%
frac-2neg67.9%
distribute-neg-frac67.9%
Applied egg-rr67.9%
associate-/r/95.3%
distribute-lft-neg-in95.3%
metadata-eval95.3%
neg-mul-195.3%
times-frac95.4%
metadata-eval95.4%
Simplified95.4%
if -1.35000000000000002e-11 < n < 0.089999999999999997Initial program 35.4%
associate-/r/35.3%
associate-*r*35.3%
*-commutative35.3%
associate-*r/35.3%
sub-neg35.3%
distribute-lft-in35.3%
fma-def35.3%
metadata-eval35.3%
metadata-eval35.3%
Simplified35.3%
Taylor expanded in i around 0 34.4%
associate-*r*34.4%
*-commutative34.4%
associate-*r/34.4%
metadata-eval34.4%
Simplified34.4%
distribute-lft-in34.4%
flip-+27.4%
Applied egg-rr27.4%
Taylor expanded in i around 0 64.7%
Final simplification84.1%
(FPCore (i n)
:precision binary64
(if (or (<= n -6.5e-6) (not (<= n 0.09)))
(* n (* 100.0 (/ (expm1 i) i)))
(/
(* n (* n 10000.0))
(- (* n 100.0) (* n (* i (+ 50.0 (* 100.0 (/ -0.5 n)))))))))
double code(double i, double n) {
double tmp;
if ((n <= -6.5e-6) || !(n <= 0.09)) {
tmp = n * (100.0 * (expm1(i) / i));
} else {
tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n))))));
}
return tmp;
}
public static double code(double i, double n) {
double tmp;
if ((n <= -6.5e-6) || !(n <= 0.09)) {
tmp = n * (100.0 * (Math.expm1(i) / i));
} else {
tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n))))));
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -6.5e-6) or not (n <= 0.09): tmp = n * (100.0 * (math.expm1(i) / i)) else: tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n)))))) return tmp
function code(i, n) tmp = 0.0 if ((n <= -6.5e-6) || !(n <= 0.09)) tmp = Float64(n * Float64(100.0 * Float64(expm1(i) / i))); else tmp = Float64(Float64(n * Float64(n * 10000.0)) / Float64(Float64(n * 100.0) - Float64(n * Float64(i * Float64(50.0 + Float64(100.0 * Float64(-0.5 / n))))))); end return tmp end
code[i_, n_] := If[Or[LessEqual[n, -6.5e-6], N[Not[LessEqual[n, 0.09]], $MachinePrecision]], N[(n * N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * N[(n * 10000.0), $MachinePrecision]), $MachinePrecision] / N[(N[(n * 100.0), $MachinePrecision] - N[(n * N[(i * N[(50.0 + N[(100.0 * N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -6.5 \cdot 10^{-6} \lor \neg \left(n \leq 0.09\right):\\
\;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{n \cdot \left(n \cdot 10000\right)}{n \cdot 100 - n \cdot \left(i \cdot \left(50 + 100 \cdot \frac{-0.5}{n}\right)\right)}\\
\end{array}
\end{array}
if n < -6.4999999999999996e-6 or 0.089999999999999997 < n Initial program 17.5%
Taylor expanded in n around inf 40.4%
expm1-def67.5%
Simplified67.5%
associate-*r/67.5%
frac-2neg67.5%
distribute-neg-frac67.5%
Applied egg-rr67.5%
associate-/r/95.2%
distribute-lft-neg-in95.2%
metadata-eval95.2%
neg-mul-195.2%
times-frac95.3%
metadata-eval95.3%
Simplified95.3%
if -6.4999999999999996e-6 < n < 0.089999999999999997Initial program 34.8%
associate-/r/34.7%
associate-*r*34.6%
*-commutative34.6%
associate-*r/34.6%
sub-neg34.6%
distribute-lft-in34.6%
fma-def34.6%
metadata-eval34.6%
metadata-eval34.6%
Simplified34.6%
Taylor expanded in i around 0 35.8%
associate-*r*35.8%
*-commutative35.8%
associate-*r/35.8%
metadata-eval35.8%
Simplified35.8%
distribute-lft-in35.8%
flip-+28.9%
Applied egg-rr28.9%
Taylor expanded in i around 0 65.4%
*-commutative65.4%
unpow265.4%
associate-*l*65.4%
Simplified65.4%
Final simplification84.1%
(FPCore (i n)
:precision binary64
(let* ((t_0 (- (* n 100.0) (* n (* i (+ 50.0 (* 100.0 (/ -0.5 n))))))))
(if (<= i -5.4e-38)
(* 100.0 (* (/ n i) (expm1 i)))
(if (<= i 2.4e-29)
(* n (+ 100.0 (* (/ i n) -50.0)))
(if (<= i 3.5e+65)
(/ (* (* n n) (+ 10000.0 (* (* i i) -2500.0))) t_0)
(if (<= i 6e+253) (/ (* n (* n 10000.0)) t_0) (* n (* i 50.0))))))))
double code(double i, double n) {
double t_0 = (n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n)))));
double tmp;
if (i <= -5.4e-38) {
tmp = 100.0 * ((n / i) * expm1(i));
} else if (i <= 2.4e-29) {
tmp = n * (100.0 + ((i / n) * -50.0));
} else if (i <= 3.5e+65) {
tmp = ((n * n) * (10000.0 + ((i * i) * -2500.0))) / t_0;
} else if (i <= 6e+253) {
tmp = (n * (n * 10000.0)) / t_0;
} else {
tmp = n * (i * 50.0);
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = (n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n)))));
double tmp;
if (i <= -5.4e-38) {
tmp = 100.0 * ((n / i) * Math.expm1(i));
} else if (i <= 2.4e-29) {
tmp = n * (100.0 + ((i / n) * -50.0));
} else if (i <= 3.5e+65) {
tmp = ((n * n) * (10000.0 + ((i * i) * -2500.0))) / t_0;
} else if (i <= 6e+253) {
tmp = (n * (n * 10000.0)) / t_0;
} else {
tmp = n * (i * 50.0);
}
return tmp;
}
def code(i, n): t_0 = (n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n))))) tmp = 0 if i <= -5.4e-38: tmp = 100.0 * ((n / i) * math.expm1(i)) elif i <= 2.4e-29: tmp = n * (100.0 + ((i / n) * -50.0)) elif i <= 3.5e+65: tmp = ((n * n) * (10000.0 + ((i * i) * -2500.0))) / t_0 elif i <= 6e+253: tmp = (n * (n * 10000.0)) / t_0 else: tmp = n * (i * 50.0) return tmp
function code(i, n) t_0 = Float64(Float64(n * 100.0) - Float64(n * Float64(i * Float64(50.0 + Float64(100.0 * Float64(-0.5 / n)))))) tmp = 0.0 if (i <= -5.4e-38) tmp = Float64(100.0 * Float64(Float64(n / i) * expm1(i))); elseif (i <= 2.4e-29) tmp = Float64(n * Float64(100.0 + Float64(Float64(i / n) * -50.0))); elseif (i <= 3.5e+65) tmp = Float64(Float64(Float64(n * n) * Float64(10000.0 + Float64(Float64(i * i) * -2500.0))) / t_0); elseif (i <= 6e+253) tmp = Float64(Float64(n * Float64(n * 10000.0)) / t_0); else tmp = Float64(n * Float64(i * 50.0)); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(n * 100.0), $MachinePrecision] - N[(n * N[(i * N[(50.0 + N[(100.0 * N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -5.4e-38], N[(100.0 * N[(N[(n / i), $MachinePrecision] * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 2.4e-29], N[(n * N[(100.0 + N[(N[(i / n), $MachinePrecision] * -50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3.5e+65], N[(N[(N[(n * n), $MachinePrecision] * N[(10000.0 + N[(N[(i * i), $MachinePrecision] * -2500.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[i, 6e+253], N[(N[(n * N[(n * 10000.0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(n * N[(i * 50.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot 100 - n \cdot \left(i \cdot \left(50 + 100 \cdot \frac{-0.5}{n}\right)\right)\\
\mathbf{if}\;i \leq -5.4 \cdot 10^{-38}:\\
\;\;\;\;100 \cdot \left(\frac{n}{i} \cdot \mathsf{expm1}\left(i\right)\right)\\
\mathbf{elif}\;i \leq 2.4 \cdot 10^{-29}:\\
\;\;\;\;n \cdot \left(100 + \frac{i}{n} \cdot -50\right)\\
\mathbf{elif}\;i \leq 3.5 \cdot 10^{+65}:\\
\;\;\;\;\frac{\left(n \cdot n\right) \cdot \left(10000 + \left(i \cdot i\right) \cdot -2500\right)}{t_0}\\
\mathbf{elif}\;i \leq 6 \cdot 10^{+253}:\\
\;\;\;\;\frac{n \cdot \left(n \cdot 10000\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(i \cdot 50\right)\\
\end{array}
\end{array}
if i < -5.40000000000000011e-38Initial program 42.1%
associate-*r/42.2%
sub-neg42.2%
distribute-lft-in42.3%
fma-def42.2%
metadata-eval42.2%
metadata-eval42.2%
Simplified42.2%
fma-udef42.3%
metadata-eval42.3%
metadata-eval42.3%
distribute-lft-in42.2%
sub-neg42.2%
*-commutative42.2%
pow-to-exp40.7%
expm1-def51.1%
*-commutative51.1%
log1p-udef98.2%
Applied egg-rr98.2%
Taylor expanded in n around inf 75.9%
expm1-def78.6%
*-commutative78.6%
associate-*r/78.7%
*-commutative78.7%
Simplified78.7%
if -5.40000000000000011e-38 < i < 2.39999999999999992e-29Initial program 7.5%
associate-/r/8.1%
associate-*r*8.1%
*-commutative8.1%
associate-*r/8.1%
sub-neg8.1%
distribute-lft-in8.1%
fma-def8.1%
metadata-eval8.1%
metadata-eval8.1%
Simplified8.1%
Taylor expanded in i around 0 86.5%
associate-*r*86.5%
*-commutative86.5%
associate-*r/86.5%
metadata-eval86.5%
Simplified86.5%
Taylor expanded in n around 0 86.5%
if 2.39999999999999992e-29 < i < 3.5000000000000001e65Initial program 20.7%
associate-/r/20.7%
associate-*r*20.7%
*-commutative20.7%
associate-*r/20.7%
sub-neg20.7%
distribute-lft-in20.4%
fma-def20.7%
metadata-eval20.7%
metadata-eval20.7%
Simplified20.7%
Taylor expanded in i around 0 19.9%
associate-*r*19.9%
*-commutative19.9%
associate-*r/19.9%
metadata-eval19.9%
Simplified19.9%
distribute-lft-in19.8%
flip-+16.4%
Applied egg-rr16.4%
Taylor expanded in n around inf 75.5%
unpow275.5%
cancel-sign-sub-inv75.5%
metadata-eval75.5%
*-commutative75.5%
unpow275.5%
Simplified75.5%
if 3.5000000000000001e65 < i < 5.9999999999999996e253Initial program 47.6%
associate-/r/47.8%
associate-*r*47.9%
*-commutative47.9%
associate-*r/47.9%
sub-neg47.9%
distribute-lft-in47.9%
fma-def47.9%
metadata-eval47.9%
metadata-eval47.9%
Simplified47.9%
Taylor expanded in i around 0 21.6%
associate-*r*21.6%
*-commutative21.6%
associate-*r/21.6%
metadata-eval21.6%
Simplified21.6%
distribute-lft-in21.6%
flip-+7.5%
Applied egg-rr7.5%
Taylor expanded in i around 0 51.1%
*-commutative51.1%
unpow251.1%
associate-*l*51.1%
Simplified51.1%
if 5.9999999999999996e253 < i Initial program 99.5%
Taylor expanded in n around inf 66.9%
expm1-def66.9%
Simplified66.9%
Taylor expanded in i around 0 66.9%
associate-*r*66.9%
Simplified66.9%
Taylor expanded in i around inf 66.9%
*-commutative66.9%
associate-*l*66.9%
Simplified66.9%
Final simplification79.1%
(FPCore (i n)
:precision binary64
(let* ((t_0 (- (* n 100.0) (* n (* i (+ 50.0 (* 100.0 (/ -0.5 n))))))))
(if (<= i -8.5e-39)
(* 100.0 (/ (expm1 i) (/ i n)))
(if (<= i 2e-28)
(* n (+ 100.0 (* (/ i n) -50.0)))
(if (<= i 3.5e+65)
(/ (* (* n n) (+ 10000.0 (* (* i i) -2500.0))) t_0)
(if (<= i 7.5e+253) (/ (* n (* n 10000.0)) t_0) (* n (* i 50.0))))))))
double code(double i, double n) {
double t_0 = (n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n)))));
double tmp;
if (i <= -8.5e-39) {
tmp = 100.0 * (expm1(i) / (i / n));
} else if (i <= 2e-28) {
tmp = n * (100.0 + ((i / n) * -50.0));
} else if (i <= 3.5e+65) {
tmp = ((n * n) * (10000.0 + ((i * i) * -2500.0))) / t_0;
} else if (i <= 7.5e+253) {
tmp = (n * (n * 10000.0)) / t_0;
} else {
tmp = n * (i * 50.0);
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = (n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n)))));
double tmp;
if (i <= -8.5e-39) {
tmp = 100.0 * (Math.expm1(i) / (i / n));
} else if (i <= 2e-28) {
tmp = n * (100.0 + ((i / n) * -50.0));
} else if (i <= 3.5e+65) {
tmp = ((n * n) * (10000.0 + ((i * i) * -2500.0))) / t_0;
} else if (i <= 7.5e+253) {
tmp = (n * (n * 10000.0)) / t_0;
} else {
tmp = n * (i * 50.0);
}
return tmp;
}
def code(i, n): t_0 = (n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n))))) tmp = 0 if i <= -8.5e-39: tmp = 100.0 * (math.expm1(i) / (i / n)) elif i <= 2e-28: tmp = n * (100.0 + ((i / n) * -50.0)) elif i <= 3.5e+65: tmp = ((n * n) * (10000.0 + ((i * i) * -2500.0))) / t_0 elif i <= 7.5e+253: tmp = (n * (n * 10000.0)) / t_0 else: tmp = n * (i * 50.0) return tmp
function code(i, n) t_0 = Float64(Float64(n * 100.0) - Float64(n * Float64(i * Float64(50.0 + Float64(100.0 * Float64(-0.5 / n)))))) tmp = 0.0 if (i <= -8.5e-39) tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n))); elseif (i <= 2e-28) tmp = Float64(n * Float64(100.0 + Float64(Float64(i / n) * -50.0))); elseif (i <= 3.5e+65) tmp = Float64(Float64(Float64(n * n) * Float64(10000.0 + Float64(Float64(i * i) * -2500.0))) / t_0); elseif (i <= 7.5e+253) tmp = Float64(Float64(n * Float64(n * 10000.0)) / t_0); else tmp = Float64(n * Float64(i * 50.0)); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(N[(n * 100.0), $MachinePrecision] - N[(n * N[(i * N[(50.0 + N[(100.0 * N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -8.5e-39], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 2e-28], N[(n * N[(100.0 + N[(N[(i / n), $MachinePrecision] * -50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3.5e+65], N[(N[(N[(n * n), $MachinePrecision] * N[(10000.0 + N[(N[(i * i), $MachinePrecision] * -2500.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[i, 7.5e+253], N[(N[(n * N[(n * 10000.0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(n * N[(i * 50.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot 100 - n \cdot \left(i \cdot \left(50 + 100 \cdot \frac{-0.5}{n}\right)\right)\\
\mathbf{if}\;i \leq -8.5 \cdot 10^{-39}:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{elif}\;i \leq 2 \cdot 10^{-28}:\\
\;\;\;\;n \cdot \left(100 + \frac{i}{n} \cdot -50\right)\\
\mathbf{elif}\;i \leq 3.5 \cdot 10^{+65}:\\
\;\;\;\;\frac{\left(n \cdot n\right) \cdot \left(10000 + \left(i \cdot i\right) \cdot -2500\right)}{t_0}\\
\mathbf{elif}\;i \leq 7.5 \cdot 10^{+253}:\\
\;\;\;\;\frac{n \cdot \left(n \cdot 10000\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(i \cdot 50\right)\\
\end{array}
\end{array}
if i < -8.5000000000000005e-39Initial program 42.1%
Taylor expanded in n around inf 76.2%
expm1-def79.0%
Simplified79.0%
if -8.5000000000000005e-39 < i < 1.99999999999999994e-28Initial program 7.5%
associate-/r/8.1%
associate-*r*8.1%
*-commutative8.1%
associate-*r/8.1%
sub-neg8.1%
distribute-lft-in8.1%
fma-def8.1%
metadata-eval8.1%
metadata-eval8.1%
Simplified8.1%
Taylor expanded in i around 0 86.5%
associate-*r*86.5%
*-commutative86.5%
associate-*r/86.5%
metadata-eval86.5%
Simplified86.5%
Taylor expanded in n around 0 86.5%
if 1.99999999999999994e-28 < i < 3.5000000000000001e65Initial program 20.7%
associate-/r/20.7%
associate-*r*20.7%
*-commutative20.7%
associate-*r/20.7%
sub-neg20.7%
distribute-lft-in20.4%
fma-def20.7%
metadata-eval20.7%
metadata-eval20.7%
Simplified20.7%
Taylor expanded in i around 0 19.9%
associate-*r*19.9%
*-commutative19.9%
associate-*r/19.9%
metadata-eval19.9%
Simplified19.9%
distribute-lft-in19.8%
flip-+16.4%
Applied egg-rr16.4%
Taylor expanded in n around inf 75.5%
unpow275.5%
cancel-sign-sub-inv75.5%
metadata-eval75.5%
*-commutative75.5%
unpow275.5%
Simplified75.5%
if 3.5000000000000001e65 < i < 7.50000000000000017e253Initial program 47.6%
associate-/r/47.8%
associate-*r*47.9%
*-commutative47.9%
associate-*r/47.9%
sub-neg47.9%
distribute-lft-in47.9%
fma-def47.9%
metadata-eval47.9%
metadata-eval47.9%
Simplified47.9%
Taylor expanded in i around 0 21.6%
associate-*r*21.6%
*-commutative21.6%
associate-*r/21.6%
metadata-eval21.6%
Simplified21.6%
distribute-lft-in21.6%
flip-+7.5%
Applied egg-rr7.5%
Taylor expanded in i around 0 51.1%
*-commutative51.1%
unpow251.1%
associate-*l*51.1%
Simplified51.1%
if 7.50000000000000017e253 < i Initial program 99.5%
Taylor expanded in n around inf 66.9%
expm1-def66.9%
Simplified66.9%
Taylor expanded in i around 0 66.9%
associate-*r*66.9%
Simplified66.9%
Taylor expanded in i around inf 66.9%
*-commutative66.9%
associate-*l*66.9%
Simplified66.9%
Final simplification79.2%
(FPCore (i n)
:precision binary64
(if (<= n -0.0036)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 0.086)
(/
(* n (* n 10000.0))
(- (* n 100.0) (* n (* i (+ 50.0 (* 100.0 (/ -0.5 n)))))))
(*
100.0
(+
n
(*
n
(+
(*
(* i i)
(+ (/ 0.3333333333333333 (* n n)) (- 0.16666666666666666 (/ 0.5 n))))
(* i (- 0.5 (/ 0.5 n))))))))))
double code(double i, double n) {
double tmp;
if (n <= -0.0036) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 0.086) {
tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n))))));
} else {
tmp = 100.0 * (n + (n * (((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 - (0.5 / n)))) + (i * (0.5 - (0.5 / n))))));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-0.0036d0)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 0.086d0) then
tmp = (n * (n * 10000.0d0)) / ((n * 100.0d0) - (n * (i * (50.0d0 + (100.0d0 * ((-0.5d0) / n))))))
else
tmp = 100.0d0 * (n + (n * (((i * i) * ((0.3333333333333333d0 / (n * n)) + (0.16666666666666666d0 - (0.5d0 / n)))) + (i * (0.5d0 - (0.5d0 / n))))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -0.0036) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 0.086) {
tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n))))));
} else {
tmp = 100.0 * (n + (n * (((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 - (0.5 / n)))) + (i * (0.5 - (0.5 / n))))));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -0.0036: tmp = n / (0.01 + (i * -0.005)) elif n <= 0.086: tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n)))))) else: tmp = 100.0 * (n + (n * (((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 - (0.5 / n)))) + (i * (0.5 - (0.5 / n)))))) return tmp
function code(i, n) tmp = 0.0 if (n <= -0.0036) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 0.086) tmp = Float64(Float64(n * Float64(n * 10000.0)) / Float64(Float64(n * 100.0) - Float64(n * Float64(i * Float64(50.0 + Float64(100.0 * Float64(-0.5 / n))))))); else tmp = Float64(100.0 * Float64(n + Float64(n * Float64(Float64(Float64(i * i) * Float64(Float64(0.3333333333333333 / Float64(n * n)) + Float64(0.16666666666666666 - Float64(0.5 / n)))) + Float64(i * Float64(0.5 - Float64(0.5 / n))))))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -0.0036) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 0.086) tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n)))))); else tmp = 100.0 * (n + (n * (((i * i) * ((0.3333333333333333 / (n * n)) + (0.16666666666666666 - (0.5 / n)))) + (i * (0.5 - (0.5 / n)))))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -0.0036], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.086], N[(N[(n * N[(n * 10000.0), $MachinePrecision]), $MachinePrecision] / N[(N[(n * 100.0), $MachinePrecision] - N[(n * N[(i * N[(50.0 + N[(100.0 * N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n + N[(n * N[(N[(N[(i * i), $MachinePrecision] * N[(N[(0.3333333333333333 / N[(n * n), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(i * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -0.0036:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 0.086:\\
\;\;\;\;\frac{n \cdot \left(n \cdot 10000\right)}{n \cdot 100 - n \cdot \left(i \cdot \left(50 + 100 \cdot \frac{-0.5}{n}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n + n \cdot \left(\left(i \cdot i\right) \cdot \left(\frac{0.3333333333333333}{n \cdot n} + \left(0.16666666666666666 - \frac{0.5}{n}\right)\right) + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)\\
\end{array}
\end{array}
if n < -0.0035999999999999999Initial program 20.8%
associate-/r/21.2%
associate-*r*21.3%
*-commutative21.3%
associate-*r/21.2%
sub-neg21.2%
distribute-lft-in21.2%
fma-def21.2%
metadata-eval21.2%
metadata-eval21.2%
Simplified21.2%
Taylor expanded in n around inf 39.4%
associate-/l*39.5%
*-commutative39.5%
fma-neg39.4%
metadata-eval39.4%
Simplified39.4%
Taylor expanded in i around 0 63.1%
*-commutative63.1%
Simplified63.1%
if -0.0035999999999999999 < n < 0.085999999999999993Initial program 34.8%
associate-/r/34.7%
associate-*r*34.6%
*-commutative34.6%
associate-*r/34.6%
sub-neg34.6%
distribute-lft-in34.6%
fma-def34.6%
metadata-eval34.6%
metadata-eval34.6%
Simplified34.6%
Taylor expanded in i around 0 35.8%
associate-*r*35.8%
*-commutative35.8%
associate-*r/35.8%
metadata-eval35.8%
Simplified35.8%
distribute-lft-in35.8%
flip-+28.9%
Applied egg-rr28.9%
Taylor expanded in i around 0 65.4%
*-commutative65.4%
unpow265.4%
associate-*l*65.4%
Simplified65.4%
if 0.085999999999999993 < n Initial program 13.6%
Taylor expanded in i around 0 73.0%
distribute-lft-out73.1%
unpow273.1%
associate--l+73.1%
associate-*r/73.1%
metadata-eval73.1%
unpow273.1%
associate-*r/73.1%
metadata-eval73.1%
associate-*r/73.1%
metadata-eval73.1%
Simplified73.1%
Final simplification66.8%
(FPCore (i n)
:precision binary64
(if (<= n -0.0062)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 0.09)
(/
(* n (* n 10000.0))
(- (* n 100.0) (* n (* i (+ 50.0 (* 100.0 (/ -0.5 n)))))))
(/ n (/ (+ 100.0 (* i -50.0)) (+ 10000.0 (* (* i i) -2500.0)))))))
double code(double i, double n) {
double tmp;
if (n <= -0.0062) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 0.09) {
tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n))))));
} else {
tmp = n / ((100.0 + (i * -50.0)) / (10000.0 + ((i * i) * -2500.0)));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-0.0062d0)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 0.09d0) then
tmp = (n * (n * 10000.0d0)) / ((n * 100.0d0) - (n * (i * (50.0d0 + (100.0d0 * ((-0.5d0) / n))))))
else
tmp = n / ((100.0d0 + (i * (-50.0d0))) / (10000.0d0 + ((i * i) * (-2500.0d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -0.0062) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 0.09) {
tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n))))));
} else {
tmp = n / ((100.0 + (i * -50.0)) / (10000.0 + ((i * i) * -2500.0)));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -0.0062: tmp = n / (0.01 + (i * -0.005)) elif n <= 0.09: tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n)))))) else: tmp = n / ((100.0 + (i * -50.0)) / (10000.0 + ((i * i) * -2500.0))) return tmp
function code(i, n) tmp = 0.0 if (n <= -0.0062) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 0.09) tmp = Float64(Float64(n * Float64(n * 10000.0)) / Float64(Float64(n * 100.0) - Float64(n * Float64(i * Float64(50.0 + Float64(100.0 * Float64(-0.5 / n))))))); else tmp = Float64(n / Float64(Float64(100.0 + Float64(i * -50.0)) / Float64(10000.0 + Float64(Float64(i * i) * -2500.0)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -0.0062) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 0.09) tmp = (n * (n * 10000.0)) / ((n * 100.0) - (n * (i * (50.0 + (100.0 * (-0.5 / n)))))); else tmp = n / ((100.0 + (i * -50.0)) / (10000.0 + ((i * i) * -2500.0))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -0.0062], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.09], N[(N[(n * N[(n * 10000.0), $MachinePrecision]), $MachinePrecision] / N[(N[(n * 100.0), $MachinePrecision] - N[(n * N[(i * N[(50.0 + N[(100.0 * N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(N[(100.0 + N[(i * -50.0), $MachinePrecision]), $MachinePrecision] / N[(10000.0 + N[(N[(i * i), $MachinePrecision] * -2500.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -0.0062:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 0.09:\\
\;\;\;\;\frac{n \cdot \left(n \cdot 10000\right)}{n \cdot 100 - n \cdot \left(i \cdot \left(50 + 100 \cdot \frac{-0.5}{n}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{\frac{100 + i \cdot -50}{10000 + \left(i \cdot i\right) \cdot -2500}}\\
\end{array}
\end{array}
if n < -0.00619999999999999978Initial program 20.8%
associate-/r/21.2%
associate-*r*21.3%
*-commutative21.3%
associate-*r/21.2%
sub-neg21.2%
distribute-lft-in21.2%
fma-def21.2%
metadata-eval21.2%
metadata-eval21.2%
Simplified21.2%
Taylor expanded in n around inf 39.4%
associate-/l*39.5%
*-commutative39.5%
fma-neg39.4%
metadata-eval39.4%
Simplified39.4%
Taylor expanded in i around 0 63.1%
*-commutative63.1%
Simplified63.1%
if -0.00619999999999999978 < n < 0.089999999999999997Initial program 34.8%
associate-/r/34.7%
associate-*r*34.6%
*-commutative34.6%
associate-*r/34.6%
sub-neg34.6%
distribute-lft-in34.6%
fma-def34.6%
metadata-eval34.6%
metadata-eval34.6%
Simplified34.6%
Taylor expanded in i around 0 35.8%
associate-*r*35.8%
*-commutative35.8%
associate-*r/35.8%
metadata-eval35.8%
Simplified35.8%
distribute-lft-in35.8%
flip-+28.9%
Applied egg-rr28.9%
Taylor expanded in i around 0 65.4%
*-commutative65.4%
unpow265.4%
associate-*l*65.4%
Simplified65.4%
if 0.089999999999999997 < n Initial program 13.6%
associate-/r/14.2%
associate-*r*14.2%
*-commutative14.2%
associate-*r/14.2%
sub-neg14.2%
distribute-lft-in14.2%
fma-def14.2%
metadata-eval14.2%
metadata-eval14.2%
Simplified14.2%
Taylor expanded in i around 0 71.8%
associate-*r*71.8%
*-commutative71.8%
associate-*r/71.8%
metadata-eval71.8%
Simplified71.8%
distribute-lft-in71.8%
flip-+31.4%
Applied egg-rr31.4%
Taylor expanded in n around inf 71.8%
associate-/l*73.0%
cancel-sign-sub-inv73.0%
metadata-eval73.0%
*-commutative73.0%
cancel-sign-sub-inv73.0%
metadata-eval73.0%
*-commutative73.0%
unpow273.0%
Simplified73.0%
Final simplification66.8%
(FPCore (i n)
:precision binary64
(if (<= n -7e-21)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 0.09)
(/ n (+ 0.01 (* (* i i) 0.0008333333333333334)))
(/ n (/ (+ 100.0 (* i -50.0)) (+ 10000.0 (* (* i i) -2500.0)))))))
double code(double i, double n) {
double tmp;
if (n <= -7e-21) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 0.09) {
tmp = n / (0.01 + ((i * i) * 0.0008333333333333334));
} else {
tmp = n / ((100.0 + (i * -50.0)) / (10000.0 + ((i * i) * -2500.0)));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-7d-21)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 0.09d0) then
tmp = n / (0.01d0 + ((i * i) * 0.0008333333333333334d0))
else
tmp = n / ((100.0d0 + (i * (-50.0d0))) / (10000.0d0 + ((i * i) * (-2500.0d0))))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -7e-21) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 0.09) {
tmp = n / (0.01 + ((i * i) * 0.0008333333333333334));
} else {
tmp = n / ((100.0 + (i * -50.0)) / (10000.0 + ((i * i) * -2500.0)));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -7e-21: tmp = n / (0.01 + (i * -0.005)) elif n <= 0.09: tmp = n / (0.01 + ((i * i) * 0.0008333333333333334)) else: tmp = n / ((100.0 + (i * -50.0)) / (10000.0 + ((i * i) * -2500.0))) return tmp
function code(i, n) tmp = 0.0 if (n <= -7e-21) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 0.09) tmp = Float64(n / Float64(0.01 + Float64(Float64(i * i) * 0.0008333333333333334))); else tmp = Float64(n / Float64(Float64(100.0 + Float64(i * -50.0)) / Float64(10000.0 + Float64(Float64(i * i) * -2500.0)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -7e-21) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 0.09) tmp = n / (0.01 + ((i * i) * 0.0008333333333333334)); else tmp = n / ((100.0 + (i * -50.0)) / (10000.0 + ((i * i) * -2500.0))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -7e-21], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.09], N[(n / N[(0.01 + N[(N[(i * i), $MachinePrecision] * 0.0008333333333333334), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(N[(100.0 + N[(i * -50.0), $MachinePrecision]), $MachinePrecision] / N[(10000.0 + N[(N[(i * i), $MachinePrecision] * -2500.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -7 \cdot 10^{-21}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 0.09:\\
\;\;\;\;\frac{n}{0.01 + \left(i \cdot i\right) \cdot 0.0008333333333333334}\\
\mathbf{else}:\\
\;\;\;\;\frac{n}{\frac{100 + i \cdot -50}{10000 + \left(i \cdot i\right) \cdot -2500}}\\
\end{array}
\end{array}
if n < -7.0000000000000007e-21Initial program 21.0%
associate-/r/21.4%
associate-*r*21.5%
*-commutative21.5%
associate-*r/21.5%
sub-neg21.5%
distribute-lft-in21.5%
fma-def21.5%
metadata-eval21.5%
metadata-eval21.5%
Simplified21.5%
Taylor expanded in n around inf 38.0%
associate-/l*38.0%
*-commutative38.0%
fma-neg38.0%
metadata-eval38.0%
Simplified38.0%
Taylor expanded in i around 0 62.8%
*-commutative62.8%
Simplified62.8%
if -7.0000000000000007e-21 < n < 0.089999999999999997Initial program 35.1%
associate-/r/35.0%
associate-*r*35.0%
*-commutative35.0%
associate-*r/35.0%
sub-neg35.0%
distribute-lft-in34.9%
fma-def35.0%
metadata-eval35.0%
metadata-eval35.0%
Simplified35.0%
Taylor expanded in n around inf 19.8%
associate-/l*19.8%
*-commutative19.8%
fma-neg19.8%
metadata-eval19.8%
Simplified19.8%
Taylor expanded in i around 0 62.2%
associate-+r+62.2%
+-commutative62.2%
*-commutative62.2%
fma-def62.2%
*-commutative62.2%
unpow262.2%
Simplified62.2%
Taylor expanded in i around 0 62.2%
if 0.089999999999999997 < n Initial program 13.6%
associate-/r/14.2%
associate-*r*14.2%
*-commutative14.2%
associate-*r/14.2%
sub-neg14.2%
distribute-lft-in14.2%
fma-def14.2%
metadata-eval14.2%
metadata-eval14.2%
Simplified14.2%
Taylor expanded in i around 0 71.8%
associate-*r*71.8%
*-commutative71.8%
associate-*r/71.8%
metadata-eval71.8%
Simplified71.8%
distribute-lft-in71.8%
flip-+31.4%
Applied egg-rr31.4%
Taylor expanded in n around inf 71.8%
associate-/l*73.0%
cancel-sign-sub-inv73.0%
metadata-eval73.0%
*-commutative73.0%
cancel-sign-sub-inv73.0%
metadata-eval73.0%
*-commutative73.0%
unpow273.0%
Simplified73.0%
Final simplification65.5%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ 0.01 (* i -0.005))))
(if (<= n -6.8e-17)
(/ n t_0)
(if (<= n 1.8e+57)
(/ n (+ (* (* i i) 0.0008333333333333334) t_0))
(/ (* 100.0 (* i n)) i)))))
double code(double i, double n) {
double t_0 = 0.01 + (i * -0.005);
double tmp;
if (n <= -6.8e-17) {
tmp = n / t_0;
} else if (n <= 1.8e+57) {
tmp = n / (((i * i) * 0.0008333333333333334) + t_0);
} else {
tmp = (100.0 * (i * n)) / i;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 0.01d0 + (i * (-0.005d0))
if (n <= (-6.8d-17)) then
tmp = n / t_0
else if (n <= 1.8d+57) then
tmp = n / (((i * i) * 0.0008333333333333334d0) + t_0)
else
tmp = (100.0d0 * (i * n)) / i
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = 0.01 + (i * -0.005);
double tmp;
if (n <= -6.8e-17) {
tmp = n / t_0;
} else if (n <= 1.8e+57) {
tmp = n / (((i * i) * 0.0008333333333333334) + t_0);
} else {
tmp = (100.0 * (i * n)) / i;
}
return tmp;
}
def code(i, n): t_0 = 0.01 + (i * -0.005) tmp = 0 if n <= -6.8e-17: tmp = n / t_0 elif n <= 1.8e+57: tmp = n / (((i * i) * 0.0008333333333333334) + t_0) else: tmp = (100.0 * (i * n)) / i return tmp
function code(i, n) t_0 = Float64(0.01 + Float64(i * -0.005)) tmp = 0.0 if (n <= -6.8e-17) tmp = Float64(n / t_0); elseif (n <= 1.8e+57) tmp = Float64(n / Float64(Float64(Float64(i * i) * 0.0008333333333333334) + t_0)); else tmp = Float64(Float64(100.0 * Float64(i * n)) / i); end return tmp end
function tmp_2 = code(i, n) t_0 = 0.01 + (i * -0.005); tmp = 0.0; if (n <= -6.8e-17) tmp = n / t_0; elseif (n <= 1.8e+57) tmp = n / (((i * i) * 0.0008333333333333334) + t_0); else tmp = (100.0 * (i * n)) / i; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -6.8e-17], N[(n / t$95$0), $MachinePrecision], If[LessEqual[n, 1.8e+57], N[(n / N[(N[(N[(i * i), $MachinePrecision] * 0.0008333333333333334), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(100.0 * N[(i * n), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.01 + i \cdot -0.005\\
\mathbf{if}\;n \leq -6.8 \cdot 10^{-17}:\\
\;\;\;\;\frac{n}{t_0}\\
\mathbf{elif}\;n \leq 1.8 \cdot 10^{+57}:\\
\;\;\;\;\frac{n}{\left(i \cdot i\right) \cdot 0.0008333333333333334 + t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{100 \cdot \left(i \cdot n\right)}{i}\\
\end{array}
\end{array}
if n < -6.7999999999999996e-17Initial program 21.0%
associate-/r/21.4%
associate-*r*21.5%
*-commutative21.5%
associate-*r/21.5%
sub-neg21.5%
distribute-lft-in21.5%
fma-def21.5%
metadata-eval21.5%
metadata-eval21.5%
Simplified21.5%
Taylor expanded in n around inf 38.0%
associate-/l*38.0%
*-commutative38.0%
fma-neg38.0%
metadata-eval38.0%
Simplified38.0%
Taylor expanded in i around 0 62.8%
*-commutative62.8%
Simplified62.8%
if -6.7999999999999996e-17 < n < 1.8000000000000001e57Initial program 33.9%
associate-/r/33.8%
associate-*r*33.8%
*-commutative33.8%
associate-*r/33.8%
sub-neg33.8%
distribute-lft-in33.7%
fma-def33.8%
metadata-eval33.8%
metadata-eval33.8%
Simplified33.8%
Taylor expanded in n around inf 20.1%
associate-/l*20.1%
*-commutative20.1%
fma-neg20.1%
metadata-eval20.1%
Simplified20.1%
Taylor expanded in i around 0 64.1%
associate-+r+64.1%
+-commutative64.1%
*-commutative64.1%
fma-def64.1%
*-commutative64.1%
unpow264.1%
Simplified64.1%
fma-udef64.1%
Applied egg-rr64.1%
if 1.8000000000000001e57 < n Initial program 11.1%
associate-/r/11.8%
associate-*r*11.8%
*-commutative11.8%
associate-*r/11.8%
sub-neg11.8%
distribute-lft-in11.8%
fma-def11.8%
metadata-eval11.8%
metadata-eval11.8%
Simplified11.8%
Taylor expanded in n around inf 47.3%
Taylor expanded in i around 0 70.9%
Final simplification65.2%
(FPCore (i n)
:precision binary64
(if (<= n -7.8e-19)
(/ n (+ 0.01 (* i -0.005)))
(if (<= n 0.065)
(/ n (+ 0.01 (* (* i i) 0.0008333333333333334)))
(* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -7.8e-19) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 0.065) {
tmp = n / (0.01 + ((i * i) * 0.0008333333333333334));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-7.8d-19)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 0.065d0) then
tmp = n / (0.01d0 + ((i * i) * 0.0008333333333333334d0))
else
tmp = n * (100.0d0 + (i * 50.0d0))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -7.8e-19) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 0.065) {
tmp = n / (0.01 + ((i * i) * 0.0008333333333333334));
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -7.8e-19: tmp = n / (0.01 + (i * -0.005)) elif n <= 0.065: tmp = n / (0.01 + ((i * i) * 0.0008333333333333334)) else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -7.8e-19) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 0.065) tmp = Float64(n / Float64(0.01 + Float64(Float64(i * i) * 0.0008333333333333334))); else tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -7.8e-19) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 0.065) tmp = n / (0.01 + ((i * i) * 0.0008333333333333334)); else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -7.8e-19], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.065], N[(n / N[(0.01 + N[(N[(i * i), $MachinePrecision] * 0.0008333333333333334), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -7.8 \cdot 10^{-19}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 0.065:\\
\;\;\;\;\frac{n}{0.01 + \left(i \cdot i\right) \cdot 0.0008333333333333334}\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -7.7999999999999999e-19Initial program 21.0%
associate-/r/21.4%
associate-*r*21.5%
*-commutative21.5%
associate-*r/21.5%
sub-neg21.5%
distribute-lft-in21.5%
fma-def21.5%
metadata-eval21.5%
metadata-eval21.5%
Simplified21.5%
Taylor expanded in n around inf 38.0%
associate-/l*38.0%
*-commutative38.0%
fma-neg38.0%
metadata-eval38.0%
Simplified38.0%
Taylor expanded in i around 0 62.8%
*-commutative62.8%
Simplified62.8%
if -7.7999999999999999e-19 < n < 0.065000000000000002Initial program 35.1%
associate-/r/35.0%
associate-*r*35.0%
*-commutative35.0%
associate-*r/35.0%
sub-neg35.0%
distribute-lft-in34.9%
fma-def35.0%
metadata-eval35.0%
metadata-eval35.0%
Simplified35.0%
Taylor expanded in n around inf 19.8%
associate-/l*19.8%
*-commutative19.8%
fma-neg19.8%
metadata-eval19.8%
Simplified19.8%
Taylor expanded in i around 0 62.2%
associate-+r+62.2%
+-commutative62.2%
*-commutative62.2%
fma-def62.2%
*-commutative62.2%
unpow262.2%
Simplified62.2%
Taylor expanded in i around 0 62.2%
if 0.065000000000000002 < n Initial program 13.6%
associate-/r/14.2%
associate-*r*14.2%
*-commutative14.2%
associate-*r/14.2%
sub-neg14.2%
distribute-lft-in14.2%
fma-def14.2%
metadata-eval14.2%
metadata-eval14.2%
Simplified14.2%
Taylor expanded in i around 0 71.8%
associate-*r*71.8%
*-commutative71.8%
associate-*r/71.8%
metadata-eval71.8%
Simplified71.8%
Taylor expanded in n around inf 71.8%
*-commutative71.8%
Simplified71.8%
Final simplification65.1%
(FPCore (i n) :precision binary64 (if (or (<= n -1.4e-129) (not (<= n 2.1e-116))) (* n (+ 100.0 (* i 50.0))) 0.0))
double code(double i, double n) {
double tmp;
if ((n <= -1.4e-129) || !(n <= 2.1e-116)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(i, n)
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if ((n <= (-1.4d-129)) .or. (.not. (n <= 2.1d-116))) then
tmp = n * (100.0d0 + (i * 50.0d0))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if ((n <= -1.4e-129) || !(n <= 2.1e-116)) {
tmp = n * (100.0 + (i * 50.0));
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if (n <= -1.4e-129) or not (n <= 2.1e-116): tmp = n * (100.0 + (i * 50.0)) else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if ((n <= -1.4e-129) || !(n <= 2.1e-116)) tmp = Float64(n * Float64(100.0 + Float64(i * 50.0))); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if ((n <= -1.4e-129) || ~((n <= 2.1e-116))) tmp = n * (100.0 + (i * 50.0)); else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[Or[LessEqual[n, -1.4e-129], N[Not[LessEqual[n, 2.1e-116]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.4 \cdot 10^{-129} \lor \neg \left(n \leq 2.1 \cdot 10^{-116}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if n < -1.4e-129 or 2.0999999999999999e-116 < n Initial program 17.7%
associate-/r/18.1%
associate-*r*18.1%
*-commutative18.1%
associate-*r/18.1%
sub-neg18.1%
distribute-lft-in18.1%
fma-def18.1%
metadata-eval18.1%
metadata-eval18.1%
Simplified18.1%
Taylor expanded in i around 0 60.5%
associate-*r*60.5%
*-commutative60.5%
associate-*r/60.5%
metadata-eval60.5%
Simplified60.5%
Taylor expanded in n around inf 60.9%
*-commutative60.9%
Simplified60.9%
if -1.4e-129 < n < 2.0999999999999999e-116Initial program 48.6%
Taylor expanded in i around 0 62.1%
Taylor expanded in i around 0 62.1%
Final simplification61.1%
(FPCore (i n) :precision binary64 (if (<= n -9e-240) (/ n (+ 0.01 (* i -0.005))) (if (<= n 2.1e-116) 0.0 (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
double tmp;
if (n <= -9e-240) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 2.1e-116) {
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 (n <= (-9d-240)) then
tmp = n / (0.01d0 + (i * (-0.005d0)))
else if (n <= 2.1d-116) 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 (n <= -9e-240) {
tmp = n / (0.01 + (i * -0.005));
} else if (n <= 2.1e-116) {
tmp = 0.0;
} else {
tmp = n * (100.0 + (i * 50.0));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -9e-240: tmp = n / (0.01 + (i * -0.005)) elif n <= 2.1e-116: tmp = 0.0 else: tmp = n * (100.0 + (i * 50.0)) return tmp
function code(i, n) tmp = 0.0 if (n <= -9e-240) tmp = Float64(n / Float64(0.01 + Float64(i * -0.005))); elseif (n <= 2.1e-116) 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 (n <= -9e-240) tmp = n / (0.01 + (i * -0.005)); elseif (n <= 2.1e-116) tmp = 0.0; else tmp = n * (100.0 + (i * 50.0)); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -9e-240], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.1e-116], 0.0, N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -9 \cdot 10^{-240}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{elif}\;n \leq 2.1 \cdot 10^{-116}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\
\end{array}
\end{array}
if n < -9.0000000000000003e-240Initial program 23.9%
associate-/r/24.1%
associate-*r*24.1%
*-commutative24.1%
associate-*r/24.1%
sub-neg24.1%
distribute-lft-in24.2%
fma-def24.1%
metadata-eval24.1%
metadata-eval24.1%
Simplified24.1%
Taylor expanded in n around inf 32.5%
associate-/l*32.5%
*-commutative32.5%
fma-neg32.5%
metadata-eval32.5%
Simplified32.5%
Taylor expanded in i around 0 59.8%
*-commutative59.8%
Simplified59.8%
if -9.0000000000000003e-240 < n < 2.0999999999999999e-116Initial program 47.8%
Taylor expanded in i around 0 67.8%
Taylor expanded in i around 0 67.8%
if 2.0999999999999999e-116 < n Initial program 15.1%
associate-/r/15.6%
associate-*r*15.6%
*-commutative15.6%
associate-*r/15.6%
sub-neg15.6%
distribute-lft-in15.6%
fma-def15.6%
metadata-eval15.6%
metadata-eval15.6%
Simplified15.6%
Taylor expanded in i around 0 66.6%
associate-*r*66.6%
*-commutative66.6%
associate-*r/66.6%
metadata-eval66.6%
Simplified66.6%
Taylor expanded in n around inf 67.0%
*-commutative67.0%
Simplified67.0%
Final simplification63.5%
(FPCore (i n) :precision binary64 (if (<= i -8.2e+34) 0.0 (if (<= i 5.8e+24) (* n 100.0) 0.0)))
double code(double i, double n) {
double tmp;
if (i <= -8.2e+34) {
tmp = 0.0;
} else if (i <= 5.8e+24) {
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 <= (-8.2d+34)) then
tmp = 0.0d0
else if (i <= 5.8d+24) 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 <= -8.2e+34) {
tmp = 0.0;
} else if (i <= 5.8e+24) {
tmp = n * 100.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(i, n): tmp = 0 if i <= -8.2e+34: tmp = 0.0 elif i <= 5.8e+24: tmp = n * 100.0 else: tmp = 0.0 return tmp
function code(i, n) tmp = 0.0 if (i <= -8.2e+34) tmp = 0.0; elseif (i <= 5.8e+24) tmp = Float64(n * 100.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (i <= -8.2e+34) tmp = 0.0; elseif (i <= 5.8e+24) tmp = n * 100.0; else tmp = 0.0; end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[i, -8.2e+34], 0.0, If[LessEqual[i, 5.8e+24], N[(n * 100.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \leq -8.2 \cdot 10^{+34}:\\
\;\;\;\;0\\
\mathbf{elif}\;i \leq 5.8 \cdot 10^{+24}:\\
\;\;\;\;n \cdot 100\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if i < -8.1999999999999997e34 or 5.79999999999999958e24 < i Initial program 51.5%
Taylor expanded in i around 0 32.8%
Taylor expanded in i around 0 32.8%
if -8.1999999999999997e34 < i < 5.79999999999999958e24Initial program 8.5%
Taylor expanded in i around 0 76.0%
*-commutative76.0%
Simplified76.0%
Final simplification60.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 24.0%
Taylor expanded in i around 0 16.0%
Taylor expanded in i around 0 16.4%
Final simplification16.4%
(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 2023230
(FPCore (i n)
:name "Compound Interest"
:precision binary64
:herbie-target
(* 100.0 (/ (- (exp (* n (if (== (+ 1.0 (/ i n)) 1.0) (/ i n) (/ (* (/ i n) (log (+ 1.0 (/ i n)))) (- (+ (/ i n) 1.0) 1.0))))) 1.0) (/ i n)))
(* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))