(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))
(t_1 (sqrt (- d))))
(if (<= h -1.1166493905219246e-54)
(* (* (sqrt (/ d h)) (/ t_1 (sqrt (- l)))) t_0)
(if (<= h -1.8608481929594e-310)
(* t_0 (* (/ t_1 (sqrt (- h))) (sqrt (/ d l))))
(* t_0 (/ d (* (sqrt l) (sqrt h))))))))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 t_1 = sqrt(-d);
double tmp;
if (h <= -1.1166493905219246e-54) {
tmp = (sqrt((d / h)) * (t_1 / sqrt(-l))) * t_0;
} else if (h <= -1.8608481929594e-310) {
tmp = t_0 * ((t_1 / sqrt(-h)) * sqrt((d / l)));
} else {
tmp = t_0 * (d / (sqrt(l) * sqrt(h)));
}
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) t_1 = sqrt(Float64(-d)) tmp = 0.0 if (h <= -1.1166493905219246e-54) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(t_1 / sqrt(Float64(-l)))) * t_0); elseif (h <= -1.8608481929594e-310) tmp = Float64(t_0 * Float64(Float64(t_1 / sqrt(Float64(-h))) * sqrt(Float64(d / l)))); else tmp = Float64(t_0 * Float64(d / Float64(sqrt(l) * sqrt(h)))); 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]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[h, -1.1166493905219246e-54], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[h, -1.8608481929594e-310], N[(t$95$0 * N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $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)\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;h \leq -1.1166493905219246 \cdot 10^{-54}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \frac{t_1}{\sqrt{-\ell}}\right) \cdot t_0\\
\mathbf{elif}\;h \leq -1.8608481929594 \cdot 10^{-310}:\\
\;\;\;\;t_0 \cdot \left(\frac{t_1}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}



Bits error versus d



Bits error versus h



Bits error versus l



Bits error versus M



Bits error versus D
if h < -1.11664939052192464e-54Initial program 24.2
Simplified24.2
Applied egg-rr20.5
if -1.11664939052192464e-54 < h < -1.860848192959401e-310Initial program 30.6
Simplified30.6
Applied egg-rr17.0
if -1.860848192959401e-310 < h Initial program 26.0
Simplified26.0
Applied egg-rr15.8
Final simplification17.4
herbie shell --seed 2022145
(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)))))