
(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 18 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
(if (<= k -2.5e+162)
(* a (pow k m))
(if (<= k 5e+140)
(/ a (/ (+ 1.0 (* k (+ k 10.0))) (pow k m)))
(/ (* (pow k m) (/ a k)) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= -2.5e+162) {
tmp = a * pow(k, m);
} else if (k <= 5e+140) {
tmp = a / ((1.0 + (k * (k + 10.0))) / pow(k, m));
} else {
tmp = (pow(k, m) * (a / k)) / k;
}
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 (k <= (-2.5d+162)) then
tmp = a * (k ** m)
else if (k <= 5d+140) then
tmp = a / ((1.0d0 + (k * (k + 10.0d0))) / (k ** m))
else
tmp = ((k ** m) * (a / k)) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= -2.5e+162) {
tmp = a * Math.pow(k, m);
} else if (k <= 5e+140) {
tmp = a / ((1.0 + (k * (k + 10.0))) / Math.pow(k, m));
} else {
tmp = (Math.pow(k, m) * (a / k)) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= -2.5e+162: tmp = a * math.pow(k, m) elif k <= 5e+140: tmp = a / ((1.0 + (k * (k + 10.0))) / math.pow(k, m)) else: tmp = (math.pow(k, m) * (a / k)) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= -2.5e+162) tmp = Float64(a * (k ^ m)); elseif (k <= 5e+140) tmp = Float64(a / Float64(Float64(1.0 + Float64(k * Float64(k + 10.0))) / (k ^ m))); else tmp = Float64(Float64((k ^ m) * Float64(a / k)) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= -2.5e+162) tmp = a * (k ^ m); elseif (k <= 5e+140) tmp = a / ((1.0 + (k * (k + 10.0))) / (k ^ m)); else tmp = ((k ^ m) * (a / k)) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, -2.5e+162], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 5e+140], N[(a / N[(N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[k, m], $MachinePrecision] * N[(a / k), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -2.5 \cdot 10^{+162}:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{elif}\;k \leq 5 \cdot 10^{+140}:\\
\;\;\;\;\frac{a}{\frac{1 + k \cdot \left(k + 10\right)}{{k}^{m}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{{k}^{m} \cdot \frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < -2.4999999999999998e162Initial program 56.3%
associate-*r/56.3%
associate-+l+56.3%
+-commutative56.3%
distribute-rgt-out62.5%
fma-def62.5%
+-commutative62.5%
Simplified62.5%
Taylor expanded in k around 0 0.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -2.4999999999999998e162 < k < 5.00000000000000008e140Initial program 100.0%
associate-/l*100.0%
associate-+l+100.0%
*-commutative100.0%
Simplified100.0%
distribute-lft-out100.0%
+-commutative100.0%
*-commutative100.0%
Applied egg-rr100.0%
if 5.00000000000000008e140 < k Initial program 61.9%
associate-/l*61.9%
associate-+l+61.9%
*-commutative61.9%
Simplified61.9%
Taylor expanded in k around inf 61.9%
unpow261.9%
Simplified61.9%
add-cube-cbrt61.8%
add-sqr-sqrt61.8%
times-frac61.9%
pow261.9%
sqrt-div61.9%
hypot-1-def61.9%
sqrt-div61.9%
hypot-1-def99.4%
Applied egg-rr99.4%
Taylor expanded in k around inf 61.9%
unpow261.9%
times-frac96.4%
mul-1-neg96.4%
exp-neg96.4%
log-rec96.4%
distribute-lft-neg-in96.4%
distribute-rgt-neg-out96.4%
exp-to-pow96.4%
Simplified96.4%
associate-*r/96.5%
pow-flip96.5%
Applied egg-rr96.5%
Final simplification99.2%
(FPCore (a k m) :precision binary64 (let* ((t_0 (/ (hypot 1.0 k) (sqrt (pow k m))))) (* (/ (pow (cbrt a) 2.0) t_0) (/ (cbrt a) t_0))))
double code(double a, double k, double m) {
double t_0 = hypot(1.0, k) / sqrt(pow(k, m));
return (pow(cbrt(a), 2.0) / t_0) * (cbrt(a) / t_0);
}
public static double code(double a, double k, double m) {
double t_0 = Math.hypot(1.0, k) / Math.sqrt(Math.pow(k, m));
return (Math.pow(Math.cbrt(a), 2.0) / t_0) * (Math.cbrt(a) / t_0);
}
function code(a, k, m) t_0 = Float64(hypot(1.0, k) / sqrt((k ^ m))) return Float64(Float64((cbrt(a) ^ 2.0) / t_0) * Float64(cbrt(a) / t_0)) end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision] / N[Sqrt[N[Power[k, m], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Power[N[Power[a, 1/3], $MachinePrecision], 2.0], $MachinePrecision] / t$95$0), $MachinePrecision] * N[(N[Power[a, 1/3], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{hypot}\left(1, k\right)}{\sqrt{{k}^{m}}}\\
\frac{{\left(\sqrt[3]{a}\right)}^{2}}{t_0} \cdot \frac{\sqrt[3]{a}}{t_0}
\end{array}
\end{array}
Initial program 88.5%
associate-/l*88.5%
associate-+l+88.5%
*-commutative88.5%
Simplified88.5%
Taylor expanded in k around inf 87.9%
unpow287.9%
Simplified87.9%
add-cube-cbrt87.5%
add-sqr-sqrt87.5%
times-frac87.5%
pow287.5%
sqrt-div87.5%
hypot-1-def87.5%
sqrt-div87.5%
hypot-1-def98.5%
Applied egg-rr98.5%
Final simplification98.5%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (sqrt (pow k m))))
(if (<= m 6.8)
(/ (* t_0 (/ a (hypot 1.0 k))) (/ (hypot 1.0 k) t_0))
(* a (pow k m)))))
double code(double a, double k, double m) {
double t_0 = sqrt(pow(k, m));
double tmp;
if (m <= 6.8) {
tmp = (t_0 * (a / hypot(1.0, k))) / (hypot(1.0, k) / t_0);
} else {
tmp = a * pow(k, m);
}
return tmp;
}
public static double code(double a, double k, double m) {
double t_0 = Math.sqrt(Math.pow(k, m));
double tmp;
if (m <= 6.8) {
tmp = (t_0 * (a / Math.hypot(1.0, k))) / (Math.hypot(1.0, k) / t_0);
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): t_0 = math.sqrt(math.pow(k, m)) tmp = 0 if m <= 6.8: tmp = (t_0 * (a / math.hypot(1.0, k))) / (math.hypot(1.0, k) / t_0) else: tmp = a * math.pow(k, m) return tmp
function code(a, k, m) t_0 = sqrt((k ^ m)) tmp = 0.0 if (m <= 6.8) tmp = Float64(Float64(t_0 * Float64(a / hypot(1.0, k))) / Float64(hypot(1.0, k) / t_0)); else tmp = Float64(a * (k ^ m)); end return tmp end
function tmp_2 = code(a, k, m) t_0 = sqrt((k ^ m)); tmp = 0.0; if (m <= 6.8) tmp = (t_0 * (a / hypot(1.0, k))) / (hypot(1.0, k) / t_0); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[Sqrt[N[Power[k, m], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[m, 6.8], N[(N[(t$95$0 * N[(a / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{{k}^{m}}\\
\mathbf{if}\;m \leq 6.8:\\
\;\;\;\;\frac{t_0 \cdot \frac{a}{\mathsf{hypot}\left(1, k\right)}}{\frac{\mathsf{hypot}\left(1, k\right)}{t_0}}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 6.79999999999999982Initial program 90.5%
associate-/l*90.5%
associate-+l+90.5%
*-commutative90.5%
Simplified90.5%
Taylor expanded in k around inf 89.8%
unpow289.8%
Simplified89.8%
*-un-lft-identity89.8%
add-sqr-sqrt89.8%
times-frac89.7%
sqrt-div89.7%
hypot-1-def89.7%
sqrt-div89.7%
hypot-1-def98.6%
Applied egg-rr98.6%
associate-*l/98.6%
*-lft-identity98.6%
associate-/r/98.6%
Simplified98.6%
if 6.79999999999999982 < m Initial program 83.1%
associate-*r/83.1%
associate-+l+83.1%
+-commutative83.1%
distribute-rgt-out83.1%
fma-def83.1%
+-commutative83.1%
Simplified83.1%
Taylor expanded in k around 0 54.9%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
Final simplification99.0%
(FPCore (a k m) :precision binary64 (if (<= k 6.6e-8) (* a (pow k m)) (* (/ a k) (/ (pow k m) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 6.6e-8) {
tmp = a * pow(k, m);
} else {
tmp = (a / k) * (pow(k, m) / k);
}
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 (k <= 6.6d-8) then
tmp = a * (k ** m)
else
tmp = (a / k) * ((k ** m) / k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 6.6e-8) {
tmp = a * Math.pow(k, m);
} else {
tmp = (a / k) * (Math.pow(k, m) / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 6.6e-8: tmp = a * math.pow(k, m) else: tmp = (a / k) * (math.pow(k, m) / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 6.6e-8) tmp = Float64(a * (k ^ m)); else tmp = Float64(Float64(a / k) * Float64((k ^ m) / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 6.6e-8) tmp = a * (k ^ m); else tmp = (a / k) * ((k ^ m) / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 6.6e-8], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] * N[(N[Power[k, m], $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 6.6 \cdot 10^{-8}:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k} \cdot \frac{{k}^{m}}{k}\\
\end{array}
\end{array}
if k < 6.59999999999999954e-8Initial program 95.5%
associate-*r/95.5%
associate-+l+95.6%
+-commutative95.6%
distribute-rgt-out96.2%
fma-def96.2%
+-commutative96.2%
Simplified96.2%
Taylor expanded in k around 0 53.8%
exp-to-pow99.4%
*-commutative99.4%
Simplified99.4%
if 6.59999999999999954e-8 < k Initial program 77.0%
associate-/l*77.0%
associate-+l+77.0%
*-commutative77.0%
Simplified77.0%
Taylor expanded in k around inf 75.5%
unpow275.5%
Simplified75.5%
add-cube-cbrt75.2%
add-sqr-sqrt75.2%
times-frac75.2%
pow275.2%
sqrt-div75.2%
hypot-1-def75.2%
sqrt-div75.2%
hypot-1-def97.8%
Applied egg-rr97.8%
Taylor expanded in k around inf 75.5%
unpow275.5%
times-frac94.2%
mul-1-neg94.2%
exp-neg94.2%
log-rec94.2%
distribute-lft-neg-in94.2%
distribute-rgt-neg-out94.2%
exp-to-pow94.2%
Simplified94.2%
Taylor expanded in k around 0 94.2%
mul-1-neg94.2%
*-commutative94.2%
distribute-lft-neg-out94.2%
rec-exp94.2%
*-commutative94.2%
distribute-rgt-neg-out94.2%
exp-to-pow94.2%
remove-double-neg94.2%
Simplified94.2%
Final simplification97.4%
(FPCore (a k m) :precision binary64 (if (<= k 6.6e-8) (* a (pow k m)) (/ (* (pow k m) (/ a k)) k)))
double code(double a, double k, double m) {
double tmp;
if (k <= 6.6e-8) {
tmp = a * pow(k, m);
} else {
tmp = (pow(k, m) * (a / k)) / k;
}
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 (k <= 6.6d-8) then
tmp = a * (k ** m)
else
tmp = ((k ** m) * (a / k)) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 6.6e-8) {
tmp = a * Math.pow(k, m);
} else {
tmp = (Math.pow(k, m) * (a / k)) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 6.6e-8: tmp = a * math.pow(k, m) else: tmp = (math.pow(k, m) * (a / k)) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 6.6e-8) tmp = Float64(a * (k ^ m)); else tmp = Float64(Float64((k ^ m) * Float64(a / k)) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 6.6e-8) tmp = a * (k ^ m); else tmp = ((k ^ m) * (a / k)) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 6.6e-8], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[k, m], $MachinePrecision] * N[(a / k), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 6.6 \cdot 10^{-8}:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{{k}^{m} \cdot \frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 6.59999999999999954e-8Initial program 95.5%
associate-*r/95.5%
associate-+l+95.6%
+-commutative95.6%
distribute-rgt-out96.2%
fma-def96.2%
+-commutative96.2%
Simplified96.2%
Taylor expanded in k around 0 53.8%
exp-to-pow99.4%
*-commutative99.4%
Simplified99.4%
if 6.59999999999999954e-8 < k Initial program 77.0%
associate-/l*77.0%
associate-+l+77.0%
*-commutative77.0%
Simplified77.0%
Taylor expanded in k around inf 75.5%
unpow275.5%
Simplified75.5%
add-cube-cbrt75.2%
add-sqr-sqrt75.2%
times-frac75.2%
pow275.2%
sqrt-div75.2%
hypot-1-def75.2%
sqrt-div75.2%
hypot-1-def97.8%
Applied egg-rr97.8%
Taylor expanded in k around inf 75.5%
unpow275.5%
times-frac94.2%
mul-1-neg94.2%
exp-neg94.2%
log-rec94.2%
distribute-lft-neg-in94.2%
distribute-rgt-neg-out94.2%
exp-to-pow94.2%
Simplified94.2%
associate-*r/94.2%
pow-flip94.2%
Applied egg-rr94.2%
Final simplification97.4%
(FPCore (a k m) :precision binary64 (if (or (<= m -1.35e-6) (not (<= m 3.6e-7))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -1.35e-6) || !(m <= 3.6e-7)) {
tmp = a * pow(k, m);
} else {
tmp = a / (1.0 + (k * (k + 10.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.35d-6)) .or. (.not. (m <= 3.6d-7))) then
tmp = a * (k ** m)
else
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((m <= -1.35e-6) || !(m <= 3.6e-7)) {
tmp = a * Math.pow(k, m);
} else {
tmp = a / (1.0 + (k * (k + 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -1.35e-6) or not (m <= 3.6e-7): tmp = a * math.pow(k, m) else: tmp = a / (1.0 + (k * (k + 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -1.35e-6) || !(m <= 3.6e-7)) tmp = Float64(a * (k ^ m)); else tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((m <= -1.35e-6) || ~((m <= 3.6e-7))) tmp = a * (k ^ m); else tmp = a / (1.0 + (k * (k + 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -1.35e-6], N[Not[LessEqual[m, 3.6e-7]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.35 \cdot 10^{-6} \lor \neg \left(m \leq 3.6 \cdot 10^{-7}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -1.34999999999999999e-6 or 3.59999999999999994e-7 < m Initial program 91.4%
associate-*r/91.4%
associate-+l+91.4%
+-commutative91.4%
distribute-rgt-out92.1%
fma-def92.1%
+-commutative92.1%
Simplified92.1%
Taylor expanded in k around 0 52.3%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -1.34999999999999999e-6 < m < 3.59999999999999994e-7Initial program 84.2%
associate-*r/84.2%
associate-+l+84.2%
+-commutative84.2%
distribute-rgt-out84.2%
fma-def84.2%
+-commutative84.2%
Simplified84.2%
Taylor expanded in m around 0 83.8%
Final simplification93.4%
(FPCore (a k m) :precision binary64 (if (<= m -0.32) (/ a (* k k)) (if (<= m 0.92) (/ a (+ 1.0 (* k (+ k 10.0)))) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.32) {
tmp = a / (k * k);
} else if (m <= 0.92) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = -10.0 * (a * k);
}
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.32d0)) then
tmp = a / (k * k)
else if (m <= 0.92d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.32) {
tmp = a / (k * k);
} else if (m <= 0.92) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.32: tmp = a / (k * k) elif m <= 0.92: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.32) tmp = Float64(a / Float64(k * k)); elseif (m <= 0.92) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.32) tmp = a / (k * k); elseif (m <= 0.92) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.32], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.92], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.32:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.92:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -0.320000000000000007Initial program 98.8%
associate-*r/98.8%
associate-+l+98.8%
+-commutative98.8%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 39.0%
Taylor expanded in k around inf 64.3%
unpow264.3%
Simplified64.3%
if -0.320000000000000007 < m < 0.92000000000000004Initial program 84.2%
associate-*r/84.2%
associate-+l+84.2%
+-commutative84.2%
distribute-rgt-out84.2%
fma-def84.2%
+-commutative84.2%
Simplified84.2%
Taylor expanded in m around 0 83.8%
if 0.92000000000000004 < m Initial program 83.1%
associate-*r/83.1%
associate-+l+83.1%
+-commutative83.1%
distribute-rgt-out83.1%
fma-def83.1%
+-commutative83.1%
Simplified83.1%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 9.8%
*-commutative9.8%
Simplified9.8%
Taylor expanded in k around inf 26.7%
Final simplification61.9%
(FPCore (a k m) :precision binary64 (if (or (<= k 2e-310) (not (<= k 6.6e-8))) (/ a (* k k)) (* a (+ 1.0 (* k -10.0)))))
double code(double a, double k, double m) {
double tmp;
if ((k <= 2e-310) || !(k <= 6.6e-8)) {
tmp = a / (k * k);
} else {
tmp = a * (1.0 + (k * -10.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 ((k <= 2d-310) .or. (.not. (k <= 6.6d-8))) then
tmp = a / (k * k)
else
tmp = a * (1.0d0 + (k * (-10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= 2e-310) || !(k <= 6.6e-8)) {
tmp = a / (k * k);
} else {
tmp = a * (1.0 + (k * -10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 2e-310) or not (k <= 6.6e-8): tmp = a / (k * k) else: tmp = a * (1.0 + (k * -10.0)) return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 2e-310) || !(k <= 6.6e-8)) tmp = Float64(a / Float64(k * k)); else tmp = Float64(a * Float64(1.0 + Float64(k * -10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= 2e-310) || ~((k <= 6.6e-8))) tmp = a / (k * k); else tmp = a * (1.0 + (k * -10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 2e-310], N[Not[LessEqual[k, 6.6e-8]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2 \cdot 10^{-310} \lor \neg \left(k \leq 6.6 \cdot 10^{-8}\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\end{array}
\end{array}
if k < 1.999999999999994e-310 or 6.59999999999999954e-8 < k Initial program 82.6%
associate-*r/82.6%
associate-+l+82.6%
+-commutative82.6%
distribute-rgt-out83.2%
fma-def83.2%
+-commutative83.2%
Simplified83.2%
Taylor expanded in m around 0 45.2%
Taylor expanded in k around inf 49.9%
unpow249.9%
Simplified49.9%
if 1.999999999999994e-310 < k < 6.59999999999999954e-8Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 51.9%
Taylor expanded in k around 0 51.7%
*-commutative51.7%
Simplified51.7%
Final simplification50.5%
(FPCore (a k m) :precision binary64 (if (<= k 9e-309) (/ a (* k k)) (if (<= k 6.6e-8) (* a (+ 1.0 (* k -10.0))) (* a (/ (/ 1.0 k) k)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 9e-309) {
tmp = a / (k * k);
} else if (k <= 6.6e-8) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = a * ((1.0 / k) / k);
}
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 (k <= 9d-309) then
tmp = a / (k * k)
else if (k <= 6.6d-8) then
tmp = a * (1.0d0 + (k * (-10.0d0)))
else
tmp = a * ((1.0d0 / k) / k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 9e-309) {
tmp = a / (k * k);
} else if (k <= 6.6e-8) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = a * ((1.0 / k) / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 9e-309: tmp = a / (k * k) elif k <= 6.6e-8: tmp = a * (1.0 + (k * -10.0)) else: tmp = a * ((1.0 / k) / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 9e-309) tmp = Float64(a / Float64(k * k)); elseif (k <= 6.6e-8) tmp = Float64(a * Float64(1.0 + Float64(k * -10.0))); else tmp = Float64(a * Float64(Float64(1.0 / k) / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 9e-309) tmp = a / (k * k); elseif (k <= 6.6e-8) tmp = a * (1.0 + (k * -10.0)); else tmp = a * ((1.0 / k) / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 9e-309], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 6.6e-8], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(N[(1.0 / k), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 9 \cdot 10^{-309}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 6.6 \cdot 10^{-8}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{\frac{1}{k}}{k}\\
\end{array}
\end{array}
if k < 9.0000000000000021e-309Initial program 90.3%
associate-*r/90.3%
associate-+l+90.3%
+-commutative90.3%
distribute-rgt-out91.7%
fma-def91.7%
+-commutative91.7%
Simplified91.7%
Taylor expanded in m around 0 22.4%
Taylor expanded in k around inf 35.3%
unpow235.3%
Simplified35.3%
if 9.0000000000000021e-309 < k < 6.59999999999999954e-8Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 51.9%
Taylor expanded in k around 0 51.7%
*-commutative51.7%
Simplified51.7%
if 6.59999999999999954e-8 < k Initial program 77.0%
associate-*r/77.0%
associate-+l+77.0%
+-commutative77.0%
distribute-rgt-out77.0%
fma-def77.0%
+-commutative77.0%
Simplified77.0%
Taylor expanded in m around 0 61.8%
Taylor expanded in k around inf 60.5%
unpow260.5%
associate-/r*61.2%
Simplified61.2%
Final simplification50.7%
(FPCore (a k m) :precision binary64 (if (<= k 1.6e-307) (/ a (* k k)) (if (<= k 6.6e-8) (+ a (* -10.0 (* a k))) (* a (/ (/ 1.0 k) k)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.6e-307) {
tmp = a / (k * k);
} else if (k <= 6.6e-8) {
tmp = a + (-10.0 * (a * k));
} else {
tmp = a * ((1.0 / k) / k);
}
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 (k <= 1.6d-307) then
tmp = a / (k * k)
else if (k <= 6.6d-8) then
tmp = a + ((-10.0d0) * (a * k))
else
tmp = a * ((1.0d0 / k) / k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 1.6e-307) {
tmp = a / (k * k);
} else if (k <= 6.6e-8) {
tmp = a + (-10.0 * (a * k));
} else {
tmp = a * ((1.0 / k) / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.6e-307: tmp = a / (k * k) elif k <= 6.6e-8: tmp = a + (-10.0 * (a * k)) else: tmp = a * ((1.0 / k) / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.6e-307) tmp = Float64(a / Float64(k * k)); elseif (k <= 6.6e-8) tmp = Float64(a + Float64(-10.0 * Float64(a * k))); else tmp = Float64(a * Float64(Float64(1.0 / k) / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.6e-307) tmp = a / (k * k); elseif (k <= 6.6e-8) tmp = a + (-10.0 * (a * k)); else tmp = a * ((1.0 / k) / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.6e-307], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 6.6e-8], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(N[(1.0 / k), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.6 \cdot 10^{-307}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 6.6 \cdot 10^{-8}:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{\frac{1}{k}}{k}\\
\end{array}
\end{array}
if k < 1.60000000000000005e-307Initial program 90.3%
associate-*r/90.3%
associate-+l+90.3%
+-commutative90.3%
distribute-rgt-out91.7%
fma-def91.7%
+-commutative91.7%
Simplified91.7%
Taylor expanded in m around 0 22.4%
Taylor expanded in k around inf 35.3%
unpow235.3%
Simplified35.3%
if 1.60000000000000005e-307 < k < 6.59999999999999954e-8Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 51.9%
Taylor expanded in k around 0 51.8%
if 6.59999999999999954e-8 < k Initial program 77.0%
associate-*r/77.0%
associate-+l+77.0%
+-commutative77.0%
distribute-rgt-out77.0%
fma-def77.0%
+-commutative77.0%
Simplified77.0%
Taylor expanded in m around 0 61.8%
Taylor expanded in k around inf 60.5%
unpow260.5%
associate-/r*61.2%
Simplified61.2%
Final simplification50.7%
(FPCore (a k m) :precision binary64 (if (<= k -5e-310) (/ a (* k k)) (if (<= k 6.6e-8) (+ a (* -10.0 (* a k))) (/ 1.0 (* k (/ k a))))))
double code(double a, double k, double m) {
double tmp;
if (k <= -5e-310) {
tmp = a / (k * k);
} else if (k <= 6.6e-8) {
tmp = a + (-10.0 * (a * k));
} else {
tmp = 1.0 / (k * (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 (k <= (-5d-310)) then
tmp = a / (k * k)
else if (k <= 6.6d-8) then
tmp = a + ((-10.0d0) * (a * k))
else
tmp = 1.0d0 / (k * (k / a))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= -5e-310) {
tmp = a / (k * k);
} else if (k <= 6.6e-8) {
tmp = a + (-10.0 * (a * k));
} else {
tmp = 1.0 / (k * (k / a));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= -5e-310: tmp = a / (k * k) elif k <= 6.6e-8: tmp = a + (-10.0 * (a * k)) else: tmp = 1.0 / (k * (k / a)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= -5e-310) tmp = Float64(a / Float64(k * k)); elseif (k <= 6.6e-8) tmp = Float64(a + Float64(-10.0 * Float64(a * k))); else tmp = Float64(1.0 / Float64(k * Float64(k / a))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= -5e-310) tmp = a / (k * k); elseif (k <= 6.6e-8) tmp = a + (-10.0 * (a * k)); else tmp = 1.0 / (k * (k / a)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, -5e-310], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 6.6e-8], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(k * N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 6.6 \cdot 10^{-8}:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{k \cdot \frac{k}{a}}\\
\end{array}
\end{array}
if k < -4.999999999999985e-310Initial program 90.3%
associate-*r/90.3%
associate-+l+90.3%
+-commutative90.3%
distribute-rgt-out91.7%
fma-def91.7%
+-commutative91.7%
Simplified91.7%
Taylor expanded in m around 0 22.4%
Taylor expanded in k around inf 35.3%
unpow235.3%
Simplified35.3%
if -4.999999999999985e-310 < k < 6.59999999999999954e-8Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 51.9%
Taylor expanded in k around 0 51.8%
if 6.59999999999999954e-8 < k Initial program 77.0%
associate-*r/77.0%
associate-+l+77.0%
+-commutative77.0%
distribute-rgt-out77.0%
fma-def77.0%
+-commutative77.0%
Simplified77.0%
Taylor expanded in m around 0 61.9%
Taylor expanded in k around inf 60.6%
unpow260.6%
Simplified60.6%
clear-num60.6%
inv-pow60.6%
Applied egg-rr60.6%
unpow-160.6%
*-lft-identity60.6%
times-frac75.8%
/-rgt-identity75.8%
Simplified75.8%
Final simplification56.3%
(FPCore (a k m) :precision binary64 (if (<= k 2e-310) (/ a (* k k)) (if (<= k 6.6e-8) (/ a (+ 1.0 (* k 10.0))) (/ 1.0 (* k (/ k a))))))
double code(double a, double k, double m) {
double tmp;
if (k <= 2e-310) {
tmp = a / (k * k);
} else if (k <= 6.6e-8) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = 1.0 / (k * (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 (k <= 2d-310) then
tmp = a / (k * k)
else if (k <= 6.6d-8) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = 1.0d0 / (k * (k / a))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 2e-310) {
tmp = a / (k * k);
} else if (k <= 6.6e-8) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = 1.0 / (k * (k / a));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 2e-310: tmp = a / (k * k) elif k <= 6.6e-8: tmp = a / (1.0 + (k * 10.0)) else: tmp = 1.0 / (k * (k / a)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 2e-310) tmp = Float64(a / Float64(k * k)); elseif (k <= 6.6e-8) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(1.0 / Float64(k * Float64(k / a))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 2e-310) tmp = a / (k * k); elseif (k <= 6.6e-8) tmp = a / (1.0 + (k * 10.0)); else tmp = 1.0 / (k * (k / a)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 2e-310], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 6.6e-8], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(k * N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2 \cdot 10^{-310}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 6.6 \cdot 10^{-8}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{k \cdot \frac{k}{a}}\\
\end{array}
\end{array}
if k < 1.999999999999994e-310Initial program 90.3%
associate-*r/90.3%
associate-+l+90.3%
+-commutative90.3%
distribute-rgt-out91.7%
fma-def91.7%
+-commutative91.7%
Simplified91.7%
Taylor expanded in m around 0 22.4%
Taylor expanded in k around inf 35.3%
unpow235.3%
Simplified35.3%
if 1.999999999999994e-310 < k < 6.59999999999999954e-8Initial program 100.0%
associate-/l*100.0%
associate-+l+100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in k around 0 99.9%
fma-def99.9%
exp-to-pow99.9%
exp-to-pow99.9%
Simplified99.9%
Taylor expanded in m around 0 51.9%
*-commutative51.9%
Simplified51.9%
if 6.59999999999999954e-8 < k Initial program 77.0%
associate-*r/77.0%
associate-+l+77.0%
+-commutative77.0%
distribute-rgt-out77.0%
fma-def77.0%
+-commutative77.0%
Simplified77.0%
Taylor expanded in m around 0 61.9%
Taylor expanded in k around inf 60.6%
unpow260.6%
Simplified60.6%
clear-num60.6%
inv-pow60.6%
Applied egg-rr60.6%
unpow-160.6%
*-lft-identity60.6%
times-frac75.8%
/-rgt-identity75.8%
Simplified75.8%
Final simplification56.4%
(FPCore (a k m) :precision binary64 (if (<= m -0.05) (/ a (* k k)) (if (<= m 0.95) (/ a (+ 1.0 (* k k))) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.05) {
tmp = a / (k * k);
} else if (m <= 0.95) {
tmp = a / (1.0 + (k * k));
} else {
tmp = -10.0 * (a * k);
}
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.05d0)) then
tmp = a / (k * k)
else if (m <= 0.95d0) then
tmp = a / (1.0d0 + (k * k))
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.05) {
tmp = a / (k * k);
} else if (m <= 0.95) {
tmp = a / (1.0 + (k * k));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.05: tmp = a / (k * k) elif m <= 0.95: tmp = a / (1.0 + (k * k)) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.05) tmp = Float64(a / Float64(k * k)); elseif (m <= 0.95) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.05) tmp = a / (k * k); elseif (m <= 0.95) tmp = a / (1.0 + (k * k)); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.05], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.95], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.05:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.95:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -0.050000000000000003Initial program 98.8%
associate-*r/98.8%
associate-+l+98.8%
+-commutative98.8%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 39.0%
Taylor expanded in k around inf 64.3%
unpow264.3%
Simplified64.3%
if -0.050000000000000003 < m < 0.94999999999999996Initial program 84.2%
associate-/l*84.2%
associate-+l+84.2%
*-commutative84.2%
Simplified84.2%
Taylor expanded in k around inf 82.0%
unpow282.0%
Simplified82.0%
add-cube-cbrt80.9%
add-sqr-sqrt80.9%
times-frac80.9%
pow280.9%
sqrt-div80.9%
hypot-1-def80.9%
sqrt-div80.9%
hypot-1-def96.3%
Applied egg-rr96.3%
expm1-log1p-u93.8%
Applied egg-rr93.8%
Taylor expanded in m around 0 81.7%
unpow281.7%
Simplified81.7%
if 0.94999999999999996 < m Initial program 83.1%
associate-*r/83.1%
associate-+l+83.1%
+-commutative83.1%
distribute-rgt-out83.1%
fma-def83.1%
+-commutative83.1%
Simplified83.1%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 9.8%
*-commutative9.8%
Simplified9.8%
Taylor expanded in k around inf 26.7%
Final simplification61.0%
(FPCore (a k m) :precision binary64 (if (or (<= k 3.4e-308) (not (<= k 6.6e-8))) (/ a (* k k)) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= 3.4e-308) || !(k <= 6.6e-8)) {
tmp = a / (k * k);
} else {
tmp = 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 ((k <= 3.4d-308) .or. (.not. (k <= 6.6d-8))) then
tmp = a / (k * k)
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= 3.4e-308) || !(k <= 6.6e-8)) {
tmp = a / (k * k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 3.4e-308) or not (k <= 6.6e-8): tmp = a / (k * k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 3.4e-308) || !(k <= 6.6e-8)) tmp = Float64(a / Float64(k * k)); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= 3.4e-308) || ~((k <= 6.6e-8))) tmp = a / (k * k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 3.4e-308], N[Not[LessEqual[k, 6.6e-8]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3.4 \cdot 10^{-308} \lor \neg \left(k \leq 6.6 \cdot 10^{-8}\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < 3.39999999999999999e-308 or 6.59999999999999954e-8 < k Initial program 82.6%
associate-*r/82.6%
associate-+l+82.6%
+-commutative82.6%
distribute-rgt-out83.2%
fma-def83.2%
+-commutative83.2%
Simplified83.2%
Taylor expanded in m around 0 45.2%
Taylor expanded in k around inf 49.9%
unpow249.9%
Simplified49.9%
if 3.39999999999999999e-308 < k < 6.59999999999999954e-8Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 51.9%
Taylor expanded in k around 0 50.8%
Final simplification50.2%
(FPCore (a k m) :precision binary64 (if (<= m -7.4e-16) (* (/ a k) 0.1) (if (<= m 0.18) a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -7.4e-16) {
tmp = (a / k) * 0.1;
} else if (m <= 0.18) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
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 <= (-7.4d-16)) then
tmp = (a / k) * 0.1d0
else if (m <= 0.18d0) then
tmp = a
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -7.4e-16) {
tmp = (a / k) * 0.1;
} else if (m <= 0.18) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -7.4e-16: tmp = (a / k) * 0.1 elif m <= 0.18: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -7.4e-16) tmp = Float64(Float64(a / k) * 0.1); elseif (m <= 0.18) tmp = a; else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -7.4e-16) tmp = (a / k) * 0.1; elseif (m <= 0.18) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -7.4e-16], N[(N[(a / k), $MachinePrecision] * 0.1), $MachinePrecision], If[LessEqual[m, 0.18], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -7.4 \cdot 10^{-16}:\\
\;\;\;\;\frac{a}{k} \cdot 0.1\\
\mathbf{elif}\;m \leq 0.18:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -7.3999999999999999e-16Initial program 98.8%
associate-/l*98.8%
associate-+l+98.8%
*-commutative98.8%
Simplified98.8%
Taylor expanded in k around 0 50.1%
fma-def50.1%
exp-to-pow50.1%
exp-to-pow69.6%
Simplified69.6%
Taylor expanded in m around 0 19.8%
*-commutative19.8%
Simplified19.8%
Taylor expanded in k around inf 25.0%
if -7.3999999999999999e-16 < m < 0.17999999999999999Initial program 83.9%
associate-*r/83.9%
associate-+l+83.9%
+-commutative83.9%
distribute-rgt-out83.9%
fma-def83.9%
+-commutative83.9%
Simplified83.9%
Taylor expanded in m around 0 83.9%
Taylor expanded in k around 0 43.3%
if 0.17999999999999999 < m Initial program 83.1%
associate-*r/83.1%
associate-+l+83.1%
+-commutative83.1%
distribute-rgt-out83.1%
fma-def83.1%
+-commutative83.1%
Simplified83.1%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 9.8%
*-commutative9.8%
Simplified9.8%
Taylor expanded in k around inf 26.7%
Final simplification32.8%
(FPCore (a k m) :precision binary64 (if (<= m -1.7e-21) (/ a (* k 10.0)) (if (<= m 0.27) a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.7e-21) {
tmp = a / (k * 10.0);
} else if (m <= 0.27) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
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.7d-21)) then
tmp = a / (k * 10.0d0)
else if (m <= 0.27d0) then
tmp = a
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1.7e-21) {
tmp = a / (k * 10.0);
} else if (m <= 0.27) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.7e-21: tmp = a / (k * 10.0) elif m <= 0.27: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.7e-21) tmp = Float64(a / Float64(k * 10.0)); elseif (m <= 0.27) tmp = a; else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.7e-21) tmp = a / (k * 10.0); elseif (m <= 0.27) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.7e-21], N[(a / N[(k * 10.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.27], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.7 \cdot 10^{-21}:\\
\;\;\;\;\frac{a}{k \cdot 10}\\
\mathbf{elif}\;m \leq 0.27:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -1.7e-21Initial program 98.8%
associate-/l*98.8%
associate-+l+98.8%
*-commutative98.8%
Simplified98.8%
Taylor expanded in k around 0 50.1%
fma-def50.1%
exp-to-pow50.1%
exp-to-pow69.6%
Simplified69.6%
Taylor expanded in m around 0 19.8%
*-commutative19.8%
Simplified19.8%
Taylor expanded in k around inf 26.1%
*-commutative26.1%
Simplified26.1%
if -1.7e-21 < m < 0.27000000000000002Initial program 83.9%
associate-*r/83.9%
associate-+l+83.9%
+-commutative83.9%
distribute-rgt-out83.9%
fma-def83.9%
+-commutative83.9%
Simplified83.9%
Taylor expanded in m around 0 83.9%
Taylor expanded in k around 0 43.3%
if 0.27000000000000002 < m Initial program 83.1%
associate-*r/83.1%
associate-+l+83.1%
+-commutative83.1%
distribute-rgt-out83.1%
fma-def83.1%
+-commutative83.1%
Simplified83.1%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 9.8%
*-commutative9.8%
Simplified9.8%
Taylor expanded in k around inf 26.7%
Final simplification33.2%
(FPCore (a k m) :precision binary64 (if (<= m 0.9) a (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.9) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
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.9d0) then
tmp = a
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 0.9) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.9: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.9) tmp = a; else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 0.9) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.9], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.9:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 0.900000000000000022Initial program 90.5%
associate-*r/90.5%
associate-+l+90.5%
+-commutative90.5%
distribute-rgt-out91.0%
fma-def91.0%
+-commutative91.0%
Simplified91.0%
Taylor expanded in m around 0 64.5%
Taylor expanded in k around 0 26.0%
if 0.900000000000000022 < m Initial program 83.1%
associate-*r/83.1%
associate-+l+83.1%
+-commutative83.1%
distribute-rgt-out83.1%
fma-def83.1%
+-commutative83.1%
Simplified83.1%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 9.8%
*-commutative9.8%
Simplified9.8%
Taylor expanded in k around inf 26.7%
Final simplification26.2%
(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 88.5%
associate-*r/88.4%
associate-+l+88.4%
+-commutative88.4%
distribute-rgt-out88.8%
fma-def88.8%
+-commutative88.8%
Simplified88.8%
Taylor expanded in m around 0 47.4%
Taylor expanded in k around 0 19.8%
Final simplification19.8%
herbie shell --seed 2023178
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))