
(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 14 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 k (sqrt (fma k 10.0 1.0))))
(t_1 (* a (pow k m)))
(t_2 (cbrt t_1)))
(if (<= k 1.9e-32) t_1 (* (/ (pow t_2 2.0) t_0) (/ t_2 t_0)))))
double code(double a, double k, double m) {
double t_0 = hypot(k, sqrt(fma(k, 10.0, 1.0)));
double t_1 = a * pow(k, m);
double t_2 = cbrt(t_1);
double tmp;
if (k <= 1.9e-32) {
tmp = t_1;
} else {
tmp = (pow(t_2, 2.0) / t_0) * (t_2 / t_0);
}
return tmp;
}
function code(a, k, m) t_0 = hypot(k, sqrt(fma(k, 10.0, 1.0))) t_1 = Float64(a * (k ^ m)) t_2 = cbrt(t_1) tmp = 0.0 if (k <= 1.9e-32) tmp = t_1; else tmp = Float64(Float64((t_2 ^ 2.0) / t_0) * Float64(t_2 / t_0)); end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[Sqrt[k ^ 2 + N[Sqrt[N[(k * 10.0 + 1.0), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$1 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$1, 1/3], $MachinePrecision]}, If[LessEqual[k, 1.9e-32], t$95$1, N[(N[(N[Power[t$95$2, 2.0], $MachinePrecision] / t$95$0), $MachinePrecision] * N[(t$95$2 / t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)\\
t_1 := a \cdot {k}^{m}\\
t_2 := \sqrt[3]{t\_1}\\
\mathbf{if}\;k \leq 1.9 \cdot 10^{-32}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{{t\_2}^{2}}{t\_0} \cdot \frac{t\_2}{t\_0}\\
\end{array}
\end{array}
if k < 1.90000000000000004e-32Initial program 96.7%
associate-*l/94.7%
sqr-neg94.7%
associate-+l+94.7%
sqr-neg94.7%
distribute-rgt-out94.7%
Simplified94.7%
Taylor expanded in k around 0 100.0%
if 1.90000000000000004e-32 < k Initial program 80.2%
associate-*l/80.2%
sqr-neg80.2%
associate-+l+80.2%
sqr-neg80.2%
distribute-rgt-out80.2%
Simplified80.2%
distribute-lft-in80.2%
associate-+l+80.2%
associate-*l/80.2%
clear-num80.0%
associate-+l+80.0%
distribute-lft-in79.9%
+-commutative79.9%
fma-def79.9%
+-commutative79.9%
Applied egg-rr79.9%
clear-num80.2%
add-cube-cbrt80.0%
add-sqr-sqrt80.0%
times-frac80.0%
Applied egg-rr99.5%
Final simplification99.8%
(FPCore (a k m) :precision binary64 (let* ((t_0 (hypot k (sqrt (fma k 10.0 1.0))))) (if (<= k -50.0) (* a (pow k m)) (* (/ (pow k m) t_0) (/ a t_0)))))
double code(double a, double k, double m) {
double t_0 = hypot(k, sqrt(fma(k, 10.0, 1.0)));
double tmp;
if (k <= -50.0) {
tmp = a * pow(k, m);
} else {
tmp = (pow(k, m) / t_0) * (a / t_0);
}
return tmp;
}
function code(a, k, m) t_0 = hypot(k, sqrt(fma(k, 10.0, 1.0))) tmp = 0.0 if (k <= -50.0) tmp = Float64(a * (k ^ m)); else tmp = Float64(Float64((k ^ m) / t_0) * Float64(a / t_0)); end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[Sqrt[k ^ 2 + N[Sqrt[N[(k * 10.0 + 1.0), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[k, -50.0], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[k, m], $MachinePrecision] / t$95$0), $MachinePrecision] * N[(a / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)\\
\mathbf{if}\;k \leq -50:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{{k}^{m}}{t\_0} \cdot \frac{a}{t\_0}\\
\end{array}
\end{array}
if k < -50Initial program 89.1%
associate-*l/82.6%
sqr-neg82.6%
associate-+l+82.6%
sqr-neg82.6%
distribute-rgt-out82.6%
Simplified82.6%
Taylor expanded in k around 0 100.0%
if -50 < k Initial program 90.1%
associate-*l/90.1%
sqr-neg90.1%
associate-+l+90.1%
sqr-neg90.1%
distribute-rgt-out90.1%
Simplified90.1%
distribute-lft-in90.1%
associate-+l+90.1%
associate-*l/90.1%
clear-num89.9%
associate-+l+89.9%
distribute-lft-in89.9%
+-commutative89.9%
fma-def89.9%
+-commutative89.9%
Applied egg-rr89.9%
clear-num90.1%
add-sqr-sqrt90.1%
times-frac90.1%
fma-udef90.1%
distribute-lft-in90.1%
associate-+r+90.1%
+-commutative90.1%
add-sqr-sqrt90.1%
hypot-def90.1%
+-commutative90.1%
fma-def90.1%
fma-udef90.1%
distribute-lft-in90.1%
associate-+r+90.1%
+-commutative90.1%
Applied egg-rr98.5%
*-commutative98.5%
Simplified98.5%
Final simplification98.8%
(FPCore (a k m) :precision binary64 (if (or (<= m -2.1e+18) (not (<= m 2e-28))) (* a (pow k m)) (/ a (+ 1.0 (fma k k (* k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -2.1e+18) || !(m <= 2e-28)) {
tmp = a * pow(k, m);
} else {
tmp = a / (1.0 + fma(k, k, (k * 10.0)));
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if ((m <= -2.1e+18) || !(m <= 2e-28)) tmp = Float64(a * (k ^ m)); else tmp = Float64(a / Float64(1.0 + fma(k, k, Float64(k * 10.0)))); end return tmp end
code[a_, k_, m_] := If[Or[LessEqual[m, -2.1e+18], N[Not[LessEqual[m, 2e-28]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a / N[(1.0 + N[(k * k + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -2.1 \cdot 10^{+18} \lor \neg \left(m \leq 2 \cdot 10^{-28}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + \mathsf{fma}\left(k, k, k \cdot 10\right)}\\
\end{array}
\end{array}
if m < -2.1e18 or 1.99999999999999994e-28 < m Initial program 87.9%
associate-*l/86.1%
sqr-neg86.1%
associate-+l+86.1%
sqr-neg86.1%
distribute-rgt-out86.1%
Simplified86.1%
Taylor expanded in k around 0 100.0%
if -2.1e18 < m < 1.99999999999999994e-28Initial program 93.6%
associate-*l/93.6%
sqr-neg93.6%
associate-+l+93.6%
sqr-neg93.6%
distribute-rgt-out93.6%
Simplified93.6%
Taylor expanded in m around 0 92.8%
distribute-lft-in92.9%
+-commutative92.9%
pow292.9%
Applied egg-rr92.9%
unpow292.9%
fma-def92.9%
Applied egg-rr92.9%
Final simplification97.5%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* a (pow k m)))) (if (<= m 2e-28) (/ 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 <= 2e-28) {
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 <= 2d-28) 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 <= 2e-28) {
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 <= 2e-28: 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 <= 2e-28) 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 <= 2e-28) 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, 2e-28], 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 2 \cdot 10^{-28}:\\
\;\;\;\;\frac{t\_0}{\left(1 + k \cdot 10\right) + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < 1.99999999999999994e-28Initial program 96.6%
if 1.99999999999999994e-28 < m Initial program 76.2%
associate-*l/72.6%
sqr-neg72.6%
associate-+l+72.6%
sqr-neg72.6%
distribute-rgt-out72.6%
Simplified72.6%
Taylor expanded in k around 0 100.0%
Final simplification97.7%
(FPCore (a k m) :precision binary64 (if (<= m 2e-28) (* (pow k m) (/ a (+ 1.0 (* k (+ k 10.0))))) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2e-28) {
tmp = pow(k, m) * (a / (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 <= 2d-28) then
tmp = (k ** m) * (a / (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 <= 2e-28) {
tmp = Math.pow(k, m) * (a / (1.0 + (k * (k + 10.0))));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2e-28: tmp = math.pow(k, m) * (a / (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 <= 2e-28) tmp = Float64((k ^ m) * Float64(a / 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 <= 2e-28) tmp = (k ^ m) * (a / (1.0 + (k * (k + 10.0)))); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2e-28], N[(N[Power[k, m], $MachinePrecision] * N[(a / 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 \cdot 10^{-28}:\\
\;\;\;\;{k}^{m} \cdot \frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 1.99999999999999994e-28Initial program 96.6%
associate-*l/96.6%
sqr-neg96.6%
associate-+l+96.6%
sqr-neg96.6%
distribute-rgt-out96.6%
Simplified96.6%
if 1.99999999999999994e-28 < m Initial program 76.2%
associate-*l/72.6%
sqr-neg72.6%
associate-+l+72.6%
sqr-neg72.6%
distribute-rgt-out72.6%
Simplified72.6%
Taylor expanded in k around 0 100.0%
Final simplification97.7%
(FPCore (a k m) :precision binary64 (if (or (<= m -2.1e+18) (not (<= m 2e-28))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -2.1e+18) || !(m <= 2e-28)) {
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 <= (-2.1d+18)) .or. (.not. (m <= 2d-28))) 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 <= -2.1e+18) || !(m <= 2e-28)) {
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 <= -2.1e+18) or not (m <= 2e-28): 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 <= -2.1e+18) || !(m <= 2e-28)) 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 <= -2.1e+18) || ~((m <= 2e-28))) 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, -2.1e+18], N[Not[LessEqual[m, 2e-28]], $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 -2.1 \cdot 10^{+18} \lor \neg \left(m \leq 2 \cdot 10^{-28}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -2.1e18 or 1.99999999999999994e-28 < m Initial program 87.9%
associate-*l/86.1%
sqr-neg86.1%
associate-+l+86.1%
sqr-neg86.1%
distribute-rgt-out86.1%
Simplified86.1%
Taylor expanded in k around 0 100.0%
if -2.1e18 < m < 1.99999999999999994e-28Initial program 93.6%
associate-*l/93.6%
sqr-neg93.6%
associate-+l+93.6%
sqr-neg93.6%
distribute-rgt-out93.6%
Simplified93.6%
Taylor expanded in m around 0 92.8%
Final simplification97.5%
(FPCore (a k m) :precision binary64 (if (<= m -1.85e-66) (* 0.1 (/ a k)) (if (<= m 4.6e+114) (* a (- 1.0 (* k -10.0))) (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.85e-66) {
tmp = 0.1 * (a / k);
} else if (m <= 4.6e+114) {
tmp = a * (1.0 - (k * -10.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.85d-66)) then
tmp = 0.1d0 * (a / k)
else if (m <= 4.6d+114) then
tmp = a * (1.0d0 - (k * (-10.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.85e-66) {
tmp = 0.1 * (a / k);
} else if (m <= 4.6e+114) {
tmp = a * (1.0 - (k * -10.0));
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.85e-66: tmp = 0.1 * (a / k) elif m <= 4.6e+114: tmp = a * (1.0 - (k * -10.0)) else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.85e-66) tmp = Float64(0.1 * Float64(a / k)); elseif (m <= 4.6e+114) tmp = Float64(a * Float64(1.0 - Float64(k * -10.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.85e-66) tmp = 0.1 * (a / k); elseif (m <= 4.6e+114) tmp = a * (1.0 - (k * -10.0)); else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.85e-66], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 4.6e+114], N[(a * N[(1.0 - N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.85 \cdot 10^{-66}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{elif}\;m \leq 4.6 \cdot 10^{+114}:\\
\;\;\;\;a \cdot \left(1 - k \cdot -10\right)\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -1.8500000000000001e-66Initial program 100.0%
associate-*l/100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 48.0%
Taylor expanded in k around 0 22.3%
*-commutative22.3%
Simplified22.3%
Taylor expanded in k around inf 25.6%
if -1.8500000000000001e-66 < m < 4.6000000000000001e114Initial program 86.2%
associate-*l/84.3%
sqr-neg84.3%
associate-+l+84.3%
sqr-neg84.3%
distribute-rgt-out84.3%
Simplified84.3%
Taylor expanded in a around 0 86.2%
+-commutative86.2%
+-commutative86.2%
fma-udef86.2%
associate-*r/86.2%
Simplified86.2%
Taylor expanded in m around 0 70.1%
Taylor expanded in k around 0 37.3%
*-commutative37.3%
Simplified37.3%
*-commutative37.3%
metadata-eval37.3%
cancel-sign-sub-inv37.3%
*-commutative37.3%
add-sqr-sqrt37.1%
sqrt-unprod37.0%
swap-sqr37.0%
metadata-eval37.0%
metadata-eval37.0%
swap-sqr37.0%
sqrt-unprod0.1%
add-sqr-sqrt40.2%
Applied egg-rr40.2%
if 4.6000000000000001e114 < m Initial program 80.4%
associate-*l/78.6%
sqr-neg78.6%
associate-+l+78.6%
sqr-neg78.6%
distribute-rgt-out78.6%
Simplified78.6%
Taylor expanded in a around 0 80.4%
+-commutative80.4%
+-commutative80.4%
fma-udef80.4%
associate-*r/80.4%
Simplified80.4%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 8.1%
*-commutative8.1%
Simplified8.1%
Taylor expanded in k around inf 20.5%
Final simplification30.6%
(FPCore (a k m) :precision binary64 (if (<= m -1.7e+21) (* 0.1 (/ a k)) (if (<= m 1.05e+105) (/ a (+ 1.0 (* k 10.0))) (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.7e+21) {
tmp = 0.1 * (a / k);
} else if (m <= 1.05e+105) {
tmp = a / (1.0 + (k * 10.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.7d+21)) then
tmp = 0.1d0 * (a / k)
else if (m <= 1.05d+105) then
tmp = a / (1.0d0 + (k * 10.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.7e+21) {
tmp = 0.1 * (a / k);
} else if (m <= 1.05e+105) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.7e+21: tmp = 0.1 * (a / k) elif m <= 1.05e+105: tmp = a / (1.0 + (k * 10.0)) else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.7e+21) tmp = Float64(0.1 * Float64(a / k)); elseif (m <= 1.05e+105) tmp = Float64(a / Float64(1.0 + Float64(k * 10.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.7e+21) tmp = 0.1 * (a / k); elseif (m <= 1.05e+105) tmp = a / (1.0 + (k * 10.0)); else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.7e+21], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.05e+105], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.7 \cdot 10^{+21}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{elif}\;m \leq 1.05 \cdot 10^{+105}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -1.7e21Initial program 100.0%
associate-*l/100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 40.9%
Taylor expanded in k around 0 16.3%
*-commutative16.3%
Simplified16.3%
Taylor expanded in k around inf 22.9%
if -1.7e21 < m < 1.05000000000000005e105Initial program 88.3%
associate-*l/86.6%
sqr-neg86.6%
associate-+l+86.6%
sqr-neg86.6%
distribute-rgt-out86.6%
Simplified86.6%
Taylor expanded in m around 0 74.0%
Taylor expanded in k around 0 52.1%
*-commutative52.1%
Simplified52.1%
if 1.05000000000000005e105 < m Initial program 79.7%
associate-*l/78.0%
sqr-neg78.0%
associate-+l+78.0%
sqr-neg78.0%
distribute-rgt-out78.0%
Simplified78.0%
Taylor expanded in a around 0 79.7%
+-commutative79.7%
+-commutative79.7%
fma-udef79.7%
associate-*r/79.7%
Simplified79.7%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 7.8%
*-commutative7.8%
Simplified7.8%
Taylor expanded in k around inf 19.6%
Final simplification35.6%
(FPCore (a k m) :precision binary64 (if (<= m 1.2e+94) (/ 1.0 (/ (+ 1.0 (* k (+ k 10.0))) a)) (* -10.0 (* k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.2e+94) {
tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / 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.2d+94) then
tmp = 1.0d0 / ((1.0d0 + (k * (k + 10.0d0))) / 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.2e+94) {
tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a);
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.2e+94: tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a) else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.2e+94) tmp = Float64(1.0 / Float64(Float64(1.0 + Float64(k * Float64(k + 10.0))) / 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.2e+94) tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a); else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.2e+94], N[(1.0 / N[(N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.2 \cdot 10^{+94}:\\
\;\;\;\;\frac{1}{\frac{1 + k \cdot \left(k + 10\right)}{a}}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 1.19999999999999991e94Initial program 93.9%
associate-*l/93.3%
sqr-neg93.3%
associate-+l+93.3%
sqr-neg93.3%
distribute-rgt-out93.3%
Simplified93.3%
distribute-lft-in93.3%
associate-+l+93.3%
associate-*l/93.9%
clear-num93.7%
associate-+l+93.7%
distribute-lft-in93.7%
+-commutative93.7%
fma-def93.7%
+-commutative93.7%
Applied egg-rr93.7%
Taylor expanded in m around 0 62.4%
if 1.19999999999999991e94 < m Initial program 78.1%
associate-*l/75.0%
sqr-neg75.0%
associate-+l+75.0%
sqr-neg75.0%
distribute-rgt-out75.0%
Simplified75.0%
Taylor expanded in a around 0 78.1%
+-commutative78.1%
+-commutative78.1%
fma-udef78.1%
associate-*r/78.1%
Simplified78.1%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 7.3%
*-commutative7.3%
Simplified7.3%
Taylor expanded in k around inf 18.2%
Final simplification51.4%
(FPCore (a k m) :precision binary64 (if (<= m -4.5e-65) (* 0.1 (/ a k)) (if (<= m 4.1e+114) a (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -4.5e-65) {
tmp = 0.1 * (a / k);
} else if (m <= 4.1e+114) {
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 <= (-4.5d-65)) then
tmp = 0.1d0 * (a / k)
else if (m <= 4.1d+114) 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 <= -4.5e-65) {
tmp = 0.1 * (a / k);
} else if (m <= 4.1e+114) {
tmp = a;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -4.5e-65: tmp = 0.1 * (a / k) elif m <= 4.1e+114: tmp = a else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -4.5e-65) tmp = Float64(0.1 * Float64(a / k)); elseif (m <= 4.1e+114) 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 <= -4.5e-65) tmp = 0.1 * (a / k); elseif (m <= 4.1e+114) tmp = a; else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -4.5e-65], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 4.1e+114], a, N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -4.5 \cdot 10^{-65}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{elif}\;m \leq 4.1 \cdot 10^{+114}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -4.4999999999999998e-65Initial program 100.0%
associate-*l/100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 48.0%
Taylor expanded in k around 0 22.3%
*-commutative22.3%
Simplified22.3%
Taylor expanded in k around inf 25.6%
if -4.4999999999999998e-65 < m < 4.1000000000000001e114Initial program 86.2%
associate-*l/84.3%
sqr-neg84.3%
associate-+l+84.3%
sqr-neg84.3%
distribute-rgt-out84.3%
Simplified84.3%
Taylor expanded in m around 0 70.2%
Taylor expanded in k around 0 38.3%
if 4.1000000000000001e114 < m Initial program 80.4%
associate-*l/78.6%
sqr-neg78.6%
associate-+l+78.6%
sqr-neg78.6%
distribute-rgt-out78.6%
Simplified78.6%
Taylor expanded in a around 0 80.4%
+-commutative80.4%
+-commutative80.4%
fma-udef80.4%
associate-*r/80.4%
Simplified80.4%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 8.1%
*-commutative8.1%
Simplified8.1%
Taylor expanded in k around inf 20.5%
Final simplification29.8%
(FPCore (a k m) :precision binary64 (if (<= m 1.2e+94) (/ a (+ 1.0 (* k (+ k 10.0)))) (* -10.0 (* k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.2e+94) {
tmp = a / (1.0 + (k * (k + 10.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.2d+94) then
tmp = a / (1.0d0 + (k * (k + 10.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.2e+94) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.2e+94: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.2e+94) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.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.2e+94) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.2e+94], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.2 \cdot 10^{+94}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 1.19999999999999991e94Initial program 93.9%
associate-*l/93.3%
sqr-neg93.3%
associate-+l+93.3%
sqr-neg93.3%
distribute-rgt-out93.3%
Simplified93.3%
Taylor expanded in m around 0 62.3%
if 1.19999999999999991e94 < m Initial program 78.1%
associate-*l/75.0%
sqr-neg75.0%
associate-+l+75.0%
sqr-neg75.0%
distribute-rgt-out75.0%
Simplified75.0%
Taylor expanded in a around 0 78.1%
+-commutative78.1%
+-commutative78.1%
fma-udef78.1%
associate-*r/78.1%
Simplified78.1%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 7.3%
*-commutative7.3%
Simplified7.3%
Taylor expanded in k around inf 18.2%
Final simplification51.3%
(FPCore (a k m) :precision binary64 (if (<= k 0.075) (* a (+ 1.0 (* k -10.0))) (* 0.1 (/ a k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.075) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = 0.1 * (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 (k <= 0.075d0) then
tmp = a * (1.0d0 + (k * (-10.0d0)))
else
tmp = 0.1d0 * (a / k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.075) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = 0.1 * (a / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.075: tmp = a * (1.0 + (k * -10.0)) else: tmp = 0.1 * (a / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.075) tmp = Float64(a * Float64(1.0 + Float64(k * -10.0))); else tmp = Float64(0.1 * Float64(a / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.075) tmp = a * (1.0 + (k * -10.0)); else tmp = 0.1 * (a / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.075], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.075:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\mathbf{else}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\end{array}
\end{array}
if k < 0.0749999999999999972Initial program 96.9%
associate-*l/95.1%
sqr-neg95.1%
associate-+l+95.1%
sqr-neg95.1%
distribute-rgt-out95.1%
Simplified95.1%
Taylor expanded in a around 0 96.9%
+-commutative96.9%
+-commutative96.9%
fma-udef96.9%
associate-*r/96.9%
Simplified96.9%
Taylor expanded in m around 0 39.9%
Taylor expanded in k around 0 29.2%
*-commutative29.2%
Simplified29.2%
if 0.0749999999999999972 < k Initial program 77.5%
associate-*l/77.5%
sqr-neg77.5%
associate-+l+77.5%
sqr-neg77.5%
distribute-rgt-out77.5%
Simplified77.5%
Taylor expanded in m around 0 60.8%
Taylor expanded in k around 0 27.1%
*-commutative27.1%
Simplified27.1%
Taylor expanded in k around inf 27.1%
Final simplification28.4%
(FPCore (a k m) :precision binary64 (if (<= m 4.1e+114) a (* -10.0 (* k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= 4.1e+114) {
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 <= 4.1d+114) 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 <= 4.1e+114) {
tmp = a;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 4.1e+114: tmp = a else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 4.1e+114) 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 <= 4.1e+114) tmp = a; else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 4.1e+114], a, N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 4.1 \cdot 10^{+114}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 4.1000000000000001e114Initial program 92.6%
associate-*l/91.6%
sqr-neg91.6%
associate-+l+91.6%
sqr-neg91.6%
distribute-rgt-out91.6%
Simplified91.6%
Taylor expanded in m around 0 59.9%
Taylor expanded in k around 0 23.5%
if 4.1000000000000001e114 < m Initial program 80.4%
associate-*l/78.6%
sqr-neg78.6%
associate-+l+78.6%
sqr-neg78.6%
distribute-rgt-out78.6%
Simplified78.6%
Taylor expanded in a around 0 80.4%
+-commutative80.4%
+-commutative80.4%
fma-udef80.4%
associate-*r/80.4%
Simplified80.4%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 8.1%
*-commutative8.1%
Simplified8.1%
Taylor expanded in k around inf 20.5%
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 89.9%
associate-*l/88.8%
sqr-neg88.8%
associate-+l+88.8%
sqr-neg88.8%
distribute-rgt-out88.7%
Simplified88.7%
Taylor expanded in m around 0 47.4%
Taylor expanded in k around 0 19.2%
Final simplification19.2%
herbie shell --seed 2024040
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))