
(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 13 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 (* (pow k m) a)) (t_1 (hypot k (sqrt (fma k 10.0 1.0))))) (if (<= k -0.1) t_0 (/ (/ t_0 t_1) t_1))))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double t_1 = hypot(k, sqrt(fma(k, 10.0, 1.0)));
double tmp;
if (k <= -0.1) {
tmp = t_0;
} else {
tmp = (t_0 / t_1) / t_1;
}
return tmp;
}
function code(a, k, m) t_0 = Float64((k ^ m) * a) t_1 = hypot(k, sqrt(fma(k, 10.0, 1.0))) tmp = 0.0 if (k <= -0.1) tmp = t_0; else tmp = Float64(Float64(t_0 / t_1) / t_1); end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[k ^ 2 + N[Sqrt[N[(k * 10.0 + 1.0), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[k, -0.1], t$95$0, N[(N[(t$95$0 / t$95$1), $MachinePrecision] / t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
t_1 := \mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)\\
\mathbf{if}\;k \leq -0.1:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{t\_1}}{t\_1}\\
\end{array}
\end{array}
if k < -0.10000000000000001Initial program 73.9%
associate-/l*73.9%
sqr-neg73.9%
associate-+l+73.9%
+-commutative73.9%
sqr-neg73.9%
distribute-rgt-out73.9%
fma-define73.9%
+-commutative73.9%
Simplified73.9%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -0.10000000000000001 < k Initial program 94.3%
associate-/l*94.3%
sqr-neg94.3%
associate-+l+94.3%
+-commutative94.3%
sqr-neg94.3%
distribute-rgt-out94.3%
fma-define94.3%
+-commutative94.3%
Simplified94.3%
associate-*r/94.3%
add-sqr-sqrt94.3%
associate-/r*94.3%
*-commutative94.3%
fma-undefine94.3%
distribute-rgt-in94.3%
associate-+r+94.3%
+-commutative94.3%
add-sqr-sqrt94.3%
hypot-define94.3%
+-commutative94.3%
*-commutative94.3%
fma-define94.3%
fma-undefine94.3%
distribute-rgt-in94.3%
associate-+r+94.3%
Applied egg-rr100.0%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* (pow k m) a))) (if (<= k 1e-254) t_0 (/ 1.0 (+ (* (/ k t_0) (+ k 10.0)) (/ 1.0 t_0))))))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if (k <= 1e-254) {
tmp = t_0;
} else {
tmp = 1.0 / (((k / t_0) * (k + 10.0)) + (1.0 / 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 = (k ** m) * a
if (k <= 1d-254) then
tmp = t_0
else
tmp = 1.0d0 / (((k / t_0) * (k + 10.0d0)) + (1.0d0 / t_0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = Math.pow(k, m) * a;
double tmp;
if (k <= 1e-254) {
tmp = t_0;
} else {
tmp = 1.0 / (((k / t_0) * (k + 10.0)) + (1.0 / t_0));
}
return tmp;
}
def code(a, k, m): t_0 = math.pow(k, m) * a tmp = 0 if k <= 1e-254: tmp = t_0 else: tmp = 1.0 / (((k / t_0) * (k + 10.0)) + (1.0 / t_0)) return tmp
function code(a, k, m) t_0 = Float64((k ^ m) * a) tmp = 0.0 if (k <= 1e-254) tmp = t_0; else tmp = Float64(1.0 / Float64(Float64(Float64(k / t_0) * Float64(k + 10.0)) + Float64(1.0 / t_0))); end return tmp end
function tmp_2 = code(a, k, m) t_0 = (k ^ m) * a; tmp = 0.0; if (k <= 1e-254) tmp = t_0; else tmp = 1.0 / (((k / t_0) * (k + 10.0)) + (1.0 / t_0)); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[k, 1e-254], t$95$0, N[(1.0 / N[(N[(N[(k / t$95$0), $MachinePrecision] * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;k \leq 10^{-254}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{k}{t\_0} \cdot \left(k + 10\right) + \frac{1}{t\_0}}\\
\end{array}
\end{array}
if k < 9.9999999999999991e-255Initial program 88.6%
associate-/l*88.6%
sqr-neg88.6%
associate-+l+88.6%
+-commutative88.6%
sqr-neg88.6%
distribute-rgt-out88.6%
fma-define88.6%
+-commutative88.6%
Simplified88.6%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if 9.9999999999999991e-255 < k Initial program 92.1%
associate-/l*92.1%
sqr-neg92.1%
associate-+l+92.1%
+-commutative92.1%
sqr-neg92.1%
distribute-rgt-out92.1%
fma-define92.1%
+-commutative92.1%
Simplified92.1%
associate-*r/92.1%
clear-num92.1%
*-commutative92.1%
Applied egg-rr92.1%
Taylor expanded in k around 0 99.9%
distribute-lft-in99.9%
un-div-inv99.9%
Applied egg-rr99.9%
*-commutative99.9%
associate-*l/99.9%
associate-*r/99.9%
distribute-rgt-out99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* (pow k m) a))) (if (<= m 3.0) (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))) t_0)))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if (m <= 3.0) {
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 = (k ** m) * a
if (m <= 3.0d0) 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 = Math.pow(k, m) * a;
double tmp;
if (m <= 3.0) {
tmp = t_0 / ((1.0 + (k * 10.0)) + (k * k));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = math.pow(k, m) * a tmp = 0 if m <= 3.0: tmp = t_0 / ((1.0 + (k * 10.0)) + (k * k)) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64((k ^ m) * a) tmp = 0.0 if (m <= 3.0) 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 = (k ^ m) * a; tmp = 0.0; if (m <= 3.0) 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[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[m, 3.0], 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 := {k}^{m} \cdot a\\
\mathbf{if}\;m \leq 3:\\
\;\;\;\;\frac{t\_0}{\left(1 + k \cdot 10\right) + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < 3Initial program 98.2%
if 3 < m Initial program 77.4%
associate-/l*77.4%
sqr-neg77.4%
associate-+l+77.4%
+-commutative77.4%
sqr-neg77.4%
distribute-rgt-out77.4%
fma-define77.4%
+-commutative77.4%
Simplified77.4%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification98.9%
(FPCore (a k m) :precision binary64 (if (<= m -1.02e-5) (* a (/ (pow k m) (+ 1.0 (* k 10.0)))) (if (<= m 0.0011) (/ a (+ 1.0 (* k (+ k 10.0)))) (* (pow k m) a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.02e-5) {
tmp = a * (pow(k, m) / (1.0 + (k * 10.0)));
} else if (m <= 0.0011) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = pow(k, m) * 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.02d-5)) then
tmp = a * ((k ** m) / (1.0d0 + (k * 10.0d0)))
else if (m <= 0.0011d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = (k ** m) * a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1.02e-5) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * 10.0)));
} else if (m <= 0.0011) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = Math.pow(k, m) * a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.02e-5: tmp = a * (math.pow(k, m) / (1.0 + (k * 10.0))) elif m <= 0.0011: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = math.pow(k, m) * a return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.02e-5) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * 10.0)))); elseif (m <= 0.0011) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64((k ^ m) * a); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.02e-5) tmp = a * ((k ^ m) / (1.0 + (k * 10.0))); elseif (m <= 0.0011) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = (k ^ m) * a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.02e-5], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.0011], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.02 \cdot 10^{-5}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot 10}\\
\mathbf{elif}\;m \leq 0.0011:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\
\end{array}
\end{array}
if m < -1.0200000000000001e-5Initial program 100.0%
associate-/l*100.0%
sqr-neg100.0%
associate-+l+100.0%
+-commutative100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
fma-define100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in k around 0 98.7%
if -1.0200000000000001e-5 < m < 0.00110000000000000007Initial program 96.8%
associate-/l*96.8%
sqr-neg96.8%
associate-+l+96.8%
+-commutative96.8%
sqr-neg96.8%
distribute-rgt-out96.8%
fma-define96.8%
+-commutative96.8%
Simplified96.8%
Taylor expanded in m around 0 96.7%
if 0.00110000000000000007 < m Initial program 77.4%
associate-/l*77.4%
sqr-neg77.4%
associate-+l+77.4%
+-commutative77.4%
sqr-neg77.4%
distribute-rgt-out77.4%
fma-define77.4%
+-commutative77.4%
Simplified77.4%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification98.5%
(FPCore (a k m) :precision binary64 (if (or (<= m -5200.0) (not (<= m 0.0012))) (* (pow k m) a) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -5200.0) || !(m <= 0.0012)) {
tmp = pow(k, m) * a;
} 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 <= (-5200.0d0)) .or. (.not. (m <= 0.0012d0))) then
tmp = (k ** m) * a
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 <= -5200.0) || !(m <= 0.0012)) {
tmp = Math.pow(k, m) * a;
} else {
tmp = a / (1.0 + (k * (k + 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -5200.0) or not (m <= 0.0012): tmp = math.pow(k, m) * a else: tmp = a / (1.0 + (k * (k + 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -5200.0) || !(m <= 0.0012)) tmp = Float64((k ^ m) * a); 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 <= -5200.0) || ~((m <= 0.0012))) tmp = (k ^ m) * a; else tmp = a / (1.0 + (k * (k + 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -5200.0], N[Not[LessEqual[m, 0.0012]], $MachinePrecision]], N[(N[Power[k, m], $MachinePrecision] * a), $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 -5200 \lor \neg \left(m \leq 0.0012\right):\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -5200 or 0.00119999999999999989 < m Initial program 87.2%
associate-/l*87.2%
sqr-neg87.2%
associate-+l+87.2%
+-commutative87.2%
sqr-neg87.2%
distribute-rgt-out87.2%
fma-define87.2%
+-commutative87.2%
Simplified87.2%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -5200 < m < 0.00119999999999999989Initial program 96.9%
associate-/l*96.9%
sqr-neg96.9%
associate-+l+96.9%
+-commutative96.9%
sqr-neg96.9%
distribute-rgt-out96.9%
fma-define96.9%
+-commutative96.9%
Simplified96.9%
Taylor expanded in m around 0 95.7%
Final simplification98.5%
(FPCore (a k m) :precision binary64 (if (<= m 2.1) (/ 1.0 (/ (+ 1.0 (* k (+ k 10.0))) a)) (+ a (* k (- (* 100.0 (* k a)) (* a 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.1) {
tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a);
} else {
tmp = a + (k * ((100.0 * (k * a)) - (a * 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.1d0) then
tmp = 1.0d0 / ((1.0d0 + (k * (k + 10.0d0))) / a)
else
tmp = a + (k * ((100.0d0 * (k * a)) - (a * 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.1) {
tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a);
} else {
tmp = a + (k * ((100.0 * (k * a)) - (a * 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.1: tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a) else: tmp = a + (k * ((100.0 * (k * a)) - (a * 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.1) tmp = Float64(1.0 / Float64(Float64(1.0 + Float64(k * Float64(k + 10.0))) / a)); else tmp = Float64(a + Float64(k * Float64(Float64(100.0 * Float64(k * a)) - Float64(a * 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.1) tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a); else tmp = a + (k * ((100.0 * (k * a)) - (a * 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.1], N[(1.0 / N[(N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(N[(100.0 * N[(k * a), $MachinePrecision]), $MachinePrecision] - N[(a * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.1:\\
\;\;\;\;\frac{1}{\frac{1 + k \cdot \left(k + 10\right)}{a}}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(100 \cdot \left(k \cdot a\right) - a \cdot 10\right)\\
\end{array}
\end{array}
if m < 2.10000000000000009Initial program 98.2%
associate-/l*98.2%
sqr-neg98.2%
associate-+l+98.2%
+-commutative98.2%
sqr-neg98.2%
distribute-rgt-out98.2%
fma-define98.2%
+-commutative98.2%
Simplified98.2%
associate-*r/98.2%
clear-num98.2%
*-commutative98.2%
Applied egg-rr98.2%
Taylor expanded in m around 0 72.6%
if 2.10000000000000009 < m Initial program 77.4%
associate-/l*77.4%
sqr-neg77.4%
associate-+l+77.4%
+-commutative77.4%
sqr-neg77.4%
distribute-rgt-out77.4%
fma-define77.4%
+-commutative77.4%
Simplified77.4%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 2.9%
*-commutative2.9%
Simplified2.9%
Taylor expanded in k around 0 22.7%
Final simplification54.5%
(FPCore (a k m) :precision binary64 (if (<= m 1.6) (/ 1.0 (/ (+ 1.0 (* k (+ k 10.0))) a)) (* (* k a) 0.001)))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.6) {
tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a);
} else {
tmp = (k * a) * 0.001;
}
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.6d0) then
tmp = 1.0d0 / ((1.0d0 + (k * (k + 10.0d0))) / a)
else
tmp = (k * a) * 0.001d0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.6) {
tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a);
} else {
tmp = (k * a) * 0.001;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.6: tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a) else: tmp = (k * a) * 0.001 return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.6) tmp = Float64(1.0 / Float64(Float64(1.0 + Float64(k * Float64(k + 10.0))) / a)); else tmp = Float64(Float64(k * a) * 0.001); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.6) tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a); else tmp = (k * a) * 0.001; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.6], N[(1.0 / N[(N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(k * a), $MachinePrecision] * 0.001), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.6:\\
\;\;\;\;\frac{1}{\frac{1 + k \cdot \left(k + 10\right)}{a}}\\
\mathbf{else}:\\
\;\;\;\;\left(k \cdot a\right) \cdot 0.001\\
\end{array}
\end{array}
if m < 1.6000000000000001Initial program 98.2%
associate-/l*98.2%
sqr-neg98.2%
associate-+l+98.2%
+-commutative98.2%
sqr-neg98.2%
distribute-rgt-out98.2%
fma-define98.2%
+-commutative98.2%
Simplified98.2%
associate-*r/98.2%
clear-num98.2%
*-commutative98.2%
Applied egg-rr98.2%
Taylor expanded in m around 0 72.6%
if 1.6000000000000001 < m Initial program 77.4%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around inf 2.3%
*-commutative2.3%
Simplified2.3%
Taylor expanded in k around 0 9.5%
Taylor expanded in k around inf 19.5%
Final simplification53.3%
(FPCore (a k m) :precision binary64 (if (<= m -1.05e-18) (* 0.1 (/ a k)) (if (<= m 0.62) a (* (* k a) 0.001))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.05e-18) {
tmp = 0.1 * (a / k);
} else if (m <= 0.62) {
tmp = a;
} else {
tmp = (k * a) * 0.001;
}
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.05d-18)) then
tmp = 0.1d0 * (a / k)
else if (m <= 0.62d0) then
tmp = a
else
tmp = (k * a) * 0.001d0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1.05e-18) {
tmp = 0.1 * (a / k);
} else if (m <= 0.62) {
tmp = a;
} else {
tmp = (k * a) * 0.001;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.05e-18: tmp = 0.1 * (a / k) elif m <= 0.62: tmp = a else: tmp = (k * a) * 0.001 return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.05e-18) tmp = Float64(0.1 * Float64(a / k)); elseif (m <= 0.62) tmp = a; else tmp = Float64(Float64(k * a) * 0.001); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.05e-18) tmp = 0.1 * (a / k); elseif (m <= 0.62) tmp = a; else tmp = (k * a) * 0.001; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.05e-18], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.62], a, N[(N[(k * a), $MachinePrecision] * 0.001), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.05 \cdot 10^{-18}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{elif}\;m \leq 0.62:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\left(k \cdot a\right) \cdot 0.001\\
\end{array}
\end{array}
if m < -1.05e-18Initial program 98.8%
Taylor expanded in m around 0 43.9%
Taylor expanded in k around inf 46.1%
*-commutative46.1%
Simplified46.1%
Taylor expanded in k around 0 25.0%
if -1.05e-18 < m < 0.619999999999999996Initial program 97.7%
Taylor expanded in m around 0 97.6%
Taylor expanded in k around inf 97.5%
Taylor expanded in k around 0 57.7%
if 0.619999999999999996 < m Initial program 77.4%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around inf 2.3%
*-commutative2.3%
Simplified2.3%
Taylor expanded in k around 0 9.5%
Taylor expanded in k around inf 19.5%
Final simplification34.0%
(FPCore (a k m) :precision binary64 (if (<= m 1.0) (/ a (+ 1.0 (* k (+ k 10.0)))) (* (* k a) 0.001)))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = (k * a) * 0.001;
}
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.0d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = (k * a) * 0.001d0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = (k * a) * 0.001;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.0: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = (k * a) * 0.001 return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.0) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(Float64(k * a) * 0.001); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.0) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = (k * a) * 0.001; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.0], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(k * a), $MachinePrecision] * 0.001), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(k \cdot a\right) \cdot 0.001\\
\end{array}
\end{array}
if m < 1Initial program 98.2%
associate-/l*98.2%
sqr-neg98.2%
associate-+l+98.2%
+-commutative98.2%
sqr-neg98.2%
distribute-rgt-out98.2%
fma-define98.2%
+-commutative98.2%
Simplified98.2%
Taylor expanded in m around 0 72.2%
if 1 < m Initial program 77.4%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around inf 2.3%
*-commutative2.3%
Simplified2.3%
Taylor expanded in k around 0 9.5%
Taylor expanded in k around inf 19.5%
Final simplification53.1%
(FPCore (a k m) :precision binary64 (if (<= m 0.9) (/ a (+ 1.0 (* k k))) (* (* k a) 0.001)))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.9) {
tmp = a / (1.0 + (k * k));
} else {
tmp = (k * a) * 0.001;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 0.9d0) then
tmp = a / (1.0d0 + (k * k))
else
tmp = (k * a) * 0.001d0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 0.9) {
tmp = a / (1.0 + (k * k));
} else {
tmp = (k * a) * 0.001;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.9: tmp = a / (1.0 + (k * k)) else: tmp = (k * a) * 0.001 return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.9) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(Float64(k * a) * 0.001); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 0.9) tmp = a / (1.0 + (k * k)); else tmp = (k * a) * 0.001; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.9], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(k * a), $MachinePrecision] * 0.001), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.9:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;\left(k \cdot a\right) \cdot 0.001\\
\end{array}
\end{array}
if m < 0.900000000000000022Initial program 98.2%
Taylor expanded in m around 0 72.2%
Taylor expanded in k around inf 72.1%
Taylor expanded in k around 0 72.2%
if 0.900000000000000022 < m Initial program 77.4%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around inf 2.3%
*-commutative2.3%
Simplified2.3%
Taylor expanded in k around 0 9.5%
Taylor expanded in k around inf 19.5%
Final simplification53.0%
(FPCore (a k m) :precision binary64 (if (<= m 1.4) (/ a (+ 1.0 (* k 10.0))) (* (* k a) 0.001)))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.4) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (k * a) * 0.001;
}
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.4d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = (k * a) * 0.001d0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.4) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (k * a) * 0.001;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.4: tmp = a / (1.0 + (k * 10.0)) else: tmp = (k * a) * 0.001 return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.4) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(Float64(k * a) * 0.001); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.4) tmp = a / (1.0 + (k * 10.0)); else tmp = (k * a) * 0.001; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.4], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(k * a), $MachinePrecision] * 0.001), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.4:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\left(k \cdot a\right) \cdot 0.001\\
\end{array}
\end{array}
if m < 1.3999999999999999Initial program 98.2%
associate-/l*98.2%
sqr-neg98.2%
associate-+l+98.2%
+-commutative98.2%
sqr-neg98.2%
distribute-rgt-out98.2%
fma-define98.2%
+-commutative98.2%
Simplified98.2%
Taylor expanded in m around 0 72.2%
Taylor expanded in k around 0 46.6%
*-commutative46.6%
Simplified46.6%
if 1.3999999999999999 < m Initial program 77.4%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around inf 2.3%
*-commutative2.3%
Simplified2.3%
Taylor expanded in k around 0 9.5%
Taylor expanded in k around inf 19.5%
Final simplification36.8%
(FPCore (a k m) :precision binary64 (if (<= m 0.55) a (* (* k a) 0.001)))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.55) {
tmp = a;
} else {
tmp = (k * a) * 0.001;
}
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.55d0) then
tmp = a
else
tmp = (k * a) * 0.001d0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 0.55) {
tmp = a;
} else {
tmp = (k * a) * 0.001;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.55: tmp = a else: tmp = (k * a) * 0.001 return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.55) tmp = a; else tmp = Float64(Float64(k * a) * 0.001); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 0.55) tmp = a; else tmp = (k * a) * 0.001; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.55], a, N[(N[(k * a), $MachinePrecision] * 0.001), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.55:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\left(k \cdot a\right) \cdot 0.001\\
\end{array}
\end{array}
if m < 0.55000000000000004Initial program 98.2%
Taylor expanded in m around 0 72.2%
Taylor expanded in k around inf 72.1%
Taylor expanded in k around 0 32.3%
if 0.55000000000000004 < m Initial program 77.4%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around inf 2.3%
*-commutative2.3%
Simplified2.3%
Taylor expanded in k around 0 9.5%
Taylor expanded in k around inf 19.5%
Final simplification27.6%
(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.7%
Taylor expanded in m around 0 47.1%
Taylor expanded in k around inf 47.0%
Taylor expanded in k around 0 21.9%
herbie shell --seed 2024095
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))