(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
(FPCore (a k m)
:precision binary64
(let* ((t_0 (/ (* a (pow k m)) (+ (+ 1.0 (* k 10.0)) (* k k)))))
(if (<= t_0 -9.662942266681646e-284)
t_0
(if (<= t_0 0.0) (/ (* a (/ (pow k m) k)) k) t_0))))double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
double code(double a, double k, double m) {
double t_0 = (a * pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_0 <= -9.662942266681646e-284) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = (a * (pow(k, m) / 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
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
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)) / ((1.0d0 + (k * 10.0d0)) + (k * k))
if (t_0 <= (-9.662942266681646d-284)) then
tmp = t_0
else if (t_0 <= 0.0d0) then
tmp = (a * ((k ** m) / k)) / k
else
tmp = t_0
end if
code = tmp
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));
}
public static double code(double a, double k, double m) {
double t_0 = (a * Math.pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_0 <= -9.662942266681646e-284) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = (a * (Math.pow(k, m) / k)) / k;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
def code(a, k, m): t_0 = (a * math.pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k)) tmp = 0 if t_0 <= -9.662942266681646e-284: tmp = t_0 elif t_0 <= 0.0: tmp = (a * (math.pow(k, m) / k)) / k else: tmp = t_0 return tmp
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function code(a, k, m) t_0 = Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) tmp = 0.0 if (t_0 <= -9.662942266681646e-284) tmp = t_0; elseif (t_0 <= 0.0) tmp = Float64(Float64(a * Float64((k ^ m) / k)) / k); else tmp = t_0; end return tmp end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
function tmp_2 = code(a, k, m) t_0 = (a * (k ^ m)) / ((1.0 + (k * 10.0)) + (k * k)); tmp = 0.0; if (t_0 <= -9.662942266681646e-284) tmp = t_0; elseif (t_0 <= 0.0) tmp = (a * ((k ^ m) / k)) / k; else tmp = t_0; end tmp_2 = tmp; 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]
code[a_, k_, m_] := Block[{t$95$0 = N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -9.662942266681646e-284], t$95$0, If[LessEqual[t$95$0, 0.0], N[(N[(a * N[(N[Power[k, m], $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision], t$95$0]]]
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\begin{array}{l}
t_0 := \frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k}\\
\mathbf{if}\;t_0 \leq -9.662942266681646 \cdot 10^{-284}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\frac{a \cdot \frac{{k}^{m}}{k}}{k}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}



Bits error versus a



Bits error versus k



Bits error versus m
Results
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) < -9.6629422666816458e-284 or 0.0 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 0.2
if -9.6629422666816458e-284 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) < 0.0Initial program 3.2
Simplified3.2
Taylor expanded in k around inf 33.2
Simplified15.5
Applied associate-/r*_binary640.4
Simplified0.4
Final simplification0.3
herbie shell --seed 2022129
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))