
(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 12 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 (* a (pow k m))) (t_1 (/ 1.0 t_0)))
(if (<= k 2.4e-11)
(* a (* (pow k m) (- 1.0 (* k 10.0))))
(/ 1.0 (+ t_1 (* k (+ (* 10.0 t_1) (/ k t_0))))))))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double t_1 = 1.0 / t_0;
double tmp;
if (k <= 2.4e-11) {
tmp = a * (pow(k, m) * (1.0 - (k * 10.0)));
} else {
tmp = 1.0 / (t_1 + (k * ((10.0 * t_1) + (k / 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) :: t_1
real(8) :: tmp
t_0 = a * (k ** m)
t_1 = 1.0d0 / t_0
if (k <= 2.4d-11) then
tmp = a * ((k ** m) * (1.0d0 - (k * 10.0d0)))
else
tmp = 1.0d0 / (t_1 + (k * ((10.0d0 * t_1) + (k / 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 t_1 = 1.0 / t_0;
double tmp;
if (k <= 2.4e-11) {
tmp = a * (Math.pow(k, m) * (1.0 - (k * 10.0)));
} else {
tmp = 1.0 / (t_1 + (k * ((10.0 * t_1) + (k / t_0))));
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) t_1 = 1.0 / t_0 tmp = 0 if k <= 2.4e-11: tmp = a * (math.pow(k, m) * (1.0 - (k * 10.0))) else: tmp = 1.0 / (t_1 + (k * ((10.0 * t_1) + (k / t_0)))) return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) t_1 = Float64(1.0 / t_0) tmp = 0.0 if (k <= 2.4e-11) tmp = Float64(a * Float64((k ^ m) * Float64(1.0 - Float64(k * 10.0)))); else tmp = Float64(1.0 / Float64(t_1 + Float64(k * Float64(Float64(10.0 * t_1) + Float64(k / t_0))))); end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); t_1 = 1.0 / t_0; tmp = 0.0; if (k <= 2.4e-11) tmp = a * ((k ^ m) * (1.0 - (k * 10.0))); else tmp = 1.0 / (t_1 + (k * ((10.0 * t_1) + (k / t_0)))); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / t$95$0), $MachinePrecision]}, If[LessEqual[k, 2.4e-11], N[(a * N[(N[Power[k, m], $MachinePrecision] * N[(1.0 - N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$1 + N[(k * N[(N[(10.0 * t$95$1), $MachinePrecision] + N[(k / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
t_1 := \frac{1}{t\_0}\\
\mathbf{if}\;k \leq 2.4 \cdot 10^{-11}:\\
\;\;\;\;a \cdot \left({k}^{m} \cdot \left(1 - k \cdot 10\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + k \cdot \left(10 \cdot t\_1 + \frac{k}{t\_0}\right)}\\
\end{array}
\end{array}
if k < 2.4000000000000001e-11Initial program 95.1%
associate-/l*95.1%
remove-double-neg95.1%
distribute-frac-neg295.1%
distribute-neg-frac295.1%
remove-double-neg95.1%
sqr-neg95.1%
associate-+l+95.1%
sqr-neg95.1%
distribute-rgt-out95.1%
Simplified95.1%
Taylor expanded in k around 0 88.3%
associate-*r*88.3%
*-lft-identity88.3%
distribute-rgt-out100.0%
*-commutative100.0%
fma-define100.0%
Simplified100.0%
fma-undefine100.0%
+-commutative100.0%
*-commutative100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
*-commutative100.0%
Applied egg-rr100.0%
if 2.4000000000000001e-11 < k Initial program 74.7%
associate-/l*74.7%
remove-double-neg74.7%
distribute-frac-neg274.7%
distribute-neg-frac274.7%
remove-double-neg74.7%
sqr-neg74.7%
associate-+l+74.7%
sqr-neg74.7%
distribute-rgt-out74.7%
Simplified74.7%
distribute-lft-in74.7%
associate-+l+74.7%
associate-*r/74.7%
clear-num74.7%
associate-+l+74.7%
distribute-lft-in74.7%
+-commutative74.7%
fma-define74.7%
+-commutative74.7%
*-commutative74.7%
Applied egg-rr74.7%
Taylor expanded in k around 0 99.9%
Final simplification100.0%
(FPCore (a k m) :precision binary64 (pow (/ (sqrt (* a (pow k m))) (hypot 1.0 k)) 2.0))
double code(double a, double k, double m) {
return pow((sqrt((a * pow(k, m))) / hypot(1.0, k)), 2.0);
}
public static double code(double a, double k, double m) {
return Math.pow((Math.sqrt((a * Math.pow(k, m))) / Math.hypot(1.0, k)), 2.0);
}
def code(a, k, m): return math.pow((math.sqrt((a * math.pow(k, m))) / math.hypot(1.0, k)), 2.0)
function code(a, k, m) return Float64(sqrt(Float64(a * (k ^ m))) / hypot(1.0, k)) ^ 2.0 end
function tmp = code(a, k, m) tmp = (sqrt((a * (k ^ m))) / hypot(1.0, k)) ^ 2.0; end
code[a_, k_, m_] := N[Power[N[(N[Sqrt[N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{\sqrt{a \cdot {k}^{m}}}{\mathsf{hypot}\left(1, k\right)}\right)}^{2}
\end{array}
Initial program 87.6%
associate-/l*87.6%
remove-double-neg87.6%
distribute-frac-neg287.6%
distribute-neg-frac287.6%
remove-double-neg87.6%
sqr-neg87.6%
associate-+l+87.6%
sqr-neg87.6%
distribute-rgt-out87.6%
Simplified87.6%
Taylor expanded in k around inf 87.4%
add-sqr-sqrt64.0%
pow264.0%
associate-*r/64.0%
*-commutative64.0%
sqrt-div59.7%
*-commutative59.7%
hypot-1-def64.7%
Applied egg-rr64.7%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* a (pow k m)))) (if (<= m 3.7) (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))) t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if (m <= 3.7) {
tmp = t_0 / ((1.0 + (k * 10.0)) + (k * k));
} 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 <= 3.7d0) then
tmp = t_0 / ((1.0d0 + (k * 10.0d0)) + (k * k))
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 <= 3.7) {
tmp = t_0 / ((1.0 + (k * 10.0)) + (k * k));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if m <= 3.7: tmp = t_0 / ((1.0 + (k * 10.0)) + (k * k)) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (m <= 3.7) tmp = Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))); 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 <= 3.7) tmp = t_0 / ((1.0 + (k * 10.0)) + (k * k)); 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, 3.7], N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;m \leq 3.7:\\
\;\;\;\;\frac{t\_0}{\left(1 + k \cdot 10\right) + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < 3.7000000000000002Initial program 97.2%
if 3.7000000000000002 < m Initial program 68.6%
associate-/l*68.6%
remove-double-neg68.6%
distribute-frac-neg268.6%
distribute-neg-frac268.6%
remove-double-neg68.6%
sqr-neg68.6%
associate-+l+68.6%
sqr-neg68.6%
distribute-rgt-out68.6%
Simplified68.6%
Taylor expanded in k around 0 100.0%
Final simplification98.1%
(FPCore (a k m) :precision binary64 (if (<= m 2.9) (* a (/ (pow k m) (+ 1.0 (* k (+ k 10.0))))) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.9) {
tmp = a * (pow(k, m) / (1.0 + (k * (k + 10.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 <= 2.9d0) then
tmp = a * ((k ** m) / (1.0d0 + (k * (k + 10.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 <= 2.9) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * (k + 10.0))));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.9: tmp = a * (math.pow(k, m) / (1.0 + (k * (k + 10.0)))) else: tmp = a * math.pow(k, m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.9) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(a * (k ^ m)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.9) tmp = a * ((k ^ m) / (1.0 + (k * (k + 10.0)))); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.9], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.9:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 2.89999999999999991Initial program 97.2%
associate-/l*97.2%
remove-double-neg97.2%
distribute-frac-neg297.2%
distribute-neg-frac297.2%
remove-double-neg97.2%
sqr-neg97.2%
associate-+l+97.2%
sqr-neg97.2%
distribute-rgt-out97.2%
Simplified97.2%
if 2.89999999999999991 < m Initial program 68.6%
associate-/l*68.6%
remove-double-neg68.6%
distribute-frac-neg268.6%
distribute-neg-frac268.6%
remove-double-neg68.6%
sqr-neg68.6%
associate-+l+68.6%
sqr-neg68.6%
distribute-rgt-out68.6%
Simplified68.6%
Taylor expanded in k around 0 100.0%
Final simplification98.1%
(FPCore (a k m) :precision binary64 (if (<= m 2.5) (* a (/ (pow k m) (+ 1.0 (* k k)))) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.5) {
tmp = a * (pow(k, m) / (1.0 + (k * k)));
} 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 <= 2.5d0) then
tmp = a * ((k ** m) / (1.0d0 + (k * k)))
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 <= 2.5) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * k)));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.5: tmp = a * (math.pow(k, m) / (1.0 + (k * k))) else: tmp = a * math.pow(k, m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.5) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * k)))); else tmp = Float64(a * (k ^ m)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.5) tmp = a * ((k ^ m) / (1.0 + (k * k))); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.5], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.5:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 2.5Initial program 97.2%
associate-/l*97.2%
remove-double-neg97.2%
distribute-frac-neg297.2%
distribute-neg-frac297.2%
remove-double-neg97.2%
sqr-neg97.2%
associate-+l+97.2%
sqr-neg97.2%
distribute-rgt-out97.2%
Simplified97.2%
Taylor expanded in k around inf 96.9%
if 2.5 < m Initial program 68.6%
associate-/l*68.6%
remove-double-neg68.6%
distribute-frac-neg268.6%
distribute-neg-frac268.6%
remove-double-neg68.6%
sqr-neg68.6%
associate-+l+68.6%
sqr-neg68.6%
distribute-rgt-out68.6%
Simplified68.6%
Taylor expanded in k around 0 100.0%
(FPCore (a k m) :precision binary64 (if (or (<= m -0.0039) (not (<= m 1.35e-33))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -0.0039) || !(m <= 1.35e-33)) {
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 <= (-0.0039d0)) .or. (.not. (m <= 1.35d-33))) 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 <= -0.0039) || !(m <= 1.35e-33)) {
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 <= -0.0039) or not (m <= 1.35e-33): 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 <= -0.0039) || !(m <= 1.35e-33)) 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 <= -0.0039) || ~((m <= 1.35e-33))) 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, -0.0039], N[Not[LessEqual[m, 1.35e-33]], $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 -0.0039 \lor \neg \left(m \leq 1.35 \cdot 10^{-33}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -0.0038999999999999998 or 1.35e-33 < m Initial program 83.8%
associate-/l*83.8%
remove-double-neg83.8%
distribute-frac-neg283.8%
distribute-neg-frac283.8%
remove-double-neg83.8%
sqr-neg83.8%
associate-+l+83.8%
sqr-neg83.8%
distribute-rgt-out83.8%
Simplified83.8%
Taylor expanded in k around 0 99.4%
if -0.0038999999999999998 < m < 1.35e-33Initial program 94.6%
associate-/l*94.6%
remove-double-neg94.6%
distribute-frac-neg294.6%
distribute-neg-frac294.6%
remove-double-neg94.6%
sqr-neg94.6%
associate-+l+94.6%
sqr-neg94.6%
distribute-rgt-out94.6%
Simplified94.6%
Taylor expanded in m around 0 94.5%
Final simplification97.7%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* k (+ k 10.0))))
(if (<= m -0.055)
(/ a t_0)
(if (<= m 2.2) (/ a (+ 1.0 t_0)) (+ a (* a (* k (- (* k 99.0) 10.0))))))))
double code(double a, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -0.055) {
tmp = a / t_0;
} else if (m <= 2.2) {
tmp = a / (1.0 + t_0);
} else {
tmp = a + (a * (k * ((k * 99.0) - 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) :: t_0
real(8) :: tmp
t_0 = k * (k + 10.0d0)
if (m <= (-0.055d0)) then
tmp = a / t_0
else if (m <= 2.2d0) then
tmp = a / (1.0d0 + t_0)
else
tmp = a + (a * (k * ((k * 99.0d0) - 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -0.055) {
tmp = a / t_0;
} else if (m <= 2.2) {
tmp = a / (1.0 + t_0);
} else {
tmp = a + (a * (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): t_0 = k * (k + 10.0) tmp = 0 if m <= -0.055: tmp = a / t_0 elif m <= 2.2: tmp = a / (1.0 + t_0) else: tmp = a + (a * (k * ((k * 99.0) - 10.0))) return tmp
function code(a, k, m) t_0 = Float64(k * Float64(k + 10.0)) tmp = 0.0 if (m <= -0.055) tmp = Float64(a / t_0); elseif (m <= 2.2) tmp = Float64(a / Float64(1.0 + t_0)); else tmp = Float64(a + Float64(a * Float64(k * Float64(Float64(k * 99.0) - 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) t_0 = k * (k + 10.0); tmp = 0.0; if (m <= -0.055) tmp = a / t_0; elseif (m <= 2.2) tmp = a / (1.0 + t_0); else tmp = a + (a * (k * ((k * 99.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -0.055], N[(a / t$95$0), $MachinePrecision], If[LessEqual[m, 2.2], N[(a / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := k \cdot \left(k + 10\right)\\
\mathbf{if}\;m \leq -0.055:\\
\;\;\;\;\frac{a}{t\_0}\\
\mathbf{elif}\;m \leq 2.2:\\
\;\;\;\;\frac{a}{1 + t\_0}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 99 - 10\right)\right)\\
\end{array}
\end{array}
if m < -0.0550000000000000003Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 31.2%
Taylor expanded in k around inf 31.2%
Taylor expanded in k around inf 41.9%
unpow241.9%
associate-*l*36.9%
+-commutative36.9%
distribute-rgt-in36.9%
associate-*l*36.9%
lft-mult-inverse36.9%
metadata-eval36.9%
*-lft-identity36.9%
+-commutative36.9%
Simplified36.9%
if -0.0550000000000000003 < m < 2.2000000000000002Initial program 94.9%
associate-/l*94.9%
remove-double-neg94.9%
distribute-frac-neg294.9%
distribute-neg-frac294.9%
remove-double-neg94.9%
sqr-neg94.9%
associate-+l+94.9%
sqr-neg94.9%
distribute-rgt-out94.9%
Simplified94.9%
Taylor expanded in m around 0 92.4%
if 2.2000000000000002 < m Initial program 68.6%
associate-/l*68.6%
remove-double-neg68.6%
distribute-frac-neg268.6%
distribute-neg-frac268.6%
remove-double-neg68.6%
sqr-neg68.6%
associate-+l+68.6%
sqr-neg68.6%
distribute-rgt-out68.6%
Simplified68.6%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 31.2%
Taylor expanded in a around 0 37.8%
Final simplification57.8%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* k (+ k 10.0))))
(if (<= m -0.245)
(/ a t_0)
(if (<= m 6.5e+37) (/ a (+ 1.0 t_0)) (* a (+ 1.0 (* k -10.0)))))))
double code(double a, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -0.245) {
tmp = a / t_0;
} else if (m <= 6.5e+37) {
tmp = a / (1.0 + t_0);
} 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) :: t_0
real(8) :: tmp
t_0 = k * (k + 10.0d0)
if (m <= (-0.245d0)) then
tmp = a / t_0
else if (m <= 6.5d+37) then
tmp = a / (1.0d0 + t_0)
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 t_0 = k * (k + 10.0);
double tmp;
if (m <= -0.245) {
tmp = a / t_0;
} else if (m <= 6.5e+37) {
tmp = a / (1.0 + t_0);
} else {
tmp = a * (1.0 + (k * -10.0));
}
return tmp;
}
def code(a, k, m): t_0 = k * (k + 10.0) tmp = 0 if m <= -0.245: tmp = a / t_0 elif m <= 6.5e+37: tmp = a / (1.0 + t_0) else: tmp = a * (1.0 + (k * -10.0)) return tmp
function code(a, k, m) t_0 = Float64(k * Float64(k + 10.0)) tmp = 0.0 if (m <= -0.245) tmp = Float64(a / t_0); elseif (m <= 6.5e+37) tmp = Float64(a / Float64(1.0 + t_0)); else tmp = Float64(a * Float64(1.0 + Float64(k * -10.0))); end return tmp end
function tmp_2 = code(a, k, m) t_0 = k * (k + 10.0); tmp = 0.0; if (m <= -0.245) tmp = a / t_0; elseif (m <= 6.5e+37) tmp = a / (1.0 + t_0); else tmp = a * (1.0 + (k * -10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -0.245], N[(a / t$95$0), $MachinePrecision], If[LessEqual[m, 6.5e+37], N[(a / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := k \cdot \left(k + 10\right)\\
\mathbf{if}\;m \leq -0.245:\\
\;\;\;\;\frac{a}{t\_0}\\
\mathbf{elif}\;m \leq 6.5 \cdot 10^{+37}:\\
\;\;\;\;\frac{a}{1 + t\_0}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\end{array}
\end{array}
if m < -0.245Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 31.2%
Taylor expanded in k around inf 31.2%
Taylor expanded in k around inf 41.9%
unpow241.9%
associate-*l*36.9%
+-commutative36.9%
distribute-rgt-in36.9%
associate-*l*36.9%
lft-mult-inverse36.9%
metadata-eval36.9%
*-lft-identity36.9%
+-commutative36.9%
Simplified36.9%
if -0.245 < m < 6.4999999999999998e37Initial program 93.4%
associate-/l*93.4%
remove-double-neg93.4%
distribute-frac-neg293.4%
distribute-neg-frac293.4%
remove-double-neg93.4%
sqr-neg93.4%
associate-+l+93.4%
sqr-neg93.4%
distribute-rgt-out93.4%
Simplified93.4%
Taylor expanded in m around 0 85.4%
if 6.4999999999999998e37 < m Initial program 67.9%
associate-/l*67.9%
remove-double-neg67.9%
distribute-frac-neg267.9%
distribute-neg-frac267.9%
remove-double-neg67.9%
sqr-neg67.9%
associate-+l+67.9%
sqr-neg67.9%
distribute-rgt-out67.9%
Simplified67.9%
Taylor expanded in k around 0 66.7%
associate-*r*66.7%
*-lft-identity66.7%
distribute-rgt-out66.7%
*-commutative66.7%
fma-define66.7%
Simplified66.7%
Taylor expanded in m around 0 11.5%
Final simplification48.7%
(FPCore (a k m) :precision binary64 (if (or (<= k -9.2e+111) (not (<= k 0.075))) (/ a (* k (+ k 10.0))) (* a (+ 1.0 (* k -10.0)))))
double code(double a, double k, double m) {
double tmp;
if ((k <= -9.2e+111) || !(k <= 0.075)) {
tmp = a / (k * (k + 10.0));
} 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 <= (-9.2d+111)) .or. (.not. (k <= 0.075d0))) then
tmp = a / (k * (k + 10.0d0))
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 <= -9.2e+111) || !(k <= 0.075)) {
tmp = a / (k * (k + 10.0));
} else {
tmp = a * (1.0 + (k * -10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -9.2e+111) or not (k <= 0.075): tmp = a / (k * (k + 10.0)) else: tmp = a * (1.0 + (k * -10.0)) return tmp
function code(a, k, m) tmp = 0.0 if ((k <= -9.2e+111) || !(k <= 0.075)) tmp = Float64(a / Float64(k * Float64(k + 10.0))); 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 <= -9.2e+111) || ~((k <= 0.075))) tmp = a / (k * (k + 10.0)); else tmp = a * (1.0 + (k * -10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -9.2e+111], N[Not[LessEqual[k, 0.075]], $MachinePrecision]], N[(a / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -9.2 \cdot 10^{+111} \lor \neg \left(k \leq 0.075\right):\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\end{array}
\end{array}
if k < -9.20000000000000008e111 or 0.0749999999999999972 < k Initial program 73.7%
*-commutative73.7%
Simplified73.7%
Taylor expanded in m around 0 53.2%
Taylor expanded in k around inf 53.2%
Taylor expanded in k around inf 53.3%
unpow253.3%
associate-*l*53.3%
+-commutative53.3%
distribute-rgt-in53.3%
associate-*l*53.3%
lft-mult-inverse53.3%
metadata-eval53.3%
*-lft-identity53.3%
+-commutative53.3%
Simplified53.3%
if -9.20000000000000008e111 < k < 0.0749999999999999972Initial 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 85.9%
associate-*r*85.9%
*-lft-identity85.9%
distribute-rgt-out100.0%
*-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in m around 0 37.9%
Final simplification45.2%
(FPCore (a k m) :precision binary64 (if (<= m -0.31) (/ a (* k (+ k 10.0))) (if (<= m 2.9e+35) (/ a (+ 1.0 (* k k))) (* a (+ 1.0 (* k -10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.31) {
tmp = a / (k * (k + 10.0));
} else if (m <= 2.9e+35) {
tmp = a / (1.0 + (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 (m <= (-0.31d0)) then
tmp = a / (k * (k + 10.0d0))
else if (m <= 2.9d+35) then
tmp = a / (1.0d0 + (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 (m <= -0.31) {
tmp = a / (k * (k + 10.0));
} else if (m <= 2.9e+35) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a * (1.0 + (k * -10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.31: tmp = a / (k * (k + 10.0)) elif m <= 2.9e+35: tmp = a / (1.0 + (k * k)) else: tmp = a * (1.0 + (k * -10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.31) tmp = Float64(a / Float64(k * Float64(k + 10.0))); elseif (m <= 2.9e+35) tmp = Float64(a / Float64(1.0 + 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 (m <= -0.31) tmp = a / (k * (k + 10.0)); elseif (m <= 2.9e+35) tmp = a / (1.0 + (k * k)); else tmp = a * (1.0 + (k * -10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.31], N[(a / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.9e+35], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.31:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\mathbf{elif}\;m \leq 2.9 \cdot 10^{+35}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\end{array}
\end{array}
if m < -0.309999999999999998Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 31.2%
Taylor expanded in k around inf 31.2%
Taylor expanded in k around inf 41.9%
unpow241.9%
associate-*l*36.9%
+-commutative36.9%
distribute-rgt-in36.9%
associate-*l*36.9%
lft-mult-inverse36.9%
metadata-eval36.9%
*-lft-identity36.9%
+-commutative36.9%
Simplified36.9%
if -0.309999999999999998 < m < 2.89999999999999995e35Initial program 93.4%
associate-/l*93.4%
remove-double-neg93.4%
distribute-frac-neg293.4%
distribute-neg-frac293.4%
remove-double-neg93.4%
sqr-neg93.4%
associate-+l+93.4%
sqr-neg93.4%
distribute-rgt-out93.4%
Simplified93.4%
Taylor expanded in m around 0 85.4%
Taylor expanded in k around inf 84.9%
if 2.89999999999999995e35 < m Initial program 67.9%
associate-/l*67.9%
remove-double-neg67.9%
distribute-frac-neg267.9%
distribute-neg-frac267.9%
remove-double-neg67.9%
sqr-neg67.9%
associate-+l+67.9%
sqr-neg67.9%
distribute-rgt-out67.9%
Simplified67.9%
Taylor expanded in k around 0 66.7%
associate-*r*66.7%
*-lft-identity66.7%
distribute-rgt-out66.7%
*-commutative66.7%
fma-define66.7%
Simplified66.7%
Taylor expanded in m around 0 11.5%
Final simplification48.5%
(FPCore (a k m) :precision binary64 (* a (+ 1.0 (* k -10.0))))
double code(double a, double k, double m) {
return a * (1.0 + (k * -10.0));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a * (1.0d0 + (k * (-10.0d0)))
end function
public static double code(double a, double k, double m) {
return a * (1.0 + (k * -10.0));
}
def code(a, k, m): return a * (1.0 + (k * -10.0))
function code(a, k, m) return Float64(a * Float64(1.0 + Float64(k * -10.0))) end
function tmp = code(a, k, m) tmp = a * (1.0 + (k * -10.0)); end
code[a_, k_, m_] := N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot \left(1 + k \cdot -10\right)
\end{array}
Initial program 87.6%
associate-/l*87.6%
remove-double-neg87.6%
distribute-frac-neg287.6%
distribute-neg-frac287.6%
remove-double-neg87.6%
sqr-neg87.6%
associate-+l+87.6%
sqr-neg87.6%
distribute-rgt-out87.6%
Simplified87.6%
Taylor expanded in k around 0 63.3%
associate-*r*62.9%
*-lft-identity62.9%
distribute-rgt-out70.3%
*-commutative70.3%
fma-define70.3%
Simplified70.3%
Taylor expanded in m around 0 22.8%
Final simplification22.8%
(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 87.6%
associate-/l*87.6%
remove-double-neg87.6%
distribute-frac-neg287.6%
distribute-neg-frac287.6%
remove-double-neg87.6%
sqr-neg87.6%
associate-+l+87.6%
sqr-neg87.6%
distribute-rgt-out87.6%
Simplified87.6%
Taylor expanded in m around 0 44.4%
Taylor expanded in k around 0 21.1%
herbie shell --seed 2024180
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))