
(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 10 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 (<= (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))) INFINITY) (* (/ (pow k m) (fma (+ k 10.0) k 1.0)) a) (* (* (* 99.0 k) k) a)))
double code(double a, double k, double m) {
double tmp;
if (((a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))) <= ((double) INFINITY)) {
tmp = (pow(k, m) / fma((k + 10.0), k, 1.0)) * a;
} else {
tmp = ((99.0 * k) * k) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) <= Inf) tmp = Float64(Float64((k ^ m) / fma(Float64(k + 10.0), k, 1.0)) * a); else tmp = Float64(Float64(Float64(99.0 * k) * k) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[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], Infinity], N[(N[(N[Power[k, m], $MachinePrecision] / N[(N[(k + 10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], N[(N[(N[(99.0 * k), $MachinePrecision] * k), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq \infty:\\
\;\;\;\;\frac{{k}^{m}}{\mathsf{fma}\left(k + 10, k, 1\right)} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(\left(99 \cdot k\right) \cdot k\right) \cdot a\\
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < +inf.0Initial program 96.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.5
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6496.5
Applied rewrites96.5%
if +inf.0 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 0.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f640.0
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f640.0
Applied rewrites0.0%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f641.6
Applied rewrites1.6%
Taylor expanded in k around 0
Applied rewrites100.0%
Taylor expanded in k around inf
Applied rewrites100.0%
(FPCore (a k m) :precision binary64 (if (<= (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))) 0.0) (* (* -10.0 a) k) (fma (* a k) -10.0 a)))
double code(double a, double k, double m) {
double tmp;
if (((a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))) <= 0.0) {
tmp = (-10.0 * a) * k;
} else {
tmp = fma((a * k), -10.0, a);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) <= 0.0) tmp = Float64(Float64(-10.0 * a) * k); else tmp = fma(Float64(a * k), -10.0, a); end return tmp end
code[a_, k_, m_] := If[LessEqual[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], 0.0], N[(N[(-10.0 * a), $MachinePrecision] * k), $MachinePrecision], N[(N[(a * k), $MachinePrecision] * -10.0 + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq 0:\\
\;\;\;\;\left(-10 \cdot a\right) \cdot k\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot k, -10, a\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 0.0Initial program 95.1%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6446.0
Applied rewrites46.0%
Taylor expanded in k around 0
Applied rewrites15.4%
Taylor expanded in k around inf
Applied rewrites11.5%
if 0.0 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 81.6%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6436.3
Applied rewrites36.3%
Taylor expanded in k around 0
Applied rewrites27.2%
(FPCore (a k m) :precision binary64 (if (or (<= m -3900.0) (not (<= m 3.8e-9))) (* (pow k m) a) (/ a (fma (+ 10.0 k) k 1.0))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -3900.0) || !(m <= 3.8e-9)) {
tmp = pow(k, m) * a;
} else {
tmp = a / fma((10.0 + k), k, 1.0);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if ((m <= -3900.0) || !(m <= 3.8e-9)) tmp = Float64((k ^ m) * a); else tmp = Float64(a / fma(Float64(10.0 + k), k, 1.0)); end return tmp end
code[a_, k_, m_] := If[Or[LessEqual[m, -3900.0], N[Not[LessEqual[m, 3.8e-9]], $MachinePrecision]], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(a / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3900 \lor \neg \left(m \leq 3.8 \cdot 10^{-9}\right):\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
\end{array}
\end{array}
if m < -3900 or 3.80000000000000011e-9 < m Initial program 90.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6490.2
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6490.2
Applied rewrites90.2%
Taylor expanded in k around 0
lower-pow.f6499.4
Applied rewrites99.4%
if -3900 < m < 3.80000000000000011e-9Initial program 90.9%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6490.9
Applied rewrites90.9%
Final simplification96.4%
(FPCore (a k m) :precision binary64 (if (<= m -1.4e+18) (* (/ (+ (/ (+ (/ 99.0 k) -10.0) k) 1.0) (* k k)) a) (if (<= m 0.72) (/ a (fma (+ 10.0 k) k 1.0)) (* (* (* 99.0 k) k) a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.4e+18) {
tmp = (((((99.0 / k) + -10.0) / k) + 1.0) / (k * k)) * a;
} else if (m <= 0.72) {
tmp = a / fma((10.0 + k), k, 1.0);
} else {
tmp = ((99.0 * k) * k) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -1.4e+18) tmp = Float64(Float64(Float64(Float64(Float64(Float64(99.0 / k) + -10.0) / k) + 1.0) / Float64(k * k)) * a); elseif (m <= 0.72) tmp = Float64(a / fma(Float64(10.0 + k), k, 1.0)); else tmp = Float64(Float64(Float64(99.0 * k) * k) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -1.4e+18], N[(N[(N[(N[(N[(N[(99.0 / k), $MachinePrecision] + -10.0), $MachinePrecision] / k), $MachinePrecision] + 1.0), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[m, 0.72], N[(a / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(99.0 * k), $MachinePrecision] * k), $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.4 \cdot 10^{+18}:\\
\;\;\;\;\frac{\frac{\frac{99}{k} + -10}{k} + 1}{k \cdot k} \cdot a\\
\mathbf{elif}\;m \leq 0.72:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(99 \cdot k\right) \cdot k\right) \cdot a\\
\end{array}
\end{array}
if m < -1.4e18Initial program 100.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64100.0
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6431.5
Applied rewrites31.5%
Taylor expanded in k around inf
Applied rewrites74.1%
if -1.4e18 < m < 0.71999999999999997Initial program 91.2%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6489.2
Applied rewrites89.2%
if 0.71999999999999997 < m Initial program 82.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6482.4
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6482.4
Applied rewrites82.4%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f642.9
Applied rewrites2.9%
Taylor expanded in k around 0
Applied rewrites27.0%
Taylor expanded in k around inf
Applied rewrites54.7%
(FPCore (a k m) :precision binary64 (if (<= m -1.4e+18) (/ a (* k k)) (if (<= m 0.72) (/ a (fma (+ 10.0 k) k 1.0)) (* (* (* 99.0 k) k) a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.4e+18) {
tmp = a / (k * k);
} else if (m <= 0.72) {
tmp = a / fma((10.0 + k), k, 1.0);
} else {
tmp = ((99.0 * k) * k) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -1.4e+18) tmp = Float64(a / Float64(k * k)); elseif (m <= 0.72) tmp = Float64(a / fma(Float64(10.0 + k), k, 1.0)); else tmp = Float64(Float64(Float64(99.0 * k) * k) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -1.4e+18], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.72], N[(a / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(99.0 * k), $MachinePrecision] * k), $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.4 \cdot 10^{+18}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.72:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(99 \cdot k\right) \cdot k\right) \cdot a\\
\end{array}
\end{array}
if m < -1.4e18Initial program 100.0%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6431.5
Applied rewrites31.5%
Taylor expanded in k around inf
Applied rewrites63.1%
if -1.4e18 < m < 0.71999999999999997Initial program 91.2%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6489.2
Applied rewrites89.2%
if 0.71999999999999997 < m Initial program 82.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6482.4
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6482.4
Applied rewrites82.4%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f642.9
Applied rewrites2.9%
Taylor expanded in k around 0
Applied rewrites27.0%
Taylor expanded in k around inf
Applied rewrites54.7%
(FPCore (a k m) :precision binary64 (if (<= m -1.3e-39) (/ a (* k k)) (if (<= m 0.23) (/ a (fma 10.0 k 1.0)) (* (* (* 99.0 k) k) a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.3e-39) {
tmp = a / (k * k);
} else if (m <= 0.23) {
tmp = a / fma(10.0, k, 1.0);
} else {
tmp = ((99.0 * k) * k) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -1.3e-39) tmp = Float64(a / Float64(k * k)); elseif (m <= 0.23) tmp = Float64(a / fma(10.0, k, 1.0)); else tmp = Float64(Float64(Float64(99.0 * k) * k) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -1.3e-39], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.23], N[(a / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(99.0 * k), $MachinePrecision] * k), $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.3 \cdot 10^{-39}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.23:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(99 \cdot k\right) \cdot k\right) \cdot a\\
\end{array}
\end{array}
if m < -1.3e-39Initial program 100.0%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6436.0
Applied rewrites36.0%
Taylor expanded in k around inf
Applied rewrites64.4%
if -1.3e-39 < m < 0.23000000000000001Initial program 90.4%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6490.4
Applied rewrites90.4%
Taylor expanded in k around 0
Applied rewrites58.1%
if 0.23000000000000001 < m Initial program 82.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6482.4
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6482.4
Applied rewrites82.4%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f642.9
Applied rewrites2.9%
Taylor expanded in k around 0
Applied rewrites27.0%
Taylor expanded in k around inf
Applied rewrites54.7%
(FPCore (a k m) :precision binary64 (if (<= m 0.5) (/ a (* k k)) (* (* (* 99.0 k) k) a)))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.5) {
tmp = a / (k * k);
} else {
tmp = ((99.0 * k) * 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.5d0) then
tmp = a / (k * k)
else
tmp = ((99.0d0 * k) * k) * a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 0.5) {
tmp = a / (k * k);
} else {
tmp = ((99.0 * k) * k) * a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.5: tmp = a / (k * k) else: tmp = ((99.0 * k) * k) * a return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.5) tmp = Float64(a / Float64(k * k)); else tmp = Float64(Float64(Float64(99.0 * k) * k) * a); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 0.5) tmp = a / (k * k); else tmp = ((99.0 * k) * k) * a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.5], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], N[(N[(N[(99.0 * k), $MachinePrecision] * k), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.5:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(99 \cdot k\right) \cdot k\right) \cdot a\\
\end{array}
\end{array}
if m < 0.5Initial program 94.9%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6464.7
Applied rewrites64.7%
Taylor expanded in k around inf
Applied rewrites55.9%
if 0.5 < m Initial program 82.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6482.4
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6482.4
Applied rewrites82.4%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f642.9
Applied rewrites2.9%
Taylor expanded in k around 0
Applied rewrites27.0%
Taylor expanded in k around inf
Applied rewrites54.7%
(FPCore (a k m) :precision binary64 (if (<= m 0.23) (/ a 1.0) (* (* (* 99.0 k) k) a)))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.23) {
tmp = a / 1.0;
} else {
tmp = ((99.0 * k) * 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.23d0) then
tmp = a / 1.0d0
else
tmp = ((99.0d0 * k) * k) * a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 0.23) {
tmp = a / 1.0;
} else {
tmp = ((99.0 * k) * k) * a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.23: tmp = a / 1.0 else: tmp = ((99.0 * k) * k) * a return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.23) tmp = Float64(a / 1.0); else tmp = Float64(Float64(Float64(99.0 * k) * k) * a); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 0.23) tmp = a / 1.0; else tmp = ((99.0 * k) * k) * a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.23], N[(a / 1.0), $MachinePrecision], N[(N[(N[(99.0 * k), $MachinePrecision] * k), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.23:\\
\;\;\;\;\frac{a}{1}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(99 \cdot k\right) \cdot k\right) \cdot a\\
\end{array}
\end{array}
if m < 0.23000000000000001Initial program 94.9%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6464.7
Applied rewrites64.7%
Taylor expanded in k around 0
Applied rewrites36.2%
Taylor expanded in k around 0
Applied rewrites26.3%
if 0.23000000000000001 < m Initial program 82.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6482.4
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6482.4
Applied rewrites82.4%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f642.9
Applied rewrites2.9%
Taylor expanded in k around 0
Applied rewrites27.0%
Taylor expanded in k around inf
Applied rewrites54.7%
(FPCore (a k m) :precision binary64 (if (<= m 0.23) (/ a 1.0) (* (* -10.0 a) k)))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.23) {
tmp = a / 1.0;
} else {
tmp = (-10.0 * 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 (m <= 0.23d0) then
tmp = a / 1.0d0
else
tmp = ((-10.0d0) * a) * k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 0.23) {
tmp = a / 1.0;
} else {
tmp = (-10.0 * a) * k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.23: tmp = a / 1.0 else: tmp = (-10.0 * a) * k return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.23) tmp = Float64(a / 1.0); else tmp = Float64(Float64(-10.0 * a) * k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 0.23) tmp = a / 1.0; else tmp = (-10.0 * a) * k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.23], N[(a / 1.0), $MachinePrecision], N[(N[(-10.0 * a), $MachinePrecision] * k), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.23:\\
\;\;\;\;\frac{a}{1}\\
\mathbf{else}:\\
\;\;\;\;\left(-10 \cdot a\right) \cdot k\\
\end{array}
\end{array}
if m < 0.23000000000000001Initial program 94.9%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6464.7
Applied rewrites64.7%
Taylor expanded in k around 0
Applied rewrites36.2%
Taylor expanded in k around 0
Applied rewrites26.3%
if 0.23000000000000001 < m Initial program 82.4%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f642.9
Applied rewrites2.9%
Taylor expanded in k around 0
Applied rewrites9.1%
Taylor expanded in k around inf
Applied rewrites23.1%
(FPCore (a k m) :precision binary64 (* (* -10.0 a) k))
double code(double a, double k, double m) {
return (-10.0 * a) * k;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = ((-10.0d0) * a) * k
end function
public static double code(double a, double k, double m) {
return (-10.0 * a) * k;
}
def code(a, k, m): return (-10.0 * a) * k
function code(a, k, m) return Float64(Float64(-10.0 * a) * k) end
function tmp = code(a, k, m) tmp = (-10.0 * a) * k; end
code[a_, k_, m_] := N[(N[(-10.0 * a), $MachinePrecision] * k), $MachinePrecision]
\begin{array}{l}
\\
\left(-10 \cdot a\right) \cdot k
\end{array}
Initial program 90.5%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6442.7
Applied rewrites42.7%
Taylor expanded in k around 0
Applied rewrites19.4%
Taylor expanded in k around inf
Applied rewrites9.7%
herbie shell --seed 2024326
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))