
(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 9 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 (* a (pow k m))) (t_1 (/ 1.0 t_0))) (if (<= k 5e-26) t_0 (/ 1.0 (+ (* k (+ (* 10.0 t_1) (/ k t_0))) t_1)))))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double t_1 = 1.0 / t_0;
double tmp;
if (k <= 5e-26) {
tmp = t_0;
} else {
tmp = 1.0 / ((k * ((10.0 * t_1) + (k / t_0))) + t_1);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = a * (k ** m)
t_1 = 1.0d0 / t_0
if (k <= 5d-26) then
tmp = t_0
else
tmp = 1.0d0 / ((k * ((10.0d0 * t_1) + (k / t_0))) + t_1)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a * Math.pow(k, m);
double t_1 = 1.0 / t_0;
double tmp;
if (k <= 5e-26) {
tmp = t_0;
} else {
tmp = 1.0 / ((k * ((10.0 * t_1) + (k / t_0))) + t_1);
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) t_1 = 1.0 / t_0 tmp = 0 if k <= 5e-26: tmp = t_0 else: tmp = 1.0 / ((k * ((10.0 * t_1) + (k / t_0))) + t_1) return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) t_1 = Float64(1.0 / t_0) tmp = 0.0 if (k <= 5e-26) tmp = t_0; else tmp = Float64(1.0 / Float64(Float64(k * Float64(Float64(10.0 * t_1) + Float64(k / t_0))) + t_1)); end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); t_1 = 1.0 / t_0; tmp = 0.0; if (k <= 5e-26) tmp = t_0; else tmp = 1.0 / ((k * ((10.0 * t_1) + (k / t_0))) + t_1); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / t$95$0), $MachinePrecision]}, If[LessEqual[k, 5e-26], t$95$0, N[(1.0 / N[(N[(k * N[(N[(10.0 * t$95$1), $MachinePrecision] + N[(k / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
t_1 := \frac{1}{t\_0}\\
\mathbf{if}\;k \leq 5 \cdot 10^{-26}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{k \cdot \left(10 \cdot t\_1 + \frac{k}{t\_0}\right) + t\_1}\\
\end{array}
\end{array}
if k < 5.00000000000000019e-26Initial program 94.3%
associate-/l*94.3%
remove-double-neg94.3%
distribute-frac-neg294.3%
distribute-neg-frac294.3%
remove-double-neg94.3%
sqr-neg94.3%
associate-+l+94.3%
sqr-neg94.3%
distribute-rgt-out94.3%
Simplified94.3%
Taylor expanded in k around 0 100.0%
if 5.00000000000000019e-26 < k Initial program 87.9%
associate-/l*87.9%
remove-double-neg87.9%
distribute-frac-neg287.9%
distribute-neg-frac287.9%
remove-double-neg87.9%
sqr-neg87.9%
associate-+l+87.9%
sqr-neg87.9%
distribute-rgt-out87.9%
Simplified87.9%
associate-*r/87.9%
clear-num87.4%
+-commutative87.4%
fma-define87.4%
+-commutative87.4%
*-commutative87.4%
Applied egg-rr87.4%
Taylor expanded in k around 0 99.4%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* a (pow k m))))
(if (<= (/ t_0 (+ (+ 1.0 (* 10.0 k)) (* k k))) 2e+175)
(* a (/ (pow k m) (+ 1.0 (* k (+ 10.0 k)))))
t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if ((t_0 / ((1.0 + (10.0 * k)) + (k * k))) <= 2e+175) {
tmp = a * (pow(k, m) / (1.0 + (k * (10.0 + 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 = a * (k ** m)
if ((t_0 / ((1.0d0 + (10.0d0 * k)) + (k * k))) <= 2d+175) then
tmp = a * ((k ** m) / (1.0d0 + (k * (10.0d0 + k))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a * Math.pow(k, m);
double tmp;
if ((t_0 / ((1.0 + (10.0 * k)) + (k * k))) <= 2e+175) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * (10.0 + k))));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if (t_0 / ((1.0 + (10.0 * k)) + (k * k))) <= 2e+175: tmp = a * (math.pow(k, m) / (1.0 + (k * (10.0 + k)))) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (Float64(t_0 / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) <= 2e+175) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * Float64(10.0 + k))))); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); tmp = 0.0; if ((t_0 / ((1.0 + (10.0 * k)) + (k * k))) <= 2e+175) tmp = a * ((k ^ m) / (1.0 + (k * (10.0 + k)))); else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+175], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * N[(10.0 + k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;\frac{t\_0}{\left(1 + 10 \cdot k\right) + k \cdot k} \leq 2 \cdot 10^{+175}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot \left(10 + k\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) < 1.9999999999999999e175Initial program 97.7%
associate-/l*97.7%
remove-double-neg97.7%
distribute-frac-neg297.7%
distribute-neg-frac297.7%
remove-double-neg97.7%
sqr-neg97.7%
associate-+l+97.7%
sqr-neg97.7%
distribute-rgt-out97.7%
Simplified97.7%
if 1.9999999999999999e175 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 66.7%
associate-/l*66.7%
remove-double-neg66.7%
distribute-frac-neg266.7%
distribute-neg-frac266.7%
remove-double-neg66.7%
sqr-neg66.7%
associate-+l+66.7%
sqr-neg66.7%
distribute-rgt-out66.7%
Simplified66.7%
Taylor expanded in k around 0 100.0%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* a (pow k m))))
(if (<= m -0.28)
t_0
(if (<= m 0.0014)
(/ 1.0 (+ (* k (+ (/ 10.0 a) (/ k a))) (/ 1.0 a)))
t_0))))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if (m <= -0.28) {
tmp = t_0;
} else if (m <= 0.0014) {
tmp = 1.0 / ((k * ((10.0 / a) + (k / a))) + (1.0 / a));
} 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 = a * (k ** m)
if (m <= (-0.28d0)) then
tmp = t_0
else if (m <= 0.0014d0) then
tmp = 1.0d0 / ((k * ((10.0d0 / a) + (k / a))) + (1.0d0 / a))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a * Math.pow(k, m);
double tmp;
if (m <= -0.28) {
tmp = t_0;
} else if (m <= 0.0014) {
tmp = 1.0 / ((k * ((10.0 / a) + (k / a))) + (1.0 / a));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if m <= -0.28: tmp = t_0 elif m <= 0.0014: tmp = 1.0 / ((k * ((10.0 / a) + (k / a))) + (1.0 / a)) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (m <= -0.28) tmp = t_0; elseif (m <= 0.0014) tmp = Float64(1.0 / Float64(Float64(k * Float64(Float64(10.0 / a) + Float64(k / a))) + Float64(1.0 / a))); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); tmp = 0.0; if (m <= -0.28) tmp = t_0; elseif (m <= 0.0014) tmp = 1.0 / ((k * ((10.0 / a) + (k / a))) + (1.0 / a)); else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -0.28], t$95$0, If[LessEqual[m, 0.0014], N[(1.0 / N[(N[(k * N[(N[(10.0 / a), $MachinePrecision] + N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;m \leq -0.28:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 0.0014:\\
\;\;\;\;\frac{1}{k \cdot \left(\frac{10}{a} + \frac{k}{a}\right) + \frac{1}{a}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < -0.28000000000000003 or 0.00139999999999999999 < m Initial program 89.7%
associate-/l*89.7%
remove-double-neg89.7%
distribute-frac-neg289.7%
distribute-neg-frac289.7%
remove-double-neg89.7%
sqr-neg89.7%
associate-+l+89.7%
sqr-neg89.7%
distribute-rgt-out89.7%
Simplified89.7%
Taylor expanded in k around 0 100.0%
if -0.28000000000000003 < m < 0.00139999999999999999Initial program 95.3%
associate-/l*95.3%
remove-double-neg95.3%
distribute-frac-neg295.3%
distribute-neg-frac295.3%
remove-double-neg95.3%
sqr-neg95.3%
associate-+l+95.3%
sqr-neg95.3%
distribute-rgt-out95.3%
Simplified95.3%
associate-*r/95.3%
clear-num94.7%
+-commutative94.7%
fma-define94.7%
+-commutative94.7%
*-commutative94.7%
Applied egg-rr94.7%
Taylor expanded in k around 0 99.3%
Taylor expanded in m around 0 97.2%
Taylor expanded in a around 0 97.2%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (+ a (* a (* k (* 99.0 k))))))
(if (<= m 2.2)
(/ a (+ 1.0 (* 10.0 k)))
(if (<= m 2.95e+194) t_0 (if (<= m 1.15e+232) (* -10.0 (* a k)) t_0)))))
double code(double a, double k, double m) {
double t_0 = a + (a * (k * (99.0 * k)));
double tmp;
if (m <= 2.2) {
tmp = a / (1.0 + (10.0 * k));
} else if (m <= 2.95e+194) {
tmp = t_0;
} else if (m <= 1.15e+232) {
tmp = -10.0 * (a * 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 = a + (a * (k * (99.0d0 * k)))
if (m <= 2.2d0) then
tmp = a / (1.0d0 + (10.0d0 * k))
else if (m <= 2.95d+194) then
tmp = t_0
else if (m <= 1.15d+232) then
tmp = (-10.0d0) * (a * k)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a + (a * (k * (99.0 * k)));
double tmp;
if (m <= 2.2) {
tmp = a / (1.0 + (10.0 * k));
} else if (m <= 2.95e+194) {
tmp = t_0;
} else if (m <= 1.15e+232) {
tmp = -10.0 * (a * k);
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a + (a * (k * (99.0 * k))) tmp = 0 if m <= 2.2: tmp = a / (1.0 + (10.0 * k)) elif m <= 2.95e+194: tmp = t_0 elif m <= 1.15e+232: tmp = -10.0 * (a * k) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a + Float64(a * Float64(k * Float64(99.0 * k)))) tmp = 0.0 if (m <= 2.2) tmp = Float64(a / Float64(1.0 + Float64(10.0 * k))); elseif (m <= 2.95e+194) tmp = t_0; elseif (m <= 1.15e+232) tmp = Float64(-10.0 * Float64(a * k)); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a + (a * (k * (99.0 * k))); tmp = 0.0; if (m <= 2.2) tmp = a / (1.0 + (10.0 * k)); elseif (m <= 2.95e+194) tmp = t_0; elseif (m <= 1.15e+232) tmp = -10.0 * (a * k); else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a + N[(a * N[(k * N[(99.0 * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, 2.2], N[(a / N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.95e+194], t$95$0, If[LessEqual[m, 1.15e+232], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a + a \cdot \left(k \cdot \left(99 \cdot k\right)\right)\\
\mathbf{if}\;m \leq 2.2:\\
\;\;\;\;\frac{a}{1 + 10 \cdot k}\\
\mathbf{elif}\;m \leq 2.95 \cdot 10^{+194}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 1.15 \cdot 10^{+232}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < 2.2000000000000002Initial program 97.2%
associate-/l*97.2%
remove-double-neg97.2%
distribute-frac-neg297.2%
distribute-neg-frac297.2%
remove-double-neg97.2%
sqr-neg97.2%
associate-+l+97.2%
sqr-neg97.2%
distribute-rgt-out97.2%
Simplified97.2%
Taylor expanded in m around 0 72.8%
Taylor expanded in k around 0 48.7%
if 2.2000000000000002 < m < 2.94999999999999986e194 or 1.15000000000000003e232 < m Initial program 79.5%
associate-/l*79.5%
remove-double-neg79.5%
distribute-frac-neg279.5%
distribute-neg-frac279.5%
remove-double-neg79.5%
sqr-neg79.5%
associate-+l+79.5%
sqr-neg79.5%
distribute-rgt-out79.5%
Simplified79.5%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 21.3%
Taylor expanded in a around 0 27.6%
Taylor expanded in k around inf 27.6%
if 2.94999999999999986e194 < m < 1.15000000000000003e232Initial 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 81.3%
Taylor expanded in m around 0 4.5%
Taylor expanded in k around inf 38.7%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (+ a (* a (* k (* 99.0 k))))))
(if (<= m 1.8)
(/ a (+ 1.0 (* k (+ 10.0 k))))
(if (<= m 6e+194) t_0 (if (<= m 1.95e+225) (* -10.0 (* a k)) t_0)))))
double code(double a, double k, double m) {
double t_0 = a + (a * (k * (99.0 * k)));
double tmp;
if (m <= 1.8) {
tmp = a / (1.0 + (k * (10.0 + k)));
} else if (m <= 6e+194) {
tmp = t_0;
} else if (m <= 1.95e+225) {
tmp = -10.0 * (a * 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 = a + (a * (k * (99.0d0 * k)))
if (m <= 1.8d0) then
tmp = a / (1.0d0 + (k * (10.0d0 + k)))
else if (m <= 6d+194) then
tmp = t_0
else if (m <= 1.95d+225) then
tmp = (-10.0d0) * (a * k)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a + (a * (k * (99.0 * k)));
double tmp;
if (m <= 1.8) {
tmp = a / (1.0 + (k * (10.0 + k)));
} else if (m <= 6e+194) {
tmp = t_0;
} else if (m <= 1.95e+225) {
tmp = -10.0 * (a * k);
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a + (a * (k * (99.0 * k))) tmp = 0 if m <= 1.8: tmp = a / (1.0 + (k * (10.0 + k))) elif m <= 6e+194: tmp = t_0 elif m <= 1.95e+225: tmp = -10.0 * (a * k) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a + Float64(a * Float64(k * Float64(99.0 * k)))) tmp = 0.0 if (m <= 1.8) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(10.0 + k)))); elseif (m <= 6e+194) tmp = t_0; elseif (m <= 1.95e+225) tmp = Float64(-10.0 * Float64(a * k)); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a + (a * (k * (99.0 * k))); tmp = 0.0; if (m <= 1.8) tmp = a / (1.0 + (k * (10.0 + k))); elseif (m <= 6e+194) tmp = t_0; elseif (m <= 1.95e+225) tmp = -10.0 * (a * k); else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a + N[(a * N[(k * N[(99.0 * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, 1.8], N[(a / N[(1.0 + N[(k * N[(10.0 + k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 6e+194], t$95$0, If[LessEqual[m, 1.95e+225], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a + a \cdot \left(k \cdot \left(99 \cdot k\right)\right)\\
\mathbf{if}\;m \leq 1.8:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(10 + k\right)}\\
\mathbf{elif}\;m \leq 6 \cdot 10^{+194}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 1.95 \cdot 10^{+225}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < 1.80000000000000004Initial program 97.2%
associate-/l*97.2%
remove-double-neg97.2%
distribute-frac-neg297.2%
distribute-neg-frac297.2%
remove-double-neg97.2%
sqr-neg97.2%
associate-+l+97.2%
sqr-neg97.2%
distribute-rgt-out97.2%
Simplified97.2%
Taylor expanded in m around 0 72.8%
if 1.80000000000000004 < m < 6.0000000000000006e194 or 1.95000000000000012e225 < m Initial program 79.5%
associate-/l*79.5%
remove-double-neg79.5%
distribute-frac-neg279.5%
distribute-neg-frac279.5%
remove-double-neg79.5%
sqr-neg79.5%
associate-+l+79.5%
sqr-neg79.5%
distribute-rgt-out79.5%
Simplified79.5%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 21.3%
Taylor expanded in a around 0 27.6%
Taylor expanded in k around inf 27.6%
if 6.0000000000000006e194 < m < 1.95000000000000012e225Initial 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 81.3%
Taylor expanded in m around 0 4.5%
Taylor expanded in k around inf 38.7%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (+ a (* a (* k (* 99.0 k))))))
(if (<= m 2.1)
(/ 1.0 (+ (* k (+ (/ 10.0 a) (/ k a))) (/ 1.0 a)))
(if (<= m 1.45e+194) t_0 (if (<= m 1.95e+225) (* -10.0 (* a k)) t_0)))))
double code(double a, double k, double m) {
double t_0 = a + (a * (k * (99.0 * k)));
double tmp;
if (m <= 2.1) {
tmp = 1.0 / ((k * ((10.0 / a) + (k / a))) + (1.0 / a));
} else if (m <= 1.45e+194) {
tmp = t_0;
} else if (m <= 1.95e+225) {
tmp = -10.0 * (a * 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 = a + (a * (k * (99.0d0 * k)))
if (m <= 2.1d0) then
tmp = 1.0d0 / ((k * ((10.0d0 / a) + (k / a))) + (1.0d0 / a))
else if (m <= 1.45d+194) then
tmp = t_0
else if (m <= 1.95d+225) then
tmp = (-10.0d0) * (a * k)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a + (a * (k * (99.0 * k)));
double tmp;
if (m <= 2.1) {
tmp = 1.0 / ((k * ((10.0 / a) + (k / a))) + (1.0 / a));
} else if (m <= 1.45e+194) {
tmp = t_0;
} else if (m <= 1.95e+225) {
tmp = -10.0 * (a * k);
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a + (a * (k * (99.0 * k))) tmp = 0 if m <= 2.1: tmp = 1.0 / ((k * ((10.0 / a) + (k / a))) + (1.0 / a)) elif m <= 1.45e+194: tmp = t_0 elif m <= 1.95e+225: tmp = -10.0 * (a * k) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a + Float64(a * Float64(k * Float64(99.0 * k)))) tmp = 0.0 if (m <= 2.1) tmp = Float64(1.0 / Float64(Float64(k * Float64(Float64(10.0 / a) + Float64(k / a))) + Float64(1.0 / a))); elseif (m <= 1.45e+194) tmp = t_0; elseif (m <= 1.95e+225) tmp = Float64(-10.0 * Float64(a * k)); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a + (a * (k * (99.0 * k))); tmp = 0.0; if (m <= 2.1) tmp = 1.0 / ((k * ((10.0 / a) + (k / a))) + (1.0 / a)); elseif (m <= 1.45e+194) tmp = t_0; elseif (m <= 1.95e+225) tmp = -10.0 * (a * k); else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a + N[(a * N[(k * N[(99.0 * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, 2.1], N[(1.0 / N[(N[(k * N[(N[(10.0 / a), $MachinePrecision] + N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.45e+194], t$95$0, If[LessEqual[m, 1.95e+225], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a + a \cdot \left(k \cdot \left(99 \cdot k\right)\right)\\
\mathbf{if}\;m \leq 2.1:\\
\;\;\;\;\frac{1}{k \cdot \left(\frac{10}{a} + \frac{k}{a}\right) + \frac{1}{a}}\\
\mathbf{elif}\;m \leq 1.45 \cdot 10^{+194}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 1.95 \cdot 10^{+225}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < 2.10000000000000009Initial program 97.2%
associate-/l*97.2%
remove-double-neg97.2%
distribute-frac-neg297.2%
distribute-neg-frac297.2%
remove-double-neg97.2%
sqr-neg97.2%
associate-+l+97.2%
sqr-neg97.2%
distribute-rgt-out97.2%
Simplified97.2%
associate-*r/97.2%
clear-num96.8%
+-commutative96.8%
fma-define96.8%
+-commutative96.8%
*-commutative96.8%
Applied egg-rr96.8%
Taylor expanded in k around 0 88.2%
Taylor expanded in m around 0 73.0%
Taylor expanded in a around 0 73.0%
if 2.10000000000000009 < m < 1.45e194 or 1.95000000000000012e225 < m Initial program 79.5%
associate-/l*79.5%
remove-double-neg79.5%
distribute-frac-neg279.5%
distribute-neg-frac279.5%
remove-double-neg79.5%
sqr-neg79.5%
associate-+l+79.5%
sqr-neg79.5%
distribute-rgt-out79.5%
Simplified79.5%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 21.3%
Taylor expanded in a around 0 27.6%
Taylor expanded in k around inf 27.6%
if 1.45e194 < m < 1.95000000000000012e225Initial 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 81.3%
Taylor expanded in m around 0 4.5%
Taylor expanded in k around inf 38.7%
(FPCore (a k m) :precision binary64 (if (<= m 3700.0) (/ a (+ 1.0 (* 10.0 k))) (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 3700.0) {
tmp = a / (1.0 + (10.0 * k));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 3700.0d0) then
tmp = a / (1.0d0 + (10.0d0 * k))
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 3700.0) {
tmp = a / (1.0 + (10.0 * k));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 3700.0: tmp = a / (1.0 + (10.0 * k)) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 3700.0) tmp = Float64(a / Float64(1.0 + Float64(10.0 * k))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 3700.0) tmp = a / (1.0 + (10.0 * k)); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 3700.0], N[(a / N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 3700:\\
\;\;\;\;\frac{a}{1 + 10 \cdot k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 3700Initial program 97.2%
associate-/l*97.2%
remove-double-neg97.2%
distribute-frac-neg297.2%
distribute-neg-frac297.2%
remove-double-neg97.2%
sqr-neg97.2%
associate-+l+97.2%
sqr-neg97.2%
distribute-rgt-out97.2%
Simplified97.2%
Taylor expanded in m around 0 72.4%
Taylor expanded in k around 0 48.5%
if 3700 < m Initial program 81.8%
associate-/l*81.8%
remove-double-neg81.8%
distribute-frac-neg281.8%
distribute-neg-frac281.8%
remove-double-neg81.8%
sqr-neg81.8%
associate-+l+81.8%
sqr-neg81.8%
distribute-rgt-out81.8%
Simplified81.8%
Taylor expanded in k around 0 79.5%
Taylor expanded in m around 0 7.8%
Taylor expanded in k around inf 23.1%
(FPCore (a k m) :precision binary64 (if (<= m 1700.0) a (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1700.0) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 1700.0d0) then
tmp = a
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1700.0) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1700.0: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1700.0) tmp = a; else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1700.0) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1700.0], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1700:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 1700Initial program 97.2%
associate-/l*97.2%
remove-double-neg97.2%
distribute-frac-neg297.2%
distribute-neg-frac297.2%
remove-double-neg97.2%
sqr-neg97.2%
associate-+l+97.2%
sqr-neg97.2%
distribute-rgt-out97.2%
Simplified97.2%
Taylor expanded in m around 0 72.4%
Taylor expanded in k around 0 33.6%
if 1700 < m Initial program 81.8%
associate-/l*81.8%
remove-double-neg81.8%
distribute-frac-neg281.8%
distribute-neg-frac281.8%
remove-double-neg81.8%
sqr-neg81.8%
associate-+l+81.8%
sqr-neg81.8%
distribute-rgt-out81.8%
Simplified81.8%
Taylor expanded in k around 0 79.5%
Taylor expanded in m around 0 7.8%
Taylor expanded in k around inf 23.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 91.9%
associate-/l*91.9%
remove-double-neg91.9%
distribute-frac-neg291.9%
distribute-neg-frac291.9%
remove-double-neg91.9%
sqr-neg91.9%
associate-+l+91.9%
sqr-neg91.9%
distribute-rgt-out91.9%
Simplified91.9%
Taylor expanded in m around 0 48.6%
Taylor expanded in k around 0 23.4%
herbie shell --seed 2024050 -o generate:simplify
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))