
(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 (<= m 6.3) (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))) (* (pow k m) a)))
double code(double a, double k, double m) {
double tmp;
if (m <= 6.3) {
tmp = (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
} 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 <= 6.3d0) then
tmp = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
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 <= 6.3) {
tmp = (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
} else {
tmp = Math.pow(k, m) * a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 6.3: tmp = (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k)) else: tmp = math.pow(k, m) * a return tmp
function code(a, k, m) tmp = 0.0 if (m <= 6.3) tmp = Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))); else tmp = Float64((k ^ m) * a); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 6.3) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); else tmp = (k ^ m) * a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 6.3], 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], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 6.3:\\
\;\;\;\;\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\
\end{array}
\end{array}
if m < 6.29999999999999982Initial program 96.8%
if 6.29999999999999982 < m Initial program 76.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6476.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-+.f6476.2
Applied rewrites76.2%
Taylor expanded in k around 0
lower-pow.f64100.0
Applied rewrites100.0%
(FPCore (a k m) :precision binary64 (if (<= m -6e-15) (* (pow (pow k (- m)) -1.0) a) (if (<= m 0.055) (/ a (fma (+ 10.0 k) k 1.0)) (* (pow k m) a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -6e-15) {
tmp = pow(pow(k, -m), -1.0) * a;
} else if (m <= 0.055) {
tmp = a / fma((10.0 + k), k, 1.0);
} else {
tmp = pow(k, m) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -6e-15) tmp = Float64(((k ^ Float64(-m)) ^ -1.0) * a); elseif (m <= 0.055) tmp = Float64(a / fma(Float64(10.0 + k), k, 1.0)); else tmp = Float64((k ^ m) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -6e-15], N[(N[Power[N[Power[k, (-m)], $MachinePrecision], -1.0], $MachinePrecision] * a), $MachinePrecision], If[LessEqual[m, 0.055], N[(a / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -6 \cdot 10^{-15}:\\
\;\;\;\;{\left({k}^{\left(-m\right)}\right)}^{-1} \cdot a\\
\mathbf{elif}\;m \leq 0.055:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\
\end{array}
\end{array}
if m < -6e-15Initial 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 k around 0
lower-pow.f64100.0
Applied rewrites100.0%
Taylor expanded in k around inf
Applied rewrites100.0%
Applied rewrites100.0%
if -6e-15 < m < 0.0550000000000000003Initial program 94.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-+.f6492.3
Applied rewrites92.3%
if 0.0550000000000000003 < m Initial program 76.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6476.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-+.f6476.5
Applied rewrites76.5%
Taylor expanded in k around 0
lower-pow.f6499.7
Applied rewrites99.7%
Final simplification97.1%
(FPCore (a k m) :precision binary64 (if (<= (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))) 0.0) (* (* -10.0 a) k) (- a (* -10.0 (* a k)))))
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 = a - (-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 (((a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))) <= 0.0d0) then
tmp = ((-10.0d0) * a) * k
else
tmp = a - ((-10.0d0) * (a * k))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (((a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))) <= 0.0) {
tmp = (-10.0 * a) * k;
} else {
tmp = a - (-10.0 * (a * k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if ((a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))) <= 0.0: tmp = (-10.0 * a) * k else: tmp = a - (-10.0 * (a * k)) 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 = Float64(a - Float64(-10.0 * Float64(a * k))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (((a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k))) <= 0.0) tmp = (-10.0 * a) * k; else tmp = a - (-10.0 * (a * k)); end tmp_2 = 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[(a - N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $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}:\\
\;\;\;\;a - -10 \cdot \left(a \cdot k\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 97.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-+.f6444.1
Applied rewrites44.1%
Taylor expanded in k around 0
Applied rewrites12.7%
Taylor expanded in k around inf
Applied rewrites10.3%
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 72.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-+.f6440.5
Applied rewrites40.5%
Taylor expanded in k around 0
Applied rewrites33.6%
Applied rewrites35.3%
(FPCore (a k m) :precision binary64 (if (<= m 6.3) (* (/ (pow k m) (fma (+ k 10.0) k 1.0)) a) (* (pow k m) a)))
double code(double a, double k, double m) {
double tmp;
if (m <= 6.3) {
tmp = (pow(k, m) / fma((k + 10.0), k, 1.0)) * a;
} else {
tmp = pow(k, m) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= 6.3) tmp = Float64(Float64((k ^ m) / fma(Float64(k + 10.0), k, 1.0)) * a); else tmp = Float64((k ^ m) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, 6.3], N[(N[(N[Power[k, m], $MachinePrecision] / N[(N[(k + 10.0), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 6.3:\\
\;\;\;\;\frac{{k}^{m}}{\mathsf{fma}\left(k + 10, k, 1\right)} \cdot a\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\
\end{array}
\end{array}
if m < 6.29999999999999982Initial program 96.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.8
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.8
Applied rewrites96.8%
if 6.29999999999999982 < m Initial program 76.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6476.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-+.f6476.2
Applied rewrites76.2%
Taylor expanded in k around 0
lower-pow.f64100.0
Applied rewrites100.0%
(FPCore (a k m) :precision binary64 (if (or (<= m -6e-15) (not (<= m 0.055))) (* (pow k m) a) (/ a (fma (+ 10.0 k) k 1.0))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -6e-15) || !(m <= 0.055)) {
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 <= -6e-15) || !(m <= 0.055)) 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, -6e-15], N[Not[LessEqual[m, 0.055]], $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 -6 \cdot 10^{-15} \lor \neg \left(m \leq 0.055\right):\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10 + k, k, 1\right)}\\
\end{array}
\end{array}
if m < -6e-15 or 0.0550000000000000003 < m Initial program 87.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6487.6
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-+.f6487.6
Applied rewrites87.6%
Taylor expanded in k around 0
lower-pow.f6499.8
Applied rewrites99.8%
if -6e-15 < m < 0.0550000000000000003Initial program 94.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-+.f6492.3
Applied rewrites92.3%
Final simplification97.1%
(FPCore (a k m) :precision binary64 (if (<= m -0.76) (* (pow (* k k) -1.0) a) (if (<= m 1.15) (/ 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 <= -0.76) {
tmp = pow((k * k), -1.0) * a;
} else if (m <= 1.15) {
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 <= -0.76) tmp = Float64((Float64(k * k) ^ -1.0) * a); elseif (m <= 1.15) 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, -0.76], N[(N[Power[N[(k * k), $MachinePrecision], -1.0], $MachinePrecision] * a), $MachinePrecision], If[LessEqual[m, 1.15], 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 -0.76:\\
\;\;\;\;{\left(k \cdot k\right)}^{-1} \cdot a\\
\mathbf{elif}\;m \leq 1.15:\\
\;\;\;\;\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 < -0.76000000000000001Initial 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-+.f6426.1
Applied rewrites26.1%
Taylor expanded in k around inf
Applied rewrites58.4%
if -0.76000000000000001 < m < 1.1499999999999999Initial program 94.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.5
Applied rewrites90.5%
if 1.1499999999999999 < m Initial program 76.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6476.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-+.f6476.2
Applied rewrites76.2%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f643.4
Applied rewrites3.4%
Taylor expanded in k around 0
Applied rewrites31.8%
Taylor expanded in k around inf
Applied rewrites65.8%
Final simplification73.0%
(FPCore (a k m) :precision binary64 (if (<= m -0.76) (* (/ (+ (/ (+ (/ 99.0 k) -10.0) k) 1.0) (* k k)) a) (if (<= m 1.15) (/ 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 <= -0.76) {
tmp = (((((99.0 / k) + -10.0) / k) + 1.0) / (k * k)) * a;
} else if (m <= 1.15) {
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 <= -0.76) tmp = Float64(Float64(Float64(Float64(Float64(Float64(99.0 / k) + -10.0) / k) + 1.0) / Float64(k * k)) * a); elseif (m <= 1.15) 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, -0.76], 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, 1.15], 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 -0.76:\\
\;\;\;\;\frac{\frac{\frac{99}{k} + -10}{k} + 1}{k \cdot k} \cdot a\\
\mathbf{elif}\;m \leq 1.15:\\
\;\;\;\;\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 < -0.76000000000000001Initial 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-+.f6426.1
Applied rewrites26.1%
Taylor expanded in k around inf
Applied rewrites62.2%
if -0.76000000000000001 < m < 1.1499999999999999Initial program 94.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.5
Applied rewrites90.5%
if 1.1499999999999999 < m Initial program 76.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6476.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-+.f6476.2
Applied rewrites76.2%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f643.4
Applied rewrites3.4%
Taylor expanded in k around 0
Applied rewrites31.8%
Taylor expanded in k around inf
Applied rewrites65.8%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (/ a (* k k))))
(if (<= m -0.46)
t_0
(if (<= m 2.3e-280)
(/ a (fma 10.0 k 1.0))
(if (<= m 0.06) t_0 (* (* (* 99.0 k) k) a))))))
double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (m <= -0.46) {
tmp = t_0;
} else if (m <= 2.3e-280) {
tmp = a / fma(10.0, k, 1.0);
} else if (m <= 0.06) {
tmp = t_0;
} else {
tmp = ((99.0 * k) * k) * a;
}
return tmp;
}
function code(a, k, m) t_0 = Float64(a / Float64(k * k)) tmp = 0.0 if (m <= -0.46) tmp = t_0; elseif (m <= 2.3e-280) tmp = Float64(a / fma(10.0, k, 1.0)); elseif (m <= 0.06) tmp = t_0; else tmp = Float64(Float64(Float64(99.0 * k) * k) * a); end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -0.46], t$95$0, If[LessEqual[m, 2.3e-280], N[(a / N[(10.0 * k + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.06], t$95$0, N[(N[(N[(99.0 * k), $MachinePrecision] * k), $MachinePrecision] * a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{k \cdot k}\\
\mathbf{if}\;m \leq -0.46:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 2.3 \cdot 10^{-280}:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(10, k, 1\right)}\\
\mathbf{elif}\;m \leq 0.06:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(\left(99 \cdot k\right) \cdot k\right) \cdot a\\
\end{array}
\end{array}
if m < -0.46000000000000002 or 2.3e-280 < m < 0.059999999999999998Initial program 96.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-+.f6445.9
Applied rewrites45.9%
Taylor expanded in k around inf
Applied rewrites58.5%
if -0.46000000000000002 < m < 2.3e-280Initial program 97.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-+.f6495.5
Applied rewrites95.5%
Taylor expanded in k around 0
Applied rewrites69.7%
if 0.059999999999999998 < m Initial program 76.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6476.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-+.f6476.5
Applied rewrites76.5%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f643.5
Applied rewrites3.5%
Taylor expanded in k around 0
Applied rewrites31.6%
Taylor expanded in k around inf
Applied rewrites65.2%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (/ a (* k k))))
(if (<= m -8.8e-188)
t_0
(if (<= m 4.8e-293)
(* 1.0 a)
(if (<= m 0.06) t_0 (* (* (* 99.0 k) k) a))))))
double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (m <= -8.8e-188) {
tmp = t_0;
} else if (m <= 4.8e-293) {
tmp = 1.0 * a;
} else if (m <= 0.06) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = a / (k * k)
if (m <= (-8.8d-188)) then
tmp = t_0
else if (m <= 4.8d-293) then
tmp = 1.0d0 * a
else if (m <= 0.06d0) then
tmp = t_0
else
tmp = ((99.0d0 * k) * k) * a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (m <= -8.8e-188) {
tmp = t_0;
} else if (m <= 4.8e-293) {
tmp = 1.0 * a;
} else if (m <= 0.06) {
tmp = t_0;
} else {
tmp = ((99.0 * k) * k) * a;
}
return tmp;
}
def code(a, k, m): t_0 = a / (k * k) tmp = 0 if m <= -8.8e-188: tmp = t_0 elif m <= 4.8e-293: tmp = 1.0 * a elif m <= 0.06: tmp = t_0 else: tmp = ((99.0 * k) * k) * a return tmp
function code(a, k, m) t_0 = Float64(a / Float64(k * k)) tmp = 0.0 if (m <= -8.8e-188) tmp = t_0; elseif (m <= 4.8e-293) tmp = Float64(1.0 * a); elseif (m <= 0.06) tmp = t_0; else tmp = Float64(Float64(Float64(99.0 * k) * k) * a); end return tmp end
function tmp_2 = code(a, k, m) t_0 = a / (k * k); tmp = 0.0; if (m <= -8.8e-188) tmp = t_0; elseif (m <= 4.8e-293) tmp = 1.0 * a; elseif (m <= 0.06) tmp = t_0; else tmp = ((99.0 * k) * k) * a; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -8.8e-188], t$95$0, If[LessEqual[m, 4.8e-293], N[(1.0 * a), $MachinePrecision], If[LessEqual[m, 0.06], t$95$0, N[(N[(N[(99.0 * k), $MachinePrecision] * k), $MachinePrecision] * a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{k \cdot k}\\
\mathbf{if}\;m \leq -8.8 \cdot 10^{-188}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 4.8 \cdot 10^{-293}:\\
\;\;\;\;1 \cdot a\\
\mathbf{elif}\;m \leq 0.06:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(\left(99 \cdot k\right) \cdot k\right) \cdot a\\
\end{array}
\end{array}
if m < -8.7999999999999998e-188 or 4.7999999999999998e-293 < m < 0.059999999999999998Initial program 97.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-+.f6458.4
Applied rewrites58.4%
Taylor expanded in k around inf
Applied rewrites57.0%
if -8.7999999999999998e-188 < m < 4.7999999999999998e-293Initial program 95.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6495.3
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-+.f6495.3
Applied rewrites95.3%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6495.3
Applied rewrites95.3%
Taylor expanded in k around 0
Applied rewrites71.1%
if 0.059999999999999998 < m Initial program 76.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6476.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-+.f6476.5
Applied rewrites76.5%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f643.5
Applied rewrites3.5%
Taylor expanded in k around 0
Applied rewrites31.6%
Taylor expanded in k around inf
Applied rewrites65.2%
(FPCore (a k m) :precision binary64 (if (<= m -0.76) (/ a (* k k)) (if (<= m 1.15) (/ 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 <= -0.76) {
tmp = a / (k * k);
} else if (m <= 1.15) {
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 <= -0.76) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.15) 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, -0.76], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.15], 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 -0.76:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.15:\\
\;\;\;\;\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 < -0.76000000000000001Initial 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-+.f6426.1
Applied rewrites26.1%
Taylor expanded in k around inf
Applied rewrites57.1%
if -0.76000000000000001 < m < 1.1499999999999999Initial program 94.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.5
Applied rewrites90.5%
if 1.1499999999999999 < m Initial program 76.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6476.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-+.f6476.2
Applied rewrites76.2%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f643.4
Applied rewrites3.4%
Taylor expanded in k around 0
Applied rewrites31.8%
Taylor expanded in k around inf
Applied rewrites65.8%
(FPCore (a k m) :precision binary64 (if (<= m 0.44) (* 1.0 a) (* (* (* 99.0 k) k) a)))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.44) {
tmp = 1.0 * a;
} 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.44d0) then
tmp = 1.0d0 * a
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.44) {
tmp = 1.0 * a;
} else {
tmp = ((99.0 * k) * k) * a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.44: tmp = 1.0 * a else: tmp = ((99.0 * k) * k) * a return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.44) tmp = Float64(1.0 * a); 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.44) tmp = 1.0 * a; else tmp = ((99.0 * k) * k) * a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.44], N[(1.0 * a), $MachinePrecision], N[(N[(N[(99.0 * k), $MachinePrecision] * k), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.44:\\
\;\;\;\;1 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(\left(99 \cdot k\right) \cdot k\right) \cdot a\\
\end{array}
\end{array}
if m < 0.440000000000000002Initial program 96.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.8
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.8
Applied rewrites96.8%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6462.4
Applied rewrites62.4%
Taylor expanded in k around 0
Applied rewrites26.0%
if 0.440000000000000002 < m Initial program 76.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6476.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-+.f6476.2
Applied rewrites76.2%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f643.4
Applied rewrites3.4%
Taylor expanded in k around 0
Applied rewrites31.8%
Taylor expanded in k around inf
Applied rewrites65.8%
(FPCore (a k m) :precision binary64 (if (<= m 5.4e+17) (* 1.0 a) (* (* -10.0 a) k)))
double code(double a, double k, double m) {
double tmp;
if (m <= 5.4e+17) {
tmp = 1.0 * a;
} 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 <= 5.4d+17) then
tmp = 1.0d0 * a
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 <= 5.4e+17) {
tmp = 1.0 * a;
} else {
tmp = (-10.0 * a) * k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 5.4e+17: tmp = 1.0 * a else: tmp = (-10.0 * a) * k return tmp
function code(a, k, m) tmp = 0.0 if (m <= 5.4e+17) tmp = Float64(1.0 * a); else tmp = Float64(Float64(-10.0 * a) * k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 5.4e+17) tmp = 1.0 * a; else tmp = (-10.0 * a) * k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 5.4e+17], N[(1.0 * a), $MachinePrecision], N[(N[(-10.0 * a), $MachinePrecision] * k), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 5.4 \cdot 10^{+17}:\\
\;\;\;\;1 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(-10 \cdot a\right) \cdot k\\
\end{array}
\end{array}
if m < 5.4e17Initial program 96.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.3
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.3
Applied rewrites96.3%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6461.7
Applied rewrites61.7%
Taylor expanded in k around 0
Applied rewrites25.8%
if 5.4e17 < m Initial program 76.8%
Taylor expanded in m around 0
lower-/.f64N/A
unpow2N/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f643.4
Applied rewrites3.4%
Taylor expanded in k around 0
Applied rewrites5.6%
Taylor expanded in k around inf
Applied rewrites22.0%
(FPCore (a k m) :precision binary64 (* 1.0 a))
double code(double a, double k, double m) {
return 1.0 * a;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = 1.0d0 * a
end function
public static double code(double a, double k, double m) {
return 1.0 * a;
}
def code(a, k, m): return 1.0 * a
function code(a, k, m) return Float64(1.0 * a) end
function tmp = code(a, k, m) tmp = 1.0 * a; end
code[a_, k_, m_] := N[(1.0 * a), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot a
\end{array}
Initial program 90.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6490.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-+.f6490.0
Applied rewrites90.0%
Taylor expanded in m around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f6443.0
Applied rewrites43.0%
Taylor expanded in k around 0
Applied rewrites18.8%
herbie shell --seed 2024332
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))