
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
(FPCore (a k m) :precision binary64 (let* ((t_0 (* (pow k m) a))) (if (<= k 3e-8) t_0 (/ (/ t_0 k) k))))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if (k <= 3e-8) {
tmp = t_0;
} else {
tmp = (t_0 / 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) :: t_0
real(8) :: tmp
t_0 = (k ** m) * a
if (k <= 3d-8) then
tmp = t_0
else
tmp = (t_0 / k) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = Math.pow(k, m) * a;
double tmp;
if (k <= 3e-8) {
tmp = t_0;
} else {
tmp = (t_0 / k) / k;
}
return tmp;
}
def code(a, k, m): t_0 = math.pow(k, m) * a tmp = 0 if k <= 3e-8: tmp = t_0 else: tmp = (t_0 / k) / k return tmp
function code(a, k, m) t_0 = Float64((k ^ m) * a) tmp = 0.0 if (k <= 3e-8) tmp = t_0; else tmp = Float64(Float64(t_0 / k) / k); end return tmp end
function tmp_2 = code(a, k, m) t_0 = (k ^ m) * a; tmp = 0.0; if (k <= 3e-8) tmp = t_0; else tmp = (t_0 / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[k, 3e-8], t$95$0, N[(N[(t$95$0 / k), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;k \leq 3 \cdot 10^{-8}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t_0}{k}}{k}\\
\end{array}
\end{array}
if k < 2.99999999999999973e-8Initial program 94.3%
associate-*r/94.3%
*-commutative94.3%
sqr-neg94.3%
associate-+l+94.3%
+-commutative94.3%
sqr-neg94.3%
distribute-rgt-out95.0%
fma-def95.0%
+-commutative95.0%
Simplified95.0%
Taylor expanded in k around 0 99.0%
if 2.99999999999999973e-8 < k Initial program 87.8%
associate-*r/87.8%
*-commutative87.8%
sqr-neg87.8%
associate-+l+87.8%
+-commutative87.8%
sqr-neg87.8%
distribute-rgt-out87.8%
fma-def87.8%
+-commutative87.8%
Simplified87.8%
Taylor expanded in k around inf 87.6%
unpow287.6%
Simplified87.6%
associate-*l/87.6%
associate-/r*99.8%
Applied egg-rr99.8%
Final simplification99.3%
(FPCore (a k m) :precision binary64 (if (or (<= m -3.6e-9) (not (<= m 1.02))) (* (pow k m) a) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -3.6e-9) || !(m <= 1.02)) {
tmp = pow(k, m) * a;
} else {
tmp = a / (1.0 + (k * (k + 10.0)));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((m <= (-3.6d-9)) .or. (.not. (m <= 1.02d0))) then
tmp = (k ** m) * a
else
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((m <= -3.6e-9) || !(m <= 1.02)) {
tmp = Math.pow(k, m) * a;
} else {
tmp = a / (1.0 + (k * (k + 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -3.6e-9) or not (m <= 1.02): tmp = math.pow(k, m) * a else: tmp = a / (1.0 + (k * (k + 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -3.6e-9) || !(m <= 1.02)) tmp = Float64((k ^ m) * a); else tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((m <= -3.6e-9) || ~((m <= 1.02))) tmp = (k ^ m) * a; else tmp = a / (1.0 + (k * (k + 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -3.6e-9], N[Not[LessEqual[m, 1.02]], $MachinePrecision]], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3.6 \cdot 10^{-9} \lor \neg \left(m \leq 1.02\right):\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -3.6e-9 or 1.02 < m Initial program 89.5%
associate-*r/89.5%
*-commutative89.5%
sqr-neg89.5%
associate-+l+89.5%
+-commutative89.5%
sqr-neg89.5%
distribute-rgt-out90.1%
fma-def90.1%
+-commutative90.1%
Simplified90.1%
Taylor expanded in k around 0 99.4%
if -3.6e-9 < m < 1.02Initial program 95.9%
associate-*r/95.9%
*-commutative95.9%
sqr-neg95.9%
associate-+l+95.9%
+-commutative95.9%
sqr-neg95.9%
distribute-rgt-out95.9%
fma-def95.9%
+-commutative95.9%
Simplified95.9%
Taylor expanded in m around 0 94.6%
Final simplification97.6%
(FPCore (a k m) :precision binary64 (if (<= k 3e-8) (* (pow k m) a) (* a (pow k (- m 2.0)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 3e-8) {
tmp = pow(k, m) * a;
} 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 <= 3d-8) then
tmp = (k ** m) * a
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 <= 3e-8) {
tmp = Math.pow(k, m) * a;
} else {
tmp = a * Math.pow(k, (m - 2.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 3e-8: tmp = math.pow(k, m) * a else: tmp = a * math.pow(k, (m - 2.0)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 3e-8) tmp = Float64((k ^ m) * a); 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 <= 3e-8) tmp = (k ^ m) * a; else tmp = a * (k ^ (m - 2.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 3e-8], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(a * N[Power[k, N[(m - 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3 \cdot 10^{-8}:\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{\left(m - 2\right)}\\
\end{array}
\end{array}
if k < 2.99999999999999973e-8Initial program 94.3%
associate-*r/94.3%
*-commutative94.3%
sqr-neg94.3%
associate-+l+94.3%
+-commutative94.3%
sqr-neg94.3%
distribute-rgt-out95.0%
fma-def95.0%
+-commutative95.0%
Simplified95.0%
Taylor expanded in k around 0 99.0%
if 2.99999999999999973e-8 < k Initial program 87.8%
associate-*r/87.8%
*-commutative87.8%
sqr-neg87.8%
associate-+l+87.8%
+-commutative87.8%
sqr-neg87.8%
distribute-rgt-out87.8%
fma-def87.8%
+-commutative87.8%
Simplified87.8%
Taylor expanded in k around inf 87.6%
unpow287.6%
Simplified87.6%
pow287.6%
pow-div96.7%
Applied egg-rr96.7%
Final simplification98.1%
(FPCore (a k m) :precision binary64 (if (<= m -2300.0) (/ a (* k k)) (if (<= m 1.25) (/ a (+ 1.0 (* k (+ k 10.0)))) (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -2300.0) {
tmp = a / (k * k);
} else if (m <= 1.25) {
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 <= (-2300.0d0)) then
tmp = a / (k * k)
else if (m <= 1.25d0) 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 <= -2300.0) {
tmp = a / (k * k);
} else if (m <= 1.25) {
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 <= -2300.0: tmp = a / (k * k) elif m <= 1.25: 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 <= -2300.0) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.25) 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 <= -2300.0) tmp = a / (k * k); elseif (m <= 1.25) 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, -2300.0], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.25], 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 -2300:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.25:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -2300Initial program 98.8%
associate-*r/98.8%
*-commutative98.8%
sqr-neg98.8%
associate-+l+98.8%
+-commutative98.8%
sqr-neg98.8%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 36.4%
Taylor expanded in k around inf 68.8%
unpow268.8%
Simplified68.8%
if -2300 < m < 1.25Initial program 96.0%
associate-*r/96.0%
*-commutative96.0%
sqr-neg96.0%
associate-+l+96.0%
+-commutative96.0%
sqr-neg96.0%
distribute-rgt-out96.0%
fma-def96.0%
+-commutative96.0%
Simplified96.0%
Taylor expanded in m around 0 93.8%
if 1.25 < m Initial program 80.0%
associate-*r/80.0%
*-commutative80.0%
sqr-neg80.0%
associate-+l+80.0%
+-commutative80.0%
sqr-neg80.0%
distribute-rgt-out80.0%
fma-def80.0%
+-commutative80.0%
Simplified80.0%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 7.9%
Taylor expanded in k around inf 26.3%
Final simplification64.9%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (/ a (* k k))))
(if (<= m -4.2e-81)
t_0
(if (<= m -5.2e-212) a (if (<= m 1.18) t_0 (* -10.0 (* k a)))))))
double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (m <= -4.2e-81) {
tmp = t_0;
} else if (m <= -5.2e-212) {
tmp = a;
} else if (m <= 1.18) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = a / (k * k)
if (m <= (-4.2d-81)) then
tmp = t_0
else if (m <= (-5.2d-212)) then
tmp = a
else if (m <= 1.18d0) then
tmp = t_0
else
tmp = (-10.0d0) * (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 <= -4.2e-81) {
tmp = t_0;
} else if (m <= -5.2e-212) {
tmp = a;
} else if (m <= 1.18) {
tmp = t_0;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): t_0 = a / (k * k) tmp = 0 if m <= -4.2e-81: tmp = t_0 elif m <= -5.2e-212: tmp = a elif m <= 1.18: tmp = t_0 else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) t_0 = Float64(a / Float64(k * k)) tmp = 0.0 if (m <= -4.2e-81) tmp = t_0; elseif (m <= -5.2e-212) tmp = a; elseif (m <= 1.18) tmp = t_0; else tmp = Float64(-10.0 * Float64(k * a)); end return tmp end
function tmp_2 = code(a, k, m) t_0 = a / (k * k); tmp = 0.0; if (m <= -4.2e-81) tmp = t_0; elseif (m <= -5.2e-212) tmp = a; elseif (m <= 1.18) tmp = t_0; else tmp = -10.0 * (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, -4.2e-81], t$95$0, If[LessEqual[m, -5.2e-212], a, If[LessEqual[m, 1.18], t$95$0, N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{k \cdot k}\\
\mathbf{if}\;m \leq -4.2 \cdot 10^{-81}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;m \leq -5.2 \cdot 10^{-212}:\\
\;\;\;\;a\\
\mathbf{elif}\;m \leq 1.18:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -4.1999999999999998e-81 or -5.2e-212 < m < 1.17999999999999994Initial program 97.6%
associate-*r/97.5%
*-commutative97.5%
sqr-neg97.5%
associate-+l+97.5%
+-commutative97.5%
sqr-neg97.5%
distribute-rgt-out98.2%
fma-def98.2%
+-commutative98.2%
Simplified98.2%
Taylor expanded in m around 0 64.6%
Taylor expanded in k around inf 64.7%
unpow264.7%
Simplified64.7%
if -4.1999999999999998e-81 < m < -5.2e-212Initial program 94.6%
associate-*r/94.6%
*-commutative94.6%
sqr-neg94.6%
associate-+l+94.6%
+-commutative94.6%
sqr-neg94.6%
distribute-rgt-out94.6%
fma-def94.6%
+-commutative94.6%
Simplified94.6%
Taylor expanded in m around 0 94.6%
Taylor expanded in k around 0 86.3%
if 1.17999999999999994 < m Initial program 80.0%
associate-*r/80.0%
*-commutative80.0%
sqr-neg80.0%
associate-+l+80.0%
+-commutative80.0%
sqr-neg80.0%
distribute-rgt-out80.0%
fma-def80.0%
+-commutative80.0%
Simplified80.0%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 7.9%
Taylor expanded in k around inf 26.3%
Final simplification54.2%
(FPCore (a k m) :precision binary64 (if (<= m -4.7e-81) (/ a (* k k)) (if (<= m -4.8e-213) a (if (<= m 1.3) (/ (/ a k) k) (* -10.0 (* k a))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -4.7e-81) {
tmp = a / (k * k);
} else if (m <= -4.8e-213) {
tmp = a;
} else if (m <= 1.3) {
tmp = (a / 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 <= (-4.7d-81)) then
tmp = a / (k * k)
else if (m <= (-4.8d-213)) then
tmp = a
else if (m <= 1.3d0) then
tmp = (a / 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 <= -4.7e-81) {
tmp = a / (k * k);
} else if (m <= -4.8e-213) {
tmp = a;
} else if (m <= 1.3) {
tmp = (a / k) / k;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -4.7e-81: tmp = a / (k * k) elif m <= -4.8e-213: tmp = a elif m <= 1.3: tmp = (a / k) / k else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -4.7e-81) tmp = Float64(a / Float64(k * k)); elseif (m <= -4.8e-213) tmp = a; elseif (m <= 1.3) tmp = Float64(Float64(a / 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 <= -4.7e-81) tmp = a / (k * k); elseif (m <= -4.8e-213) tmp = a; elseif (m <= 1.3) tmp = (a / k) / k; else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -4.7e-81], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, -4.8e-213], a, If[LessEqual[m, 1.3], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision], N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -4.7 \cdot 10^{-81}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq -4.8 \cdot 10^{-213}:\\
\;\;\;\;a\\
\mathbf{elif}\;m \leq 1.3:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -4.70000000000000029e-81Initial program 98.0%
associate-*r/98.0%
*-commutative98.0%
sqr-neg98.0%
associate-+l+98.0%
+-commutative98.0%
sqr-neg98.0%
distribute-rgt-out99.0%
fma-def99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in m around 0 46.6%
Taylor expanded in k around inf 68.1%
unpow268.1%
Simplified68.1%
if -4.70000000000000029e-81 < m < -4.79999999999999991e-213Initial program 94.6%
associate-*r/94.6%
*-commutative94.6%
sqr-neg94.6%
associate-+l+94.6%
+-commutative94.6%
sqr-neg94.6%
distribute-rgt-out94.6%
fma-def94.6%
+-commutative94.6%
Simplified94.6%
Taylor expanded in m around 0 94.6%
Taylor expanded in k around 0 86.3%
if -4.79999999999999991e-213 < m < 1.30000000000000004Initial program 96.8%
associate-*r/96.7%
*-commutative96.7%
sqr-neg96.7%
associate-+l+96.7%
+-commutative96.7%
sqr-neg96.7%
distribute-rgt-out96.7%
fma-def96.7%
+-commutative96.7%
Simplified96.7%
Taylor expanded in k around inf 60.5%
unpow260.5%
Simplified60.5%
associate-*l/60.6%
associate-/r*63.8%
Applied egg-rr63.8%
Taylor expanded in m around 0 59.0%
unpow259.0%
associate-/r*62.0%
Simplified62.0%
if 1.30000000000000004 < m Initial program 80.0%
associate-*r/80.0%
*-commutative80.0%
sqr-neg80.0%
associate-+l+80.0%
+-commutative80.0%
sqr-neg80.0%
distribute-rgt-out80.0%
fma-def80.0%
+-commutative80.0%
Simplified80.0%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 7.9%
Taylor expanded in k around inf 26.3%
Final simplification54.9%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* -10.0 (* k a))))
(if (<= m -4.3e-82)
(/ a (* k k))
(if (<= m -1.2e-212) (+ a t_0) (if (<= m 1.52) (/ (/ a k) k) t_0)))))
double code(double a, double k, double m) {
double t_0 = -10.0 * (k * a);
double tmp;
if (m <= -4.3e-82) {
tmp = a / (k * k);
} else if (m <= -1.2e-212) {
tmp = a + t_0;
} else if (m <= 1.52) {
tmp = (a / k) / k;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = (-10.0d0) * (k * a)
if (m <= (-4.3d-82)) then
tmp = a / (k * k)
else if (m <= (-1.2d-212)) then
tmp = a + t_0
else if (m <= 1.52d0) then
tmp = (a / k) / k
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = -10.0 * (k * a);
double tmp;
if (m <= -4.3e-82) {
tmp = a / (k * k);
} else if (m <= -1.2e-212) {
tmp = a + t_0;
} else if (m <= 1.52) {
tmp = (a / k) / k;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = -10.0 * (k * a) tmp = 0 if m <= -4.3e-82: tmp = a / (k * k) elif m <= -1.2e-212: tmp = a + t_0 elif m <= 1.52: tmp = (a / k) / k else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(-10.0 * Float64(k * a)) tmp = 0.0 if (m <= -4.3e-82) tmp = Float64(a / Float64(k * k)); elseif (m <= -1.2e-212) tmp = Float64(a + t_0); elseif (m <= 1.52) tmp = Float64(Float64(a / k) / k); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = -10.0 * (k * a); tmp = 0.0; if (m <= -4.3e-82) tmp = a / (k * k); elseif (m <= -1.2e-212) tmp = a + t_0; elseif (m <= 1.52) tmp = (a / k) / k; else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -4.3e-82], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, -1.2e-212], N[(a + t$95$0), $MachinePrecision], If[LessEqual[m, 1.52], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -10 \cdot \left(k \cdot a\right)\\
\mathbf{if}\;m \leq -4.3 \cdot 10^{-82}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq -1.2 \cdot 10^{-212}:\\
\;\;\;\;a + t_0\\
\mathbf{elif}\;m \leq 1.52:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if m < -4.30000000000000019e-82Initial program 98.0%
associate-*r/98.0%
*-commutative98.0%
sqr-neg98.0%
associate-+l+98.0%
+-commutative98.0%
sqr-neg98.0%
distribute-rgt-out99.0%
fma-def99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in m around 0 46.6%
Taylor expanded in k around inf 68.1%
unpow268.1%
Simplified68.1%
if -4.30000000000000019e-82 < m < -1.19999999999999995e-212Initial program 94.6%
associate-*r/94.6%
*-commutative94.6%
sqr-neg94.6%
associate-+l+94.6%
+-commutative94.6%
sqr-neg94.6%
distribute-rgt-out94.6%
fma-def94.6%
+-commutative94.6%
Simplified94.6%
Taylor expanded in m around 0 94.6%
Taylor expanded in k around 0 89.1%
if -1.19999999999999995e-212 < m < 1.52Initial program 96.8%
associate-*r/96.7%
*-commutative96.7%
sqr-neg96.7%
associate-+l+96.7%
+-commutative96.7%
sqr-neg96.7%
distribute-rgt-out96.7%
fma-def96.7%
+-commutative96.7%
Simplified96.7%
Taylor expanded in k around inf 60.5%
unpow260.5%
Simplified60.5%
associate-*l/60.6%
associate-/r*63.8%
Applied egg-rr63.8%
Taylor expanded in m around 0 59.0%
unpow259.0%
associate-/r*62.0%
Simplified62.0%
if 1.52 < m Initial program 80.0%
associate-*r/80.0%
*-commutative80.0%
sqr-neg80.0%
associate-+l+80.0%
+-commutative80.0%
sqr-neg80.0%
distribute-rgt-out80.0%
fma-def80.0%
+-commutative80.0%
Simplified80.0%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 7.9%
Taylor expanded in k around inf 26.3%
Final simplification55.1%
(FPCore (a k m)
:precision binary64
(if (<= m -5.5e-60)
(/ a (* k k))
(if (<= m 8.5e-90)
(/ a (+ 1.0 (* k 10.0)))
(if (<= m 1.1) (/ (/ a k) k) (* -10.0 (* k a))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -5.5e-60) {
tmp = a / (k * k);
} else if (m <= 8.5e-90) {
tmp = a / (1.0 + (k * 10.0));
} else if (m <= 1.1) {
tmp = (a / 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 <= (-5.5d-60)) then
tmp = a / (k * k)
else if (m <= 8.5d-90) then
tmp = a / (1.0d0 + (k * 10.0d0))
else if (m <= 1.1d0) then
tmp = (a / 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 <= -5.5e-60) {
tmp = a / (k * k);
} else if (m <= 8.5e-90) {
tmp = a / (1.0 + (k * 10.0));
} else if (m <= 1.1) {
tmp = (a / k) / k;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -5.5e-60: tmp = a / (k * k) elif m <= 8.5e-90: tmp = a / (1.0 + (k * 10.0)) elif m <= 1.1: tmp = (a / k) / k else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -5.5e-60) tmp = Float64(a / Float64(k * k)); elseif (m <= 8.5e-90) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); elseif (m <= 1.1) tmp = Float64(Float64(a / 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 <= -5.5e-60) tmp = a / (k * k); elseif (m <= 8.5e-90) tmp = a / (1.0 + (k * 10.0)); elseif (m <= 1.1) tmp = (a / k) / k; else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -5.5e-60], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 8.5e-90], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.1], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision], N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -5.5 \cdot 10^{-60}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 8.5 \cdot 10^{-90}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{elif}\;m \leq 1.1:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -5.4999999999999997e-60Initial program 98.9%
associate-*r/98.9%
*-commutative98.9%
sqr-neg98.9%
associate-+l+98.9%
+-commutative98.9%
sqr-neg98.9%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 44.2%
Taylor expanded in k around inf 69.1%
unpow269.1%
Simplified69.1%
if -5.4999999999999997e-60 < m < 8.5000000000000001e-90Initial program 95.7%
associate-*r/95.7%
*-commutative95.7%
sqr-neg95.7%
associate-+l+95.7%
+-commutative95.7%
sqr-neg95.7%
distribute-rgt-out95.7%
fma-def95.7%
+-commutative95.7%
Simplified95.7%
Taylor expanded in m around 0 95.7%
Taylor expanded in k around 0 76.8%
*-commutative76.8%
Simplified76.8%
if 8.5000000000000001e-90 < m < 1.1000000000000001Initial program 94.1%
associate-*r/94.0%
*-commutative94.0%
sqr-neg94.0%
associate-+l+94.0%
+-commutative94.0%
sqr-neg94.0%
distribute-rgt-out94.0%
fma-def94.0%
+-commutative94.0%
Simplified94.0%
Taylor expanded in k around inf 75.0%
unpow275.0%
Simplified75.0%
associate-*l/75.1%
associate-/r*80.8%
Applied egg-rr80.8%
Taylor expanded in m around 0 69.4%
unpow269.4%
associate-/r*74.1%
Simplified74.1%
if 1.1000000000000001 < m Initial program 80.0%
associate-*r/80.0%
*-commutative80.0%
sqr-neg80.0%
associate-+l+80.0%
+-commutative80.0%
sqr-neg80.0%
distribute-rgt-out80.0%
fma-def80.0%
+-commutative80.0%
Simplified80.0%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 7.9%
Taylor expanded in k around inf 26.3%
Final simplification58.1%
(FPCore (a k m) :precision binary64 (if (<= m -2300.0) (/ a (* k k)) (if (<= m 1.15) (/ a (+ 1.0 (* k k))) (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -2300.0) {
tmp = a / (k * k);
} else if (m <= 1.15) {
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 <= (-2300.0d0)) then
tmp = a / (k * k)
else if (m <= 1.15d0) 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 <= -2300.0) {
tmp = a / (k * k);
} else if (m <= 1.15) {
tmp = a / (1.0 + (k * k));
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -2300.0: tmp = a / (k * k) elif m <= 1.15: tmp = a / (1.0 + (k * k)) else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -2300.0) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.15) 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 <= -2300.0) tmp = a / (k * k); elseif (m <= 1.15) tmp = a / (1.0 + (k * k)); else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -2300.0], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.15], 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 -2300:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.15:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -2300Initial program 98.8%
associate-*r/98.8%
*-commutative98.8%
sqr-neg98.8%
associate-+l+98.8%
+-commutative98.8%
sqr-neg98.8%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 36.4%
Taylor expanded in k around inf 68.8%
unpow268.8%
Simplified68.8%
if -2300 < m < 1.1499999999999999Initial program 96.0%
associate-*r/96.0%
*-commutative96.0%
sqr-neg96.0%
associate-+l+96.0%
+-commutative96.0%
sqr-neg96.0%
distribute-rgt-out96.0%
fma-def96.0%
+-commutative96.0%
Simplified96.0%
Taylor expanded in m around 0 93.8%
Taylor expanded in k around inf 93.2%
unpow293.2%
Simplified93.2%
if 1.1499999999999999 < m Initial program 80.0%
associate-*r/80.0%
*-commutative80.0%
sqr-neg80.0%
associate-+l+80.0%
+-commutative80.0%
sqr-neg80.0%
distribute-rgt-out80.0%
fma-def80.0%
+-commutative80.0%
Simplified80.0%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 7.9%
Taylor expanded in k around inf 26.3%
Final simplification64.7%
(FPCore (a k m) :precision binary64 (if (<= m 1.02) a (* -10.0 (* k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.02) {
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 <= 1.02d0) 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 <= 1.02) {
tmp = a;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.02: tmp = a else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.02) 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 <= 1.02) tmp = a; else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.02], a, N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.02:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 1.02Initial program 97.3%
associate-*r/97.2%
*-commutative97.2%
sqr-neg97.2%
associate-+l+97.2%
+-commutative97.2%
sqr-neg97.2%
distribute-rgt-out97.8%
fma-def97.8%
+-commutative97.8%
Simplified97.8%
Taylor expanded in m around 0 67.7%
Taylor expanded in k around 0 27.3%
if 1.02 < m Initial program 80.0%
associate-*r/80.0%
*-commutative80.0%
sqr-neg80.0%
associate-+l+80.0%
+-commutative80.0%
sqr-neg80.0%
distribute-rgt-out80.0%
fma-def80.0%
+-commutative80.0%
Simplified80.0%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 7.9%
Taylor expanded in k around inf 26.3%
Final simplification27.0%
(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 91.9%
associate-*r/91.9%
*-commutative91.9%
sqr-neg91.9%
associate-+l+91.9%
+-commutative91.9%
sqr-neg91.9%
distribute-rgt-out92.2%
fma-def92.2%
+-commutative92.2%
Simplified92.2%
Taylor expanded in m around 0 47.5%
Taylor expanded in k around 0 19.9%
Final simplification19.9%
herbie shell --seed 2023272
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))