
(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 0.1) (* a (pow k m)) (* (/ (pow k m) k) (/ a (+ k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a * pow(k, m);
} else {
tmp = (pow(k, m) / k) * (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 (k <= 0.1d0) then
tmp = a * (k ** m)
else
tmp = ((k ** m) / k) * (a / (k + 10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a * Math.pow(k, m);
} else {
tmp = (Math.pow(k, m) / k) * (a / (k + 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.1: tmp = a * math.pow(k, m) else: tmp = (math.pow(k, m) / k) * (a / (k + 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.1) tmp = Float64(a * (k ^ m)); else tmp = Float64(Float64((k ^ m) / k) * Float64(a / Float64(k + 10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.1) tmp = a * (k ^ m); else tmp = ((k ^ m) / k) * (a / (k + 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.1], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[k, m], $MachinePrecision] / k), $MachinePrecision] * N[(a / N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.1:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{{k}^{m}}{k} \cdot \frac{a}{k + 10}\\
\end{array}
\end{array}
if k < 0.10000000000000001Initial program 96.3%
associate-*l/93.1%
sqr-neg93.1%
associate-+l+93.1%
sqr-neg93.1%
distribute-rgt-out93.1%
Simplified93.1%
Taylor expanded in k around 0 99.8%
if 0.10000000000000001 < k Initial program 82.4%
associate-*l/77.2%
sqr-neg77.2%
associate-+l+77.2%
sqr-neg77.2%
distribute-rgt-out77.2%
Simplified77.2%
*-commutative77.2%
clear-num75.7%
un-div-inv75.7%
+-commutative75.7%
fma-def75.7%
+-commutative75.7%
Applied egg-rr75.7%
Taylor expanded in k around inf 75.1%
+-commutative75.1%
unpow275.1%
distribute-rgt-in75.1%
Simplified75.1%
associate-/l*82.1%
associate-/r/96.2%
Applied egg-rr96.2%
Final simplification98.4%
(FPCore (a k m) :precision binary64 (if (or (<= m -230000000.0) (not (<= m 0.0005))) (* a (pow k m)) (* a (/ 1.0 (+ 1.0 (* k (+ k 10.0)))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -230000000.0) || !(m <= 0.0005)) {
tmp = a * pow(k, m);
} else {
tmp = a * (1.0 / (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 <= (-230000000.0d0)) .or. (.not. (m <= 0.0005d0))) then
tmp = a * (k ** m)
else
tmp = a * (1.0d0 / (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 <= -230000000.0) || !(m <= 0.0005)) {
tmp = a * Math.pow(k, m);
} else {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -230000000.0) or not (m <= 0.0005): tmp = a * math.pow(k, m) else: tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -230000000.0) || !(m <= 0.0005)) tmp = Float64(a * (k ^ m)); else tmp = Float64(a * Float64(1.0 / 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 <= -230000000.0) || ~((m <= 0.0005))) tmp = a * (k ^ m); else tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -230000000.0], N[Not[LessEqual[m, 0.0005]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -230000000 \lor \neg \left(m \leq 0.0005\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -2.3e8 or 5.0000000000000001e-4 < m Initial program 89.5%
associate-*l/83.7%
sqr-neg83.7%
associate-+l+83.7%
sqr-neg83.7%
distribute-rgt-out83.7%
Simplified83.7%
Taylor expanded in k around 0 100.0%
if -2.3e8 < m < 5.0000000000000001e-4Initial program 94.2%
associate-*l/94.2%
sqr-neg94.2%
associate-+l+94.2%
sqr-neg94.2%
distribute-rgt-out94.2%
Simplified94.2%
Taylor expanded in a around 0 94.2%
+-commutative94.2%
distribute-lft-in94.2%
unpow294.2%
+-commutative94.2%
unpow294.2%
distribute-lft-in94.2%
fma-udef94.2%
associate-*r/94.2%
Simplified94.2%
Taylor expanded in m around 0 93.2%
Final simplification97.8%
(FPCore (a k m) :precision binary64 (if (<= k 1.0) (* a (pow k m)) (* (/ (pow k m) k) (/ a k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.0) {
tmp = a * pow(k, m);
} else {
tmp = (pow(k, m) / k) * (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 = a * (k ** m)
else
tmp = ((k ** m) / k) * (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 = a * Math.pow(k, m);
} else {
tmp = (Math.pow(k, m) / k) * (a / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.0: tmp = a * math.pow(k, m) else: tmp = (math.pow(k, m) / k) * (a / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.0) tmp = Float64(a * (k ^ m)); else tmp = Float64(Float64((k ^ m) / k) * Float64(a / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.0) tmp = a * (k ^ m); else tmp = ((k ^ m) / k) * (a / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.0], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[k, m], $MachinePrecision] / k), $MachinePrecision] * N[(a / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{{k}^{m}}{k} \cdot \frac{a}{k}\\
\end{array}
\end{array}
if k < 1Initial program 96.3%
associate-*l/93.1%
sqr-neg93.1%
associate-+l+93.1%
sqr-neg93.1%
distribute-rgt-out93.1%
Simplified93.1%
Taylor expanded in k around 0 99.8%
if 1 < k Initial program 82.4%
associate-*l/77.2%
sqr-neg77.2%
associate-+l+77.2%
sqr-neg77.2%
distribute-rgt-out77.2%
Simplified77.2%
*-commutative77.2%
clear-num75.7%
un-div-inv75.7%
+-commutative75.7%
fma-def75.7%
+-commutative75.7%
Applied egg-rr75.7%
Taylor expanded in k around inf 75.1%
+-commutative75.1%
unpow275.1%
distribute-rgt-in75.1%
Simplified75.1%
associate-/l*82.1%
associate-/r/96.2%
Applied egg-rr96.2%
Taylor expanded in k around inf 95.5%
Final simplification98.2%
(FPCore (a k m) :precision binary64 (if (or (<= k -6.2e+153) (not (<= k 0.075))) (/ a (* k (+ k 10.0))) (+ a (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if ((k <= -6.2e+153) || !(k <= 0.075)) {
tmp = a / (k * (k + 10.0));
} else {
tmp = a + (-10.0 * (k * a));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((k <= (-6.2d+153)) .or. (.not. (k <= 0.075d0))) then
tmp = a / (k * (k + 10.0d0))
else
tmp = a + ((-10.0d0) * (k * a))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= -6.2e+153) || !(k <= 0.075)) {
tmp = a / (k * (k + 10.0));
} else {
tmp = a + (-10.0 * (k * a));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -6.2e+153) or not (k <= 0.075): tmp = a / (k * (k + 10.0)) else: tmp = a + (-10.0 * (k * a)) return tmp
function code(a, k, m) tmp = 0.0 if ((k <= -6.2e+153) || !(k <= 0.075)) tmp = Float64(a / Float64(k * Float64(k + 10.0))); else tmp = Float64(a + Float64(-10.0 * Float64(k * a))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= -6.2e+153) || ~((k <= 0.075))) tmp = a / (k * (k + 10.0)); else tmp = a + (-10.0 * (k * a)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -6.2e+153], N[Not[LessEqual[k, 0.075]], $MachinePrecision]], N[(a / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -6.2 \cdot 10^{+153} \lor \neg \left(k \leq 0.075\right):\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if k < -6.2e153 or 0.0749999999999999972 < k Initial program 80.0%
associate-*l/75.6%
sqr-neg75.6%
associate-+l+75.6%
sqr-neg75.6%
distribute-rgt-out75.6%
Simplified75.6%
Taylor expanded in m around 0 59.1%
+-commutative59.1%
distribute-lft-in59.1%
unpow259.1%
+-commutative59.1%
unpow259.1%
distribute-lft-in59.1%
fma-udef59.1%
Simplified59.1%
Taylor expanded in k around inf 58.6%
+-commutative73.8%
unpow273.8%
distribute-rgt-in73.7%
Simplified58.6%
if -6.2e153 < k < 0.0749999999999999972Initial program 100.0%
associate-*l/96.5%
sqr-neg96.5%
associate-+l+96.5%
sqr-neg96.5%
distribute-rgt-out96.5%
Simplified96.5%
Taylor expanded in m around 0 28.4%
+-commutative28.4%
distribute-lft-in28.4%
unpow228.4%
+-commutative28.4%
unpow228.4%
distribute-lft-in28.4%
fma-udef28.4%
Simplified28.4%
Taylor expanded in k around 0 29.3%
Final simplification42.4%
(FPCore (a k m) :precision binary64 (if (<= k -6.5e+153) (/ a (* k (+ k 10.0))) (if (<= k 0.075) (+ a (* -10.0 (* k a))) (/ (/ a k) (+ k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if (k <= -6.5e+153) {
tmp = a / (k * (k + 10.0));
} else if (k <= 0.075) {
tmp = a + (-10.0 * (k * a));
} else {
tmp = (a / k) / (k + 10.0);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= (-6.5d+153)) then
tmp = a / (k * (k + 10.0d0))
else if (k <= 0.075d0) then
tmp = a + ((-10.0d0) * (k * a))
else
tmp = (a / k) / (k + 10.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= -6.5e+153) {
tmp = a / (k * (k + 10.0));
} else if (k <= 0.075) {
tmp = a + (-10.0 * (k * a));
} else {
tmp = (a / k) / (k + 10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= -6.5e+153: tmp = a / (k * (k + 10.0)) elif k <= 0.075: tmp = a + (-10.0 * (k * a)) else: tmp = (a / k) / (k + 10.0) return tmp
function code(a, k, m) tmp = 0.0 if (k <= -6.5e+153) tmp = Float64(a / Float64(k * Float64(k + 10.0))); elseif (k <= 0.075) tmp = Float64(a + Float64(-10.0 * Float64(k * a))); else tmp = Float64(Float64(a / k) / Float64(k + 10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= -6.5e+153) tmp = a / (k * (k + 10.0)); elseif (k <= 0.075) tmp = a + (-10.0 * (k * a)); else tmp = (a / k) / (k + 10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, -6.5e+153], N[(a / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.075], N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / N[(k + 10.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -6.5 \cdot 10^{+153}:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\mathbf{elif}\;k \leq 0.075:\\
\;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k + 10}\\
\end{array}
\end{array}
if k < -6.49999999999999972e153Initial program 66.7%
associate-*l/66.7%
sqr-neg66.7%
associate-+l+66.7%
sqr-neg66.7%
distribute-rgt-out66.7%
Simplified66.7%
Taylor expanded in m around 0 67.2%
+-commutative67.2%
distribute-lft-in67.2%
unpow267.2%
+-commutative67.2%
unpow267.2%
distribute-lft-in67.2%
fma-udef67.2%
Simplified67.2%
Taylor expanded in k around inf 67.2%
+-commutative66.7%
unpow266.7%
distribute-rgt-in66.7%
Simplified67.2%
if -6.49999999999999972e153 < k < 0.0749999999999999972Initial program 100.0%
associate-*l/96.5%
sqr-neg96.5%
associate-+l+96.5%
sqr-neg96.5%
distribute-rgt-out96.5%
Simplified96.5%
Taylor expanded in m around 0 28.4%
+-commutative28.4%
distribute-lft-in28.4%
unpow228.4%
+-commutative28.4%
unpow228.4%
distribute-lft-in28.4%
fma-udef28.4%
Simplified28.4%
Taylor expanded in k around 0 29.3%
if 0.0749999999999999972 < k Initial program 82.4%
associate-*l/77.2%
sqr-neg77.2%
associate-+l+77.2%
sqr-neg77.2%
distribute-rgt-out77.2%
Simplified77.2%
Taylor expanded in m around 0 57.6%
+-commutative57.6%
distribute-lft-in57.6%
unpow257.6%
+-commutative57.6%
unpow257.6%
distribute-lft-in57.6%
fma-udef57.6%
Simplified57.6%
Taylor expanded in k around inf 57.0%
+-commutative75.1%
unpow275.1%
distribute-rgt-in75.1%
Simplified57.0%
Taylor expanded in a around 0 57.0%
associate-/r*60.5%
+-commutative60.5%
Simplified60.5%
Final simplification43.7%
(FPCore (a k m) :precision binary64 (if (<= m 6.2e+38) (* a (/ 1.0 (+ 1.0 (* k (+ k 10.0))))) (+ a (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 6.2e+38) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = a + (-10.0 * (k * a));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 6.2d+38) then
tmp = a * (1.0d0 / (1.0d0 + (k * (k + 10.0d0))))
else
tmp = a + ((-10.0d0) * (k * a))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 6.2e+38) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = a + (-10.0 * (k * a));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 6.2e+38: tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))) else: tmp = a + (-10.0 * (k * a)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 6.2e+38) tmp = Float64(a * Float64(1.0 / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(a + Float64(-10.0 * Float64(k * a))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 6.2e+38) tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))); else tmp = a + (-10.0 * (k * a)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 6.2e+38], N[(a * N[(1.0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 6.2 \cdot 10^{+38}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 6.20000000000000035e38Initial program 96.6%
associate-*l/95.4%
sqr-neg95.4%
associate-+l+95.4%
sqr-neg95.4%
distribute-rgt-out95.4%
Simplified95.4%
Taylor expanded in a around 0 96.5%
+-commutative96.5%
distribute-lft-in96.6%
unpow296.6%
+-commutative96.6%
unpow296.6%
distribute-lft-in96.5%
fma-udef96.6%
associate-*r/96.6%
Simplified96.6%
Taylor expanded in m around 0 61.9%
if 6.20000000000000035e38 < m Initial program 80.2%
associate-*l/70.9%
sqr-neg70.9%
associate-+l+70.9%
sqr-neg70.9%
distribute-rgt-out70.9%
Simplified70.9%
Taylor expanded in m around 0 2.8%
+-commutative2.8%
distribute-lft-in2.8%
unpow22.8%
+-commutative2.8%
unpow22.8%
distribute-lft-in2.8%
fma-udef2.8%
Simplified2.8%
Taylor expanded in k around 0 10.8%
Final simplification44.7%
(FPCore (a k m) :precision binary64 (if (<= m 7.8e+31) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 7.8e+31) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (-10.0 * (k * a));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 7.8d+31) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + ((-10.0d0) * (k * a))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 7.8e+31) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (-10.0 * (k * a));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 7.8e+31: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (-10.0 * (k * a)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 7.8e+31) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(-10.0 * Float64(k * a))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 7.8e+31) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (-10.0 * (k * a)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 7.8e+31], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 7.8 \cdot 10^{+31}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 7.79999999999999999e31Initial program 96.5%
associate-*l/95.3%
sqr-neg95.3%
associate-+l+95.3%
sqr-neg95.3%
distribute-rgt-out95.3%
Simplified95.3%
Taylor expanded in m around 0 62.9%
if 7.79999999999999999e31 < m Initial program 80.9%
associate-*l/71.9%
sqr-neg71.9%
associate-+l+71.9%
sqr-neg71.9%
distribute-rgt-out71.9%
Simplified71.9%
Taylor expanded in m around 0 2.9%
+-commutative2.9%
distribute-lft-in2.9%
unpow22.9%
+-commutative2.9%
unpow22.9%
distribute-lft-in2.9%
fma-udef2.9%
Simplified2.9%
Taylor expanded in k around 0 10.6%
Final simplification44.7%
(FPCore (a k m) :precision binary64 (if (<= k 0.075) (+ a (* -10.0 (* k a))) (/ 0.1 (/ k a))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.075) {
tmp = a + (-10.0 * (k * a));
} else {
tmp = 0.1 / (k / a);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 0.075d0) then
tmp = a + ((-10.0d0) * (k * a))
else
tmp = 0.1d0 / (k / a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.075) {
tmp = a + (-10.0 * (k * a));
} else {
tmp = 0.1 / (k / a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.075: tmp = a + (-10.0 * (k * a)) else: tmp = 0.1 / (k / a) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.075) tmp = Float64(a + Float64(-10.0 * Float64(k * a))); else tmp = Float64(0.1 / Float64(k / a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.075) tmp = a + (-10.0 * (k * a)); else tmp = 0.1 / (k / a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.075], N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.1 / N[(k / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.075:\\
\;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a}}\\
\end{array}
\end{array}
if k < 0.0749999999999999972Initial program 96.3%
associate-*l/93.1%
sqr-neg93.1%
associate-+l+93.1%
sqr-neg93.1%
distribute-rgt-out93.1%
Simplified93.1%
Taylor expanded in m around 0 32.7%
+-commutative32.7%
distribute-lft-in32.7%
unpow232.7%
+-commutative32.7%
unpow232.7%
distribute-lft-in32.7%
fma-udef32.7%
Simplified32.7%
Taylor expanded in k around 0 27.5%
if 0.0749999999999999972 < k Initial program 82.4%
associate-*l/77.2%
sqr-neg77.2%
associate-+l+77.2%
sqr-neg77.2%
distribute-rgt-out77.2%
Simplified77.2%
Taylor expanded in m around 0 57.6%
+-commutative57.6%
distribute-lft-in57.6%
unpow257.6%
+-commutative57.6%
unpow257.6%
distribute-lft-in57.6%
fma-udef57.6%
Simplified57.6%
Taylor expanded in k around inf 57.0%
+-commutative75.1%
unpow275.1%
distribute-rgt-in75.1%
Simplified57.0%
Taylor expanded in k around 0 19.3%
clear-num20.6%
un-div-inv20.6%
Applied egg-rr20.6%
Final simplification24.9%
(FPCore (a k m) :precision binary64 (if (<= k 0.1) a (* (/ a k) 0.1)))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a;
} else {
tmp = (a / k) * 0.1;
}
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 <= 0.1d0) then
tmp = a
else
tmp = (a / k) * 0.1d0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a;
} else {
tmp = (a / k) * 0.1;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.1: tmp = a else: tmp = (a / k) * 0.1 return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.1) tmp = a; else tmp = Float64(Float64(a / k) * 0.1); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.1) tmp = a; else tmp = (a / k) * 0.1; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.1], a, N[(N[(a / k), $MachinePrecision] * 0.1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.1:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k} \cdot 0.1\\
\end{array}
\end{array}
if k < 0.10000000000000001Initial program 96.3%
associate-*l/93.1%
sqr-neg93.1%
associate-+l+93.1%
sqr-neg93.1%
distribute-rgt-out93.1%
Simplified93.1%
Taylor expanded in m around 0 32.7%
+-commutative32.7%
distribute-lft-in32.7%
unpow232.7%
+-commutative32.7%
unpow232.7%
distribute-lft-in32.7%
fma-udef32.7%
Simplified32.7%
Taylor expanded in k around 0 23.3%
if 0.10000000000000001 < k Initial program 82.4%
associate-*l/77.2%
sqr-neg77.2%
associate-+l+77.2%
sqr-neg77.2%
distribute-rgt-out77.2%
Simplified77.2%
Taylor expanded in m around 0 57.6%
+-commutative57.6%
distribute-lft-in57.6%
unpow257.6%
+-commutative57.6%
unpow257.6%
distribute-lft-in57.6%
fma-udef57.6%
Simplified57.6%
Taylor expanded in k around inf 57.0%
+-commutative75.1%
unpow275.1%
distribute-rgt-in75.1%
Simplified57.0%
Taylor expanded in k around 0 19.3%
Final simplification21.8%
(FPCore (a k m) :precision binary64 (if (<= k 0.1) a (* a (/ 0.1 k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a;
} else {
tmp = a * (0.1 / 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 <= 0.1d0) then
tmp = a
else
tmp = a * (0.1d0 / k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a;
} else {
tmp = a * (0.1 / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.1: tmp = a else: tmp = a * (0.1 / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.1) tmp = a; else tmp = Float64(a * Float64(0.1 / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.1) tmp = a; else tmp = a * (0.1 / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.1], a, N[(a * N[(0.1 / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.1:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{0.1}{k}\\
\end{array}
\end{array}
if k < 0.10000000000000001Initial program 96.3%
associate-*l/93.1%
sqr-neg93.1%
associate-+l+93.1%
sqr-neg93.1%
distribute-rgt-out93.1%
Simplified93.1%
Taylor expanded in m around 0 32.7%
+-commutative32.7%
distribute-lft-in32.7%
unpow232.7%
+-commutative32.7%
unpow232.7%
distribute-lft-in32.7%
fma-udef32.7%
Simplified32.7%
Taylor expanded in k around 0 23.3%
if 0.10000000000000001 < k Initial program 82.4%
associate-*l/77.2%
sqr-neg77.2%
associate-+l+77.2%
sqr-neg77.2%
distribute-rgt-out77.2%
Simplified77.2%
Taylor expanded in a around 0 82.4%
+-commutative82.4%
distribute-lft-in82.4%
unpow282.4%
+-commutative82.4%
unpow282.4%
distribute-lft-in82.4%
fma-udef82.4%
associate-*r/82.4%
Simplified82.4%
Taylor expanded in m around 0 57.6%
Taylor expanded in k around 0 19.3%
*-commutative19.3%
Simplified19.3%
Taylor expanded in k around inf 19.3%
Final simplification21.8%
(FPCore (a k m) :precision binary64 (if (<= k 0.1) a (/ 0.1 (/ k a))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a;
} else {
tmp = 0.1 / (k / a);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 0.1d0) then
tmp = a
else
tmp = 0.1d0 / (k / a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a;
} else {
tmp = 0.1 / (k / a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.1: tmp = a else: tmp = 0.1 / (k / a) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.1) tmp = a; else tmp = Float64(0.1 / Float64(k / a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.1) tmp = a; else tmp = 0.1 / (k / a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.1], a, N[(0.1 / N[(k / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.1:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a}}\\
\end{array}
\end{array}
if k < 0.10000000000000001Initial program 96.3%
associate-*l/93.1%
sqr-neg93.1%
associate-+l+93.1%
sqr-neg93.1%
distribute-rgt-out93.1%
Simplified93.1%
Taylor expanded in m around 0 32.7%
+-commutative32.7%
distribute-lft-in32.7%
unpow232.7%
+-commutative32.7%
unpow232.7%
distribute-lft-in32.7%
fma-udef32.7%
Simplified32.7%
Taylor expanded in k around 0 23.3%
if 0.10000000000000001 < k Initial program 82.4%
associate-*l/77.2%
sqr-neg77.2%
associate-+l+77.2%
sqr-neg77.2%
distribute-rgt-out77.2%
Simplified77.2%
Taylor expanded in m around 0 57.6%
+-commutative57.6%
distribute-lft-in57.6%
unpow257.6%
+-commutative57.6%
unpow257.6%
distribute-lft-in57.6%
fma-udef57.6%
Simplified57.6%
Taylor expanded in k around inf 57.0%
+-commutative75.1%
unpow275.1%
distribute-rgt-in75.1%
Simplified57.0%
Taylor expanded in k around 0 19.3%
clear-num20.6%
un-div-inv20.6%
Applied egg-rr20.6%
Final simplification22.3%
(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.1%
associate-*l/87.2%
sqr-neg87.2%
associate-+l+87.2%
sqr-neg87.2%
distribute-rgt-out87.2%
Simplified87.2%
Taylor expanded in m around 0 42.1%
+-commutative42.1%
distribute-lft-in42.1%
unpow242.1%
+-commutative42.1%
unpow242.1%
distribute-lft-in42.1%
fma-udef42.1%
Simplified42.1%
Taylor expanded in k around 0 16.1%
Final simplification16.1%
herbie shell --seed 2024019
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))