
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
(FPCore (a k m) :precision binary64 (if (<= m 9.6e-15) (* (/ a (fma k k (fma k 10.0 1.0))) (pow k m)) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 9.6e-15) {
tmp = (a / fma(k, k, fma(k, 10.0, 1.0))) * pow(k, m);
} else {
tmp = a * pow(k, m);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= 9.6e-15) tmp = Float64(Float64(a / fma(k, k, fma(k, 10.0, 1.0))) * (k ^ m)); else tmp = Float64(a * (k ^ m)); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, 9.6e-15], N[(N[(a / N[(k * k + N[(k * 10.0 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 9.6 \cdot 10^{-15}:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(k, k, \mathsf{fma}\left(k, 10, 1\right)\right)} \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 9.5999999999999998e-15Initial program 96.7%
associate-*l/96.7%
+-commutative96.7%
fma-def96.7%
+-commutative96.7%
*-commutative96.7%
fma-def96.7%
Simplified96.7%
if 9.5999999999999998e-15 < m Initial program 69.7%
Taylor expanded in k around 0 48.5%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
Final simplification98.0%
(FPCore (a k m) :precision binary64 (if (<= m 9.6e-15) (* (pow k m) (/ a (fma k (+ k 10.0) 1.0))) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 9.6e-15) {
tmp = pow(k, m) * (a / fma(k, (k + 10.0), 1.0));
} else {
tmp = a * pow(k, m);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= 9.6e-15) tmp = Float64((k ^ m) * Float64(a / fma(k, Float64(k + 10.0), 1.0))); else tmp = Float64(a * (k ^ m)); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, 9.6e-15], N[(N[Power[k, m], $MachinePrecision] * N[(a / N[(k * N[(k + 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 9.6 \cdot 10^{-15}:\\
\;\;\;\;{k}^{m} \cdot \frac{a}{\mathsf{fma}\left(k, k + 10, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 9.5999999999999998e-15Initial program 96.7%
*-commutative96.7%
associate-*r/96.7%
associate-+l+96.7%
+-commutative96.7%
distribute-rgt-out96.7%
fma-def96.7%
+-commutative96.7%
Simplified96.7%
if 9.5999999999999998e-15 < m Initial program 69.7%
Taylor expanded in k around 0 48.5%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
Final simplification98.0%
(FPCore (a k m) :precision binary64 (if (<= m 5.2e-9) (/ a (/ (+ 1.0 (+ (* k k) (* k 10.0))) (pow k m))) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 5.2e-9) {
tmp = a / ((1.0 + ((k * k) + (k * 10.0))) / 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 <= 5.2d-9) then
tmp = a / ((1.0d0 + ((k * k) + (k * 10.0d0))) / (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 <= 5.2e-9) {
tmp = a / ((1.0 + ((k * k) + (k * 10.0))) / Math.pow(k, m));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 5.2e-9: tmp = a / ((1.0 + ((k * k) + (k * 10.0))) / math.pow(k, m)) else: tmp = a * math.pow(k, m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 5.2e-9) tmp = Float64(a / Float64(Float64(1.0 + Float64(Float64(k * k) + Float64(k * 10.0))) / (k ^ m))); else tmp = Float64(a * (k ^ m)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 5.2e-9) tmp = a / ((1.0 + ((k * k) + (k * 10.0))) / (k ^ m)); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 5.2e-9], N[(a / N[(N[(1.0 + N[(N[(k * k), $MachinePrecision] + N[(k * 10.0), $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 5.2 \cdot 10^{-9}:\\
\;\;\;\;\frac{a}{\frac{1 + \left(k \cdot k + k \cdot 10\right)}{{k}^{m}}}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 5.2000000000000002e-9Initial program 96.7%
associate-/l*96.7%
associate-+l+96.7%
*-commutative96.7%
Simplified96.7%
if 5.2000000000000002e-9 < m Initial program 69.4%
Taylor expanded in k around 0 48.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
Final simplification97.9%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* a (pow k m)))) (if (<= m 9.6e-15) (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))) t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if (m <= 9.6e-15) {
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 = a * (k ** m)
if (m <= 9.6d-15) 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 = a * Math.pow(k, m);
double tmp;
if (m <= 9.6e-15) {
tmp = t_0 / ((1.0 + (k * 10.0)) + (k * k));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if m <= 9.6e-15: tmp = t_0 / ((1.0 + (k * 10.0)) + (k * k)) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (m <= 9.6e-15) 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 = a * (k ^ m); tmp = 0.0; if (m <= 9.6e-15) 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[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, 9.6e-15], 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 := a \cdot {k}^{m}\\
\mathbf{if}\;m \leq 9.6 \cdot 10^{-15}:\\
\;\;\;\;\frac{t_0}{\left(1 + k \cdot 10\right) + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if m < 9.5999999999999998e-15Initial program 96.7%
if 9.5999999999999998e-15 < m Initial program 69.7%
Taylor expanded in k around 0 48.5%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
Final simplification97.9%
(FPCore (a k m) :precision binary64 (if (<= m -4.3e-22) (* (pow k m) (/ (/ a k) k)) (if (<= m 9.6e-15) (/ a (+ 1.0 (fma k k (* k 10.0)))) (* a (pow k m)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -4.3e-22) {
tmp = pow(k, m) * ((a / k) / k);
} else if (m <= 9.6e-15) {
tmp = a / (1.0 + fma(k, k, (k * 10.0)));
} else {
tmp = a * pow(k, m);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= -4.3e-22) tmp = Float64((k ^ m) * Float64(Float64(a / k) / k)); elseif (m <= 9.6e-15) tmp = Float64(a / Float64(1.0 + fma(k, k, Float64(k * 10.0)))); else tmp = Float64(a * (k ^ m)); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, -4.3e-22], N[(N[Power[k, m], $MachinePrecision] * N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 9.6e-15], N[(a / N[(1.0 + N[(k * k + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -4.3 \cdot 10^{-22}:\\
\;\;\;\;{k}^{m} \cdot \frac{\frac{a}{k}}{k}\\
\mathbf{elif}\;m \leq 9.6 \cdot 10^{-15}:\\
\;\;\;\;\frac{a}{1 + \mathsf{fma}\left(k, k, k \cdot 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < -4.30000000000000037e-22Initial program 100.0%
*-commutative100.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 k around inf 100.0%
unpow2100.0%
Simplified100.0%
associate-/r*100.0%
div-inv100.0%
Applied egg-rr100.0%
un-div-inv100.0%
Applied egg-rr100.0%
if -4.30000000000000037e-22 < m < 9.5999999999999998e-15Initial program 94.1%
associate-*r/94.1%
associate-+l+94.1%
+-commutative94.1%
distribute-rgt-out94.1%
fma-def94.1%
+-commutative94.1%
Simplified94.1%
Taylor expanded in m around 0 94.0%
distribute-lft-in94.0%
fma-udef94.0%
Applied egg-rr94.0%
if 9.5999999999999998e-15 < m Initial program 69.7%
Taylor expanded in k around 0 48.5%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
Final simplification97.9%
(FPCore (a k m) :precision binary64 (if (<= m -4.3e-22) (* (pow k m) (/ (/ a k) k)) (if (<= m 6.8e-15) (/ a (+ 1.0 (* k (+ k 10.0)))) (* a (pow k m)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -4.3e-22) {
tmp = pow(k, m) * ((a / k) / k);
} else if (m <= 6.8e-15) {
tmp = a / (1.0 + (k * (k + 10.0)));
} 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 <= (-4.3d-22)) then
tmp = (k ** m) * ((a / k) / k)
else if (m <= 6.8d-15) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
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 <= -4.3e-22) {
tmp = Math.pow(k, m) * ((a / k) / k);
} else if (m <= 6.8e-15) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -4.3e-22: tmp = math.pow(k, m) * ((a / k) / k) elif m <= 6.8e-15: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a * math.pow(k, m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -4.3e-22) tmp = Float64((k ^ m) * Float64(Float64(a / k) / k)); elseif (m <= 6.8e-15) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a * (k ^ m)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -4.3e-22) tmp = (k ^ m) * ((a / k) / k); elseif (m <= 6.8e-15) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -4.3e-22], N[(N[Power[k, m], $MachinePrecision] * N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 6.8e-15], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -4.3 \cdot 10^{-22}:\\
\;\;\;\;{k}^{m} \cdot \frac{\frac{a}{k}}{k}\\
\mathbf{elif}\;m \leq 6.8 \cdot 10^{-15}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < -4.30000000000000037e-22Initial program 100.0%
*-commutative100.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 k around inf 100.0%
unpow2100.0%
Simplified100.0%
associate-/r*100.0%
div-inv100.0%
Applied egg-rr100.0%
un-div-inv100.0%
Applied egg-rr100.0%
if -4.30000000000000037e-22 < m < 6.8000000000000001e-15Initial program 94.1%
associate-*r/94.1%
associate-+l+94.1%
+-commutative94.1%
distribute-rgt-out94.1%
fma-def94.1%
+-commutative94.1%
Simplified94.1%
Taylor expanded in m around 0 94.0%
if 6.8000000000000001e-15 < m Initial program 69.7%
Taylor expanded in k around 0 48.5%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
Final simplification97.9%
(FPCore (a k m) :precision binary64 (if (or (<= m -65000.0) (not (<= m 9.6e-15))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -65000.0) || !(m <= 9.6e-15)) {
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 <= (-65000.0d0)) .or. (.not. (m <= 9.6d-15))) 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 <= -65000.0) || !(m <= 9.6e-15)) {
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 <= -65000.0) or not (m <= 9.6e-15): 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 <= -65000.0) || !(m <= 9.6e-15)) 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 <= -65000.0) || ~((m <= 9.6e-15))) 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, -65000.0], N[Not[LessEqual[m, 9.6e-15]], $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 -65000 \lor \neg \left(m \leq 9.6 \cdot 10^{-15}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -65000 or 9.5999999999999998e-15 < m Initial program 81.7%
Taylor expanded in k around 0 50.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -65000 < m < 9.5999999999999998e-15Initial program 94.3%
associate-*r/94.3%
associate-+l+94.3%
+-commutative94.3%
distribute-rgt-out94.3%
fma-def94.3%
+-commutative94.3%
Simplified94.3%
Taylor expanded in m around 0 94.1%
Final simplification97.9%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* -10.0 (* a k))) (t_1 (/ a (* k k))))
(if (<= k -8.2e+252)
t_0
(if (<= k 2.4e-308)
t_1
(if (<= k 1.26e-200)
a
(if (<= k 8.1e-171) t_1 (if (<= k 0.1) (+ a t_0) (/ (/ a k) k))))))))
double code(double a, double k, double m) {
double t_0 = -10.0 * (a * k);
double t_1 = a / (k * k);
double tmp;
if (k <= -8.2e+252) {
tmp = t_0;
} else if (k <= 2.4e-308) {
tmp = t_1;
} else if (k <= 1.26e-200) {
tmp = a;
} else if (k <= 8.1e-171) {
tmp = t_1;
} else if (k <= 0.1) {
tmp = a + t_0;
} 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) :: t_1
real(8) :: tmp
t_0 = (-10.0d0) * (a * k)
t_1 = a / (k * k)
if (k <= (-8.2d+252)) then
tmp = t_0
else if (k <= 2.4d-308) then
tmp = t_1
else if (k <= 1.26d-200) then
tmp = a
else if (k <= 8.1d-171) then
tmp = t_1
else if (k <= 0.1d0) then
tmp = a + t_0
else
tmp = (a / k) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = -10.0 * (a * k);
double t_1 = a / (k * k);
double tmp;
if (k <= -8.2e+252) {
tmp = t_0;
} else if (k <= 2.4e-308) {
tmp = t_1;
} else if (k <= 1.26e-200) {
tmp = a;
} else if (k <= 8.1e-171) {
tmp = t_1;
} else if (k <= 0.1) {
tmp = a + t_0;
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): t_0 = -10.0 * (a * k) t_1 = a / (k * k) tmp = 0 if k <= -8.2e+252: tmp = t_0 elif k <= 2.4e-308: tmp = t_1 elif k <= 1.26e-200: tmp = a elif k <= 8.1e-171: tmp = t_1 elif k <= 0.1: tmp = a + t_0 else: tmp = (a / k) / k return tmp
function code(a, k, m) t_0 = Float64(-10.0 * Float64(a * k)) t_1 = Float64(a / Float64(k * k)) tmp = 0.0 if (k <= -8.2e+252) tmp = t_0; elseif (k <= 2.4e-308) tmp = t_1; elseif (k <= 1.26e-200) tmp = a; elseif (k <= 8.1e-171) tmp = t_1; elseif (k <= 0.1) tmp = Float64(a + t_0); else tmp = Float64(Float64(a / k) / k); end return tmp end
function tmp_2 = code(a, k, m) t_0 = -10.0 * (a * k); t_1 = a / (k * k); tmp = 0.0; if (k <= -8.2e+252) tmp = t_0; elseif (k <= 2.4e-308) tmp = t_1; elseif (k <= 1.26e-200) tmp = a; elseif (k <= 8.1e-171) tmp = t_1; elseif (k <= 0.1) tmp = a + t_0; else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, -8.2e+252], t$95$0, If[LessEqual[k, 2.4e-308], t$95$1, If[LessEqual[k, 1.26e-200], a, If[LessEqual[k, 8.1e-171], t$95$1, If[LessEqual[k, 0.1], N[(a + t$95$0), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -10 \cdot \left(a \cdot k\right)\\
t_1 := \frac{a}{k \cdot k}\\
\mathbf{if}\;k \leq -8.2 \cdot 10^{+252}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;k \leq 2.4 \cdot 10^{-308}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;k \leq 1.26 \cdot 10^{-200}:\\
\;\;\;\;a\\
\mathbf{elif}\;k \leq 8.1 \cdot 10^{-171}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;k \leq 0.1:\\
\;\;\;\;a + t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < -8.2000000000000007e252Initial program 16.7%
associate-*r/16.7%
associate-+l+16.7%
+-commutative16.7%
distribute-rgt-out16.7%
fma-def16.7%
+-commutative16.7%
Simplified16.7%
Taylor expanded in m around 0 18.0%
Taylor expanded in k around 0 41.4%
Taylor expanded in k around inf 41.4%
if -8.2000000000000007e252 < k < 2.40000000000000008e-308 or 1.26e-200 < k < 8.1e-171Initial program 98.6%
associate-*r/98.6%
associate-+l+98.6%
+-commutative98.6%
distribute-rgt-out98.6%
fma-def98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in m around 0 17.9%
Taylor expanded in k around inf 33.4%
unpow233.4%
Simplified33.4%
if 2.40000000000000008e-308 < k < 1.26e-200Initial 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 55.9%
Taylor expanded in k around 0 55.9%
if 8.1e-171 < k < 0.10000000000000001Initial 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 58.2%
Taylor expanded in k around 0 58.2%
if 0.10000000000000001 < k Initial program 77.4%
associate-*r/77.3%
associate-+l+77.3%
+-commutative77.3%
distribute-rgt-out77.3%
fma-def77.3%
+-commutative77.3%
Simplified77.3%
Taylor expanded in m around 0 59.3%
Taylor expanded in k around inf 56.7%
unpow256.7%
Simplified56.7%
un-div-inv56.7%
associate-/l/58.4%
Applied egg-rr58.4%
Final simplification49.7%
(FPCore (a k m)
:precision binary64
(if (<= k -2.05e+254)
(* -10.0 (* a k))
(if (or (<= k -5e-310)
(not (or (<= k 5.8e-200) (and (not (<= k 1.35e-171)) (<= k 1.0)))))
(/ a (* k k))
a)))
double code(double a, double k, double m) {
double tmp;
if (k <= -2.05e+254) {
tmp = -10.0 * (a * k);
} else if ((k <= -5e-310) || !((k <= 5.8e-200) || (!(k <= 1.35e-171) && (k <= 1.0)))) {
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 <= (-2.05d+254)) then
tmp = (-10.0d0) * (a * k)
else if ((k <= (-5d-310)) .or. (.not. (k <= 5.8d-200) .or. (.not. (k <= 1.35d-171)) .and. (k <= 1.0d0))) 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 <= -2.05e+254) {
tmp = -10.0 * (a * k);
} else if ((k <= -5e-310) || !((k <= 5.8e-200) || (!(k <= 1.35e-171) && (k <= 1.0)))) {
tmp = a / (k * k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= -2.05e+254: tmp = -10.0 * (a * k) elif (k <= -5e-310) or not ((k <= 5.8e-200) or (not (k <= 1.35e-171) and (k <= 1.0))): tmp = a / (k * k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if (k <= -2.05e+254) tmp = Float64(-10.0 * Float64(a * k)); elseif ((k <= -5e-310) || !((k <= 5.8e-200) || (!(k <= 1.35e-171) && (k <= 1.0)))) 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 <= -2.05e+254) tmp = -10.0 * (a * k); elseif ((k <= -5e-310) || ~(((k <= 5.8e-200) || (~((k <= 1.35e-171)) && (k <= 1.0))))) tmp = a / (k * k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, -2.05e+254], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[k, -5e-310], N[Not[Or[LessEqual[k, 5.8e-200], And[N[Not[LessEqual[k, 1.35e-171]], $MachinePrecision], LessEqual[k, 1.0]]]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], a]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -2.05 \cdot 10^{+254}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\mathbf{elif}\;k \leq -5 \cdot 10^{-310} \lor \neg \left(k \leq 5.8 \cdot 10^{-200} \lor \neg \left(k \leq 1.35 \cdot 10^{-171}\right) \land k \leq 1\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < -2.04999999999999993e254Initial program 16.7%
associate-*r/16.7%
associate-+l+16.7%
+-commutative16.7%
distribute-rgt-out16.7%
fma-def16.7%
+-commutative16.7%
Simplified16.7%
Taylor expanded in m around 0 18.0%
Taylor expanded in k around 0 41.4%
Taylor expanded in k around inf 41.4%
if -2.04999999999999993e254 < k < -4.999999999999985e-310 or 5.8e-200 < k < 1.35000000000000007e-171 or 1 < k Initial program 87.2%
associate-*r/87.2%
associate-+l+87.2%
+-commutative87.2%
distribute-rgt-out87.2%
fma-def87.2%
+-commutative87.2%
Simplified87.2%
Taylor expanded in m around 0 40.2%
Taylor expanded in k around inf 46.0%
unpow246.0%
Simplified46.0%
if -4.999999999999985e-310 < k < 5.8e-200 or 1.35000000000000007e-171 < k < 1Initial 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%
Final simplification49.2%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (/ a (* k k))))
(if (<= k -3e+254)
(* -10.0 (* a k))
(if (<= k -5e-310)
t_0
(if (<= k 1.7e-200)
a
(if (<= k 2e-171) t_0 (if (<= k 1.0) a (/ (/ a k) k))))))))
double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (k <= -3e+254) {
tmp = -10.0 * (a * k);
} else if (k <= -5e-310) {
tmp = t_0;
} else if (k <= 1.7e-200) {
tmp = a;
} else if (k <= 2e-171) {
tmp = t_0;
} else if (k <= 1.0) {
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 <= (-3d+254)) then
tmp = (-10.0d0) * (a * k)
else if (k <= (-5d-310)) then
tmp = t_0
else if (k <= 1.7d-200) then
tmp = a
else if (k <= 2d-171) then
tmp = t_0
else if (k <= 1.0d0) 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 <= -3e+254) {
tmp = -10.0 * (a * k);
} else if (k <= -5e-310) {
tmp = t_0;
} else if (k <= 1.7e-200) {
tmp = a;
} else if (k <= 2e-171) {
tmp = t_0;
} else if (k <= 1.0) {
tmp = a;
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): t_0 = a / (k * k) tmp = 0 if k <= -3e+254: tmp = -10.0 * (a * k) elif k <= -5e-310: tmp = t_0 elif k <= 1.7e-200: tmp = a elif k <= 2e-171: tmp = t_0 elif k <= 1.0: 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 <= -3e+254) tmp = Float64(-10.0 * Float64(a * k)); elseif (k <= -5e-310) tmp = t_0; elseif (k <= 1.7e-200) tmp = a; elseif (k <= 2e-171) tmp = t_0; elseif (k <= 1.0) 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 <= -3e+254) tmp = -10.0 * (a * k); elseif (k <= -5e-310) tmp = t_0; elseif (k <= 1.7e-200) tmp = a; elseif (k <= 2e-171) tmp = t_0; elseif (k <= 1.0) 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, -3e+254], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, -5e-310], t$95$0, If[LessEqual[k, 1.7e-200], a, If[LessEqual[k, 2e-171], t$95$0, If[LessEqual[k, 1.0], 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 -3 \cdot 10^{+254}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\mathbf{elif}\;k \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;k \leq 1.7 \cdot 10^{-200}:\\
\;\;\;\;a\\
\mathbf{elif}\;k \leq 2 \cdot 10^{-171}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;k \leq 1:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < -3.00000000000000007e254Initial program 16.7%
associate-*r/16.7%
associate-+l+16.7%
+-commutative16.7%
distribute-rgt-out16.7%
fma-def16.7%
+-commutative16.7%
Simplified16.7%
Taylor expanded in m around 0 18.0%
Taylor expanded in k around 0 41.4%
Taylor expanded in k around inf 41.4%
if -3.00000000000000007e254 < k < -4.999999999999985e-310 or 1.7000000000000001e-200 < k < 2e-171Initial program 98.6%
associate-*r/98.6%
associate-+l+98.6%
+-commutative98.6%
distribute-rgt-out98.6%
fma-def98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in m around 0 17.9%
Taylor expanded in k around inf 33.4%
unpow233.4%
Simplified33.4%
if -4.999999999999985e-310 < k < 1.7000000000000001e-200 or 2e-171 < k < 1Initial 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 1 < k Initial program 77.4%
associate-*r/77.3%
associate-+l+77.3%
+-commutative77.3%
distribute-rgt-out77.3%
fma-def77.3%
+-commutative77.3%
Simplified77.3%
Taylor expanded in m around 0 59.3%
Taylor expanded in k around inf 56.7%
unpow256.7%
Simplified56.7%
un-div-inv56.7%
associate-/l/58.4%
Applied egg-rr58.4%
Final simplification49.7%
(FPCore (a k m) :precision binary64 (if (<= m -4.3e-22) (* a (/ 1.0 (* k k))) (if (<= m 38.0) (/ a (+ 1.0 (* k (+ k 10.0)))) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -4.3e-22) {
tmp = a * (1.0 / (k * k));
} else if (m <= 38.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} 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 <= (-4.3d-22)) then
tmp = a * (1.0d0 / (k * k))
else if (m <= 38.0d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
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 <= -4.3e-22) {
tmp = a * (1.0 / (k * k));
} else if (m <= 38.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -4.3e-22: tmp = a * (1.0 / (k * k)) elif m <= 38.0: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -4.3e-22) tmp = Float64(a * Float64(1.0 / Float64(k * k))); elseif (m <= 38.0) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -4.3e-22) tmp = a * (1.0 / (k * k)); elseif (m <= 38.0) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -4.3e-22], N[(a * N[(1.0 / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 38.0], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -4.3 \cdot 10^{-22}:\\
\;\;\;\;a \cdot \frac{1}{k \cdot k}\\
\mathbf{elif}\;m \leq 38:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -4.30000000000000037e-22Initial 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 36.5%
Taylor expanded in k around inf 67.8%
unpow267.8%
Simplified67.8%
if -4.30000000000000037e-22 < m < 38Initial program 94.3%
associate-*r/94.3%
associate-+l+94.3%
+-commutative94.3%
distribute-rgt-out94.3%
fma-def94.3%
+-commutative94.3%
Simplified94.3%
Taylor expanded in m around 0 92.7%
if 38 < m Initial program 68.8%
associate-*r/68.8%
associate-+l+68.8%
+-commutative68.8%
distribute-rgt-out68.8%
fma-def68.8%
+-commutative68.8%
Simplified68.8%
Taylor expanded in m around 0 2.5%
Taylor expanded in k around 0 9.8%
Taylor expanded in k around inf 17.5%
Final simplification57.9%
(FPCore (a k m) :precision binary64 (if (<= m 8.5e+19) a (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 8.5e+19) {
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 <= 8.5d+19) 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 <= 8.5e+19) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 8.5e+19: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 8.5e+19) 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 <= 8.5e+19) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 8.5e+19], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 8.5 \cdot 10^{+19}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 8.5e19Initial program 96.2%
associate-*r/96.2%
associate-+l+96.2%
+-commutative96.2%
distribute-rgt-out96.2%
fma-def96.2%
+-commutative96.2%
Simplified96.2%
Taylor expanded in m around 0 67.2%
Taylor expanded in k around 0 31.5%
if 8.5e19 < m Initial program 68.5%
associate-*r/68.5%
associate-+l+68.5%
+-commutative68.5%
distribute-rgt-out68.5%
fma-def68.5%
+-commutative68.5%
Simplified68.5%
Taylor expanded in m around 0 2.5%
Taylor expanded in k around 0 10.1%
Taylor expanded in k around inf 18.1%
Final simplification26.7%
(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 86.2%
associate-*r/86.2%
associate-+l+86.2%
+-commutative86.2%
distribute-rgt-out86.2%
fma-def86.2%
+-commutative86.2%
Simplified86.2%
Taylor expanded in m around 0 43.9%
Taylor expanded in k around 0 21.3%
Final simplification21.3%
herbie shell --seed 2023229
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))