
(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 (if (<= k 2.45e-5) (* a (pow k m)) (/ (* a (/ (pow k m) k)) k)))
double code(double a, double k, double m) {
double tmp;
if (k <= 2.45e-5) {
tmp = a * pow(k, m);
} else {
tmp = (a * (pow(k, m) / k)) / k;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 2.45d-5) then
tmp = a * (k ** m)
else
tmp = (a * ((k ** m) / k)) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 2.45e-5) {
tmp = a * Math.pow(k, m);
} else {
tmp = (a * (Math.pow(k, m) / k)) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 2.45e-5: tmp = a * math.pow(k, m) else: tmp = (a * (math.pow(k, m) / k)) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 2.45e-5) tmp = Float64(a * (k ^ m)); else tmp = Float64(Float64(a * Float64((k ^ m) / k)) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 2.45e-5) tmp = a * (k ^ m); else tmp = (a * ((k ^ m) / k)) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 2.45e-5], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(N[Power[k, m], $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.45 \cdot 10^{-5}:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a \cdot \frac{{k}^{m}}{k}}{k}\\
\end{array}
\end{array}
if k < 2.45e-5Initial program 96.5%
associate-*r/96.5%
associate-+l+96.5%
+-commutative96.5%
distribute-rgt-out96.5%
fma-def96.5%
+-commutative96.5%
Simplified96.5%
Taylor expanded in k around 0 58.4%
exp-to-pow99.6%
Simplified99.6%
if 2.45e-5 < k Initial program 82.4%
associate-*r/82.4%
associate-+l+82.4%
+-commutative82.4%
distribute-rgt-out82.4%
fma-def82.4%
+-commutative82.4%
Simplified82.4%
Taylor expanded in k around inf 81.3%
unpow281.3%
Simplified81.3%
associate-/r*93.8%
div-inv93.8%
Applied egg-rr93.8%
associate-*r/93.8%
*-rgt-identity93.8%
Simplified93.8%
associate-*r/98.8%
Applied egg-rr98.8%
Final simplification99.3%
(FPCore (a k m) :precision binary64 (if (<= k 2.45e-5) (* a (pow k m)) (* a (/ (/ (pow k m) k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 2.45e-5) {
tmp = a * pow(k, m);
} else {
tmp = a * ((pow(k, m) / k) / k);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 2.45d-5) then
tmp = a * (k ** m)
else
tmp = a * (((k ** m) / k) / k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 2.45e-5) {
tmp = a * Math.pow(k, m);
} else {
tmp = a * ((Math.pow(k, m) / k) / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 2.45e-5: tmp = a * math.pow(k, m) else: tmp = a * ((math.pow(k, m) / k) / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 2.45e-5) tmp = Float64(a * (k ^ m)); else tmp = Float64(a * Float64(Float64((k ^ m) / k) / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 2.45e-5) tmp = a * (k ^ m); else tmp = a * (((k ^ m) / k) / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 2.45e-5], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a * N[(N[(N[Power[k, m], $MachinePrecision] / k), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.45 \cdot 10^{-5}:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{\frac{{k}^{m}}{k}}{k}\\
\end{array}
\end{array}
if k < 2.45e-5Initial program 96.5%
associate-*r/96.5%
associate-+l+96.5%
+-commutative96.5%
distribute-rgt-out96.5%
fma-def96.5%
+-commutative96.5%
Simplified96.5%
Taylor expanded in k around 0 58.4%
exp-to-pow99.6%
Simplified99.6%
if 2.45e-5 < k Initial program 82.4%
associate-*r/82.4%
associate-+l+82.4%
+-commutative82.4%
distribute-rgt-out82.4%
fma-def82.4%
+-commutative82.4%
Simplified82.4%
Taylor expanded in k around inf 81.3%
unpow281.3%
Simplified81.3%
associate-/r*93.8%
div-inv93.8%
Applied egg-rr93.8%
associate-*r/93.8%
*-rgt-identity93.8%
Simplified93.8%
Final simplification97.1%
(FPCore (a k m) :precision binary64 (if (or (<= m -7.9e-10) (not (<= m 0.45))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -7.9e-10) || !(m <= 0.45)) {
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 <= (-7.9d-10)) .or. (.not. (m <= 0.45d0))) 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 <= -7.9e-10) || !(m <= 0.45)) {
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 <= -7.9e-10) or not (m <= 0.45): 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 <= -7.9e-10) || !(m <= 0.45)) 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 <= -7.9e-10) || ~((m <= 0.45))) 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, -7.9e-10], N[Not[LessEqual[m, 0.45]], $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 -7.9 \cdot 10^{-10} \lor \neg \left(m \leq 0.45\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -7.8999999999999996e-10 or 0.450000000000000011 < m Initial program 88.5%
associate-*r/88.5%
associate-+l+88.5%
+-commutative88.5%
distribute-rgt-out88.5%
fma-def88.5%
+-commutative88.5%
Simplified88.5%
Taylor expanded in k around 0 64.8%
exp-to-pow98.9%
Simplified98.9%
if -7.8999999999999996e-10 < m < 0.450000000000000011Initial program 94.1%
associate-*r/94.0%
associate-+l+94.0%
+-commutative94.0%
distribute-rgt-out94.0%
fma-def94.0%
+-commutative94.0%
Simplified94.0%
Taylor expanded in m around 0 91.9%
Final simplification96.6%
(FPCore (a k m) :precision binary64 (if (<= k 2.45e-5) (* a (pow k m)) (* a (pow k (- m 2.0)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 2.45e-5) {
tmp = a * pow(k, m);
} else {
tmp = a * pow(k, (m - 2.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 <= 2.45d-5) then
tmp = a * (k ** m)
else
tmp = a * (k ** (m - 2.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 2.45e-5) {
tmp = a * Math.pow(k, m);
} else {
tmp = a * Math.pow(k, (m - 2.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 2.45e-5: tmp = a * math.pow(k, m) else: tmp = a * math.pow(k, (m - 2.0)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 2.45e-5) tmp = Float64(a * (k ^ m)); else tmp = Float64(a * (k ^ Float64(m - 2.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 2.45e-5) tmp = a * (k ^ m); else tmp = a * (k ^ (m - 2.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 2.45e-5], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, N[(m - 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.45 \cdot 10^{-5}:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{\left(m - 2\right)}\\
\end{array}
\end{array}
if k < 2.45e-5Initial program 96.5%
associate-*r/96.5%
associate-+l+96.5%
+-commutative96.5%
distribute-rgt-out96.5%
fma-def96.5%
+-commutative96.5%
Simplified96.5%
Taylor expanded in k around 0 58.4%
exp-to-pow99.6%
Simplified99.6%
if 2.45e-5 < k Initial program 82.4%
associate-*r/82.4%
associate-+l+82.4%
+-commutative82.4%
distribute-rgt-out82.4%
fma-def82.4%
+-commutative82.4%
Simplified82.4%
Taylor expanded in k around inf 81.3%
unpow281.3%
Simplified81.3%
expm1-log1p-u81.3%
expm1-udef63.5%
pow263.5%
pow-div75.8%
Applied egg-rr75.8%
expm1-def93.5%
expm1-log1p93.5%
Simplified93.5%
Final simplification96.9%
(FPCore (a k m) :precision binary64 (if (<= m -0.0096) (/ a (* k k)) (if (<= m 3.15e+16) (/ a (+ 1.0 (* k (+ k 10.0)))) (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.0096) {
tmp = a / (k * k);
} else if (m <= 3.15e+16) {
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 <= (-0.0096d0)) then
tmp = a / (k * k)
else if (m <= 3.15d+16) 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 <= -0.0096) {
tmp = a / (k * k);
} else if (m <= 3.15e+16) {
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 <= -0.0096: tmp = a / (k * k) elif m <= 3.15e+16: 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 <= -0.0096) tmp = Float64(a / Float64(k * k)); elseif (m <= 3.15e+16) 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 <= -0.0096) tmp = a / (k * k); elseif (m <= 3.15e+16) 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, -0.0096], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 3.15e+16], 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 -0.0096:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 3.15 \cdot 10^{+16}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -0.00959999999999999916Initial program 99.0%
associate-*r/99.0%
associate-+l+99.0%
+-commutative99.0%
distribute-rgt-out99.0%
fma-def99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in m around 0 42.3%
Taylor expanded in k around inf 64.9%
unpow264.9%
Simplified64.9%
if -0.00959999999999999916 < m < 3.15e16Initial program 91.0%
associate-*r/91.0%
associate-+l+91.0%
+-commutative91.0%
distribute-rgt-out91.0%
fma-def91.0%
+-commutative91.0%
Simplified91.0%
Taylor expanded in m around 0 87.8%
if 3.15e16 < m Initial program 79.5%
associate-*r/79.5%
associate-+l+79.5%
+-commutative79.5%
distribute-rgt-out79.5%
fma-def79.5%
+-commutative79.5%
Simplified79.5%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 6.5%
Taylor expanded in k around inf 19.1%
Final simplification58.8%
(FPCore (a k m) :precision binary64 (if (or (<= k 8e-308) (not (<= k 0.1))) (/ a (* k k)) (+ a (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if ((k <= 8e-308) || !(k <= 0.1)) {
tmp = a / (k * k);
} 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 <= 8d-308) .or. (.not. (k <= 0.1d0))) then
tmp = a / (k * k)
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 <= 8e-308) || !(k <= 0.1)) {
tmp = a / (k * k);
} else {
tmp = a + (-10.0 * (k * a));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 8e-308) or not (k <= 0.1): tmp = a / (k * k) else: tmp = a + (-10.0 * (k * a)) return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 8e-308) || !(k <= 0.1)) tmp = Float64(a / Float64(k * k)); 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 <= 8e-308) || ~((k <= 0.1))) tmp = a / (k * k); else tmp = a + (-10.0 * (k * a)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 8e-308], N[Not[LessEqual[k, 0.1]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 8 \cdot 10^{-308} \lor \neg \left(k \leq 0.1\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if k < 8.00000000000000026e-308 or 0.10000000000000001 < k Initial program 85.5%
associate-*r/85.4%
associate-+l+85.4%
+-commutative85.4%
distribute-rgt-out85.4%
fma-def85.4%
+-commutative85.4%
Simplified85.4%
Taylor expanded in m around 0 49.2%
Taylor expanded in k around inf 53.3%
unpow253.3%
Simplified53.3%
if 8.00000000000000026e-308 < k < 0.10000000000000001Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 39.4%
Taylor expanded in k around 0 39.2%
Final simplification48.6%
(FPCore (a k m) :precision binary64 (if (<= k 7.7e-308) (/ a (* k k)) (if (<= k 0.075) (+ a (* -10.0 (* k a))) (/ a (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (k <= 7.7e-308) {
tmp = a / (k * k);
} else if (k <= 0.075) {
tmp = a + (-10.0 * (k * a));
} 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 <= 7.7d-308) then
tmp = a / (k * k)
else if (k <= 0.075d0) then
tmp = a + ((-10.0d0) * (k * a))
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 <= 7.7e-308) {
tmp = a / (k * k);
} else if (k <= 0.075) {
tmp = a + (-10.0 * (k * a));
} else {
tmp = a / (k * (k + 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 7.7e-308: tmp = a / (k * k) elif k <= 0.075: tmp = a + (-10.0 * (k * a)) else: tmp = a / (k * (k + 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 7.7e-308) tmp = Float64(a / Float64(k * k)); elseif (k <= 0.075) tmp = Float64(a + Float64(-10.0 * Float64(k * a))); else tmp = Float64(a / Float64(k * Float64(k + 10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 7.7e-308) tmp = a / (k * k); elseif (k <= 0.075) tmp = a + (-10.0 * (k * a)); else tmp = a / (k * (k + 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 7.7e-308], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.075], N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 7.7 \cdot 10^{-308}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 0.075:\\
\;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if k < 7.70000000000000019e-308Initial program 91.7%
associate-*r/91.7%
associate-+l+91.7%
+-commutative91.7%
distribute-rgt-out91.7%
fma-def91.7%
+-commutative91.7%
Simplified91.7%
Taylor expanded in m around 0 26.0%
Taylor expanded in k around inf 39.9%
unpow239.9%
Simplified39.9%
if 7.70000000000000019e-308 < k < 0.0749999999999999972Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 39.4%
Taylor expanded in k around 0 39.2%
if 0.0749999999999999972 < k Initial program 82.1%
Taylor expanded in m around 0 61.7%
Taylor expanded in k around inf 61.3%
*-commutative61.3%
Simplified61.3%
+-commutative61.3%
distribute-lft-in61.3%
*-commutative61.3%
Applied egg-rr61.3%
Final simplification48.9%
(FPCore (a k m) :precision binary64 (if (<= k 1.58e-307) (/ a (* k k)) (if (<= k 41.0) (/ a (+ 1.0 (* k 10.0))) (/ a (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.58e-307) {
tmp = a / (k * k);
} else if (k <= 41.0) {
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.58d-307) then
tmp = a / (k * k)
else if (k <= 41.0d0) 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.58e-307) {
tmp = a / (k * k);
} else if (k <= 41.0) {
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.58e-307: tmp = a / (k * k) elif k <= 41.0: 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.58e-307) tmp = Float64(a / Float64(k * k)); elseif (k <= 41.0) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(a / Float64(k * Float64(k + 10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.58e-307) tmp = a / (k * k); elseif (k <= 41.0) 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.58e-307], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 41.0], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.58 \cdot 10^{-307}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 41:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if k < 1.57999999999999992e-307Initial program 91.7%
associate-*r/91.7%
associate-+l+91.7%
+-commutative91.7%
distribute-rgt-out91.7%
fma-def91.7%
+-commutative91.7%
Simplified91.7%
Taylor expanded in m around 0 26.0%
Taylor expanded in k around inf 39.9%
unpow239.9%
Simplified39.9%
if 1.57999999999999992e-307 < k < 41Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 39.0%
Taylor expanded in k around 0 38.9%
*-commutative38.9%
Simplified38.9%
if 41 < k Initial program 81.9%
Taylor expanded in m around 0 62.2%
Taylor expanded in k around inf 61.8%
*-commutative61.8%
Simplified61.8%
+-commutative61.8%
distribute-lft-in61.8%
*-commutative61.8%
Applied egg-rr61.8%
Final simplification49.0%
(FPCore (a k m) :precision binary64 (if (<= m -0.0096) (/ a (* k k)) (if (<= m 3.15e+16) (/ a (+ 1.0 (* k k))) (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.0096) {
tmp = a / (k * k);
} else if (m <= 3.15e+16) {
tmp = a / (1.0 + (k * k));
} 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 <= (-0.0096d0)) then
tmp = a / (k * k)
else if (m <= 3.15d+16) then
tmp = a / (1.0d0 + (k * k))
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 <= -0.0096) {
tmp = a / (k * k);
} else if (m <= 3.15e+16) {
tmp = a / (1.0 + (k * k));
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.0096: tmp = a / (k * k) elif m <= 3.15e+16: tmp = a / (1.0 + (k * k)) else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.0096) tmp = Float64(a / Float64(k * k)); elseif (m <= 3.15e+16) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(-10.0 * Float64(k * a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.0096) tmp = a / (k * k); elseif (m <= 3.15e+16) tmp = a / (1.0 + (k * k)); else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.0096], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 3.15e+16], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.0096:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 3.15 \cdot 10^{+16}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -0.00959999999999999916Initial program 99.0%
associate-*r/99.0%
associate-+l+99.0%
+-commutative99.0%
distribute-rgt-out99.0%
fma-def99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in m around 0 42.3%
Taylor expanded in k around inf 64.9%
unpow264.9%
Simplified64.9%
if -0.00959999999999999916 < m < 3.15e16Initial program 91.0%
associate-*r/91.0%
associate-+l+91.0%
+-commutative91.0%
distribute-rgt-out91.0%
fma-def91.0%
+-commutative91.0%
Simplified91.0%
Taylor expanded in m around 0 87.8%
Taylor expanded in k around inf 85.8%
unpow285.8%
Simplified85.8%
if 3.15e16 < m Initial program 79.5%
associate-*r/79.5%
associate-+l+79.5%
+-commutative79.5%
distribute-rgt-out79.5%
fma-def79.5%
+-commutative79.5%
Simplified79.5%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 6.5%
Taylor expanded in k around inf 19.1%
Final simplification58.1%
(FPCore (a k m) :precision binary64 (if (or (<= k 1.8e-307) (not (<= k 41.0))) (/ a (* k k)) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= 1.8e-307) || !(k <= 41.0)) {
tmp = a / (k * k);
} else {
tmp = a;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((k <= 1.8d-307) .or. (.not. (k <= 41.0d0))) then
tmp = a / (k * k)
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= 1.8e-307) || !(k <= 41.0)) {
tmp = a / (k * k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 1.8e-307) or not (k <= 41.0): tmp = a / (k * k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 1.8e-307) || !(k <= 41.0)) tmp = Float64(a / Float64(k * k)); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= 1.8e-307) || ~((k <= 41.0))) tmp = a / (k * k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 1.8e-307], N[Not[LessEqual[k, 41.0]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.8 \cdot 10^{-307} \lor \neg \left(k \leq 41\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < 1.80000000000000003e-307 or 41 < k Initial program 85.4%
associate-*r/85.4%
associate-+l+85.4%
+-commutative85.4%
distribute-rgt-out85.4%
fma-def85.4%
+-commutative85.4%
Simplified85.4%
Taylor expanded in m around 0 49.5%
Taylor expanded in k around inf 53.6%
unpow253.6%
Simplified53.6%
if 1.80000000000000003e-307 < k < 41Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 39.0%
Taylor expanded in k around 0 38.4%
Final simplification48.5%
(FPCore (a k m) :precision binary64 (if (<= m -4.6e-9) (/ a (* k 10.0)) (if (<= m 6.6e+16) a (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -4.6e-9) {
tmp = a / (k * 10.0);
} else if (m <= 6.6e+16) {
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.6d-9)) then
tmp = a / (k * 10.0d0)
else if (m <= 6.6d+16) 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.6e-9) {
tmp = a / (k * 10.0);
} else if (m <= 6.6e+16) {
tmp = a;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -4.6e-9: tmp = a / (k * 10.0) elif m <= 6.6e+16: tmp = a else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -4.6e-9) tmp = Float64(a / Float64(k * 10.0)); elseif (m <= 6.6e+16) 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.6e-9) tmp = a / (k * 10.0); elseif (m <= 6.6e+16) tmp = a; else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -4.6e-9], N[(a / N[(k * 10.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 6.6e+16], a, N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -4.6 \cdot 10^{-9}:\\
\;\;\;\;\frac{a}{k \cdot 10}\\
\mathbf{elif}\;m \leq 6.6 \cdot 10^{+16}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -4.5999999999999998e-9Initial program 99.0%
associate-*r/99.0%
associate-+l+99.0%
+-commutative99.0%
distribute-rgt-out99.0%
fma-def99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in m around 0 42.3%
Taylor expanded in k around 0 16.6%
*-commutative16.6%
Simplified16.6%
Taylor expanded in k around inf 20.5%
*-commutative20.5%
Simplified20.5%
if -4.5999999999999998e-9 < m < 6.6e16Initial program 90.9%
associate-*r/90.9%
associate-+l+90.9%
+-commutative90.9%
distribute-rgt-out90.9%
fma-def90.9%
+-commutative90.9%
Simplified90.9%
Taylor expanded in m around 0 88.2%
Taylor expanded in k around 0 38.8%
if 6.6e16 < m Initial program 79.5%
associate-*r/79.5%
associate-+l+79.5%
+-commutative79.5%
distribute-rgt-out79.5%
fma-def79.5%
+-commutative79.5%
Simplified79.5%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 6.5%
Taylor expanded in k around inf 19.1%
Final simplification26.3%
(FPCore (a k m) :precision binary64 (if (<= m 3.15e+16) a (* -10.0 (* k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= 3.15e+16) {
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 <= 3.15d+16) 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 <= 3.15e+16) {
tmp = a;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 3.15e+16: tmp = a else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 3.15e+16) 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 <= 3.15e+16) tmp = a; else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 3.15e+16], a, N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 3.15 \cdot 10^{+16}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 3.15e16Initial program 95.0%
associate-*r/95.0%
associate-+l+95.0%
+-commutative95.0%
distribute-rgt-out95.0%
fma-def95.0%
+-commutative95.0%
Simplified95.0%
Taylor expanded in m around 0 64.8%
Taylor expanded in k around 0 21.1%
if 3.15e16 < m Initial program 79.5%
associate-*r/79.5%
associate-+l+79.5%
+-commutative79.5%
distribute-rgt-out79.5%
fma-def79.5%
+-commutative79.5%
Simplified79.5%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 6.5%
Taylor expanded in k around inf 19.1%
Final simplification20.5%
(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.3%
associate-*r/90.3%
associate-+l+90.3%
+-commutative90.3%
distribute-rgt-out90.3%
fma-def90.3%
+-commutative90.3%
Simplified90.3%
Taylor expanded in m around 0 45.9%
Taylor expanded in k around 0 15.8%
Final simplification15.8%
herbie shell --seed 2023193
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))