
(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 15 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 2.2e-14) (* a (* (pow k m) (fma k -10.0 1.0))) (/ (/ (* (pow k m) a) (hypot 1.0 k)) k)))
double code(double a, double k, double m) {
double tmp;
if (k <= 2.2e-14) {
tmp = a * (pow(k, m) * fma(k, -10.0, 1.0));
} else {
tmp = ((pow(k, m) * a) / hypot(1.0, k)) / k;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (k <= 2.2e-14) tmp = Float64(a * Float64((k ^ m) * fma(k, -10.0, 1.0))); else tmp = Float64(Float64(Float64((k ^ m) * a) / hypot(1.0, k)) / k); end return tmp end
code[a_, k_, m_] := If[LessEqual[k, 2.2e-14], N[(a * N[(N[Power[k, m], $MachinePrecision] * N[(k * -10.0 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.2 \cdot 10^{-14}:\\
\;\;\;\;a \cdot \left({k}^{m} \cdot \mathsf{fma}\left(k, -10, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{k}^{m} \cdot a}{\mathsf{hypot}\left(1, k\right)}}{k}\\
\end{array}
\end{array}
if k < 2.2000000000000001e-14Initial program 96.5%
associate-/l*96.5%
remove-double-neg96.5%
distribute-frac-neg296.5%
distribute-neg-frac296.5%
remove-double-neg96.5%
sqr-neg96.5%
associate-+l+96.5%
sqr-neg96.5%
distribute-rgt-out96.5%
Simplified96.5%
Taylor expanded in k around 0 86.0%
associate-*r*86.0%
*-lft-identity86.0%
distribute-rgt-out100.0%
*-commutative100.0%
fma-define100.0%
Simplified100.0%
if 2.2000000000000001e-14 < k Initial program 83.0%
associate-/l*82.9%
remove-double-neg82.9%
distribute-frac-neg282.9%
distribute-neg-frac282.9%
remove-double-neg82.9%
sqr-neg82.9%
associate-+l+83.0%
sqr-neg83.0%
distribute-rgt-out83.0%
Simplified83.0%
Taylor expanded in k around inf 81.2%
associate-*r/81.3%
*-commutative81.3%
add-sqr-sqrt81.3%
associate-/r*81.2%
hypot-1-def81.2%
hypot-1-def98.2%
Applied egg-rr98.2%
Taylor expanded in k around inf 98.1%
(FPCore (a k m) :precision binary64 (/ (/ (* (pow k m) a) (hypot 1.0 k)) (hypot 1.0 k)))
double code(double a, double k, double m) {
return ((pow(k, m) * a) / hypot(1.0, k)) / hypot(1.0, k);
}
public static double code(double a, double k, double m) {
return ((Math.pow(k, m) * a) / Math.hypot(1.0, k)) / Math.hypot(1.0, k);
}
def code(a, k, m): return ((math.pow(k, m) * a) / math.hypot(1.0, k)) / math.hypot(1.0, k)
function code(a, k, m) return Float64(Float64(Float64((k ^ m) * a) / hypot(1.0, k)) / hypot(1.0, k)) end
function tmp = code(a, k, m) tmp = (((k ^ m) * a) / hypot(1.0, k)) / hypot(1.0, k); end
code[a_, k_, m_] := N[(N[(N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{{k}^{m} \cdot a}{\mathsf{hypot}\left(1, k\right)}}{\mathsf{hypot}\left(1, k\right)}
\end{array}
Initial program 92.0%
associate-/l*92.0%
remove-double-neg92.0%
distribute-frac-neg292.0%
distribute-neg-frac292.0%
remove-double-neg92.0%
sqr-neg92.0%
associate-+l+92.0%
sqr-neg92.0%
distribute-rgt-out92.0%
Simplified92.0%
Taylor expanded in k around inf 91.4%
associate-*r/91.4%
*-commutative91.4%
add-sqr-sqrt91.4%
associate-/r*91.4%
hypot-1-def91.4%
hypot-1-def99.3%
Applied egg-rr99.3%
(FPCore (a k m) :precision binary64 (if (<= k 2.2e-14) (* a (* (pow k m) (fma k -10.0 1.0))) (/ (/ (* (pow k m) a) k) k)))
double code(double a, double k, double m) {
double tmp;
if (k <= 2.2e-14) {
tmp = a * (pow(k, m) * fma(k, -10.0, 1.0));
} else {
tmp = ((pow(k, m) * a) / k) / k;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (k <= 2.2e-14) tmp = Float64(a * Float64((k ^ m) * fma(k, -10.0, 1.0))); else tmp = Float64(Float64(Float64((k ^ m) * a) / k) / k); end return tmp end
code[a_, k_, m_] := If[LessEqual[k, 2.2e-14], N[(a * N[(N[Power[k, m], $MachinePrecision] * N[(k * -10.0 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision] / k), $MachinePrecision] / k), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.2 \cdot 10^{-14}:\\
\;\;\;\;a \cdot \left({k}^{m} \cdot \mathsf{fma}\left(k, -10, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{k}^{m} \cdot a}{k}}{k}\\
\end{array}
\end{array}
if k < 2.2000000000000001e-14Initial program 96.5%
associate-/l*96.5%
remove-double-neg96.5%
distribute-frac-neg296.5%
distribute-neg-frac296.5%
remove-double-neg96.5%
sqr-neg96.5%
associate-+l+96.5%
sqr-neg96.5%
distribute-rgt-out96.5%
Simplified96.5%
Taylor expanded in k around 0 86.0%
associate-*r*86.0%
*-lft-identity86.0%
distribute-rgt-out100.0%
*-commutative100.0%
fma-define100.0%
Simplified100.0%
if 2.2000000000000001e-14 < k Initial program 83.0%
associate-/l*82.9%
remove-double-neg82.9%
distribute-frac-neg282.9%
distribute-neg-frac282.9%
remove-double-neg82.9%
sqr-neg82.9%
associate-+l+83.0%
sqr-neg83.0%
distribute-rgt-out83.0%
Simplified83.0%
Taylor expanded in k around inf 81.2%
associate-*r/81.3%
*-commutative81.3%
add-sqr-sqrt81.3%
associate-/r*81.2%
hypot-1-def81.2%
hypot-1-def98.2%
Applied egg-rr98.2%
Taylor expanded in k around inf 98.1%
Taylor expanded in k around inf 98.1%
(FPCore (a k m) :precision binary64 (if (or (<= m -1.32e-9) (not (<= m 0.082))) (* (pow k m) a) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -1.32e-9) || !(m <= 0.082)) {
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 <= (-1.32d-9)) .or. (.not. (m <= 0.082d0))) 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 <= -1.32e-9) || !(m <= 0.082)) {
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 <= -1.32e-9) or not (m <= 0.082): 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 <= -1.32e-9) || !(m <= 0.082)) 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 <= -1.32e-9) || ~((m <= 0.082))) 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, -1.32e-9], N[Not[LessEqual[m, 0.082]], $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 -1.32 \cdot 10^{-9} \lor \neg \left(m \leq 0.082\right):\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -1.32e-9 or 0.0820000000000000034 < m Initial program 91.5%
associate-/l*91.5%
remove-double-neg91.5%
distribute-frac-neg291.5%
distribute-neg-frac291.5%
remove-double-neg91.5%
sqr-neg91.5%
associate-+l+91.5%
sqr-neg91.5%
distribute-rgt-out91.5%
Simplified91.5%
Taylor expanded in k around 0 100.0%
if -1.32e-9 < m < 0.0820000000000000034Initial program 93.1%
associate-/l*93.0%
remove-double-neg93.0%
distribute-frac-neg293.0%
distribute-neg-frac293.0%
remove-double-neg93.0%
sqr-neg93.0%
associate-+l+93.0%
sqr-neg93.0%
distribute-rgt-out93.0%
Simplified93.0%
Taylor expanded in m around 0 92.0%
Final simplification97.5%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* (pow k m) a))) (if (<= k 1.0) 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 <= 1.0) {
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 <= 1.0d0) 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 <= 1.0) {
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 <= 1.0: 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 <= 1.0) 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 <= 1.0) 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, 1.0], 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 1:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{k}}{k}\\
\end{array}
\end{array}
if k < 1Initial program 96.6%
associate-/l*96.6%
remove-double-neg96.6%
distribute-frac-neg296.6%
distribute-neg-frac296.6%
remove-double-neg96.6%
sqr-neg96.6%
associate-+l+96.6%
sqr-neg96.6%
distribute-rgt-out96.6%
Simplified96.6%
Taylor expanded in k around 0 99.4%
if 1 < k Initial program 82.0%
associate-/l*81.9%
remove-double-neg81.9%
distribute-frac-neg281.9%
distribute-neg-frac281.9%
remove-double-neg81.9%
sqr-neg81.9%
associate-+l+81.9%
sqr-neg81.9%
distribute-rgt-out81.9%
Simplified81.9%
Taylor expanded in k around inf 81.1%
associate-*r/81.1%
*-commutative81.1%
add-sqr-sqrt81.1%
associate-/r*81.1%
hypot-1-def81.1%
hypot-1-def99.1%
Applied egg-rr99.1%
Taylor expanded in k around inf 99.1%
Taylor expanded in k around inf 99.1%
Final simplification99.3%
(FPCore (a k m) :precision binary64 (if (<= m 1.6e+22) (/ 1.0 (/ (+ 1.0 (* k (+ k 10.0))) a)) (+ a (* a (* k (- (* k 100.0) 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.6e+22) {
tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a);
} else {
tmp = a + (a * (k * ((k * 100.0) - 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 <= 1.6d+22) then
tmp = 1.0d0 / ((1.0d0 + (k * (k + 10.0d0))) / a)
else
tmp = a + (a * (k * ((k * 100.0d0) - 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.6e+22) {
tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a);
} else {
tmp = a + (a * (k * ((k * 100.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.6e+22: tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a) else: tmp = a + (a * (k * ((k * 100.0) - 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.6e+22) tmp = Float64(1.0 / Float64(Float64(1.0 + Float64(k * Float64(k + 10.0))) / a)); else tmp = Float64(a + Float64(a * Float64(k * Float64(Float64(k * 100.0) - 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.6e+22) tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a); else tmp = a + (a * (k * ((k * 100.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.6e+22], N[(1.0 / N[(N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(N[(k * 100.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.6 \cdot 10^{+22}:\\
\;\;\;\;\frac{1}{\frac{1 + k \cdot \left(k + 10\right)}{a}}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 100 - 10\right)\right)\\
\end{array}
\end{array}
if m < 1.6e22Initial program 96.9%
associate-/l*96.8%
remove-double-neg96.8%
distribute-frac-neg296.8%
distribute-neg-frac296.8%
remove-double-neg96.8%
sqr-neg96.8%
associate-+l+96.8%
sqr-neg96.8%
distribute-rgt-out96.8%
Simplified96.8%
distribute-lft-in96.8%
associate-+l+96.8%
associate-*r/96.9%
clear-num96.8%
associate-+l+96.8%
distribute-lft-in96.8%
+-commutative96.8%
fma-define96.8%
+-commutative96.8%
*-commutative96.8%
Applied egg-rr96.8%
Taylor expanded in m around 0 57.8%
if 1.6e22 < m Initial program 81.9%
associate-/l*81.9%
remove-double-neg81.9%
distribute-frac-neg281.9%
distribute-neg-frac281.9%
remove-double-neg81.9%
sqr-neg81.9%
associate-+l+81.9%
sqr-neg81.9%
distribute-rgt-out81.9%
Simplified81.9%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 3.1%
*-commutative3.1%
Simplified3.1%
Taylor expanded in k around 0 21.6%
Taylor expanded in a around 0 27.2%
Final simplification47.9%
(FPCore (a k m) :precision binary64 (if (<= m 2.2) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* a (* k (- (* k 100.0) 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.2) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * ((k * 100.0) - 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 <= 2.2d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (a * (k * ((k * 100.0d0) - 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.2) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * ((k * 100.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.2: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (a * (k * ((k * 100.0) - 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.2) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(a * Float64(k * Float64(Float64(k * 100.0) - 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.2) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (a * (k * ((k * 100.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.2], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(N[(k * 100.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.2:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 100 - 10\right)\right)\\
\end{array}
\end{array}
if m < 2.2000000000000002Initial program 96.8%
associate-/l*96.8%
remove-double-neg96.8%
distribute-frac-neg296.8%
distribute-neg-frac296.8%
remove-double-neg96.8%
sqr-neg96.8%
associate-+l+96.8%
sqr-neg96.8%
distribute-rgt-out96.8%
Simplified96.8%
Taylor expanded in m around 0 58.5%
if 2.2000000000000002 < m Initial program 82.6%
associate-/l*82.6%
remove-double-neg82.6%
distribute-frac-neg282.6%
distribute-neg-frac282.6%
remove-double-neg82.6%
sqr-neg82.6%
associate-+l+82.6%
sqr-neg82.6%
distribute-rgt-out82.6%
Simplified82.6%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 3.2%
*-commutative3.2%
Simplified3.2%
Taylor expanded in k around 0 21.0%
Taylor expanded in a around 0 26.5%
Final simplification47.8%
(FPCore (a k m) :precision binary64 (if (or (<= k -1e+65) (not (<= k 2.2e-14))) (/ 0.1 (/ k a)) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= -1e+65) || !(k <= 2.2e-14)) {
tmp = 0.1 / (k / a);
} else {
tmp = 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 <= (-1d+65)) .or. (.not. (k <= 2.2d-14))) then
tmp = 0.1d0 / (k / a)
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= -1e+65) || !(k <= 2.2e-14)) {
tmp = 0.1 / (k / a);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -1e+65) or not (k <= 2.2e-14): tmp = 0.1 / (k / a) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= -1e+65) || !(k <= 2.2e-14)) tmp = Float64(0.1 / Float64(k / a)); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= -1e+65) || ~((k <= 2.2e-14))) tmp = 0.1 / (k / a); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -1e+65], N[Not[LessEqual[k, 2.2e-14]], $MachinePrecision]], N[(0.1 / N[(k / a), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -1 \cdot 10^{+65} \lor \neg \left(k \leq 2.2 \cdot 10^{-14}\right):\\
\;\;\;\;\frac{0.1}{\frac{k}{a}}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < -9.9999999999999999e64 or 2.2000000000000001e-14 < k Initial program 81.8%
associate-/l*81.7%
remove-double-neg81.7%
distribute-frac-neg281.7%
distribute-neg-frac281.7%
remove-double-neg81.7%
sqr-neg81.7%
associate-+l+81.7%
sqr-neg81.7%
distribute-rgt-out81.7%
Simplified81.7%
Taylor expanded in m around 0 49.9%
Taylor expanded in k around 0 24.6%
*-commutative24.6%
Simplified24.6%
Taylor expanded in k around inf 24.5%
clear-num24.8%
un-div-inv24.8%
Applied egg-rr24.8%
if -9.9999999999999999e64 < k < 2.2000000000000001e-14Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
distribute-neg-frac2100.0%
remove-double-neg100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 32.2%
Taylor expanded in k around 0 31.5%
Final simplification28.6%
(FPCore (a k m) :precision binary64 (if (<= m 2.0) (/ a (+ 1.0 (* k (+ k 10.0)))) (* a (+ 1.0 (* k (* k 99.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a * (1.0 + (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 <= 2.0d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a * (1.0d0 + (k * (k * 99.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a * (1.0 + (k * (k * 99.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.0: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a * (1.0 + (k * (k * 99.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.0) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a * Float64(1.0 + Float64(k * Float64(k * 99.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.0) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a * (1.0 + (k * (k * 99.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.0], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot \left(k \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < 2Initial program 96.8%
associate-/l*96.8%
remove-double-neg96.8%
distribute-frac-neg296.8%
distribute-neg-frac296.8%
remove-double-neg96.8%
sqr-neg96.8%
associate-+l+96.8%
sqr-neg96.8%
distribute-rgt-out96.8%
Simplified96.8%
Taylor expanded in m around 0 58.5%
if 2 < m Initial program 82.6%
associate-/l*82.6%
remove-double-neg82.6%
distribute-frac-neg282.6%
distribute-neg-frac282.6%
remove-double-neg82.6%
sqr-neg82.6%
associate-+l+82.6%
sqr-neg82.6%
distribute-rgt-out82.6%
Simplified82.6%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 26.5%
Taylor expanded in k around inf 26.5%
*-commutative26.5%
Simplified26.5%
Final simplification47.8%
(FPCore (a k m) :precision binary64 (if (<= m 2.0) (/ a (+ 1.0 (* k k))) (* a (+ 1.0 (* k (* k 99.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.0) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a * (1.0 + (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 <= 2.0d0) then
tmp = a / (1.0d0 + (k * k))
else
tmp = a * (1.0d0 + (k * (k * 99.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.0) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a * (1.0 + (k * (k * 99.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.0: tmp = a / (1.0 + (k * k)) else: tmp = a * (1.0 + (k * (k * 99.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.0) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(a * Float64(1.0 + Float64(k * Float64(k * 99.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.0) tmp = a / (1.0 + (k * k)); else tmp = a * (1.0 + (k * (k * 99.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.0], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot \left(k \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < 2Initial program 96.8%
associate-/l*96.8%
remove-double-neg96.8%
distribute-frac-neg296.8%
distribute-neg-frac296.8%
remove-double-neg96.8%
sqr-neg96.8%
associate-+l+96.8%
sqr-neg96.8%
distribute-rgt-out96.8%
Simplified96.8%
Taylor expanded in m around 0 58.5%
Taylor expanded in k around inf 57.6%
if 2 < m Initial program 82.6%
associate-/l*82.6%
remove-double-neg82.6%
distribute-frac-neg282.6%
distribute-neg-frac282.6%
remove-double-neg82.6%
sqr-neg82.6%
associate-+l+82.6%
sqr-neg82.6%
distribute-rgt-out82.6%
Simplified82.6%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 26.5%
Taylor expanded in k around inf 26.5%
*-commutative26.5%
Simplified26.5%
(FPCore (a k m) :precision binary64 (if (<= m -5.2e+33) (/ 0.1 (/ k a)) (/ a (+ 1.0 (* k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -5.2e+33) {
tmp = 0.1 / (k / a);
} else {
tmp = a / (1.0 + (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 <= (-5.2d+33)) then
tmp = 0.1d0 / (k / a)
else
tmp = a / (1.0d0 + (k * 10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -5.2e+33) {
tmp = 0.1 / (k / a);
} else {
tmp = a / (1.0 + (k * 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -5.2e+33: tmp = 0.1 / (k / a) else: tmp = a / (1.0 + (k * 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -5.2e+33) tmp = Float64(0.1 / Float64(k / a)); else tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -5.2e+33) tmp = 0.1 / (k / a); else tmp = a / (1.0 + (k * 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -5.2e+33], N[(0.1 / N[(k / a), $MachinePrecision]), $MachinePrecision], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -5.2 \cdot 10^{+33}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\end{array}
\end{array}
if m < -5.1999999999999995e33Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
distribute-neg-frac2100.0%
remove-double-neg100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 29.9%
Taylor expanded in k around 0 16.3%
*-commutative16.3%
Simplified16.3%
Taylor expanded in k around inf 24.9%
clear-num25.2%
un-div-inv25.2%
Applied egg-rr25.2%
if -5.1999999999999995e33 < m Initial program 88.1%
associate-/l*88.1%
remove-double-neg88.1%
distribute-frac-neg288.1%
distribute-neg-frac288.1%
remove-double-neg88.1%
sqr-neg88.1%
associate-+l+88.1%
sqr-neg88.1%
distribute-rgt-out88.1%
Simplified88.1%
Taylor expanded in m around 0 44.9%
Taylor expanded in k around 0 34.4%
*-commutative34.4%
Simplified34.4%
(FPCore (a k m) :precision binary64 (if (<= k 2.2e-14) (* a (+ 1.0 (* k -10.0))) (/ 0.1 (/ k a))))
double code(double a, double k, double m) {
double tmp;
if (k <= 2.2e-14) {
tmp = a * (1.0 + (k * -10.0));
} 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 <= 2.2d-14) then
tmp = a * (1.0d0 + (k * (-10.0d0)))
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 <= 2.2e-14) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = 0.1 / (k / a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 2.2e-14: tmp = a * (1.0 + (k * -10.0)) else: tmp = 0.1 / (k / a) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 2.2e-14) tmp = Float64(a * Float64(1.0 + Float64(k * -10.0))); else tmp = Float64(0.1 / Float64(k / a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 2.2e-14) tmp = a * (1.0 + (k * -10.0)); else tmp = 0.1 / (k / a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 2.2e-14], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.1 / N[(k / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.2 \cdot 10^{-14}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a}}\\
\end{array}
\end{array}
if k < 2.2000000000000001e-14Initial program 96.5%
associate-/l*96.5%
remove-double-neg96.5%
distribute-frac-neg296.5%
distribute-neg-frac296.5%
remove-double-neg96.5%
sqr-neg96.5%
associate-+l+96.5%
sqr-neg96.5%
distribute-rgt-out96.5%
Simplified96.5%
Taylor expanded in m around 0 34.2%
Taylor expanded in k around 0 29.3%
*-commutative29.3%
Simplified29.3%
if 2.2000000000000001e-14 < k Initial program 83.0%
associate-/l*82.9%
remove-double-neg82.9%
distribute-frac-neg282.9%
distribute-neg-frac282.9%
remove-double-neg82.9%
sqr-neg82.9%
associate-+l+83.0%
sqr-neg83.0%
distribute-rgt-out83.0%
Simplified83.0%
Taylor expanded in m around 0 51.6%
Taylor expanded in k around 0 24.7%
*-commutative24.7%
Simplified24.7%
Taylor expanded in k around inf 24.6%
clear-num24.9%
un-div-inv24.9%
Applied egg-rr24.9%
(FPCore (a k m) :precision binary64 (if (<= m -2.1e-5) (* 0.1 (/ a k)) a))
double code(double a, double k, double m) {
double tmp;
if (m <= -2.1e-5) {
tmp = 0.1 * (a / k);
} else {
tmp = 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 <= (-2.1d-5)) then
tmp = 0.1d0 * (a / k)
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -2.1e-5) {
tmp = 0.1 * (a / k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -2.1e-5: tmp = 0.1 * (a / k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if (m <= -2.1e-5) tmp = Float64(0.1 * Float64(a / k)); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -2.1e-5) tmp = 0.1 * (a / k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -2.1e-5], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -2.1 \cdot 10^{-5}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if m < -2.09999999999999988e-5Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
distribute-neg-frac2100.0%
remove-double-neg100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 29.3%
Taylor expanded in k around 0 16.6%
*-commutative16.6%
Simplified16.6%
Taylor expanded in k around inf 24.5%
if -2.09999999999999988e-5 < m Initial program 87.7%
associate-/l*87.6%
remove-double-neg87.6%
distribute-frac-neg287.6%
distribute-neg-frac287.6%
remove-double-neg87.6%
sqr-neg87.6%
associate-+l+87.7%
sqr-neg87.7%
distribute-rgt-out87.7%
Simplified87.7%
Taylor expanded in m around 0 45.8%
Taylor expanded in k around 0 28.2%
(FPCore (a k m) :precision binary64 (/ a (+ 1.0 (* k k))))
double code(double a, double k, double m) {
return a / (1.0 + (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 / (1.0d0 + (k * k))
end function
public static double code(double a, double k, double m) {
return a / (1.0 + (k * k));
}
def code(a, k, m): return a / (1.0 + (k * k))
function code(a, k, m) return Float64(a / Float64(1.0 + Float64(k * k))) end
function tmp = code(a, k, m) tmp = a / (1.0 + (k * k)); end
code[a_, k_, m_] := N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a}{1 + k \cdot k}
\end{array}
Initial program 92.0%
associate-/l*92.0%
remove-double-neg92.0%
distribute-frac-neg292.0%
distribute-neg-frac292.0%
remove-double-neg92.0%
sqr-neg92.0%
associate-+l+92.0%
sqr-neg92.0%
distribute-rgt-out92.0%
Simplified92.0%
Taylor expanded in m around 0 40.0%
Taylor expanded in k around inf 39.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 92.0%
associate-/l*92.0%
remove-double-neg92.0%
distribute-frac-neg292.0%
distribute-neg-frac292.0%
remove-double-neg92.0%
sqr-neg92.0%
associate-+l+92.0%
sqr-neg92.0%
distribute-rgt-out92.0%
Simplified92.0%
Taylor expanded in m around 0 40.0%
Taylor expanded in k around 0 19.6%
herbie shell --seed 2024144
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))