
(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
(let* ((t_0 (* a (pow k m))))
(if (<= (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))) 2e+223)
(* a (/ (pow k m) (fma k (+ k 10.0) 1.0)))
t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+223) {
tmp = a * (pow(k, m) / fma(k, (k + 10.0), 1.0));
} 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(k * 10.0)) + Float64(k * k))) <= 2e+223) tmp = Float64(a * Float64((k ^ m) / fma(k, Float64(k + 10.0), 1.0))); else tmp = t_0; end return 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[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+223], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(k * N[(k + 10.0), $MachinePrecision] + 1.0), $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 + k \cdot 10\right) + k \cdot k} \leq 2 \cdot 10^{+223}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{\mathsf{fma}\left(k, k + 10, 1\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))) < 2.00000000000000009e223Initial program 98.1%
associate-*r/98.1%
associate-+l+98.1%
+-commutative98.1%
distribute-rgt-out98.1%
fma-def98.1%
+-commutative98.1%
Simplified98.1%
if 2.00000000000000009e223 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 59.6%
*-commutative59.6%
associate-*r/57.9%
associate-+l+57.9%
+-commutative57.9%
distribute-rgt-out57.9%
fma-def57.9%
+-commutative57.9%
Simplified57.9%
Taylor expanded in k around 0 100.0%
Final simplification98.5%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* a (pow k m)))) (if (<= m 3.4e-28) (/ -1.0 (/ (- -1.0 (* k (+ k 10.0))) t_0)) t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if (m <= 3.4e-28) {
tmp = -1.0 / ((-1.0 - (k * (k + 10.0))) / t_0);
} 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 <= 3.4d-28) then
tmp = (-1.0d0) / (((-1.0d0) - (k * (k + 10.0d0))) / t_0)
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 <= 3.4e-28) {
tmp = -1.0 / ((-1.0 - (k * (k + 10.0))) / t_0);
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if m <= 3.4e-28: tmp = -1.0 / ((-1.0 - (k * (k + 10.0))) / t_0) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (m <= 3.4e-28) tmp = Float64(-1.0 / Float64(Float64(-1.0 - Float64(k * Float64(k + 10.0))) / t_0)); 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 <= 3.4e-28) tmp = -1.0 / ((-1.0 - (k * (k + 10.0))) / t_0); 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, 3.4e-28], N[(-1.0 / N[(N[(-1.0 - N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;m \leq 3.4 \cdot 10^{-28}:\\
\;\;\;\;\frac{-1}{\frac{-1 - k \cdot \left(k + 10\right)}{t_0}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if m < 3.4000000000000001e-28Initial program 97.7%
associate-*r/97.7%
associate-+l+97.7%
+-commutative97.7%
distribute-rgt-out97.7%
fma-def97.7%
+-commutative97.7%
Simplified97.7%
associate-*r/97.7%
fma-udef97.7%
+-commutative97.7%
distribute-lft-out97.7%
+-commutative97.7%
associate-/l*97.7%
clear-num97.2%
frac-2neg97.2%
metadata-eval97.2%
associate-/l/97.2%
+-commutative97.2%
distribute-lft-out97.2%
+-commutative97.2%
fma-udef97.2%
Applied egg-rr97.2%
distribute-neg-frac97.2%
neg-sub097.2%
metadata-eval97.2%
fma-udef97.2%
+-commutative97.2%
associate--r+97.2%
metadata-eval97.2%
metadata-eval97.2%
Simplified97.2%
if 3.4000000000000001e-28 < m Initial program 74.2%
*-commutative74.2%
associate-*r/73.0%
associate-+l+73.0%
+-commutative73.0%
distribute-rgt-out73.0%
fma-def73.0%
+-commutative73.0%
Simplified73.0%
Taylor expanded in k around 0 100.0%
Final simplification98.2%
(FPCore (a k m) :precision binary64 (if (<= m 3.4e-28) (/ a (/ (+ 1.0 (+ (* k 10.0) (* k k))) (pow k m))) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 3.4e-28) {
tmp = a / ((1.0 + ((k * 10.0) + (k * k))) / pow(k, m));
} else {
tmp = a * 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 <= 3.4d-28) then
tmp = a / ((1.0d0 + ((k * 10.0d0) + (k * k))) / (k ** m))
else
tmp = a * (k ** m)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 3.4e-28) {
tmp = a / ((1.0 + ((k * 10.0) + (k * k))) / Math.pow(k, m));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 3.4e-28: tmp = a / ((1.0 + ((k * 10.0) + (k * k))) / math.pow(k, m)) else: tmp = a * math.pow(k, m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 3.4e-28) tmp = Float64(a / Float64(Float64(1.0 + Float64(Float64(k * 10.0) + Float64(k * k))) / (k ^ m))); else tmp = Float64(a * (k ^ m)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 3.4e-28) tmp = a / ((1.0 + ((k * 10.0) + (k * k))) / (k ^ m)); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 3.4e-28], N[(a / N[(N[(1.0 + N[(N[(k * 10.0), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 3.4 \cdot 10^{-28}:\\
\;\;\;\;\frac{a}{\frac{1 + \left(k \cdot 10 + k \cdot k\right)}{{k}^{m}}}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 3.4000000000000001e-28Initial program 97.7%
associate-/l*97.7%
associate-+l+97.7%
*-commutative97.7%
Simplified97.7%
if 3.4000000000000001e-28 < m Initial program 74.2%
*-commutative74.2%
associate-*r/73.0%
associate-+l+73.0%
+-commutative73.0%
distribute-rgt-out73.0%
fma-def73.0%
+-commutative73.0%
Simplified73.0%
Taylor expanded in k around 0 100.0%
Final simplification98.5%
(FPCore (a k m) :precision binary64 (if (or (<= m -6e-15) (not (<= m 3.4e-28))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -6e-15) || !(m <= 3.4e-28)) {
tmp = a * pow(k, m);
} 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 <= (-6d-15)) .or. (.not. (m <= 3.4d-28))) then
tmp = a * (k ** m)
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 <= -6e-15) || !(m <= 3.4e-28)) {
tmp = a * Math.pow(k, m);
} else {
tmp = a / (1.0 + (k * (k + 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -6e-15) or not (m <= 3.4e-28): tmp = a * math.pow(k, m) else: tmp = a / (1.0 + (k * (k + 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -6e-15) || !(m <= 3.4e-28)) tmp = Float64(a * (k ^ m)); 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 <= -6e-15) || ~((m <= 3.4e-28))) tmp = a * (k ^ m); else tmp = a / (1.0 + (k * (k + 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -6e-15], N[Not[LessEqual[m, 3.4e-28]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $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 -6 \cdot 10^{-15} \lor \neg \left(m \leq 3.4 \cdot 10^{-28}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -6e-15 or 3.4000000000000001e-28 < m Initial program 86.8%
*-commutative86.8%
associate-*r/86.3%
associate-+l+86.3%
+-commutative86.3%
distribute-rgt-out86.3%
fma-def86.3%
+-commutative86.3%
Simplified86.3%
Taylor expanded in k around 0 100.0%
if -6e-15 < m < 3.4000000000000001e-28Initial program 95.3%
associate-*r/95.3%
associate-+l+95.3%
+-commutative95.3%
distribute-rgt-out95.3%
fma-def95.3%
+-commutative95.3%
Simplified95.3%
Taylor expanded in m around 0 95.3%
Final simplification98.5%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (/ a (* k k))))
(if (<= k 1.8e-293)
t_0
(if (<= k 1.85e-219)
a
(if (<= k 5e-163)
t_0
(if (<= k 1.35e-9) (+ a (* -10.0 (* a k))) (/ (/ a k) k)))))))
double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (k <= 1.8e-293) {
tmp = t_0;
} else if (k <= 1.85e-219) {
tmp = a;
} else if (k <= 5e-163) {
tmp = t_0;
} else if (k <= 1.35e-9) {
tmp = a + (-10.0 * (a * k));
} else {
tmp = (a / 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 = a / (k * k)
if (k <= 1.8d-293) then
tmp = t_0
else if (k <= 1.85d-219) then
tmp = a
else if (k <= 5d-163) then
tmp = t_0
else if (k <= 1.35d-9) then
tmp = a + ((-10.0d0) * (a * k))
else
tmp = (a / k) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (k <= 1.8e-293) {
tmp = t_0;
} else if (k <= 1.85e-219) {
tmp = a;
} else if (k <= 5e-163) {
tmp = t_0;
} else if (k <= 1.35e-9) {
tmp = a + (-10.0 * (a * k));
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): t_0 = a / (k * k) tmp = 0 if k <= 1.8e-293: tmp = t_0 elif k <= 1.85e-219: tmp = a elif k <= 5e-163: tmp = t_0 elif k <= 1.35e-9: tmp = a + (-10.0 * (a * k)) else: tmp = (a / k) / k return tmp
function code(a, k, m) t_0 = Float64(a / Float64(k * k)) tmp = 0.0 if (k <= 1.8e-293) tmp = t_0; elseif (k <= 1.85e-219) tmp = a; elseif (k <= 5e-163) tmp = t_0; elseif (k <= 1.35e-9) tmp = Float64(a + Float64(-10.0 * Float64(a * k))); else tmp = Float64(Float64(a / k) / k); end return tmp end
function tmp_2 = code(a, k, m) t_0 = a / (k * k); tmp = 0.0; if (k <= 1.8e-293) tmp = t_0; elseif (k <= 1.85e-219) tmp = a; elseif (k <= 5e-163) tmp = t_0; elseif (k <= 1.35e-9) tmp = a + (-10.0 * (a * k)); else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 1.8e-293], t$95$0, If[LessEqual[k, 1.85e-219], a, If[LessEqual[k, 5e-163], t$95$0, If[LessEqual[k, 1.35e-9], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{k \cdot k}\\
\mathbf{if}\;k \leq 1.8 \cdot 10^{-293}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;k \leq 1.85 \cdot 10^{-219}:\\
\;\;\;\;a\\
\mathbf{elif}\;k \leq 5 \cdot 10^{-163}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;k \leq 1.35 \cdot 10^{-9}:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 1.79999999999999993e-293 or 1.85e-219 < k < 4.99999999999999977e-163Initial program 92.0%
associate-*r/92.0%
associate-+l+92.0%
+-commutative92.0%
distribute-rgt-out92.0%
fma-def92.0%
+-commutative92.0%
Simplified92.0%
Taylor expanded in m around 0 26.3%
Taylor expanded in k around inf 36.8%
unpow236.8%
Simplified36.8%
if 1.79999999999999993e-293 < k < 1.85e-219Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 57.2%
Taylor expanded in k around 0 57.2%
if 4.99999999999999977e-163 < k < 1.3500000000000001e-9Initial program 99.9%
associate-*r/99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-rgt-out99.9%
fma-def99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in m around 0 58.0%
Taylor expanded in k around 0 58.1%
if 1.3500000000000001e-9 < k Initial program 81.3%
associate-*r/81.3%
associate-+l+81.3%
+-commutative81.3%
distribute-rgt-out81.3%
fma-def81.3%
+-commutative81.3%
Simplified81.3%
Taylor expanded in m around 0 54.4%
Taylor expanded in k around inf 52.6%
unpow252.6%
associate-/r*54.3%
Simplified54.3%
Final simplification49.2%
(FPCore (a k m)
:precision binary64
(if (or (<= k 3.8e-294)
(not (or (<= k 8.6e-219) (and (not (<= k 4.8e-163)) (<= k 1.35e-9)))))
(/ a (* k k))
a))
double code(double a, double k, double m) {
double tmp;
if ((k <= 3.8e-294) || !((k <= 8.6e-219) || (!(k <= 4.8e-163) && (k <= 1.35e-9)))) {
tmp = a / (k * 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 ((k <= 3.8d-294) .or. (.not. (k <= 8.6d-219) .or. (.not. (k <= 4.8d-163)) .and. (k <= 1.35d-9))) then
tmp = a / (k * k)
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= 3.8e-294) || !((k <= 8.6e-219) || (!(k <= 4.8e-163) && (k <= 1.35e-9)))) {
tmp = a / (k * k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 3.8e-294) or not ((k <= 8.6e-219) or (not (k <= 4.8e-163) and (k <= 1.35e-9))): tmp = a / (k * k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 3.8e-294) || !((k <= 8.6e-219) || (!(k <= 4.8e-163) && (k <= 1.35e-9)))) tmp = Float64(a / Float64(k * k)); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= 3.8e-294) || ~(((k <= 8.6e-219) || (~((k <= 4.8e-163)) && (k <= 1.35e-9))))) tmp = a / (k * k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 3.8e-294], N[Not[Or[LessEqual[k, 8.6e-219], And[N[Not[LessEqual[k, 4.8e-163]], $MachinePrecision], LessEqual[k, 1.35e-9]]]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3.8 \cdot 10^{-294} \lor \neg \left(k \leq 8.6 \cdot 10^{-219} \lor \neg \left(k \leq 4.8 \cdot 10^{-163}\right) \land k \leq 1.35 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < 3.8e-294 or 8.6000000000000005e-219 < k < 4.8000000000000001e-163 or 1.3500000000000001e-9 < k Initial program 86.1%
associate-*r/86.1%
associate-+l+86.1%
+-commutative86.1%
distribute-rgt-out86.1%
fma-def86.1%
+-commutative86.1%
Simplified86.1%
Taylor expanded in m around 0 41.8%
Taylor expanded in k around inf 45.5%
unpow245.5%
Simplified45.5%
if 3.8e-294 < k < 8.6000000000000005e-219 or 4.8000000000000001e-163 < k < 1.3500000000000001e-9Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 57.9%
Taylor expanded in k around 0 57.4%
Final simplification48.4%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (/ a (* k k))))
(if (<= k 2e-294)
t_0
(if (<= k 3.05e-218)
a
(if (<= k 1.2e-163) t_0 (if (<= k 1.35e-9) a (/ (/ a k) k)))))))
double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (k <= 2e-294) {
tmp = t_0;
} else if (k <= 3.05e-218) {
tmp = a;
} else if (k <= 1.2e-163) {
tmp = t_0;
} else if (k <= 1.35e-9) {
tmp = a;
} else {
tmp = (a / 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 = a / (k * k)
if (k <= 2d-294) then
tmp = t_0
else if (k <= 3.05d-218) then
tmp = a
else if (k <= 1.2d-163) then
tmp = t_0
else if (k <= 1.35d-9) then
tmp = a
else
tmp = (a / k) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (k <= 2e-294) {
tmp = t_0;
} else if (k <= 3.05e-218) {
tmp = a;
} else if (k <= 1.2e-163) {
tmp = t_0;
} else if (k <= 1.35e-9) {
tmp = a;
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): t_0 = a / (k * k) tmp = 0 if k <= 2e-294: tmp = t_0 elif k <= 3.05e-218: tmp = a elif k <= 1.2e-163: tmp = t_0 elif k <= 1.35e-9: tmp = a else: tmp = (a / k) / k return tmp
function code(a, k, m) t_0 = Float64(a / Float64(k * k)) tmp = 0.0 if (k <= 2e-294) tmp = t_0; elseif (k <= 3.05e-218) tmp = a; elseif (k <= 1.2e-163) tmp = t_0; elseif (k <= 1.35e-9) tmp = a; else tmp = Float64(Float64(a / k) / k); end return tmp end
function tmp_2 = code(a, k, m) t_0 = a / (k * k); tmp = 0.0; if (k <= 2e-294) tmp = t_0; elseif (k <= 3.05e-218) tmp = a; elseif (k <= 1.2e-163) tmp = t_0; elseif (k <= 1.35e-9) tmp = a; else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 2e-294], t$95$0, If[LessEqual[k, 3.05e-218], a, If[LessEqual[k, 1.2e-163], t$95$0, If[LessEqual[k, 1.35e-9], a, N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{k \cdot k}\\
\mathbf{if}\;k \leq 2 \cdot 10^{-294}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;k \leq 3.05 \cdot 10^{-218}:\\
\;\;\;\;a\\
\mathbf{elif}\;k \leq 1.2 \cdot 10^{-163}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;k \leq 1.35 \cdot 10^{-9}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 2.00000000000000003e-294 or 3.0500000000000002e-218 < k < 1.2e-163Initial program 92.0%
associate-*r/92.0%
associate-+l+92.0%
+-commutative92.0%
distribute-rgt-out92.0%
fma-def92.0%
+-commutative92.0%
Simplified92.0%
Taylor expanded in m around 0 26.3%
Taylor expanded in k around inf 36.8%
unpow236.8%
Simplified36.8%
if 2.00000000000000003e-294 < k < 3.0500000000000002e-218 or 1.2e-163 < k < 1.3500000000000001e-9Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 57.9%
Taylor expanded in k around 0 57.4%
if 1.3500000000000001e-9 < k Initial program 81.3%
associate-*r/81.3%
associate-+l+81.3%
+-commutative81.3%
distribute-rgt-out81.3%
fma-def81.3%
+-commutative81.3%
Simplified81.3%
Taylor expanded in m around 0 54.4%
Taylor expanded in k around inf 52.6%
unpow252.6%
associate-/r*54.3%
Simplified54.3%
Final simplification49.1%
(FPCore (a k m) :precision binary64 (if (<= m -1.85e+19) (/ a (* k k)) (if (<= m 3.4e-28) (/ a (+ 1.0 (* k k))) (+ a (* a (* k (* k 100.0)))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.85e+19) {
tmp = a / (k * k);
} else if (m <= 3.4e-28) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (a * (k * (k * 100.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.85d+19)) then
tmp = a / (k * k)
else if (m <= 3.4d-28) then
tmp = a / (1.0d0 + (k * k))
else
tmp = a + (a * (k * (k * 100.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1.85e+19) {
tmp = a / (k * k);
} else if (m <= 3.4e-28) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (a * (k * (k * 100.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.85e+19: tmp = a / (k * k) elif m <= 3.4e-28: tmp = a / (1.0 + (k * k)) else: tmp = a + (a * (k * (k * 100.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.85e+19) tmp = Float64(a / Float64(k * k)); elseif (m <= 3.4e-28) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(a + Float64(a * Float64(k * Float64(k * 100.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.85e+19) tmp = a / (k * k); elseif (m <= 3.4e-28) tmp = a / (1.0 + (k * k)); else tmp = a + (a * (k * (k * 100.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.85e+19], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 3.4e-28], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(k * 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.85 \cdot 10^{+19}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 3.4 \cdot 10^{-28}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 100\right)\right)\\
\end{array}
\end{array}
if m < -1.85e19Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 40.9%
Taylor expanded in k around inf 62.4%
unpow262.4%
Simplified62.4%
if -1.85e19 < m < 3.4000000000000001e-28Initial program 95.5%
associate-*r/95.5%
associate-+l+95.6%
+-commutative95.6%
distribute-rgt-out95.6%
fma-def95.6%
+-commutative95.6%
Simplified95.6%
Taylor expanded in m around 0 93.0%
Taylor expanded in k around inf 89.6%
unpow289.6%
Simplified89.6%
if 3.4000000000000001e-28 < m Initial program 74.2%
associate-*r/74.2%
associate-+l+74.2%
+-commutative74.2%
distribute-rgt-out74.2%
fma-def74.2%
+-commutative74.2%
Simplified74.2%
Taylor expanded in m around 0 4.5%
Taylor expanded in k around 0 4.6%
*-commutative4.6%
Simplified4.6%
Taylor expanded in k around 0 27.8%
+-commutative27.8%
associate-*r*27.8%
*-commutative27.8%
unpow227.8%
associate-*r*26.7%
distribute-rgt-out36.8%
associate-*l*36.8%
*-commutative36.8%
Simplified36.8%
Taylor expanded in k around inf 37.9%
unpow237.9%
associate-*r*37.9%
*-commutative37.9%
*-commutative37.9%
associate-*l*37.9%
Simplified37.9%
Final simplification63.0%
(FPCore (a k m)
:precision binary64
(if (<= m -1.85e+19)
(/ a (* k k))
(if (<= m 3.4e-28)
(/ a (+ 1.0 (* k (+ k 10.0))))
(+ a (* a (* k (* k 100.0)))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.85e+19) {
tmp = a / (k * k);
} else if (m <= 3.4e-28) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * (k * 100.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.85d+19)) then
tmp = a / (k * k)
else if (m <= 3.4d-28) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (a * (k * (k * 100.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1.85e+19) {
tmp = a / (k * k);
} else if (m <= 3.4e-28) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * (k * 100.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.85e+19: tmp = a / (k * k) elif m <= 3.4e-28: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (a * (k * (k * 100.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.85e+19) tmp = Float64(a / Float64(k * k)); elseif (m <= 3.4e-28) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(a * Float64(k * Float64(k * 100.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.85e+19) tmp = a / (k * k); elseif (m <= 3.4e-28) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (a * (k * (k * 100.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.85e+19], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 3.4e-28], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(k * 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.85 \cdot 10^{+19}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 3.4 \cdot 10^{-28}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 100\right)\right)\\
\end{array}
\end{array}
if m < -1.85e19Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 40.9%
Taylor expanded in k around inf 62.4%
unpow262.4%
Simplified62.4%
if -1.85e19 < m < 3.4000000000000001e-28Initial program 95.5%
associate-*r/95.5%
associate-+l+95.6%
+-commutative95.6%
distribute-rgt-out95.6%
fma-def95.6%
+-commutative95.6%
Simplified95.6%
Taylor expanded in m around 0 93.0%
if 3.4000000000000001e-28 < m Initial program 74.2%
associate-*r/74.2%
associate-+l+74.2%
+-commutative74.2%
distribute-rgt-out74.2%
fma-def74.2%
+-commutative74.2%
Simplified74.2%
Taylor expanded in m around 0 4.5%
Taylor expanded in k around 0 4.6%
*-commutative4.6%
Simplified4.6%
Taylor expanded in k around 0 27.8%
+-commutative27.8%
associate-*r*27.8%
*-commutative27.8%
unpow227.8%
associate-*r*26.7%
distribute-rgt-out36.8%
associate-*l*36.8%
*-commutative36.8%
Simplified36.8%
Taylor expanded in k around inf 37.9%
unpow237.9%
associate-*r*37.9%
*-commutative37.9%
*-commutative37.9%
associate-*l*37.9%
Simplified37.9%
Final simplification64.2%
(FPCore (a k m) :precision binary64 (if (<= m -1.85e+19) (/ a (* k k)) (/ a (+ 1.0 (* k k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.85e+19) {
tmp = a / (k * k);
} else {
tmp = a / (1.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) :: tmp
if (m <= (-1.85d+19)) then
tmp = a / (k * k)
else
tmp = a / (1.0d0 + (k * k))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1.85e+19) {
tmp = a / (k * k);
} else {
tmp = a / (1.0 + (k * k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.85e+19: tmp = a / (k * k) else: tmp = a / (1.0 + (k * k)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.85e+19) tmp = Float64(a / Float64(k * k)); else tmp = Float64(a / Float64(1.0 + Float64(k * k))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.85e+19) tmp = a / (k * k); else tmp = a / (1.0 + (k * k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.85e+19], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.85 \cdot 10^{+19}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\end{array}
\end{array}
if m < -1.85e19Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 40.9%
Taylor expanded in k around inf 62.4%
unpow262.4%
Simplified62.4%
if -1.85e19 < m Initial program 84.7%
associate-*r/84.7%
associate-+l+84.7%
+-commutative84.7%
distribute-rgt-out84.7%
fma-def84.7%
+-commutative84.7%
Simplified84.7%
Taylor expanded in m around 0 48.0%
Taylor expanded in k around inf 46.3%
unpow246.3%
Simplified46.3%
Final simplification51.4%
(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 89.5%
associate-*r/89.5%
associate-+l+89.5%
+-commutative89.5%
distribute-rgt-out89.5%
fma-def89.5%
+-commutative89.5%
Simplified89.5%
Taylor expanded in m around 0 45.7%
Taylor expanded in k around 0 18.6%
Final simplification18.6%
herbie shell --seed 2023224
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))