
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
(FPCore (a k m) :precision binary64 (let* ((t_0 (hypot 1.0 (* k (hypot 1.0 (sqrt (/ 10.0 k))))))) (if (<= k 1e-99) (/ a (/ 1.0 (pow k m))) (/ (/ (* a (pow k m)) t_0) t_0))))
double code(double a, double k, double m) {
double t_0 = hypot(1.0, (k * hypot(1.0, sqrt((10.0 / k)))));
double tmp;
if (k <= 1e-99) {
tmp = a / (1.0 / pow(k, m));
} else {
tmp = ((a * pow(k, m)) / t_0) / t_0;
}
return tmp;
}
public static double code(double a, double k, double m) {
double t_0 = Math.hypot(1.0, (k * Math.hypot(1.0, Math.sqrt((10.0 / k)))));
double tmp;
if (k <= 1e-99) {
tmp = a / (1.0 / Math.pow(k, m));
} else {
tmp = ((a * Math.pow(k, m)) / t_0) / t_0;
}
return tmp;
}
def code(a, k, m): t_0 = math.hypot(1.0, (k * math.hypot(1.0, math.sqrt((10.0 / k))))) tmp = 0 if k <= 1e-99: tmp = a / (1.0 / math.pow(k, m)) else: tmp = ((a * math.pow(k, m)) / t_0) / t_0 return tmp
function code(a, k, m) t_0 = hypot(1.0, Float64(k * hypot(1.0, sqrt(Float64(10.0 / k))))) tmp = 0.0 if (k <= 1e-99) tmp = Float64(a / Float64(1.0 / (k ^ m))); else tmp = Float64(Float64(Float64(a * (k ^ m)) / t_0) / t_0); end return tmp end
function tmp_2 = code(a, k, m) t_0 = hypot(1.0, (k * hypot(1.0, sqrt((10.0 / k))))); tmp = 0.0; if (k <= 1e-99) tmp = a / (1.0 / (k ^ m)); else tmp = ((a * (k ^ m)) / t_0) / t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[Sqrt[1.0 ^ 2 + N[(k * N[Sqrt[1.0 ^ 2 + N[Sqrt[N[(10.0 / k), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[k, 1e-99], N[(a / N[(1.0 / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(1, k \cdot \mathsf{hypot}\left(1, \sqrt{\frac{10}{k}}\right)\right)\\
\mathbf{if}\;k \leq 10^{-99}:\\
\;\;\;\;\frac{a}{\frac{1}{{k}^{m}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a \cdot {k}^{m}}{t\_0}}{t\_0}\\
\end{array}
\end{array}
if k < 1e-99Initial program 96.1%
associate-/l*96.1%
remove-double-neg96.1%
distribute-frac-neg296.1%
distribute-neg-frac296.1%
remove-double-neg96.1%
sqr-neg96.1%
associate-+l+96.1%
sqr-neg96.1%
distribute-rgt-out96.1%
Simplified96.1%
clear-num96.1%
un-div-inv96.1%
+-commutative96.1%
fma-define96.1%
+-commutative96.1%
Applied egg-rr96.1%
Taylor expanded in k around 0 100.0%
if 1e-99 < k Initial program 88.6%
associate-/l*88.5%
remove-double-neg88.5%
distribute-frac-neg288.5%
distribute-neg-frac288.5%
remove-double-neg88.5%
sqr-neg88.5%
associate-+l+88.5%
sqr-neg88.5%
distribute-rgt-out88.5%
Simplified88.5%
Taylor expanded in k around inf 88.5%
associate-*r/88.5%
metadata-eval88.5%
Simplified88.5%
associate-*r/88.6%
add-sqr-sqrt88.5%
associate-/r*88.5%
Applied egg-rr99.9%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (hypot 1.0 (* k (sqrt (+ (/ 10.0 k) 1.0))))))
(if (<= k 1.1e-9)
(* a (* (pow k m) (fma k -10.0 1.0)))
(/ (* a (/ (pow k m) t_0)) t_0))))
double code(double a, double k, double m) {
double t_0 = hypot(1.0, (k * sqrt(((10.0 / k) + 1.0))));
double tmp;
if (k <= 1.1e-9) {
tmp = a * (pow(k, m) * fma(k, -10.0, 1.0));
} else {
tmp = (a * (pow(k, m) / t_0)) / t_0;
}
return tmp;
}
function code(a, k, m) t_0 = hypot(1.0, Float64(k * sqrt(Float64(Float64(10.0 / k) + 1.0)))) tmp = 0.0 if (k <= 1.1e-9) tmp = Float64(a * Float64((k ^ m) * fma(k, -10.0, 1.0))); else tmp = Float64(Float64(a * Float64((k ^ m) / t_0)) / t_0); end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[Sqrt[1.0 ^ 2 + N[(k * N[Sqrt[N[(N[(10.0 / k), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[k, 1.1e-9], N[(a * N[(N[Power[k, m], $MachinePrecision] * N[(k * -10.0 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(N[Power[k, m], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(1, k \cdot \sqrt{\frac{10}{k} + 1}\right)\\
\mathbf{if}\;k \leq 1.1 \cdot 10^{-9}:\\
\;\;\;\;a \cdot \left({k}^{m} \cdot \mathsf{fma}\left(k, -10, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a \cdot \frac{{k}^{m}}{t\_0}}{t\_0}\\
\end{array}
\end{array}
if k < 1.0999999999999999e-9Initial program 96.8%
associate-/l*96.8%
remove-double-neg96.8%
distribute-frac-neg296.8%
distribute-neg-frac296.8%
remove-double-neg96.8%
sqr-neg96.8%
associate-+l+96.8%
sqr-neg96.8%
distribute-rgt-out96.8%
Simplified96.8%
Taylor expanded in k around 0 86.7%
associate-*r*86.7%
*-lft-identity86.7%
distribute-rgt-out100.0%
*-commutative100.0%
fma-define100.0%
Simplified100.0%
if 1.0999999999999999e-9 < k Initial program 85.2%
associate-/l*85.2%
remove-double-neg85.2%
distribute-frac-neg285.2%
distribute-neg-frac285.2%
remove-double-neg85.2%
sqr-neg85.2%
associate-+l+85.2%
sqr-neg85.2%
distribute-rgt-out85.2%
Simplified85.2%
Taylor expanded in k around inf 85.2%
associate-*r/85.2%
metadata-eval85.2%
Simplified85.2%
*-un-lft-identity85.2%
add-sqr-sqrt85.2%
times-frac85.1%
add-sqr-sqrt85.1%
hypot-1-def85.1%
associate-*r*85.1%
sqrt-prod85.1%
sqrt-unprod85.0%
add-sqr-sqrt85.1%
add-sqr-sqrt85.1%
hypot-1-def85.1%
Applied egg-rr95.2%
associate-*l/95.2%
*-lft-identity95.2%
hypot-undefine95.2%
metadata-eval95.2%
rem-square-sqrt95.2%
hypot-undefine95.2%
metadata-eval95.2%
rem-square-sqrt95.2%
Simplified95.2%
associate-*r/99.8%
Applied egg-rr99.8%
Final simplification99.9%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (hypot 1.0 (* k (sqrt (+ (/ 10.0 k) 1.0))))))
(if (<= k 1e-9)
(* a (* (pow k m) (fma k -10.0 1.0)))
(* a (/ (/ (pow k m) t_0) t_0)))))
double code(double a, double k, double m) {
double t_0 = hypot(1.0, (k * sqrt(((10.0 / k) + 1.0))));
double tmp;
if (k <= 1e-9) {
tmp = a * (pow(k, m) * fma(k, -10.0, 1.0));
} else {
tmp = a * ((pow(k, m) / t_0) / t_0);
}
return tmp;
}
function code(a, k, m) t_0 = hypot(1.0, Float64(k * sqrt(Float64(Float64(10.0 / k) + 1.0)))) tmp = 0.0 if (k <= 1e-9) tmp = Float64(a * Float64((k ^ m) * fma(k, -10.0, 1.0))); else tmp = Float64(a * Float64(Float64((k ^ m) / t_0) / t_0)); end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[Sqrt[1.0 ^ 2 + N[(k * N[Sqrt[N[(N[(10.0 / k), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[k, 1e-9], N[(a * N[(N[Power[k, m], $MachinePrecision] * N[(k * -10.0 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(N[(N[Power[k, m], $MachinePrecision] / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(1, k \cdot \sqrt{\frac{10}{k} + 1}\right)\\
\mathbf{if}\;k \leq 10^{-9}:\\
\;\;\;\;a \cdot \left({k}^{m} \cdot \mathsf{fma}\left(k, -10, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{\frac{{k}^{m}}{t\_0}}{t\_0}\\
\end{array}
\end{array}
if k < 1.00000000000000006e-9Initial program 96.8%
associate-/l*96.8%
remove-double-neg96.8%
distribute-frac-neg296.8%
distribute-neg-frac296.8%
remove-double-neg96.8%
sqr-neg96.8%
associate-+l+96.8%
sqr-neg96.8%
distribute-rgt-out96.8%
Simplified96.8%
Taylor expanded in k around 0 86.7%
associate-*r*86.7%
*-lft-identity86.7%
distribute-rgt-out100.0%
*-commutative100.0%
fma-define100.0%
Simplified100.0%
if 1.00000000000000006e-9 < k Initial program 85.2%
associate-/l*85.2%
remove-double-neg85.2%
distribute-frac-neg285.2%
distribute-neg-frac285.2%
remove-double-neg85.2%
sqr-neg85.2%
associate-+l+85.2%
sqr-neg85.2%
distribute-rgt-out85.2%
Simplified85.2%
Taylor expanded in k around inf 85.2%
associate-*r/85.2%
metadata-eval85.2%
Simplified85.2%
*-un-lft-identity85.2%
add-sqr-sqrt85.2%
times-frac85.1%
add-sqr-sqrt85.1%
hypot-1-def85.1%
associate-*r*85.1%
sqrt-prod85.1%
sqrt-unprod85.0%
add-sqr-sqrt85.1%
add-sqr-sqrt85.1%
hypot-1-def85.1%
Applied egg-rr95.2%
associate-*l/95.2%
*-lft-identity95.2%
hypot-undefine95.2%
metadata-eval95.2%
rem-square-sqrt95.2%
hypot-undefine95.2%
metadata-eval95.2%
rem-square-sqrt95.2%
Simplified95.2%
Final simplification98.2%
(FPCore (a k m) :precision binary64 (if (<= m 0.75) (/ a (/ (fma k (+ k 10.0) 1.0) (pow k m))) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.75) {
tmp = a / (fma(k, (k + 10.0), 1.0) / pow(k, m));
} else {
tmp = a * pow(k, m);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= 0.75) tmp = Float64(a / Float64(fma(k, Float64(k + 10.0), 1.0) / (k ^ m))); else tmp = Float64(a * (k ^ m)); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, 0.75], N[(a / N[(N[(k * N[(k + 10.0), $MachinePrecision] + 1.0), $MachinePrecision] / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.75:\\
\;\;\;\;\frac{a}{\frac{\mathsf{fma}\left(k, k + 10, 1\right)}{{k}^{m}}}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 0.75Initial program 96.8%
associate-/l*96.8%
remove-double-neg96.8%
distribute-frac-neg296.8%
distribute-neg-frac296.8%
remove-double-neg96.8%
sqr-neg96.8%
associate-+l+96.8%
sqr-neg96.8%
distribute-rgt-out96.8%
Simplified96.8%
clear-num96.8%
un-div-inv96.8%
+-commutative96.8%
fma-define96.9%
+-commutative96.9%
Applied egg-rr96.9%
if 0.75 < m Initial program 82.7%
associate-/l*82.7%
remove-double-neg82.7%
distribute-frac-neg282.7%
distribute-neg-frac282.7%
remove-double-neg82.7%
sqr-neg82.7%
associate-+l+82.7%
sqr-neg82.7%
distribute-rgt-out82.7%
Simplified82.7%
Taylor expanded in k around 0 100.0%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* a (pow k m)))) (if (<= m 0.75) (/ t_0 (+ (* k k) (+ (* k 10.0) 1.0))) t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if (m <= 0.75) {
tmp = t_0 / ((k * k) + ((k * 10.0) + 1.0));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = a * (k ** m)
if (m <= 0.75d0) then
tmp = t_0 / ((k * k) + ((k * 10.0d0) + 1.0d0))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a * Math.pow(k, m);
double tmp;
if (m <= 0.75) {
tmp = t_0 / ((k * k) + ((k * 10.0) + 1.0));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if m <= 0.75: tmp = t_0 / ((k * k) + ((k * 10.0) + 1.0)) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (m <= 0.75) tmp = Float64(t_0 / Float64(Float64(k * k) + Float64(Float64(k * 10.0) + 1.0))); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); tmp = 0.0; if (m <= 0.75) tmp = t_0 / ((k * k) + ((k * 10.0) + 1.0)); else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, 0.75], N[(t$95$0 / N[(N[(k * k), $MachinePrecision] + N[(N[(k * 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;m \leq 0.75:\\
\;\;\;\;\frac{t\_0}{k \cdot k + \left(k \cdot 10 + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < 0.75Initial program 96.8%
if 0.75 < m Initial program 82.7%
associate-/l*82.7%
remove-double-neg82.7%
distribute-frac-neg282.7%
distribute-neg-frac282.7%
remove-double-neg82.7%
sqr-neg82.7%
associate-+l+82.7%
sqr-neg82.7%
distribute-rgt-out82.7%
Simplified82.7%
Taylor expanded in k around 0 100.0%
Final simplification97.8%
(FPCore (a k m) :precision binary64 (if (<= m 0.75) (* a (/ (pow k m) (+ (* k (+ k 10.0)) 1.0))) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.75) {
tmp = a * (pow(k, m) / ((k * (k + 10.0)) + 1.0));
} else {
tmp = a * pow(k, m);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 0.75d0) then
tmp = a * ((k ** m) / ((k * (k + 10.0d0)) + 1.0d0))
else
tmp = a * (k ** m)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 0.75) {
tmp = a * (Math.pow(k, m) / ((k * (k + 10.0)) + 1.0));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.75: tmp = a * (math.pow(k, m) / ((k * (k + 10.0)) + 1.0)) else: tmp = a * math.pow(k, m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.75) tmp = Float64(a * Float64((k ^ m) / Float64(Float64(k * Float64(k + 10.0)) + 1.0))); else tmp = Float64(a * (k ^ m)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 0.75) tmp = a * ((k ^ m) / ((k * (k + 10.0)) + 1.0)); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.75], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.75:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{k \cdot \left(k + 10\right) + 1}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 0.75Initial program 96.8%
associate-/l*96.8%
remove-double-neg96.8%
distribute-frac-neg296.8%
distribute-neg-frac296.8%
remove-double-neg96.8%
sqr-neg96.8%
associate-+l+96.8%
sqr-neg96.8%
distribute-rgt-out96.8%
Simplified96.8%
if 0.75 < m Initial program 82.7%
associate-/l*82.7%
remove-double-neg82.7%
distribute-frac-neg282.7%
distribute-neg-frac282.7%
remove-double-neg82.7%
sqr-neg82.7%
associate-+l+82.7%
sqr-neg82.7%
distribute-rgt-out82.7%
Simplified82.7%
Taylor expanded in k around 0 100.0%
Final simplification97.8%
(FPCore (a k m) :precision binary64 (if (or (<= m -0.00055) (not (<= m 0.0045))) (* a (pow k m)) (/ a (+ (* k k) (+ (* k 10.0) 1.0)))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -0.00055) || !(m <= 0.0045)) {
tmp = a * pow(k, m);
} else {
tmp = a / ((k * k) + ((k * 10.0) + 1.0));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((m <= (-0.00055d0)) .or. (.not. (m <= 0.0045d0))) then
tmp = a * (k ** m)
else
tmp = a / ((k * k) + ((k * 10.0d0) + 1.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((m <= -0.00055) || !(m <= 0.0045)) {
tmp = a * Math.pow(k, m);
} else {
tmp = a / ((k * k) + ((k * 10.0) + 1.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -0.00055) or not (m <= 0.0045): tmp = a * math.pow(k, m) else: tmp = a / ((k * k) + ((k * 10.0) + 1.0)) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -0.00055) || !(m <= 0.0045)) tmp = Float64(a * (k ^ m)); else tmp = Float64(a / Float64(Float64(k * k) + Float64(Float64(k * 10.0) + 1.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((m <= -0.00055) || ~((m <= 0.0045))) tmp = a * (k ^ m); else tmp = a / ((k * k) + ((k * 10.0) + 1.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -0.00055], N[Not[LessEqual[m, 0.0045]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a / N[(N[(k * k), $MachinePrecision] + N[(N[(k * 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.00055 \lor \neg \left(m \leq 0.0045\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot k + \left(k \cdot 10 + 1\right)}\\
\end{array}
\end{array}
if m < -5.50000000000000033e-4 or 0.00449999999999999966 < m Initial program 91.1%
associate-/l*91.1%
remove-double-neg91.1%
distribute-frac-neg291.1%
distribute-neg-frac291.1%
remove-double-neg91.1%
sqr-neg91.1%
associate-+l+91.1%
sqr-neg91.1%
distribute-rgt-out91.1%
Simplified91.1%
Taylor expanded in k around 0 100.0%
if -5.50000000000000033e-4 < m < 0.00449999999999999966Initial program 94.4%
*-commutative94.4%
Simplified94.4%
Taylor expanded in m around 0 93.0%
Final simplification97.3%
(FPCore (a k m)
:precision binary64
(if (<= m -1.65)
(/ (- (/ (- (* 0.001 (/ a k)) (* a 0.01)) k) (* a -0.1)) k)
(if (<= m 0.75)
(/ a (+ (* k k) (+ (* k 10.0) 1.0)))
(* a (+ (* k (* k 99.0)) 1.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.65) {
tmp = ((((0.001 * (a / k)) - (a * 0.01)) / k) - (a * -0.1)) / k;
} else if (m <= 0.75) {
tmp = a / ((k * k) + ((k * 10.0) + 1.0));
} else {
tmp = a * ((k * (k * 99.0)) + 1.0);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-1.65d0)) then
tmp = ((((0.001d0 * (a / k)) - (a * 0.01d0)) / k) - (a * (-0.1d0))) / k
else if (m <= 0.75d0) then
tmp = a / ((k * k) + ((k * 10.0d0) + 1.0d0))
else
tmp = a * ((k * (k * 99.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1.65) {
tmp = ((((0.001 * (a / k)) - (a * 0.01)) / k) - (a * -0.1)) / k;
} else if (m <= 0.75) {
tmp = a / ((k * k) + ((k * 10.0) + 1.0));
} else {
tmp = a * ((k * (k * 99.0)) + 1.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.65: tmp = ((((0.001 * (a / k)) - (a * 0.01)) / k) - (a * -0.1)) / k elif m <= 0.75: tmp = a / ((k * k) + ((k * 10.0) + 1.0)) else: tmp = a * ((k * (k * 99.0)) + 1.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.65) tmp = Float64(Float64(Float64(Float64(Float64(0.001 * Float64(a / k)) - Float64(a * 0.01)) / k) - Float64(a * -0.1)) / k); elseif (m <= 0.75) tmp = Float64(a / Float64(Float64(k * k) + Float64(Float64(k * 10.0) + 1.0))); else tmp = Float64(a * Float64(Float64(k * Float64(k * 99.0)) + 1.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.65) tmp = ((((0.001 * (a / k)) - (a * 0.01)) / k) - (a * -0.1)) / k; elseif (m <= 0.75) tmp = a / ((k * k) + ((k * 10.0) + 1.0)); else tmp = a * ((k * (k * 99.0)) + 1.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.65], N[(N[(N[(N[(N[(0.001 * N[(a / k), $MachinePrecision]), $MachinePrecision] - N[(a * 0.01), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision] - N[(a * -0.1), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision], If[LessEqual[m, 0.75], N[(a / N[(N[(k * k), $MachinePrecision] + N[(N[(k * 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.65:\\
\;\;\;\;\frac{\frac{0.001 \cdot \frac{a}{k} - a \cdot 0.01}{k} - a \cdot -0.1}{k}\\
\mathbf{elif}\;m \leq 0.75:\\
\;\;\;\;\frac{a}{k \cdot k + \left(k \cdot 10 + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(k \cdot \left(k \cdot 99\right) + 1\right)\\
\end{array}
\end{array}
if m < -1.6499999999999999Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
distribute-neg-frac2100.0%
remove-double-neg100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
expm1-log1p-u80.5%
expm1-undefine80.5%
+-commutative80.5%
fma-define80.5%
Applied egg-rr80.5%
expm1-define80.5%
associate-*r/80.5%
*-rgt-identity80.5%
times-frac80.5%
/-rgt-identity80.5%
Simplified80.5%
Taylor expanded in m around 0 37.7%
Taylor expanded in k around -inf 41.4%
if -1.6499999999999999 < m < 0.75Initial program 94.4%
*-commutative94.4%
Simplified94.4%
Taylor expanded in m around 0 93.0%
if 0.75 < m Initial program 82.7%
associate-/l*82.7%
remove-double-neg82.7%
distribute-frac-neg282.7%
distribute-neg-frac282.7%
remove-double-neg82.7%
sqr-neg82.7%
associate-+l+82.7%
sqr-neg82.7%
distribute-rgt-out82.7%
Simplified82.7%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 27.6%
Taylor expanded in k around inf 27.6%
*-commutative27.6%
Simplified27.6%
Final simplification56.8%
(FPCore (a k m) :precision binary64 (if (<= m -0.225) (* (/ a k) 0.1) (if (<= m 78000000000000.0) (/ a (+ (* k 10.0) 1.0)) (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.225) {
tmp = (a / k) * 0.1;
} else if (m <= 78000000000000.0) {
tmp = a / ((k * 10.0) + 1.0);
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-0.225d0)) then
tmp = (a / k) * 0.1d0
else if (m <= 78000000000000.0d0) then
tmp = a / ((k * 10.0d0) + 1.0d0)
else
tmp = (-10.0d0) * (k * a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.225) {
tmp = (a / k) * 0.1;
} else if (m <= 78000000000000.0) {
tmp = a / ((k * 10.0) + 1.0);
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.225: tmp = (a / k) * 0.1 elif m <= 78000000000000.0: tmp = a / ((k * 10.0) + 1.0) else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.225) tmp = Float64(Float64(a / k) * 0.1); elseif (m <= 78000000000000.0) tmp = Float64(a / Float64(Float64(k * 10.0) + 1.0)); else tmp = Float64(-10.0 * Float64(k * a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.225) tmp = (a / k) * 0.1; elseif (m <= 78000000000000.0) tmp = a / ((k * 10.0) + 1.0); else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.225], N[(N[(a / k), $MachinePrecision] * 0.1), $MachinePrecision], If[LessEqual[m, 78000000000000.0], N[(a / N[(N[(k * 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.225:\\
\;\;\;\;\frac{a}{k} \cdot 0.1\\
\mathbf{elif}\;m \leq 78000000000000:\\
\;\;\;\;\frac{a}{k \cdot 10 + 1}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -0.225000000000000006Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
distribute-neg-frac2100.0%
remove-double-neg100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
expm1-log1p-u80.5%
expm1-undefine80.5%
+-commutative80.5%
fma-define80.5%
Applied egg-rr80.5%
expm1-define80.5%
associate-*r/80.5%
*-rgt-identity80.5%
times-frac80.5%
/-rgt-identity80.5%
Simplified80.5%
Taylor expanded in m around 0 37.7%
Taylor expanded in k around inf 29.1%
*-commutative29.1%
Simplified29.1%
if -0.225000000000000006 < m < 7.8e13Initial program 94.6%
associate-/l*94.5%
remove-double-neg94.5%
distribute-frac-neg294.5%
distribute-neg-frac294.5%
remove-double-neg94.5%
sqr-neg94.5%
associate-+l+94.5%
sqr-neg94.5%
distribute-rgt-out94.5%
Simplified94.5%
Taylor expanded in m around 0 89.5%
Taylor expanded in k around 0 59.7%
*-commutative64.3%
Simplified59.7%
if 7.8e13 < m Initial program 81.8%
associate-/l*81.8%
remove-double-neg81.8%
distribute-frac-neg281.8%
distribute-neg-frac281.8%
remove-double-neg81.8%
sqr-neg81.8%
associate-+l+81.8%
sqr-neg81.8%
distribute-rgt-out81.8%
Simplified81.8%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 5.4%
*-commutative5.4%
Simplified5.4%
Taylor expanded in k around inf 15.7%
Final simplification37.3%
(FPCore (a k m) :precision binary64 (if (<= m 0.75) (/ a (+ (* k k) (+ (* k 10.0) 1.0))) (* a (+ (* k (* k 99.0)) 1.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.75) {
tmp = a / ((k * k) + ((k * 10.0) + 1.0));
} else {
tmp = a * ((k * (k * 99.0)) + 1.0);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 0.75d0) then
tmp = a / ((k * k) + ((k * 10.0d0) + 1.0d0))
else
tmp = a * ((k * (k * 99.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 0.75) {
tmp = a / ((k * k) + ((k * 10.0) + 1.0));
} else {
tmp = a * ((k * (k * 99.0)) + 1.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.75: tmp = a / ((k * k) + ((k * 10.0) + 1.0)) else: tmp = a * ((k * (k * 99.0)) + 1.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.75) tmp = Float64(a / Float64(Float64(k * k) + Float64(Float64(k * 10.0) + 1.0))); else tmp = Float64(a * Float64(Float64(k * Float64(k * 99.0)) + 1.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 0.75) tmp = a / ((k * k) + ((k * 10.0) + 1.0)); else tmp = a * ((k * (k * 99.0)) + 1.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.75], N[(a / N[(N[(k * k), $MachinePrecision] + N[(N[(k * 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.75:\\
\;\;\;\;\frac{a}{k \cdot k + \left(k \cdot 10 + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(k \cdot \left(k \cdot 99\right) + 1\right)\\
\end{array}
\end{array}
if m < 0.75Initial program 96.8%
*-commutative96.8%
Simplified96.8%
Taylor expanded in m around 0 66.0%
if 0.75 < m Initial program 82.7%
associate-/l*82.7%
remove-double-neg82.7%
distribute-frac-neg282.7%
distribute-neg-frac282.7%
remove-double-neg82.7%
sqr-neg82.7%
associate-+l+82.7%
sqr-neg82.7%
distribute-rgt-out82.7%
Simplified82.7%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 27.6%
Taylor expanded in k around inf 27.6%
*-commutative27.6%
Simplified27.6%
Final simplification53.8%
(FPCore (a k m) :precision binary64 (if (<= m -2.85e-12) (* (/ a k) 0.1) (if (<= m 80000000000000.0) a (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -2.85e-12) {
tmp = (a / k) * 0.1;
} else if (m <= 80000000000000.0) {
tmp = a;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-2.85d-12)) then
tmp = (a / k) * 0.1d0
else if (m <= 80000000000000.0d0) then
tmp = a
else
tmp = (-10.0d0) * (k * a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -2.85e-12) {
tmp = (a / k) * 0.1;
} else if (m <= 80000000000000.0) {
tmp = a;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -2.85e-12: tmp = (a / k) * 0.1 elif m <= 80000000000000.0: tmp = a else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -2.85e-12) tmp = Float64(Float64(a / k) * 0.1); elseif (m <= 80000000000000.0) tmp = a; else tmp = Float64(-10.0 * Float64(k * a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -2.85e-12) tmp = (a / k) * 0.1; elseif (m <= 80000000000000.0) tmp = a; else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -2.85e-12], N[(N[(a / k), $MachinePrecision] * 0.1), $MachinePrecision], If[LessEqual[m, 80000000000000.0], a, N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -2.85 \cdot 10^{-12}:\\
\;\;\;\;\frac{a}{k} \cdot 0.1\\
\mathbf{elif}\;m \leq 80000000000000:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -2.8500000000000002e-12Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
distribute-neg-frac2100.0%
remove-double-neg100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in k around 0 98.8%
*-commutative98.8%
Simplified98.8%
expm1-log1p-u80.0%
expm1-undefine80.1%
+-commutative80.1%
fma-define80.1%
Applied egg-rr80.1%
expm1-define80.0%
associate-*r/80.0%
*-rgt-identity80.0%
times-frac80.0%
/-rgt-identity80.0%
Simplified80.0%
Taylor expanded in m around 0 38.8%
Taylor expanded in k around inf 29.4%
*-commutative29.4%
Simplified29.4%
if -2.8500000000000002e-12 < m < 8e13Initial program 94.4%
associate-/l*94.4%
remove-double-neg94.4%
distribute-frac-neg294.4%
distribute-neg-frac294.4%
remove-double-neg94.4%
sqr-neg94.4%
associate-+l+94.4%
sqr-neg94.4%
distribute-rgt-out94.4%
Simplified94.4%
Taylor expanded in m around 0 89.7%
Taylor expanded in k around 0 51.3%
if 8e13 < m Initial program 81.8%
associate-/l*81.8%
remove-double-neg81.8%
distribute-frac-neg281.8%
distribute-neg-frac281.8%
remove-double-neg81.8%
sqr-neg81.8%
associate-+l+81.8%
sqr-neg81.8%
distribute-rgt-out81.8%
Simplified81.8%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 5.4%
*-commutative5.4%
Simplified5.4%
Taylor expanded in k around inf 15.7%
Final simplification33.7%
(FPCore (a k m) :precision binary64 (if (<= m 0.75) (/ a (+ (* k (+ k 10.0)) 1.0)) (* a (+ (* k (* k 99.0)) 1.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.75) {
tmp = a / ((k * (k + 10.0)) + 1.0);
} else {
tmp = a * ((k * (k * 99.0)) + 1.0);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 0.75d0) then
tmp = a / ((k * (k + 10.0d0)) + 1.0d0)
else
tmp = a * ((k * (k * 99.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 0.75) {
tmp = a / ((k * (k + 10.0)) + 1.0);
} else {
tmp = a * ((k * (k * 99.0)) + 1.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.75: tmp = a / ((k * (k + 10.0)) + 1.0) else: tmp = a * ((k * (k * 99.0)) + 1.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.75) tmp = Float64(a / Float64(Float64(k * Float64(k + 10.0)) + 1.0)); else tmp = Float64(a * Float64(Float64(k * Float64(k * 99.0)) + 1.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 0.75) tmp = a / ((k * (k + 10.0)) + 1.0); else tmp = a * ((k * (k * 99.0)) + 1.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.75], N[(a / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(a * N[(N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.75:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right) + 1}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(k \cdot \left(k \cdot 99\right) + 1\right)\\
\end{array}
\end{array}
if m < 0.75Initial program 96.8%
associate-/l*96.8%
remove-double-neg96.8%
distribute-frac-neg296.8%
distribute-neg-frac296.8%
remove-double-neg96.8%
sqr-neg96.8%
associate-+l+96.8%
sqr-neg96.8%
distribute-rgt-out96.8%
Simplified96.8%
Taylor expanded in m around 0 66.0%
if 0.75 < m Initial program 82.7%
associate-/l*82.7%
remove-double-neg82.7%
distribute-frac-neg282.7%
distribute-neg-frac282.7%
remove-double-neg82.7%
sqr-neg82.7%
associate-+l+82.7%
sqr-neg82.7%
distribute-rgt-out82.7%
Simplified82.7%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 27.6%
Taylor expanded in k around inf 27.6%
*-commutative27.6%
Simplified27.6%
Final simplification53.8%
(FPCore (a k m) :precision binary64 (if (<= m 0.75) (/ a (+ (* k k) 1.0)) (* a (+ (* k (* k 99.0)) 1.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.75) {
tmp = a / ((k * k) + 1.0);
} else {
tmp = a * ((k * (k * 99.0)) + 1.0);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 0.75d0) then
tmp = a / ((k * k) + 1.0d0)
else
tmp = a * ((k * (k * 99.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 0.75) {
tmp = a / ((k * k) + 1.0);
} else {
tmp = a * ((k * (k * 99.0)) + 1.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.75: tmp = a / ((k * k) + 1.0) else: tmp = a * ((k * (k * 99.0)) + 1.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.75) tmp = Float64(a / Float64(Float64(k * k) + 1.0)); else tmp = Float64(a * Float64(Float64(k * Float64(k * 99.0)) + 1.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 0.75) tmp = a / ((k * k) + 1.0); else tmp = a * ((k * (k * 99.0)) + 1.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.75], N[(a / N[(N[(k * k), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(a * N[(N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.75:\\
\;\;\;\;\frac{a}{k \cdot k + 1}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(k \cdot \left(k \cdot 99\right) + 1\right)\\
\end{array}
\end{array}
if m < 0.75Initial program 96.8%
associate-/l*96.8%
remove-double-neg96.8%
distribute-frac-neg296.8%
distribute-neg-frac296.8%
remove-double-neg96.8%
sqr-neg96.8%
associate-+l+96.8%
sqr-neg96.8%
distribute-rgt-out96.8%
Simplified96.8%
Taylor expanded in m around 0 66.0%
Taylor expanded in k around inf 63.8%
if 0.75 < m Initial program 82.7%
associate-/l*82.7%
remove-double-neg82.7%
distribute-frac-neg282.7%
distribute-neg-frac282.7%
remove-double-neg82.7%
sqr-neg82.7%
associate-+l+82.7%
sqr-neg82.7%
distribute-rgt-out82.7%
Simplified82.7%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 27.6%
Taylor expanded in k around inf 27.6%
*-commutative27.6%
Simplified27.6%
Final simplification52.3%
(FPCore (a k m) :precision binary64 (if (<= m 1.15) (/ a (+ (* k k) 1.0)) (* -10.0 (* k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.15) {
tmp = a / ((k * k) + 1.0);
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 1.15d0) then
tmp = a / ((k * k) + 1.0d0)
else
tmp = (-10.0d0) * (k * a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.15) {
tmp = a / ((k * k) + 1.0);
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.15: tmp = a / ((k * k) + 1.0) else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.15) tmp = Float64(a / Float64(Float64(k * k) + 1.0)); else tmp = Float64(-10.0 * Float64(k * a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.15) tmp = a / ((k * k) + 1.0); else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.15], N[(a / N[(N[(k * k), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.15:\\
\;\;\;\;\frac{a}{k \cdot k + 1}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 1.1499999999999999Initial program 96.9%
associate-/l*96.8%
remove-double-neg96.8%
distribute-frac-neg296.8%
distribute-neg-frac296.8%
remove-double-neg96.8%
sqr-neg96.8%
associate-+l+96.8%
sqr-neg96.8%
distribute-rgt-out96.8%
Simplified96.8%
Taylor expanded in m around 0 65.6%
Taylor expanded in k around inf 63.5%
if 1.1499999999999999 < m Initial program 82.5%
associate-/l*82.5%
remove-double-neg82.5%
distribute-frac-neg282.5%
distribute-neg-frac282.5%
remove-double-neg82.5%
sqr-neg82.5%
associate-+l+82.5%
sqr-neg82.5%
distribute-rgt-out82.5%
Simplified82.5%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 5.3%
*-commutative5.3%
Simplified5.3%
Taylor expanded in k around inf 15.3%
Final simplification48.4%
(FPCore (a k m) :precision binary64 (if (<= m 1.06e+14) a (* -10.0 (* k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.06e+14) {
tmp = a;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 1.06d+14) then
tmp = a
else
tmp = (-10.0d0) * (k * a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.06e+14) {
tmp = a;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.06e+14: tmp = a else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.06e+14) tmp = a; else tmp = Float64(-10.0 * Float64(k * a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.06e+14) tmp = a; else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.06e+14], a, N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.06 \cdot 10^{+14}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 1.06e14Initial program 96.9%
associate-/l*96.9%
remove-double-neg96.9%
distribute-frac-neg296.9%
distribute-neg-frac296.9%
remove-double-neg96.9%
sqr-neg96.9%
associate-+l+96.9%
sqr-neg96.9%
distribute-rgt-out96.9%
Simplified96.9%
Taylor expanded in m around 0 64.6%
Taylor expanded in k around 0 30.4%
if 1.06e14 < m Initial program 81.8%
associate-/l*81.8%
remove-double-neg81.8%
distribute-frac-neg281.8%
distribute-neg-frac281.8%
remove-double-neg81.8%
sqr-neg81.8%
associate-+l+81.8%
sqr-neg81.8%
distribute-rgt-out81.8%
Simplified81.8%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 5.4%
*-commutative5.4%
Simplified5.4%
Taylor expanded in k around inf 15.7%
Final simplification26.0%
(FPCore (a k m) :precision binary64 a)
double code(double a, double k, double m) {
return a;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a
end function
public static double code(double a, double k, double m) {
return a;
}
def code(a, k, m): return a
function code(a, k, m) return a end
function tmp = code(a, k, m) tmp = a; end
code[a_, k_, m_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 92.4%
associate-/l*92.4%
remove-double-neg92.4%
distribute-frac-neg292.4%
distribute-neg-frac292.4%
remove-double-neg92.4%
sqr-neg92.4%
associate-+l+92.4%
sqr-neg92.4%
distribute-rgt-out92.4%
Simplified92.4%
Taylor expanded in m around 0 46.0%
Taylor expanded in k around 0 22.3%
herbie shell --seed 2024130
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))