
(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
(if (<= m -8e-17)
(/ (* (pow k m) a) (+ 1.0 (* k k)))
(if (<= m 4.3e-6)
(/ 1.0 (+ (/ 1.0 a) (* k (+ (* 10.0 (/ 1.0 a)) (/ k a)))))
(/ a (/ 1.0 (pow k m))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -8e-17) {
tmp = (pow(k, m) * a) / (1.0 + (k * k));
} else if (m <= 4.3e-6) {
tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a))));
} else {
tmp = a / (1.0 / pow(k, m));
}
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 <= (-8d-17)) then
tmp = ((k ** m) * a) / (1.0d0 + (k * k))
else if (m <= 4.3d-6) then
tmp = 1.0d0 / ((1.0d0 / a) + (k * ((10.0d0 * (1.0d0 / a)) + (k / a))))
else
tmp = a / (1.0d0 / (k ** m))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -8e-17) {
tmp = (Math.pow(k, m) * a) / (1.0 + (k * k));
} else if (m <= 4.3e-6) {
tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a))));
} else {
tmp = a / (1.0 / Math.pow(k, m));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -8e-17: tmp = (math.pow(k, m) * a) / (1.0 + (k * k)) elif m <= 4.3e-6: tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a)))) else: tmp = a / (1.0 / math.pow(k, m)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -8e-17) tmp = Float64(Float64((k ^ m) * a) / Float64(1.0 + Float64(k * k))); elseif (m <= 4.3e-6) tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(k * Float64(Float64(10.0 * Float64(1.0 / a)) + Float64(k / a))))); else tmp = Float64(a / Float64(1.0 / (k ^ m))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -8e-17) tmp = ((k ^ m) * a) / (1.0 + (k * k)); elseif (m <= 4.3e-6) tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a)))); else tmp = a / (1.0 / (k ^ m)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -8e-17], N[(N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision] / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 4.3e-6], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(k * N[(N[(10.0 * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] + N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(1.0 / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -8 \cdot 10^{-17}:\\
\;\;\;\;\frac{{k}^{m} \cdot a}{1 + k \cdot k}\\
\mathbf{elif}\;m \leq 4.3 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{\frac{1}{a} + k \cdot \left(10 \cdot \frac{1}{a} + \frac{k}{a}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{\frac{1}{{k}^{m}}}\\
\end{array}
\end{array}
if m < -8.00000000000000057e-17Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in k around 0 100.0%
if -8.00000000000000057e-17 < m < 4.30000000000000033e-6Initial program 90.6%
associate-/l*90.6%
remove-double-neg90.6%
distribute-frac-neg290.6%
distribute-neg-frac290.6%
remove-double-neg90.6%
sqr-neg90.6%
associate-+l+90.6%
sqr-neg90.6%
distribute-rgt-out90.6%
Simplified90.6%
Taylor expanded in m around 0 90.2%
clear-num88.8%
inv-pow88.8%
+-commutative88.8%
+-commutative88.8%
fma-undefine88.8%
Applied egg-rr88.8%
unpow-188.8%
Simplified88.8%
Taylor expanded in k around 0 97.4%
if 4.30000000000000033e-6 < m Initial program 67.1%
associate-/l*67.1%
remove-double-neg67.1%
distribute-frac-neg267.1%
distribute-neg-frac267.1%
remove-double-neg67.1%
sqr-neg67.1%
associate-+l+67.1%
sqr-neg67.1%
distribute-rgt-out67.1%
Simplified67.1%
clear-num67.1%
un-div-inv67.2%
+-commutative67.2%
fma-define67.2%
+-commutative67.2%
Applied egg-rr67.2%
Taylor expanded in k around 0 100.0%
Final simplification98.9%
(FPCore (a k m) :precision binary64 (if (<= m 2.65e-5) (* (/ (pow k m) (hypot 1.0 k)) (/ a (hypot 1.0 k))) (/ a (/ 1.0 (pow k m)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.65e-5) {
tmp = (pow(k, m) / hypot(1.0, k)) * (a / hypot(1.0, k));
} else {
tmp = a / (1.0 / pow(k, m));
}
return tmp;
}
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.65e-5) {
tmp = (Math.pow(k, m) / Math.hypot(1.0, k)) * (a / Math.hypot(1.0, k));
} else {
tmp = a / (1.0 / Math.pow(k, m));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.65e-5: tmp = (math.pow(k, m) / math.hypot(1.0, k)) * (a / math.hypot(1.0, k)) else: tmp = a / (1.0 / math.pow(k, m)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.65e-5) tmp = Float64(Float64((k ^ m) / hypot(1.0, k)) * Float64(a / hypot(1.0, k))); else tmp = Float64(a / Float64(1.0 / (k ^ m))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.65e-5) tmp = ((k ^ m) / hypot(1.0, k)) * (a / hypot(1.0, k)); else tmp = a / (1.0 / (k ^ m)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.65e-5], N[(N[(N[Power[k, m], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision] * N[(a / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(1.0 / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.65 \cdot 10^{-5}:\\
\;\;\;\;\frac{{k}^{m}}{\mathsf{hypot}\left(1, k\right)} \cdot \frac{a}{\mathsf{hypot}\left(1, k\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{\frac{1}{{k}^{m}}}\\
\end{array}
\end{array}
if m < 2.65e-5Initial program 94.6%
*-commutative94.6%
Simplified94.6%
Taylor expanded in k around 0 93.1%
*-commutative93.1%
add-sqr-sqrt93.1%
times-frac93.1%
hypot-1-def93.1%
hypot-1-def98.4%
Applied egg-rr98.4%
if 2.65e-5 < m Initial program 67.1%
associate-/l*67.1%
remove-double-neg67.1%
distribute-frac-neg267.1%
distribute-neg-frac267.1%
remove-double-neg67.1%
sqr-neg67.1%
associate-+l+67.1%
sqr-neg67.1%
distribute-rgt-out67.1%
Simplified67.1%
clear-num67.1%
un-div-inv67.2%
+-commutative67.2%
fma-define67.2%
+-commutative67.2%
Applied egg-rr67.2%
Taylor expanded in k around 0 100.0%
Final simplification98.8%
(FPCore (a k m)
:precision binary64
(if (<= m -0.021)
(* (pow k m) a)
(if (<= m 1.85e-5)
(/ 1.0 (+ (/ 1.0 a) (* k (+ (* 10.0 (/ 1.0 a)) (/ k a)))))
(/ a (/ 1.0 (pow k m))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.021) {
tmp = pow(k, m) * a;
} else if (m <= 1.85e-5) {
tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a))));
} else {
tmp = a / (1.0 / pow(k, m));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-0.021d0)) then
tmp = (k ** m) * a
else if (m <= 1.85d-5) then
tmp = 1.0d0 / ((1.0d0 / a) + (k * ((10.0d0 * (1.0d0 / a)) + (k / a))))
else
tmp = a / (1.0d0 / (k ** m))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.021) {
tmp = Math.pow(k, m) * a;
} else if (m <= 1.85e-5) {
tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a))));
} else {
tmp = a / (1.0 / Math.pow(k, m));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.021: tmp = math.pow(k, m) * a elif m <= 1.85e-5: tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a)))) else: tmp = a / (1.0 / math.pow(k, m)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.021) tmp = Float64((k ^ m) * a); elseif (m <= 1.85e-5) tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(k * Float64(Float64(10.0 * Float64(1.0 / a)) + Float64(k / a))))); else tmp = Float64(a / Float64(1.0 / (k ^ m))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.021) tmp = (k ^ m) * a; elseif (m <= 1.85e-5) tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a)))); else tmp = a / (1.0 / (k ^ m)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.021], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], If[LessEqual[m, 1.85e-5], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(k * N[(N[(10.0 * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] + N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(1.0 / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.021:\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{elif}\;m \leq 1.85 \cdot 10^{-5}:\\
\;\;\;\;\frac{1}{\frac{1}{a} + k \cdot \left(10 \cdot \frac{1}{a} + \frac{k}{a}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{\frac{1}{{k}^{m}}}\\
\end{array}
\end{array}
if m < -0.0210000000000000013Initial 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 k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -0.0210000000000000013 < m < 1.84999999999999991e-5Initial program 90.7%
associate-/l*90.7%
remove-double-neg90.7%
distribute-frac-neg290.7%
distribute-neg-frac290.7%
remove-double-neg90.7%
sqr-neg90.7%
associate-+l+90.7%
sqr-neg90.7%
distribute-rgt-out90.6%
Simplified90.6%
Taylor expanded in m around 0 89.6%
clear-num88.3%
inv-pow88.3%
+-commutative88.3%
+-commutative88.3%
fma-undefine88.3%
Applied egg-rr88.3%
unpow-188.3%
Simplified88.3%
Taylor expanded in k around 0 96.8%
if 1.84999999999999991e-5 < m Initial program 67.1%
associate-/l*67.1%
remove-double-neg67.1%
distribute-frac-neg267.1%
distribute-neg-frac267.1%
remove-double-neg67.1%
sqr-neg67.1%
associate-+l+67.1%
sqr-neg67.1%
distribute-rgt-out67.1%
Simplified67.1%
clear-num67.1%
un-div-inv67.2%
+-commutative67.2%
fma-define67.2%
+-commutative67.2%
Applied egg-rr67.2%
Taylor expanded in k around 0 100.0%
Final simplification98.6%
(FPCore (a k m) :precision binary64 (if (or (<= m -9.5e-5) (not (<= m 6e-7))) (* (pow k m) a) (/ 1.0 (+ (/ 1.0 a) (* k (+ (* 10.0 (/ 1.0 a)) (/ k a)))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -9.5e-5) || !(m <= 6e-7)) {
tmp = pow(k, m) * a;
} else {
tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (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 <= (-9.5d-5)) .or. (.not. (m <= 6d-7))) then
tmp = (k ** m) * a
else
tmp = 1.0d0 / ((1.0d0 / a) + (k * ((10.0d0 * (1.0d0 / a)) + (k / a))))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((m <= -9.5e-5) || !(m <= 6e-7)) {
tmp = Math.pow(k, m) * a;
} else {
tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a))));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -9.5e-5) or not (m <= 6e-7): tmp = math.pow(k, m) * a else: tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a)))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -9.5e-5) || !(m <= 6e-7)) tmp = Float64((k ^ m) * a); else tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(k * Float64(Float64(10.0 * Float64(1.0 / a)) + Float64(k / a))))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((m <= -9.5e-5) || ~((m <= 6e-7))) tmp = (k ^ m) * a; else tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a)))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -9.5e-5], N[Not[LessEqual[m, 6e-7]], $MachinePrecision]], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(k * N[(N[(10.0 * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] + N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -9.5 \cdot 10^{-5} \lor \neg \left(m \leq 6 \cdot 10^{-7}\right):\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{a} + k \cdot \left(10 \cdot \frac{1}{a} + \frac{k}{a}\right)}\\
\end{array}
\end{array}
if m < -9.5000000000000005e-5 or 5.9999999999999997e-7 < m Initial program 85.0%
associate-/l*85.0%
remove-double-neg85.0%
distribute-frac-neg285.0%
distribute-neg-frac285.0%
remove-double-neg85.0%
sqr-neg85.0%
associate-+l+85.0%
sqr-neg85.0%
distribute-rgt-out85.0%
Simplified85.0%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -9.5000000000000005e-5 < m < 5.9999999999999997e-7Initial program 90.7%
associate-/l*90.7%
remove-double-neg90.7%
distribute-frac-neg290.7%
distribute-neg-frac290.7%
remove-double-neg90.7%
sqr-neg90.7%
associate-+l+90.7%
sqr-neg90.7%
distribute-rgt-out90.6%
Simplified90.6%
Taylor expanded in m around 0 89.6%
clear-num88.3%
inv-pow88.3%
+-commutative88.3%
+-commutative88.3%
fma-undefine88.3%
Applied egg-rr88.3%
unpow-188.3%
Simplified88.3%
Taylor expanded in k around 0 96.8%
Final simplification98.6%
(FPCore (a k m)
:precision binary64
(if (<= m -1.8e+49)
(/ a (+ 1.0 (* k (+ k 10.0))))
(if (<= m 2.65e-5)
(/ 1.0 (+ (/ 1.0 a) (* k (+ (* 10.0 (/ 1.0 a)) (/ k a)))))
(+ a (* a (* k (- (* k 99.0) 10.0)))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.8e+49) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else if (m <= 2.65e-5) {
tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a))));
} else {
tmp = a + (a * (k * ((k * 99.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.8d+49)) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else if (m <= 2.65d-5) then
tmp = 1.0d0 / ((1.0d0 / a) + (k * ((10.0d0 * (1.0d0 / a)) + (k / a))))
else
tmp = a + (a * (k * ((k * 99.0d0) - 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1.8e+49) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else if (m <= 2.65e-5) {
tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a))));
} else {
tmp = a + (a * (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.8e+49: tmp = a / (1.0 + (k * (k + 10.0))) elif m <= 2.65e-5: tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a)))) else: tmp = a + (a * (k * ((k * 99.0) - 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.8e+49) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); elseif (m <= 2.65e-5) tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(k * Float64(Float64(10.0 * Float64(1.0 / a)) + Float64(k / a))))); else tmp = Float64(a + Float64(a * Float64(k * Float64(Float64(k * 99.0) - 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.8e+49) tmp = a / (1.0 + (k * (k + 10.0))); elseif (m <= 2.65e-5) tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a)))); else tmp = a + (a * (k * ((k * 99.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.8e+49], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.65e-5], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(k * N[(N[(10.0 * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] + N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.8 \cdot 10^{+49}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{elif}\;m \leq 2.65 \cdot 10^{-5}:\\
\;\;\;\;\frac{1}{\frac{1}{a} + k \cdot \left(10 \cdot \frac{1}{a} + \frac{k}{a}\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 99 - 10\right)\right)\\
\end{array}
\end{array}
if m < -1.79999999999999998e49Initial 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 46.1%
if -1.79999999999999998e49 < m < 2.65e-5Initial program 91.1%
associate-/l*91.1%
remove-double-neg91.1%
distribute-frac-neg291.1%
distribute-neg-frac291.1%
remove-double-neg91.1%
sqr-neg91.1%
associate-+l+91.1%
sqr-neg91.1%
distribute-rgt-out91.0%
Simplified91.0%
Taylor expanded in m around 0 88.4%
clear-num87.1%
inv-pow87.1%
+-commutative87.1%
+-commutative87.1%
fma-undefine87.1%
Applied egg-rr87.1%
unpow-187.1%
Simplified87.1%
Taylor expanded in k around 0 95.2%
if 2.65e-5 < m Initial program 67.1%
associate-/l*67.1%
remove-double-neg67.1%
distribute-frac-neg267.1%
distribute-neg-frac267.1%
remove-double-neg67.1%
sqr-neg67.1%
associate-+l+67.1%
sqr-neg67.1%
distribute-rgt-out67.1%
Simplified67.1%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 27.4%
cancel-sign-sub-inv27.4%
associate-*r*27.4%
mul-1-neg27.4%
distribute-rgt1-in27.4%
metadata-eval27.4%
metadata-eval27.4%
*-commutative27.4%
Simplified27.4%
Taylor expanded in a around 0 37.2%
Final simplification65.7%
(FPCore (a k m) :precision binary64 (if (<= m 2.65e-5) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* a (* k (- (* k 99.0) 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.65e-5) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * ((k * 99.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.65d-5) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (a * (k * ((k * 99.0d0) - 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.65e-5) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.65e-5: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (a * (k * ((k * 99.0) - 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.65e-5) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(a * Float64(k * Float64(Float64(k * 99.0) - 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.65e-5) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (a * (k * ((k * 99.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.65e-5], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.65 \cdot 10^{-5}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 99 - 10\right)\right)\\
\end{array}
\end{array}
if m < 2.65e-5Initial program 94.6%
associate-/l*94.6%
remove-double-neg94.6%
distribute-frac-neg294.6%
distribute-neg-frac294.6%
remove-double-neg94.6%
sqr-neg94.6%
associate-+l+94.6%
sqr-neg94.6%
distribute-rgt-out94.6%
Simplified94.6%
Taylor expanded in m around 0 71.6%
if 2.65e-5 < m Initial program 67.1%
associate-/l*67.1%
remove-double-neg67.1%
distribute-frac-neg267.1%
distribute-neg-frac267.1%
remove-double-neg67.1%
sqr-neg67.1%
associate-+l+67.1%
sqr-neg67.1%
distribute-rgt-out67.1%
Simplified67.1%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 27.4%
cancel-sign-sub-inv27.4%
associate-*r*27.4%
mul-1-neg27.4%
distribute-rgt1-in27.4%
metadata-eval27.4%
metadata-eval27.4%
*-commutative27.4%
Simplified27.4%
Taylor expanded in a around 0 37.2%
Final simplification62.6%
(FPCore (a k m) :precision binary64 (if (<= m 2.65e-5) (/ a (+ (* k k) (+ 1.0 (* k 10.0)))) (+ a (* a (* k (- (* k 99.0) 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.65e-5) {
tmp = a / ((k * k) + (1.0 + (k * 10.0)));
} else {
tmp = a + (a * (k * ((k * 99.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.65d-5) then
tmp = a / ((k * k) + (1.0d0 + (k * 10.0d0)))
else
tmp = a + (a * (k * ((k * 99.0d0) - 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.65e-5) {
tmp = a / ((k * k) + (1.0 + (k * 10.0)));
} else {
tmp = a + (a * (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.65e-5: tmp = a / ((k * k) + (1.0 + (k * 10.0))) else: tmp = a + (a * (k * ((k * 99.0) - 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.65e-5) tmp = Float64(a / Float64(Float64(k * k) + Float64(1.0 + Float64(k * 10.0)))); else tmp = Float64(a + Float64(a * Float64(k * Float64(Float64(k * 99.0) - 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.65e-5) tmp = a / ((k * k) + (1.0 + (k * 10.0))); else tmp = a + (a * (k * ((k * 99.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.65e-5], N[(a / N[(N[(k * k), $MachinePrecision] + N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.65 \cdot 10^{-5}:\\
\;\;\;\;\frac{a}{k \cdot k + \left(1 + k \cdot 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 99 - 10\right)\right)\\
\end{array}
\end{array}
if m < 2.65e-5Initial program 94.6%
*-commutative94.6%
Simplified94.6%
Taylor expanded in m around 0 71.6%
if 2.65e-5 < m Initial program 67.1%
associate-/l*67.1%
remove-double-neg67.1%
distribute-frac-neg267.1%
distribute-neg-frac267.1%
remove-double-neg67.1%
sqr-neg67.1%
associate-+l+67.1%
sqr-neg67.1%
distribute-rgt-out67.1%
Simplified67.1%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 27.4%
cancel-sign-sub-inv27.4%
associate-*r*27.4%
mul-1-neg27.4%
distribute-rgt1-in27.4%
metadata-eval27.4%
metadata-eval27.4%
*-commutative27.4%
Simplified27.4%
Taylor expanded in a around 0 37.2%
Final simplification62.6%
(FPCore (a k m) :precision binary64 (/ a (+ 1.0 (* k (+ k 10.0)))))
double code(double a, double k, double m) {
return a / (1.0 + (k * (k + 10.0)));
}
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 + 10.0d0)))
end function
public static double code(double a, double k, double m) {
return a / (1.0 + (k * (k + 10.0)));
}
def code(a, k, m): return a / (1.0 + (k * (k + 10.0)))
function code(a, k, m) return Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))) end
function tmp = code(a, k, m) tmp = a / (1.0 + (k * (k + 10.0))); end
code[a_, k_, m_] := N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a}{1 + k \cdot \left(k + 10\right)}
\end{array}
Initial program 87.4%
associate-/l*87.4%
remove-double-neg87.4%
distribute-frac-neg287.4%
distribute-neg-frac287.4%
remove-double-neg87.4%
sqr-neg87.4%
associate-+l+87.4%
sqr-neg87.4%
distribute-rgt-out87.4%
Simplified87.4%
Taylor expanded in m around 0 53.7%
Final simplification53.7%
(FPCore (a k m) :precision binary64 (/ a (+ 1.0 (* k 10.0))))
double code(double a, double k, double m) {
return a / (1.0 + (k * 10.0));
}
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 * 10.0d0))
end function
public static double code(double a, double k, double m) {
return a / (1.0 + (k * 10.0));
}
def code(a, k, m): return a / (1.0 + (k * 10.0))
function code(a, k, m) return Float64(a / Float64(1.0 + Float64(k * 10.0))) end
function tmp = code(a, k, m) tmp = a / (1.0 + (k * 10.0)); end
code[a_, k_, m_] := N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a}{1 + k \cdot 10}
\end{array}
Initial program 87.4%
associate-/l*87.4%
remove-double-neg87.4%
distribute-frac-neg287.4%
distribute-neg-frac287.4%
remove-double-neg87.4%
sqr-neg87.4%
associate-+l+87.4%
sqr-neg87.4%
distribute-rgt-out87.4%
Simplified87.4%
Taylor expanded in m around 0 53.7%
Taylor expanded in k around 0 32.3%
*-commutative32.3%
Simplified32.3%
Final simplification32.3%
(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 87.4%
*-commutative87.4%
Simplified87.4%
Taylor expanded in k around 0 86.3%
Taylor expanded in m around 0 52.6%
Final simplification52.6%
(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 87.4%
associate-/l*87.4%
remove-double-neg87.4%
distribute-frac-neg287.4%
distribute-neg-frac287.4%
remove-double-neg87.4%
sqr-neg87.4%
associate-+l+87.4%
sqr-neg87.4%
distribute-rgt-out87.4%
Simplified87.4%
Taylor expanded in k around 0 77.1%
*-commutative77.1%
Simplified77.1%
Taylor expanded in m around 0 21.9%
Final simplification21.9%
herbie shell --seed 2024076
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))