
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
(FPCore (a k m) :precision binary64 (if (<= k 1.0) (* (pow k m) a) (/ (* (pow k (+ -1.0 m)) a) k)))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.0) {
tmp = pow(k, m) * a;
} else {
tmp = (pow(k, (-1.0 + m)) * 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 (k <= 1.0d0) then
tmp = (k ** m) * a
else
tmp = ((k ** ((-1.0d0) + m)) * a) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 1.0) {
tmp = Math.pow(k, m) * a;
} else {
tmp = (Math.pow(k, (-1.0 + m)) * a) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.0: tmp = math.pow(k, m) * a else: tmp = (math.pow(k, (-1.0 + m)) * a) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.0) tmp = Float64((k ^ m) * a); else tmp = Float64(Float64((k ^ Float64(-1.0 + m)) * a) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.0) tmp = (k ^ m) * a; else tmp = ((k ^ (-1.0 + m)) * a) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.0], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(N[(N[Power[k, N[(-1.0 + m), $MachinePrecision]], $MachinePrecision] * a), $MachinePrecision] / k), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1:\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{{k}^{\left(-1 + m\right)} \cdot a}{k}\\
\end{array}
\end{array}
if k < 1Initial program 93.9%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f6499.5
Applied rewrites99.5%
if 1 < k Initial program 81.4%
Taylor expanded in k around inf
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
exp-prodN/A
neg-mul-1N/A
log-recN/A
remove-double-negN/A
rem-exp-logN/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-pow.f6486.0
Applied rewrites86.0%
Applied rewrites92.3%
Applied rewrites98.9%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* (pow k m) a)))
(if (<= m -29000000.0)
t_0
(if (<= m 2.55e-25) (* (/ 1.0 (fma (+ 10.0 k) k 1.0)) a) t_0))))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if (m <= -29000000.0) {
tmp = t_0;
} else if (m <= 2.55e-25) {
tmp = (1.0 / fma((10.0 + k), k, 1.0)) * a;
} else {
tmp = t_0;
}
return tmp;
}
function code(a, k, m) t_0 = Float64((k ^ m) * a) tmp = 0.0 if (m <= -29000000.0) tmp = t_0; elseif (m <= 2.55e-25) tmp = Float64(Float64(1.0 / fma(Float64(10.0 + k), k, 1.0)) * a); else tmp = t_0; end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[m, -29000000.0], t$95$0, If[LessEqual[m, 2.55e-25], N[(N[(1.0 / N[(N[(10.0 + k), $MachinePrecision] * k + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;m \leq -29000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 2.55 \cdot 10^{-25}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(10 + k, k, 1\right)} \cdot a\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < -2.9e7 or 2.5500000000000001e-25 < m Initial program 85.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64100.0
Applied rewrites100.0%
if -2.9e7 < m < 2.5500000000000001e-25Initial program 97.6%
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%
Taylor expanded in m around 0
Applied rewrites95.1%
Final simplification98.4%
(FPCore (a k m) :precision binary64 (if (<= k 1.0) (* (pow k m) a) (* (pow k (+ (+ -1.0 m) -1.0)) a)))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.0) {
tmp = pow(k, m) * a;
} else {
tmp = pow(k, ((-1.0 + m) + -1.0)) * 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.0d0) then
tmp = (k ** m) * a
else
tmp = (k ** (((-1.0d0) + m) + (-1.0d0))) * a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 1.0) {
tmp = Math.pow(k, m) * a;
} else {
tmp = Math.pow(k, ((-1.0 + m) + -1.0)) * a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.0: tmp = math.pow(k, m) * a else: tmp = math.pow(k, ((-1.0 + m) + -1.0)) * a return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.0) tmp = Float64((k ^ m) * a); else tmp = Float64((k ^ Float64(Float64(-1.0 + m) + -1.0)) * a); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.0) tmp = (k ^ m) * a; else tmp = (k ^ ((-1.0 + m) + -1.0)) * a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.0], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(N[Power[k, N[(N[(-1.0 + m), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1:\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;{k}^{\left(\left(-1 + m\right) + -1\right)} \cdot a\\
\end{array}
\end{array}
if k < 1Initial program 93.9%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f6499.5
Applied rewrites99.5%
if 1 < k Initial program 81.4%
Taylor expanded in k around inf
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
exp-prodN/A
neg-mul-1N/A
log-recN/A
remove-double-negN/A
rem-exp-logN/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lower-pow.f6486.0
Applied rewrites86.0%
Applied rewrites92.3%
Applied rewrites96.0%
Final simplification98.3%
(FPCore (a k m)
:precision binary64
(if (<= m -0.6)
(/ (* 99.0 (/ (/ a k) k)) (* k k))
(if (<= m 0.92)
(* (/ 1.0 (fma (+ 10.0 k) k 1.0)) a)
(* (* (* 99.0 k) k) a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.6) {
tmp = (99.0 * ((a / k) / k)) / (k * k);
} else if (m <= 0.92) {
tmp = (1.0 / fma((10.0 + k), k, 1.0)) * a;
} else {
tmp = ((99.0 * k) * k) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -0.6) tmp = Float64(Float64(99.0 * Float64(Float64(a / k) / k)) / Float64(k * k)); elseif (m <= 0.92) tmp = Float64(Float64(1.0 / fma(Float64(10.0 + k), k, 1.0)) * a); else tmp = Float64(Float64(Float64(99.0 * k) * k) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -0.6], N[(N[(99.0 * N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision] / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.92], N[(N[(1.0 / N[(N[(10.0 + k), $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}\;m \leq -0.6:\\
\;\;\;\;\frac{99 \cdot \frac{\frac{a}{k}}{k}}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.92:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(10 + k, k, 1\right)} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(\left(99 \cdot k\right) \cdot k\right) \cdot a\\
\end{array}
\end{array}
if m < -0.599999999999999978Initial program 100.0%
Taylor expanded in m around 0
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
lft-mult-inverseN/A
distribute-rgt-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
associate-+r+N/A
distribute-rgt-inN/A
unpow2N/A
associate-*r*N/A
lft-mult-inverseN/A
lower-fma.f64N/A
Applied rewrites34.8%
Applied rewrites22.9%
Taylor expanded in k around inf
Applied rewrites68.1%
Taylor expanded in k around 0
Applied rewrites73.2%
if -0.599999999999999978 < m < 0.92000000000000004Initial program 97.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6497.7
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-+.f6497.7
Applied rewrites97.7%
Taylor expanded in m around 0
Applied rewrites95.4%
if 0.92000000000000004 < m Initial program 70.9%
Taylor expanded in m around 0
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
lft-mult-inverseN/A
distribute-rgt-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
associate-+r+N/A
distribute-rgt-inN/A
unpow2N/A
associate-*r*N/A
lft-mult-inverseN/A
lower-fma.f64N/A
Applied rewrites2.8%
Applied rewrites2.6%
Taylor expanded in k around 0
Applied rewrites40.6%
Taylor expanded in k around inf
Applied rewrites67.5%
Final simplification78.7%
(FPCore (a k m)
:precision binary64
(if (<= m -29000000.0)
(/ a (* k k))
(if (<= m 0.92)
(* (/ 1.0 (fma (+ 10.0 k) k 1.0)) a)
(* (* (* 99.0 k) k) a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -29000000.0) {
tmp = a / (k * k);
} else if (m <= 0.92) {
tmp = (1.0 / fma((10.0 + k), k, 1.0)) * a;
} else {
tmp = ((99.0 * k) * k) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -29000000.0) tmp = Float64(a / Float64(k * k)); elseif (m <= 0.92) tmp = Float64(Float64(1.0 / fma(Float64(10.0 + k), k, 1.0)) * a); else tmp = Float64(Float64(Float64(99.0 * k) * k) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -29000000.0], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.92], N[(N[(1.0 / N[(N[(10.0 + k), $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}\;m \leq -29000000:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.92:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(10 + k, k, 1\right)} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(\left(99 \cdot k\right) \cdot k\right) \cdot a\\
\end{array}
\end{array}
if m < -2.9e7Initial program 100.0%
Taylor expanded in m around 0
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
lft-mult-inverseN/A
distribute-rgt-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
associate-+r+N/A
distribute-rgt-inN/A
unpow2N/A
associate-*r*N/A
lft-mult-inverseN/A
lower-fma.f64N/A
Applied rewrites34.3%
Taylor expanded in k around inf
Applied rewrites62.6%
if -2.9e7 < m < 0.92000000000000004Initial program 97.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.7
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.7
Applied rewrites96.7%
Taylor expanded in m around 0
Applied rewrites94.4%
if 0.92000000000000004 < m Initial program 70.9%
Taylor expanded in m around 0
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
lft-mult-inverseN/A
distribute-rgt-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
associate-+r+N/A
distribute-rgt-inN/A
unpow2N/A
associate-*r*N/A
lft-mult-inverseN/A
lower-fma.f64N/A
Applied rewrites2.8%
Applied rewrites2.6%
Taylor expanded in k around 0
Applied rewrites40.6%
Taylor expanded in k around inf
Applied rewrites67.5%
Final simplification75.2%
(FPCore (a k m) :precision binary64 (if (<= m -29000000.0) (/ a (* k k)) (if (<= m 0.92) (/ 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 <= -29000000.0) {
tmp = a / (k * k);
} else if (m <= 0.92) {
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 <= -29000000.0) tmp = Float64(a / Float64(k * k)); elseif (m <= 0.92) 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, -29000000.0], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.92], 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 -29000000:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.92:\\
\;\;\;\;\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 < -2.9e7Initial program 100.0%
Taylor expanded in m around 0
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
lft-mult-inverseN/A
distribute-rgt-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
associate-+r+N/A
distribute-rgt-inN/A
unpow2N/A
associate-*r*N/A
lft-mult-inverseN/A
lower-fma.f64N/A
Applied rewrites34.3%
Taylor expanded in k around inf
Applied rewrites62.6%
if -2.9e7 < m < 0.92000000000000004Initial program 97.7%
Taylor expanded in m around 0
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
lft-mult-inverseN/A
distribute-rgt-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
associate-+r+N/A
distribute-rgt-inN/A
unpow2N/A
associate-*r*N/A
lft-mult-inverseN/A
lower-fma.f64N/A
Applied rewrites94.4%
if 0.92000000000000004 < m Initial program 70.9%
Taylor expanded in m around 0
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
lft-mult-inverseN/A
distribute-rgt-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
associate-+r+N/A
distribute-rgt-inN/A
unpow2N/A
associate-*r*N/A
lft-mult-inverseN/A
lower-fma.f64N/A
Applied rewrites2.8%
Applied rewrites2.6%
Taylor expanded in k around 0
Applied rewrites40.6%
Taylor expanded in k around inf
Applied rewrites67.5%
(FPCore (a k m) :precision binary64 (if (<= m -1.5e-41) (/ a (* k k)) (if (<= m 1.2) (/ 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.5e-41) {
tmp = a / (k * k);
} else if (m <= 1.2) {
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.5e-41) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.2) 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.5e-41], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.2], 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.5 \cdot 10^{-41}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.2:\\
\;\;\;\;\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.49999999999999994e-41Initial program 98.9%
Taylor expanded in m around 0
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
lft-mult-inverseN/A
distribute-rgt-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
associate-+r+N/A
distribute-rgt-inN/A
unpow2N/A
associate-*r*N/A
lft-mult-inverseN/A
lower-fma.f64N/A
Applied rewrites35.9%
Taylor expanded in k around inf
Applied rewrites61.4%
if -1.49999999999999994e-41 < m < 1.19999999999999996Initial program 98.8%
Taylor expanded in m around 0
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
lft-mult-inverseN/A
distribute-rgt-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
associate-+r+N/A
distribute-rgt-inN/A
unpow2N/A
associate-*r*N/A
lft-mult-inverseN/A
lower-fma.f64N/A
Applied rewrites97.8%
Taylor expanded in k around 0
Applied rewrites72.6%
if 1.19999999999999996 < m Initial program 70.9%
Taylor expanded in m around 0
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
lft-mult-inverseN/A
distribute-rgt-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
associate-+r+N/A
distribute-rgt-inN/A
unpow2N/A
associate-*r*N/A
lft-mult-inverseN/A
lower-fma.f64N/A
Applied rewrites2.8%
Applied rewrites2.6%
Taylor expanded in k around 0
Applied rewrites40.6%
Taylor expanded in k around inf
Applied rewrites67.5%
(FPCore (a k m) :precision binary64 (if (<= m -1.8e-74) (/ a (* k k)) (if (<= m 0.205) (* 1.0 a) (* (* (* 99.0 k) k) a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.8e-74) {
tmp = a / (k * k);
} else if (m <= 0.205) {
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 <= (-1.8d-74)) then
tmp = a / (k * k)
else if (m <= 0.205d0) 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 <= -1.8e-74) {
tmp = a / (k * k);
} else if (m <= 0.205) {
tmp = 1.0 * a;
} else {
tmp = ((99.0 * k) * k) * a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.8e-74: tmp = a / (k * k) elif m <= 0.205: tmp = 1.0 * a else: tmp = ((99.0 * k) * k) * a return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.8e-74) tmp = Float64(a / Float64(k * k)); elseif (m <= 0.205) 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 <= -1.8e-74) tmp = a / (k * k); elseif (m <= 0.205) tmp = 1.0 * a; else tmp = ((99.0 * k) * k) * a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.8e-74], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.205], 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 -1.8 \cdot 10^{-74}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.205:\\
\;\;\;\;1 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(\left(99 \cdot k\right) \cdot k\right) \cdot a\\
\end{array}
\end{array}
if m < -1.8000000000000001e-74Initial program 99.0%
Taylor expanded in m around 0
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
lft-mult-inverseN/A
distribute-rgt-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
associate-+r+N/A
distribute-rgt-inN/A
unpow2N/A
associate-*r*N/A
lft-mult-inverseN/A
lower-fma.f64N/A
Applied rewrites38.7%
Taylor expanded in k around inf
Applied rewrites61.1%
if -1.8000000000000001e-74 < m < 0.204999999999999988Initial program 98.7%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f6460.7
Applied rewrites60.7%
Taylor expanded in m around 0
Applied rewrites59.7%
if 0.204999999999999988 < m Initial program 70.9%
Taylor expanded in m around 0
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
lft-mult-inverseN/A
distribute-rgt-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
associate-+r+N/A
distribute-rgt-inN/A
unpow2N/A
associate-*r*N/A
lft-mult-inverseN/A
lower-fma.f64N/A
Applied rewrites2.8%
Applied rewrites2.6%
Taylor expanded in k around 0
Applied rewrites40.6%
Taylor expanded in k around inf
Applied rewrites67.5%
(FPCore (a k m) :precision binary64 (if (<= m 0.205) (* 1.0 a) (* (* (* 99.0 k) k) a)))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.205) {
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.205d0) 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.205) {
tmp = 1.0 * a;
} else {
tmp = ((99.0 * k) * k) * a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.205: tmp = 1.0 * a else: tmp = ((99.0 * k) * k) * a return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.205) 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.205) tmp = 1.0 * a; else tmp = ((99.0 * k) * k) * a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.205], 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.205:\\
\;\;\;\;1 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(\left(99 \cdot k\right) \cdot k\right) \cdot a\\
\end{array}
\end{array}
if m < 0.204999999999999988Initial program 98.8%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f6478.2
Applied rewrites78.2%
Taylor expanded in m around 0
Applied rewrites30.5%
if 0.204999999999999988 < m Initial program 70.9%
Taylor expanded in m around 0
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
lft-mult-inverseN/A
distribute-rgt-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
associate-+r+N/A
distribute-rgt-inN/A
unpow2N/A
associate-*r*N/A
lft-mult-inverseN/A
lower-fma.f64N/A
Applied rewrites2.8%
Applied rewrites2.6%
Taylor expanded in k around 0
Applied rewrites40.6%
Taylor expanded in k around inf
Applied rewrites67.5%
(FPCore (a k m) :precision binary64 (if (<= m 0.205) (* 1.0 a) (* (* (* a k) k) 99.0)))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.205) {
tmp = 1.0 * a;
} else {
tmp = ((a * k) * k) * 99.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 <= 0.205d0) then
tmp = 1.0d0 * a
else
tmp = ((a * k) * k) * 99.0d0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 0.205) {
tmp = 1.0 * a;
} else {
tmp = ((a * k) * k) * 99.0;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.205: tmp = 1.0 * a else: tmp = ((a * k) * k) * 99.0 return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.205) tmp = Float64(1.0 * a); else tmp = Float64(Float64(Float64(a * k) * k) * 99.0); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 0.205) tmp = 1.0 * a; else tmp = ((a * k) * k) * 99.0; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.205], N[(1.0 * a), $MachinePrecision], N[(N[(N[(a * k), $MachinePrecision] * k), $MachinePrecision] * 99.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.205:\\
\;\;\;\;1 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(\left(a \cdot k\right) \cdot k\right) \cdot 99\\
\end{array}
\end{array}
if m < 0.204999999999999988Initial program 98.8%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f6478.2
Applied rewrites78.2%
Taylor expanded in m around 0
Applied rewrites30.5%
if 0.204999999999999988 < m Initial program 70.9%
Taylor expanded in m around 0
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
lft-mult-inverseN/A
distribute-rgt-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
associate-+r+N/A
distribute-rgt-inN/A
unpow2N/A
associate-*r*N/A
lft-mult-inverseN/A
lower-fma.f64N/A
Applied rewrites2.8%
Taylor expanded in k around 0
Applied rewrites35.1%
Taylor expanded in k around inf
Applied rewrites53.5%
Final simplification38.3%
(FPCore (a k m) :precision binary64 (if (<= m 3.6e+15) (* 1.0 a) (* (* a k) -10.0)))
double code(double a, double k, double m) {
double tmp;
if (m <= 3.6e+15) {
tmp = 1.0 * a;
} else {
tmp = (a * k) * -10.0;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 3.6d+15) then
tmp = 1.0d0 * a
else
tmp = (a * k) * (-10.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 3.6e+15) {
tmp = 1.0 * a;
} else {
tmp = (a * k) * -10.0;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 3.6e+15: tmp = 1.0 * a else: tmp = (a * k) * -10.0 return tmp
function code(a, k, m) tmp = 0.0 if (m <= 3.6e+15) tmp = Float64(1.0 * a); else tmp = Float64(Float64(a * k) * -10.0); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 3.6e+15) tmp = 1.0 * a; else tmp = (a * k) * -10.0; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 3.6e+15], N[(1.0 * a), $MachinePrecision], N[(N[(a * k), $MachinePrecision] * -10.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 3.6 \cdot 10^{+15}:\\
\;\;\;\;1 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot k\right) \cdot -10\\
\end{array}
\end{array}
if m < 3.6e15Initial program 97.7%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f6478.7
Applied rewrites78.7%
Taylor expanded in m around 0
Applied rewrites30.0%
if 3.6e15 < m Initial program 72.0%
Taylor expanded in m around 0
lower-/.f64N/A
associate-+r+N/A
+-commutativeN/A
+-commutativeN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
lft-mult-inverseN/A
distribute-rgt-inN/A
*-rgt-identityN/A
distribute-lft-inN/A
associate-+r+N/A
distribute-rgt-inN/A
unpow2N/A
associate-*r*N/A
lft-mult-inverseN/A
lower-fma.f64N/A
Applied rewrites2.8%
Taylor expanded in k around 0
Applied rewrites10.0%
Taylor expanded in k around inf
Applied rewrites24.1%
Final simplification28.1%
(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 89.5%
Taylor expanded in k around 0
*-commutativeN/A
lower-*.f64N/A
lower-pow.f6485.6
Applied rewrites85.6%
Taylor expanded in m around 0
Applied rewrites21.6%
herbie shell --seed 2024249
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))