(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fma (pow (/ (* M D) (* d 2.0)) 2.0) (* (/ h l) -0.5) 1.0)))
(if (<= d -2.690952209301035e-293)
(* (* (/ 1.0 (/ (sqrt (- h)) (sqrt (- d)))) (/ 1.0 (sqrt (/ l d)))) t_0)
(if (<= d 3.788971036180514e+215)
(* t_0 (/ d (* (sqrt h) (sqrt l))))
(* d (sqrt (/ 1.0 (* h l))))))))double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
double code(double d, double h, double l, double M, double D) {
double t_0 = fma(pow(((M * D) / (d * 2.0)), 2.0), ((h / l) * -0.5), 1.0);
double tmp;
if (d <= -2.690952209301035e-293) {
tmp = ((1.0 / (sqrt(-h) / sqrt(-d))) * (1.0 / sqrt((l / d)))) * t_0;
} else if (d <= 3.788971036180514e+215) {
tmp = t_0 * (d / (sqrt(h) * sqrt(l)));
} else {
tmp = d * sqrt((1.0 / (h * l)));
}
return tmp;
}
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function code(d, h, l, M, D) t_0 = fma((Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) tmp = 0.0 if (d <= -2.690952209301035e-293) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(-h)) / sqrt(Float64(-d)))) * Float64(1.0 / sqrt(Float64(l / d)))) * t_0); elseif (d <= 3.788971036180514e+215) tmp = Float64(t_0 * Float64(d / Float64(sqrt(h) * sqrt(l)))); else tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))); end return tmp end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[d, -2.690952209301035e-293], N[(N[(N[(1.0 / N[(N[Sqrt[(-h)], $MachinePrecision] / N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[d, 3.788971036180514e+215], N[(t$95$0 * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\begin{array}{l}
t_0 := \mathsf{fma}\left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)\\
\mathbf{if}\;d \leq -2.690952209301035 \cdot 10^{-293}:\\
\;\;\;\;\left(\frac{1}{\frac{\sqrt{-h}}{\sqrt{-d}}} \cdot \frac{1}{\sqrt{\frac{\ell}{d}}}\right) \cdot t_0\\
\mathbf{elif}\;d \leq 3.788971036180514 \cdot 10^{+215}:\\
\;\;\;\;t_0 \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}



Bits error versus d



Bits error versus h



Bits error versus l



Bits error versus M



Bits error versus D
if d < -2.6909522093010347e-293Initial program 27.4
Simplified27.4
Applied egg-rr26.9
Applied egg-rr27.0
Applied egg-rr21.0
if -2.6909522093010347e-293 < d < 3.788971036180514e215Initial program 25.0
Simplified25.0
Applied egg-rr17.4
if 3.788971036180514e215 < d Initial program 31.7
Simplified31.7
Taylor expanded in d around inf 14.6
Final simplification19.0
herbie shell --seed 2022146
(FPCore (d h l M D)
:name "Henrywood and Agarwal, Equation (12)"
:precision binary64
(* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))