
(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 14 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 2e-26)
t_0
(/ 1.0 (+ (/ (/ 1.0 a) (pow k m)) (* (/ k t_0) (+ k 10.0)))))))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if (k <= 2e-26) {
tmp = t_0;
} else {
tmp = 1.0 / (((1.0 / a) / pow(k, m)) + ((k / t_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) :: t_0
real(8) :: tmp
t_0 = (k ** m) * a
if (k <= 2d-26) then
tmp = t_0
else
tmp = 1.0d0 / (((1.0d0 / a) / (k ** m)) + ((k / t_0) * (k + 10.0d0)))
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 <= 2e-26) {
tmp = t_0;
} else {
tmp = 1.0 / (((1.0 / a) / Math.pow(k, m)) + ((k / t_0) * (k + 10.0)));
}
return tmp;
}
def code(a, k, m): t_0 = math.pow(k, m) * a tmp = 0 if k <= 2e-26: tmp = t_0 else: tmp = 1.0 / (((1.0 / a) / math.pow(k, m)) + ((k / t_0) * (k + 10.0))) return tmp
function code(a, k, m) t_0 = Float64((k ^ m) * a) tmp = 0.0 if (k <= 2e-26) tmp = t_0; else tmp = Float64(1.0 / Float64(Float64(Float64(1.0 / a) / (k ^ m)) + Float64(Float64(k / t_0) * Float64(k + 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) t_0 = (k ^ m) * a; tmp = 0.0; if (k <= 2e-26) tmp = t_0; else tmp = 1.0 / (((1.0 / a) / (k ^ m)) + ((k / t_0) * (k + 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[k, 2e-26], t$95$0, N[(1.0 / N[(N[(N[(1.0 / a), $MachinePrecision] / N[Power[k, m], $MachinePrecision]), $MachinePrecision] + N[(N[(k / t$95$0), $MachinePrecision] * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;k \leq 2 \cdot 10^{-26}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\frac{1}{a}}{{k}^{m}} + \frac{k}{t\_0} \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if k < 2.0000000000000001e-26Initial program 93.8%
associate-/l*93.8%
remove-double-neg93.8%
distribute-frac-neg293.8%
distribute-neg-frac293.8%
remove-double-neg93.8%
sqr-neg93.8%
associate-+l+93.8%
sqr-neg93.8%
distribute-rgt-out93.8%
Simplified93.8%
Taylor expanded in k around 0 100.0%
if 2.0000000000000001e-26 < k Initial program 77.8%
associate-/l*77.8%
remove-double-neg77.8%
distribute-frac-neg277.8%
distribute-neg-frac277.8%
remove-double-neg77.8%
sqr-neg77.8%
associate-+l+77.8%
sqr-neg77.8%
distribute-rgt-out77.8%
Simplified77.8%
distribute-lft-in77.8%
associate-+l+77.8%
associate-*r/77.8%
clear-num77.8%
associate-+l+77.8%
distribute-lft-in77.8%
+-commutative77.8%
fma-define77.8%
+-commutative77.8%
*-commutative77.8%
Applied egg-rr77.8%
Taylor expanded in k around 0 99.4%
+-commutative99.4%
*-un-lft-identity99.4%
fma-define99.4%
un-div-inv99.4%
associate-/r*93.1%
Applied egg-rr93.1%
fma-undefine93.1%
*-lft-identity93.1%
associate-/r*93.1%
distribute-lft-in93.1%
*-commutative93.1%
associate-*l/93.1%
associate-*r/93.1%
associate-/r*93.1%
distribute-rgt-out93.1%
+-commutative93.1%
associate-/r*99.4%
Simplified99.4%
Final simplification99.8%
(FPCore (a k m) :precision binary64 (pow (/ (sqrt (* (pow k m) a)) (hypot 1.0 k)) 2.0))
double code(double a, double k, double m) {
return pow((sqrt((pow(k, m) * a)) / hypot(1.0, k)), 2.0);
}
public static double code(double a, double k, double m) {
return Math.pow((Math.sqrt((Math.pow(k, m) * a)) / Math.hypot(1.0, k)), 2.0);
}
def code(a, k, m): return math.pow((math.sqrt((math.pow(k, m) * a)) / math.hypot(1.0, k)), 2.0)
function code(a, k, m) return Float64(sqrt(Float64((k ^ m) * a)) / hypot(1.0, k)) ^ 2.0 end
function tmp = code(a, k, m) tmp = (sqrt(((k ^ m) * a)) / hypot(1.0, k)) ^ 2.0; end
code[a_, k_, m_] := N[Power[N[(N[Sqrt[N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{\sqrt{{k}^{m} \cdot a}}{\mathsf{hypot}\left(1, k\right)}\right)}^{2}
\end{array}
Initial program 87.8%
associate-/l*87.8%
remove-double-neg87.8%
distribute-frac-neg287.8%
distribute-neg-frac287.8%
remove-double-neg87.8%
sqr-neg87.8%
associate-+l+87.8%
sqr-neg87.8%
distribute-rgt-out87.8%
Simplified87.8%
Taylor expanded in k around inf 87.1%
add-sqr-sqrt64.5%
pow264.5%
associate-*r/64.5%
*-commutative64.5%
sqrt-div60.7%
hypot-1-def65.7%
Applied egg-rr65.7%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* (pow k m) a))) (if (<= m 2.9) (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))) t_0)))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if (m <= 2.9) {
tmp = t_0 / ((1.0 + (k * 10.0)) + (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 = (k ** m) * a
if (m <= 2.9d0) then
tmp = t_0 / ((1.0d0 + (k * 10.0d0)) + (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 = Math.pow(k, m) * a;
double tmp;
if (m <= 2.9) {
tmp = t_0 / ((1.0 + (k * 10.0)) + (k * k));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = math.pow(k, m) * a tmp = 0 if m <= 2.9: tmp = t_0 / ((1.0 + (k * 10.0)) + (k * k)) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64((k ^ m) * a) tmp = 0.0 if (m <= 2.9) tmp = Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = (k ^ m) * a; tmp = 0.0; if (m <= 2.9) tmp = t_0 / ((1.0 + (k * 10.0)) + (k * k)); else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[m, 2.9], N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;m \leq 2.9:\\
\;\;\;\;\frac{t\_0}{\left(1 + k \cdot 10\right) + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < 2.89999999999999991Initial program 96.9%
if 2.89999999999999991 < m Initial program 69.0%
associate-/l*69.0%
remove-double-neg69.0%
distribute-frac-neg269.0%
distribute-neg-frac269.0%
remove-double-neg69.0%
sqr-neg69.0%
associate-+l+69.0%
sqr-neg69.0%
distribute-rgt-out69.0%
Simplified69.0%
Taylor expanded in k around 0 100.0%
Final simplification97.9%
(FPCore (a k m) :precision binary64 (if (<= m 7.2) (* a (/ (pow k m) (+ 1.0 (* k (+ k 10.0))))) (* (pow k m) a)))
double code(double a, double k, double m) {
double tmp;
if (m <= 7.2) {
tmp = a * (pow(k, m) / (1.0 + (k * (k + 10.0))));
} else {
tmp = pow(k, m) * 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.2d0) then
tmp = a * ((k ** m) / (1.0d0 + (k * (k + 10.0d0))))
else
tmp = (k ** m) * a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 7.2) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * (k + 10.0))));
} else {
tmp = Math.pow(k, m) * a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 7.2: tmp = a * (math.pow(k, m) / (1.0 + (k * (k + 10.0)))) else: tmp = math.pow(k, m) * a return tmp
function code(a, k, m) tmp = 0.0 if (m <= 7.2) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64((k ^ m) * a); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 7.2) tmp = a * ((k ^ m) / (1.0 + (k * (k + 10.0)))); else tmp = (k ^ m) * a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 7.2], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 7.2:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\
\end{array}
\end{array}
if m < 7.20000000000000018Initial program 96.9%
associate-/l*96.9%
remove-double-neg96.9%
distribute-frac-neg296.9%
distribute-neg-frac296.9%
remove-double-neg96.9%
sqr-neg96.9%
associate-+l+96.9%
sqr-neg96.9%
distribute-rgt-out96.9%
Simplified96.9%
if 7.20000000000000018 < m Initial program 69.0%
associate-/l*69.0%
remove-double-neg69.0%
distribute-frac-neg269.0%
distribute-neg-frac269.0%
remove-double-neg69.0%
sqr-neg69.0%
associate-+l+69.0%
sqr-neg69.0%
distribute-rgt-out69.0%
Simplified69.0%
Taylor expanded in k around 0 100.0%
Final simplification97.9%
(FPCore (a k m)
:precision binary64
(if (<= m -1e-75)
(* a (/ (pow k m) (+ 1.0 (* k k))))
(if (<= m 0.0033)
(/ 1.0 (+ (/ 1.0 a) (* k (+ (* (/ 1.0 a) 10.0) (/ k a)))))
(* (pow k m) a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1e-75) {
tmp = a * (pow(k, m) / (1.0 + (k * k)));
} else if (m <= 0.0033) {
tmp = 1.0 / ((1.0 / a) + (k * (((1.0 / a) * 10.0) + (k / a))));
} else {
tmp = pow(k, m) * 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 <= (-1d-75)) then
tmp = a * ((k ** m) / (1.0d0 + (k * k)))
else if (m <= 0.0033d0) then
tmp = 1.0d0 / ((1.0d0 / a) + (k * (((1.0d0 / a) * 10.0d0) + (k / a))))
else
tmp = (k ** m) * a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1e-75) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * k)));
} else if (m <= 0.0033) {
tmp = 1.0 / ((1.0 / a) + (k * (((1.0 / a) * 10.0) + (k / a))));
} else {
tmp = Math.pow(k, m) * a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1e-75: tmp = a * (math.pow(k, m) / (1.0 + (k * k))) elif m <= 0.0033: tmp = 1.0 / ((1.0 / a) + (k * (((1.0 / a) * 10.0) + (k / a)))) else: tmp = math.pow(k, m) * a return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1e-75) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * k)))); elseif (m <= 0.0033) tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(k * Float64(Float64(Float64(1.0 / a) * 10.0) + Float64(k / a))))); else tmp = Float64((k ^ m) * a); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1e-75) tmp = a * ((k ^ m) / (1.0 + (k * k))); elseif (m <= 0.0033) tmp = 1.0 / ((1.0 / a) + (k * (((1.0 / a) * 10.0) + (k / a)))); else tmp = (k ^ m) * a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1e-75], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.0033], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(k * N[(N[(N[(1.0 / a), $MachinePrecision] * 10.0), $MachinePrecision] + N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1 \cdot 10^{-75}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot k}\\
\mathbf{elif}\;m \leq 0.0033:\\
\;\;\;\;\frac{1}{\frac{1}{a} + k \cdot \left(\frac{1}{a} \cdot 10 + \frac{k}{a}\right)}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\
\end{array}
\end{array}
if m < -9.9999999999999996e-76Initial 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 inf 99.6%
if -9.9999999999999996e-76 < m < 0.0033Initial program 93.5%
associate-/l*93.4%
remove-double-neg93.4%
distribute-frac-neg293.4%
distribute-neg-frac293.4%
remove-double-neg93.4%
sqr-neg93.4%
associate-+l+93.4%
sqr-neg93.4%
distribute-rgt-out93.4%
Simplified93.4%
distribute-lft-in93.4%
associate-+l+93.4%
associate-*r/93.5%
clear-num93.4%
associate-+l+93.4%
distribute-lft-in93.4%
+-commutative93.4%
fma-define93.4%
+-commutative93.4%
*-commutative93.4%
Applied egg-rr93.4%
Taylor expanded in k around 0 99.2%
Taylor expanded in m around 0 97.8%
if 0.0033 < m Initial program 69.0%
associate-/l*69.0%
remove-double-neg69.0%
distribute-frac-neg269.0%
distribute-neg-frac269.0%
remove-double-neg69.0%
sqr-neg69.0%
associate-+l+69.0%
sqr-neg69.0%
distribute-rgt-out69.0%
Simplified69.0%
Taylor expanded in k around 0 100.0%
Final simplification99.1%
(FPCore (a k m) :precision binary64 (if (or (<= m -1.05e-7) (not (<= m 0.000185))) (* (pow k m) a) (/ 1.0 (+ (/ 1.0 a) (* k (+ (* (/ 1.0 a) 10.0) (/ k a)))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -1.05e-7) || !(m <= 0.000185)) {
tmp = pow(k, m) * a;
} else {
tmp = 1.0 / ((1.0 / a) + (k * (((1.0 / 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 <= (-1.05d-7)) .or. (.not. (m <= 0.000185d0))) then
tmp = (k ** m) * a
else
tmp = 1.0d0 / ((1.0d0 / a) + (k * (((1.0d0 / 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 <= -1.05e-7) || !(m <= 0.000185)) {
tmp = Math.pow(k, m) * a;
} else {
tmp = 1.0 / ((1.0 / a) + (k * (((1.0 / a) * 10.0) + (k / a))));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -1.05e-7) or not (m <= 0.000185): tmp = math.pow(k, m) * a else: tmp = 1.0 / ((1.0 / a) + (k * (((1.0 / a) * 10.0) + (k / a)))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -1.05e-7) || !(m <= 0.000185)) tmp = Float64((k ^ m) * a); else tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(k * Float64(Float64(Float64(1.0 / a) * 10.0) + Float64(k / a))))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((m <= -1.05e-7) || ~((m <= 0.000185))) tmp = (k ^ m) * a; else tmp = 1.0 / ((1.0 / a) + (k * (((1.0 / a) * 10.0) + (k / a)))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -1.05e-7], N[Not[LessEqual[m, 0.000185]], $MachinePrecision]], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(k * N[(N[(N[(1.0 / a), $MachinePrecision] * 10.0), $MachinePrecision] + N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.05 \cdot 10^{-7} \lor \neg \left(m \leq 0.000185\right):\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{a} + k \cdot \left(\frac{1}{a} \cdot 10 + \frac{k}{a}\right)}\\
\end{array}
\end{array}
if m < -1.05e-7 or 1.85e-4 < m Initial program 83.9%
associate-/l*83.9%
remove-double-neg83.9%
distribute-frac-neg283.9%
distribute-neg-frac283.9%
remove-double-neg83.9%
sqr-neg83.9%
associate-+l+83.9%
sqr-neg83.9%
distribute-rgt-out83.9%
Simplified83.9%
Taylor expanded in k around 0 100.0%
if -1.05e-7 < m < 1.85e-4Initial program 94.5%
associate-/l*94.4%
remove-double-neg94.4%
distribute-frac-neg294.4%
distribute-neg-frac294.4%
remove-double-neg94.4%
sqr-neg94.4%
associate-+l+94.4%
sqr-neg94.4%
distribute-rgt-out94.4%
Simplified94.4%
distribute-lft-in94.4%
associate-+l+94.4%
associate-*r/94.5%
clear-num94.3%
associate-+l+94.3%
distribute-lft-in94.3%
+-commutative94.3%
fma-define94.3%
+-commutative94.3%
*-commutative94.3%
Applied egg-rr94.3%
Taylor expanded in k around 0 99.2%
Taylor expanded in m around 0 97.1%
Final simplification98.9%
(FPCore (a k m)
:precision binary64
(if (<= m -5.5e-76)
(/ a (+ 1.0 (* k k)))
(if (<= m 19000000000.0)
(/ 1.0 (+ (/ 1.0 a) (* k (+ (* (/ 1.0 a) 10.0) (/ k a)))))
(+ a (* a (* k (- (* k 99.0) 10.0)))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -5.5e-76) {
tmp = a / (1.0 + (k * k));
} else if (m <= 19000000000.0) {
tmp = 1.0 / ((1.0 / a) + (k * (((1.0 / a) * 10.0) + (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 <= (-5.5d-76)) then
tmp = a / (1.0d0 + (k * k))
else if (m <= 19000000000.0d0) then
tmp = 1.0d0 / ((1.0d0 / a) + (k * (((1.0d0 / a) * 10.0d0) + (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 <= -5.5e-76) {
tmp = a / (1.0 + (k * k));
} else if (m <= 19000000000.0) {
tmp = 1.0 / ((1.0 / a) + (k * (((1.0 / a) * 10.0) + (k / a))));
} else {
tmp = a + (a * (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -5.5e-76: tmp = a / (1.0 + (k * k)) elif m <= 19000000000.0: tmp = 1.0 / ((1.0 / a) + (k * (((1.0 / a) * 10.0) + (k / a)))) else: tmp = a + (a * (k * ((k * 99.0) - 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -5.5e-76) tmp = Float64(a / Float64(1.0 + Float64(k * k))); elseif (m <= 19000000000.0) tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(k * Float64(Float64(Float64(1.0 / a) * 10.0) + 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 <= -5.5e-76) tmp = a / (1.0 + (k * k)); elseif (m <= 19000000000.0) tmp = 1.0 / ((1.0 / a) + (k * (((1.0 / a) * 10.0) + (k / a)))); else tmp = a + (a * (k * ((k * 99.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -5.5e-76], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 19000000000.0], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(k * N[(N[(N[(1.0 / a), $MachinePrecision] * 10.0), $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 -5.5 \cdot 10^{-76}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{elif}\;m \leq 19000000000:\\
\;\;\;\;\frac{1}{\frac{1}{a} + k \cdot \left(\frac{1}{a} \cdot 10 + \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 < -5.50000000000000014e-76Initial 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 42.8%
Taylor expanded in k around inf 42.9%
if -5.50000000000000014e-76 < m < 1.9e10Initial program 93.6%
associate-/l*93.5%
remove-double-neg93.5%
distribute-frac-neg293.5%
distribute-neg-frac293.5%
remove-double-neg93.5%
sqr-neg93.5%
associate-+l+93.5%
sqr-neg93.5%
distribute-rgt-out93.5%
Simplified93.5%
distribute-lft-in93.5%
associate-+l+93.5%
associate-*r/93.6%
clear-num93.5%
associate-+l+93.5%
distribute-lft-in93.5%
+-commutative93.5%
fma-define93.5%
+-commutative93.5%
*-commutative93.5%
Applied egg-rr93.5%
Taylor expanded in k around 0 99.2%
Taylor expanded in m around 0 96.6%
if 1.9e10 < m Initial program 68.7%
associate-/l*68.7%
remove-double-neg68.7%
distribute-frac-neg268.7%
distribute-neg-frac268.7%
remove-double-neg68.7%
sqr-neg68.7%
associate-+l+68.7%
sqr-neg68.7%
distribute-rgt-out68.7%
Simplified68.7%
Taylor expanded in m around 0 2.6%
Taylor expanded in k around 0 32.9%
Taylor expanded in a around 0 40.8%
Final simplification59.4%
(FPCore (a k m) :precision binary64 (if (<= m 19000000000.0) (/ 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 <= 19000000000.0) {
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 <= 19000000000.0d0) 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 <= 19000000000.0) {
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 <= 19000000000.0: 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 <= 19000000000.0) 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 <= 19000000000.0) 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, 19000000000.0], 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 19000000000:\\
\;\;\;\;\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 < 1.9e10Initial program 97.0%
associate-/l*96.9%
remove-double-neg96.9%
distribute-frac-neg296.9%
distribute-neg-frac296.9%
remove-double-neg96.9%
sqr-neg96.9%
associate-+l+96.9%
sqr-neg96.9%
distribute-rgt-out96.9%
Simplified96.9%
Taylor expanded in m around 0 66.0%
if 1.9e10 < m Initial program 68.7%
associate-/l*68.7%
remove-double-neg68.7%
distribute-frac-neg268.7%
distribute-neg-frac268.7%
remove-double-neg68.7%
sqr-neg68.7%
associate-+l+68.7%
sqr-neg68.7%
distribute-rgt-out68.7%
Simplified68.7%
Taylor expanded in m around 0 2.6%
Taylor expanded in k around 0 32.9%
Taylor expanded in a around 0 40.8%
Final simplification57.8%
(FPCore (a k m) :precision binary64 (if (<= m 1.85) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* k (* k (* a 99.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.85) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (k * (k * (a * 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 <= 1.85d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (k * (k * (a * 99.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.85) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (k * (k * (a * 99.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.85: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (k * (k * (a * 99.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.85) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(k * Float64(k * Float64(a * 99.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.85) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (k * (k * (a * 99.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.85], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(k * N[(a * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.85:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(k \cdot \left(a \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < 1.8500000000000001Initial program 96.9%
associate-/l*96.9%
remove-double-neg96.9%
distribute-frac-neg296.9%
distribute-neg-frac296.9%
remove-double-neg96.9%
sqr-neg96.9%
associate-+l+96.9%
sqr-neg96.9%
distribute-rgt-out96.9%
Simplified96.9%
Taylor expanded in m around 0 66.4%
if 1.8500000000000001 < m Initial program 69.0%
associate-/l*69.0%
remove-double-neg69.0%
distribute-frac-neg269.0%
distribute-neg-frac269.0%
remove-double-neg69.0%
sqr-neg69.0%
associate-+l+69.0%
sqr-neg69.0%
distribute-rgt-out69.0%
Simplified69.0%
Taylor expanded in m around 0 2.6%
Taylor expanded in k around 0 32.5%
Taylor expanded in k around inf 32.5%
Taylor expanded in a around 0 32.5%
metadata-eval32.5%
distribute-lft-neg-in32.5%
associate-*r*32.5%
*-commutative32.5%
distribute-rgt-neg-in32.5%
*-commutative32.5%
distribute-rgt-neg-in32.5%
metadata-eval32.5%
Simplified32.5%
Final simplification55.3%
(FPCore (a k m) :precision binary64 (if (<= m 1.9) (/ a (+ 1.0 (* k k))) (+ a (* k (* k (* a 99.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.9) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (k * (k * (a * 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 <= 1.9d0) then
tmp = a / (1.0d0 + (k * k))
else
tmp = a + (k * (k * (a * 99.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.9) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (k * (k * (a * 99.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.9: tmp = a / (1.0 + (k * k)) else: tmp = a + (k * (k * (a * 99.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.9) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(a + Float64(k * Float64(k * Float64(a * 99.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.9) tmp = a / (1.0 + (k * k)); else tmp = a + (k * (k * (a * 99.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.9], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(k * N[(a * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.9:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(k \cdot \left(a \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < 1.8999999999999999Initial program 96.9%
associate-/l*96.9%
remove-double-neg96.9%
distribute-frac-neg296.9%
distribute-neg-frac296.9%
remove-double-neg96.9%
sqr-neg96.9%
associate-+l+96.9%
sqr-neg96.9%
distribute-rgt-out96.9%
Simplified96.9%
Taylor expanded in m around 0 66.4%
Taylor expanded in k around inf 65.6%
if 1.8999999999999999 < m Initial program 69.0%
associate-/l*69.0%
remove-double-neg69.0%
distribute-frac-neg269.0%
distribute-neg-frac269.0%
remove-double-neg69.0%
sqr-neg69.0%
associate-+l+69.0%
sqr-neg69.0%
distribute-rgt-out69.0%
Simplified69.0%
Taylor expanded in m around 0 2.6%
Taylor expanded in k around 0 32.5%
Taylor expanded in k around inf 32.5%
Taylor expanded in a around 0 32.5%
metadata-eval32.5%
distribute-lft-neg-in32.5%
associate-*r*32.5%
*-commutative32.5%
distribute-rgt-neg-in32.5%
*-commutative32.5%
distribute-rgt-neg-in32.5%
metadata-eval32.5%
Simplified32.5%
(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.8%
associate-/l*87.8%
remove-double-neg87.8%
distribute-frac-neg287.8%
distribute-neg-frac287.8%
remove-double-neg87.8%
sqr-neg87.8%
associate-+l+87.8%
sqr-neg87.8%
distribute-rgt-out87.8%
Simplified87.8%
Taylor expanded in m around 0 45.4%
Taylor expanded in k around inf 44.9%
(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.8%
associate-/l*87.8%
remove-double-neg87.8%
distribute-frac-neg287.8%
distribute-neg-frac287.8%
remove-double-neg87.8%
sqr-neg87.8%
associate-+l+87.8%
sqr-neg87.8%
distribute-rgt-out87.8%
Simplified87.8%
Taylor expanded in m around 0 45.4%
Taylor expanded in k around 0 28.5%
*-commutative28.5%
Simplified28.5%
(FPCore (a k m) :precision binary64 (+ a (* -10.0 (* k a))))
double code(double a, double k, double m) {
return a + (-10.0 * (k * 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 + ((-10.0d0) * (k * a))
end function
public static double code(double a, double k, double m) {
return a + (-10.0 * (k * a));
}
def code(a, k, m): return a + (-10.0 * (k * a))
function code(a, k, m) return Float64(a + Float64(-10.0 * Float64(k * a))) end
function tmp = code(a, k, m) tmp = a + (-10.0 * (k * a)); end
code[a_, k_, m_] := N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a + -10 \cdot \left(k \cdot a\right)
\end{array}
Initial program 87.8%
associate-/l*87.8%
remove-double-neg87.8%
distribute-frac-neg287.8%
distribute-neg-frac287.8%
remove-double-neg87.8%
sqr-neg87.8%
associate-+l+87.8%
sqr-neg87.8%
distribute-rgt-out87.8%
Simplified87.8%
Taylor expanded in m around 0 45.4%
Taylor expanded in k around 0 22.1%
Final simplification22.1%
(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.8%
associate-/l*87.8%
remove-double-neg87.8%
distribute-frac-neg287.8%
distribute-neg-frac287.8%
remove-double-neg87.8%
sqr-neg87.8%
associate-+l+87.8%
sqr-neg87.8%
distribute-rgt-out87.8%
Simplified87.8%
Taylor expanded in m around 0 45.4%
Taylor expanded in k around 0 21.9%
herbie shell --seed 2024182
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))