
(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 (if (<= k 0.1) (* a (pow k m)) (* (/ (pow k m) k) (/ a (+ k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a * pow(k, m);
} else {
tmp = (pow(k, m) / k) * (a / (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 <= 0.1d0) then
tmp = a * (k ** m)
else
tmp = ((k ** m) / k) * (a / (k + 10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a * Math.pow(k, m);
} else {
tmp = (Math.pow(k, m) / k) * (a / (k + 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.1: tmp = a * math.pow(k, m) else: tmp = (math.pow(k, m) / k) * (a / (k + 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.1) tmp = Float64(a * (k ^ m)); else tmp = Float64(Float64((k ^ m) / k) * Float64(a / Float64(k + 10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.1) tmp = a * (k ^ m); else tmp = ((k ^ m) / k) * (a / (k + 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.1], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[k, m], $MachinePrecision] / k), $MachinePrecision] * N[(a / N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.1:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{{k}^{m}}{k} \cdot \frac{a}{k + 10}\\
\end{array}
\end{array}
if k < 0.10000000000000001Initial program 94.3%
associate-*l/91.8%
sqr-neg91.8%
associate-+l+91.8%
sqr-neg91.8%
distribute-rgt-out91.8%
Simplified91.8%
Taylor expanded in k around 0 99.6%
if 0.10000000000000001 < k Initial program 85.3%
associate-*l/84.3%
sqr-neg84.3%
associate-+l+84.3%
sqr-neg84.3%
distribute-rgt-out84.3%
Simplified84.3%
*-commutative84.3%
clear-num84.2%
un-div-inv84.2%
+-commutative84.2%
fma-define84.2%
+-commutative84.2%
Applied egg-rr84.2%
Taylor expanded in k around inf 82.6%
+-commutative82.6%
unpow282.6%
distribute-rgt-in82.6%
Simplified82.6%
associate-/l*89.3%
associate-/r/97.2%
Applied egg-rr97.2%
Final simplification98.7%
(FPCore (a k m) :precision binary64 (if (or (<= m -2.6e-10) (not (<= m 4.3e-7))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -2.6e-10) || !(m <= 4.3e-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 <= (-2.6d-10)) .or. (.not. (m <= 4.3d-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 <= -2.6e-10) || !(m <= 4.3e-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 <= -2.6e-10) or not (m <= 4.3e-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 <= -2.6e-10) || !(m <= 4.3e-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 <= -2.6e-10) || ~((m <= 4.3e-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, -2.6e-10], N[Not[LessEqual[m, 4.3e-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 -2.6 \cdot 10^{-10} \lor \neg \left(m \leq 4.3 \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 < -2.59999999999999981e-10 or 4.3000000000000001e-7 < m Initial program 89.3%
associate-*l/86.3%
sqr-neg86.3%
associate-+l+86.3%
sqr-neg86.3%
distribute-rgt-out86.3%
Simplified86.3%
Taylor expanded in k around 0 99.4%
if -2.59999999999999981e-10 < m < 4.3000000000000001e-7Initial program 93.9%
associate-*l/93.9%
sqr-neg93.9%
associate-+l+93.9%
sqr-neg93.9%
distribute-rgt-out93.9%
Simplified93.9%
Taylor expanded in m around 0 92.9%
Final simplification97.2%
(FPCore (a k m) :precision binary64 (if (or (<= k -1.15e+19) (not (<= k 0.076))) (/ a (* k (+ k 10.0))) (+ a (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if ((k <= -1.15e+19) || !(k <= 0.076)) {
tmp = a / (k * (k + 10.0));
} else {
tmp = a + (-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 ((k <= (-1.15d+19)) .or. (.not. (k <= 0.076d0))) then
tmp = a / (k * (k + 10.0d0))
else
tmp = a + ((-10.0d0) * (k * a))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= -1.15e+19) || !(k <= 0.076)) {
tmp = a / (k * (k + 10.0));
} else {
tmp = a + (-10.0 * (k * a));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -1.15e+19) or not (k <= 0.076): tmp = a / (k * (k + 10.0)) else: tmp = a + (-10.0 * (k * a)) return tmp
function code(a, k, m) tmp = 0.0 if ((k <= -1.15e+19) || !(k <= 0.076)) tmp = Float64(a / Float64(k * Float64(k + 10.0))); else tmp = Float64(a + Float64(-10.0 * Float64(k * a))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= -1.15e+19) || ~((k <= 0.076))) tmp = a / (k * (k + 10.0)); else tmp = a + (-10.0 * (k * a)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -1.15e+19], N[Not[LessEqual[k, 0.076]], $MachinePrecision]], N[(a / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -1.15 \cdot 10^{+19} \lor \neg \left(k \leq 0.076\right):\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if k < -1.15e19 or 0.0759999999999999981 < k Initial program 83.7%
associate-*l/80.2%
sqr-neg80.2%
associate-+l+80.2%
sqr-neg80.2%
distribute-rgt-out80.2%
Simplified80.2%
*-commutative80.2%
clear-num80.2%
un-div-inv80.2%
+-commutative80.2%
fma-define80.2%
+-commutative80.2%
Applied egg-rr80.2%
Taylor expanded in k around inf 79.1%
+-commutative79.1%
unpow279.1%
distribute-rgt-in79.1%
Simplified79.1%
Taylor expanded in m around 0 55.1%
if -1.15e19 < k < 0.0759999999999999981Initial 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 37.8%
Taylor expanded in k around 0 37.8%
Final simplification47.5%
(FPCore (a k m) :precision binary64 (if (or (<= k -10.0) (not (<= k 1.75))) (/ a (* k (+ k 10.0))) (/ a (+ 1.0 (* k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if ((k <= -10.0) || !(k <= 1.75)) {
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 <= (-10.0d0)) .or. (.not. (k <= 1.75d0))) 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 <= -10.0) || !(k <= 1.75)) {
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 <= -10.0) or not (k <= 1.75): 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 <= -10.0) || !(k <= 1.75)) 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 <= -10.0) || ~((k <= 1.75))) 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, -10.0], N[Not[LessEqual[k, 1.75]], $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 -10 \lor \neg \left(k \leq 1.75\right):\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\end{array}
\end{array}
if k < -10 or 1.75 < k Initial program 83.4%
associate-*l/79.8%
sqr-neg79.8%
associate-+l+79.8%
sqr-neg79.8%
distribute-rgt-out79.8%
Simplified79.8%
*-commutative79.8%
clear-num79.8%
un-div-inv79.8%
+-commutative79.8%
fma-define79.8%
+-commutative79.8%
Applied egg-rr79.8%
Taylor expanded in k around inf 79.2%
+-commutative79.2%
unpow279.2%
distribute-rgt-in79.2%
Simplified79.2%
Taylor expanded in m around 0 56.0%
if -10 < k < 1.75Initial 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 37.8%
Taylor expanded in k around 0 37.2%
*-commutative37.2%
Simplified37.2%
Final simplification47.5%
(FPCore (a k m) :precision binary64 (if (<= k -1.7) (/ a (* k (+ k 10.0))) (if (<= k 1.75) (/ a (+ 1.0 (* k 10.0))) (/ (/ a k) (+ k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if (k <= -1.7) {
tmp = a / (k * (k + 10.0));
} else if (k <= 1.75) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (a / 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 (k <= (-1.7d0)) then
tmp = a / (k * (k + 10.0d0))
else if (k <= 1.75d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = (a / k) / (k + 10.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= -1.7) {
tmp = a / (k * (k + 10.0));
} else if (k <= 1.75) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (a / k) / (k + 10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= -1.7: tmp = a / (k * (k + 10.0)) elif k <= 1.75: tmp = a / (1.0 + (k * 10.0)) else: tmp = (a / k) / (k + 10.0) return tmp
function code(a, k, m) tmp = 0.0 if (k <= -1.7) tmp = Float64(a / Float64(k * Float64(k + 10.0))); elseif (k <= 1.75) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(Float64(a / k) / Float64(k + 10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= -1.7) tmp = a / (k * (k + 10.0)); elseif (k <= 1.75) tmp = a / (1.0 + (k * 10.0)); else tmp = (a / k) / (k + 10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, -1.7], N[(a / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 1.75], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / N[(k + 10.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -1.7:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\mathbf{elif}\;k \leq 1.75:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k + 10}\\
\end{array}
\end{array}
if k < -1.69999999999999996Initial program 80.4%
associate-*l/71.7%
sqr-neg71.7%
associate-+l+71.7%
sqr-neg71.7%
distribute-rgt-out71.7%
Simplified71.7%
*-commutative71.7%
clear-num71.7%
un-div-inv71.7%
+-commutative71.7%
fma-define71.7%
+-commutative71.7%
Applied egg-rr71.7%
Taylor expanded in k around inf 71.7%
+-commutative71.7%
unpow271.7%
distribute-rgt-in71.7%
Simplified71.7%
Taylor expanded in m around 0 44.8%
if -1.69999999999999996 < k < 1.75Initial 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 37.8%
Taylor expanded in k around 0 37.2%
*-commutative37.2%
Simplified37.2%
if 1.75 < k Initial program 84.8%
associate-*l/83.8%
sqr-neg83.8%
associate-+l+83.8%
sqr-neg83.8%
distribute-rgt-out83.8%
Simplified83.8%
*-commutative83.8%
clear-num83.7%
un-div-inv83.7%
+-commutative83.7%
fma-define83.7%
+-commutative83.7%
Applied egg-rr83.7%
Taylor expanded in k around inf 82.8%
+-commutative82.8%
unpow282.8%
distribute-rgt-in82.8%
Simplified82.8%
Taylor expanded in m around 0 61.6%
associate-/r*62.6%
+-commutative62.6%
Simplified62.6%
Final simplification47.9%
(FPCore (a k m) :precision binary64 (if (<= k -1.35) (/ 1.0 (/ (* k (+ k 10.0)) a)) (if (<= k 1.75) (/ a (+ 1.0 (* k 10.0))) (/ (/ a k) (+ k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if (k <= -1.35) {
tmp = 1.0 / ((k * (k + 10.0)) / a);
} else if (k <= 1.75) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (a / 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 (k <= (-1.35d0)) then
tmp = 1.0d0 / ((k * (k + 10.0d0)) / a)
else if (k <= 1.75d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = (a / k) / (k + 10.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= -1.35) {
tmp = 1.0 / ((k * (k + 10.0)) / a);
} else if (k <= 1.75) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (a / k) / (k + 10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= -1.35: tmp = 1.0 / ((k * (k + 10.0)) / a) elif k <= 1.75: tmp = a / (1.0 + (k * 10.0)) else: tmp = (a / k) / (k + 10.0) return tmp
function code(a, k, m) tmp = 0.0 if (k <= -1.35) tmp = Float64(1.0 / Float64(Float64(k * Float64(k + 10.0)) / a)); elseif (k <= 1.75) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(Float64(a / k) / Float64(k + 10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= -1.35) tmp = 1.0 / ((k * (k + 10.0)) / a); elseif (k <= 1.75) tmp = a / (1.0 + (k * 10.0)); else tmp = (a / k) / (k + 10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, -1.35], N[(1.0 / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 1.75], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / N[(k + 10.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -1.35:\\
\;\;\;\;\frac{1}{\frac{k \cdot \left(k + 10\right)}{a}}\\
\mathbf{elif}\;k \leq 1.75:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k + 10}\\
\end{array}
\end{array}
if k < -1.3500000000000001Initial program 80.4%
associate-*l/71.7%
sqr-neg71.7%
associate-+l+71.7%
sqr-neg71.7%
distribute-rgt-out71.7%
Simplified71.7%
Taylor expanded in m around 0 44.8%
clear-num45.4%
distribute-lft-in45.4%
associate-+l+45.4%
associate-/r/44.7%
associate-+l+44.7%
distribute-lft-in44.8%
+-commutative44.8%
fma-define44.8%
+-commutative44.8%
Applied egg-rr44.8%
associate-*l/44.8%
associate-/l*45.4%
Applied egg-rr45.4%
Taylor expanded in k around inf 45.4%
+-commutative71.7%
unpow271.7%
distribute-rgt-in71.7%
Simplified45.4%
if -1.3500000000000001 < k < 1.75Initial 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 37.8%
Taylor expanded in k around 0 37.2%
*-commutative37.2%
Simplified37.2%
if 1.75 < k Initial program 84.8%
associate-*l/83.8%
sqr-neg83.8%
associate-+l+83.8%
sqr-neg83.8%
distribute-rgt-out83.8%
Simplified83.8%
*-commutative83.8%
clear-num83.7%
un-div-inv83.7%
+-commutative83.7%
fma-define83.7%
+-commutative83.7%
Applied egg-rr83.7%
Taylor expanded in k around inf 82.8%
+-commutative82.8%
unpow282.8%
distribute-rgt-in82.8%
Simplified82.8%
Taylor expanded in m around 0 61.6%
associate-/r*62.6%
+-commutative62.6%
Simplified62.6%
Final simplification48.0%
(FPCore (a k m) :precision binary64 (if (<= m 3.2e+37) (/ 1.0 (/ (+ 1.0 (* k (+ k 10.0))) a)) (+ a (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 3.2e+37) {
tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a);
} else {
tmp = a + (-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 <= 3.2d+37) then
tmp = 1.0d0 / ((1.0d0 + (k * (k + 10.0d0))) / a)
else
tmp = a + ((-10.0d0) * (k * a))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 3.2e+37) {
tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a);
} else {
tmp = a + (-10.0 * (k * a));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 3.2e+37: tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a) else: tmp = a + (-10.0 * (k * a)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 3.2e+37) tmp = Float64(1.0 / Float64(Float64(1.0 + Float64(k * Float64(k + 10.0))) / a)); else tmp = Float64(a + Float64(-10.0 * Float64(k * a))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 3.2e+37) tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a); else tmp = a + (-10.0 * (k * a)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 3.2e+37], N[(1.0 / N[(N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 3.2 \cdot 10^{+37}:\\
\;\;\;\;\frac{1}{\frac{1 + k \cdot \left(k + 10\right)}{a}}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 3.20000000000000014e37Initial program 96.2%
associate-*l/95.7%
sqr-neg95.7%
associate-+l+95.7%
sqr-neg95.7%
distribute-rgt-out95.7%
Simplified95.7%
Taylor expanded in m around 0 62.5%
clear-num62.6%
distribute-lft-in62.6%
associate-+l+62.6%
associate-/r/62.5%
associate-+l+62.5%
distribute-lft-in62.5%
+-commutative62.5%
fma-define62.5%
+-commutative62.5%
Applied egg-rr62.5%
associate-*l/62.5%
associate-/l*62.6%
Applied egg-rr62.6%
fma-undefine62.6%
Applied egg-rr62.6%
if 3.20000000000000014e37 < m Initial program 74.2%
associate-*l/67.7%
sqr-neg67.7%
associate-+l+67.7%
sqr-neg67.7%
distribute-rgt-out67.7%
Simplified67.7%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 11.5%
Final simplification50.2%
(FPCore (a k m) :precision binary64 (if (or (<= k -2.55e+68) (not (<= k 0.1))) (* (/ a k) 0.1) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= -2.55e+68) || !(k <= 0.1)) {
tmp = (a / k) * 0.1;
} 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 <= (-2.55d+68)) .or. (.not. (k <= 0.1d0))) then
tmp = (a / k) * 0.1d0
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= -2.55e+68) || !(k <= 0.1)) {
tmp = (a / k) * 0.1;
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -2.55e+68) or not (k <= 0.1): tmp = (a / k) * 0.1 else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= -2.55e+68) || !(k <= 0.1)) tmp = Float64(Float64(a / k) * 0.1); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= -2.55e+68) || ~((k <= 0.1))) tmp = (a / k) * 0.1; else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -2.55e+68], N[Not[LessEqual[k, 0.1]], $MachinePrecision]], N[(N[(a / k), $MachinePrecision] * 0.1), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -2.55 \cdot 10^{+68} \lor \neg \left(k \leq 0.1\right):\\
\;\;\;\;\frac{a}{k} \cdot 0.1\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < -2.55e68 or 0.10000000000000001 < k Initial program 82.9%
associate-*l/80.0%
sqr-neg80.0%
associate-+l+80.0%
sqr-neg80.0%
distribute-rgt-out80.0%
Simplified80.0%
Taylor expanded in m around 0 58.9%
Taylor expanded in k around 0 19.3%
*-commutative19.3%
Simplified19.3%
Taylor expanded in k around inf 19.2%
if -2.55e68 < k < 0.10000000000000001Initial program 100.0%
associate-*l/99.1%
sqr-neg99.1%
associate-+l+99.1%
sqr-neg99.1%
distribute-rgt-out99.1%
Simplified99.1%
Taylor expanded in m around 0 35.9%
Taylor expanded in k around 0 35.3%
Final simplification26.8%
(FPCore (a k m) :precision binary64 (if (<= k -2.4e+67) (* (/ a k) 0.1) (if (<= k 0.1) a (/ 0.1 (/ k a)))))
double code(double a, double k, double m) {
double tmp;
if (k <= -2.4e+67) {
tmp = (a / k) * 0.1;
} else if (k <= 0.1) {
tmp = a;
} else {
tmp = 0.1 / (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 <= (-2.4d+67)) then
tmp = (a / k) * 0.1d0
else if (k <= 0.1d0) then
tmp = a
else
tmp = 0.1d0 / (k / a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= -2.4e+67) {
tmp = (a / k) * 0.1;
} else if (k <= 0.1) {
tmp = a;
} else {
tmp = 0.1 / (k / a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= -2.4e+67: tmp = (a / k) * 0.1 elif k <= 0.1: tmp = a else: tmp = 0.1 / (k / a) return tmp
function code(a, k, m) tmp = 0.0 if (k <= -2.4e+67) tmp = Float64(Float64(a / k) * 0.1); elseif (k <= 0.1) tmp = a; else tmp = Float64(0.1 / Float64(k / a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= -2.4e+67) tmp = (a / k) * 0.1; elseif (k <= 0.1) tmp = a; else tmp = 0.1 / (k / a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, -2.4e+67], N[(N[(a / k), $MachinePrecision] * 0.1), $MachinePrecision], If[LessEqual[k, 0.1], a, N[(0.1 / N[(k / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -2.4 \cdot 10^{+67}:\\
\;\;\;\;\frac{a}{k} \cdot 0.1\\
\mathbf{elif}\;k \leq 0.1:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a}}\\
\end{array}
\end{array}
if k < -2.40000000000000002e67Initial program 76.9%
associate-*l/69.2%
sqr-neg69.2%
associate-+l+69.2%
sqr-neg69.2%
distribute-rgt-out69.2%
Simplified69.2%
Taylor expanded in m around 0 52.0%
Taylor expanded in k around 0 16.3%
*-commutative16.3%
Simplified16.3%
Taylor expanded in k around inf 16.3%
if -2.40000000000000002e67 < k < 0.10000000000000001Initial program 100.0%
associate-*l/99.1%
sqr-neg99.1%
associate-+l+99.1%
sqr-neg99.1%
distribute-rgt-out99.1%
Simplified99.1%
Taylor expanded in m around 0 35.9%
Taylor expanded in k around 0 35.3%
if 0.10000000000000001 < k Initial program 85.3%
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 61.7%
Taylor expanded in k around 0 20.5%
*-commutative20.5%
Simplified20.5%
Taylor expanded in k around inf 20.4%
clear-num20.8%
un-div-inv20.8%
Applied egg-rr20.8%
Final simplification26.9%
(FPCore (a k m) :precision binary64 (if (<= m 2.35e+42) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.35e+42) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (-10.0 * (k * a));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 2.35d+42) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + ((-10.0d0) * (k * a))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.35e+42) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (-10.0 * (k * a));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.35e+42: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (-10.0 * (k * a)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.35e+42) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(-10.0 * Float64(k * a))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.35e+42) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (-10.0 * (k * a)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.35e+42], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.35 \cdot 10^{+42}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 2.34999999999999993e42Initial program 96.2%
associate-*l/95.7%
sqr-neg95.7%
associate-+l+95.7%
sqr-neg95.7%
distribute-rgt-out95.7%
Simplified95.7%
Taylor expanded in m around 0 62.5%
if 2.34999999999999993e42 < m Initial program 74.2%
associate-*l/67.7%
sqr-neg67.7%
associate-+l+67.7%
sqr-neg67.7%
distribute-rgt-out67.7%
Simplified67.7%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 11.5%
Final simplification50.2%
(FPCore (a k m) :precision binary64 (if (<= k 0.08) (+ a (* -10.0 (* k a))) (/ 0.1 (/ k a))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.08) {
tmp = a + (-10.0 * (k * a));
} else {
tmp = 0.1 / (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 <= 0.08d0) then
tmp = a + ((-10.0d0) * (k * a))
else
tmp = 0.1d0 / (k / a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.08) {
tmp = a + (-10.0 * (k * a));
} else {
tmp = 0.1 / (k / a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.08: tmp = a + (-10.0 * (k * a)) else: tmp = 0.1 / (k / a) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.08) tmp = Float64(a + Float64(-10.0 * Float64(k * a))); else tmp = Float64(0.1 / Float64(k / a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.08) tmp = a + (-10.0 * (k * a)); else tmp = 0.1 / (k / a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.08], N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.1 / N[(k / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.08:\\
\;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a}}\\
\end{array}
\end{array}
if k < 0.0800000000000000017Initial program 94.3%
associate-*l/91.8%
sqr-neg91.8%
associate-+l+91.8%
sqr-neg91.8%
distribute-rgt-out91.8%
Simplified91.8%
Taylor expanded in m around 0 39.8%
Taylor expanded in k around 0 31.0%
if 0.0800000000000000017 < k Initial program 85.3%
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 61.7%
Taylor expanded in k around 0 20.5%
*-commutative20.5%
Simplified20.5%
Taylor expanded in k around inf 20.4%
clear-num20.8%
un-div-inv20.8%
Applied egg-rr20.8%
Final simplification27.1%
(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 90.9%
associate-*l/88.9%
sqr-neg88.9%
associate-+l+89.0%
sqr-neg89.0%
distribute-rgt-out89.0%
Simplified89.0%
Taylor expanded in m around 0 48.1%
Taylor expanded in k around 0 18.8%
Final simplification18.8%
herbie shell --seed 2024039
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))