(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 (sqrt (/ (cbrt d) (cbrt h))))
(t_1 (* (fabs (cbrt d)) (sqrt (/ (cbrt d) l)))))
(if (<=
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0)) (/ h l))))
-8.226158848812984e-212)
(*
(* (* (sqrt (/ (* (cbrt d) (cbrt d)) (* (cbrt h) (cbrt h)))) t_0) t_1)
(fma (pow (* (/ M d) (/ D 2.0)) 2.0) (* (/ h l) -0.5) 1.0))
(* t_1 (* t_0 (* t_0 t_0))))))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 = sqrt((cbrt(d) / cbrt(h)));
double t_1 = fabs(cbrt(d)) * sqrt((cbrt(d) / l));
double tmp;
if (((pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((0.5 * pow(((M * D) / (d * 2.0)), 2.0)) * (h / l)))) <= -8.226158848812984e-212) {
tmp = ((sqrt(((cbrt(d) * cbrt(d)) / (cbrt(h) * cbrt(h)))) * t_0) * t_1) * fma(pow(((M / d) * (D / 2.0)), 2.0), ((h / l) * -0.5), 1.0);
} else {
tmp = t_1 * (t_0 * (t_0 * t_0));
}
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 = sqrt(Float64(cbrt(d) / cbrt(h))) t_1 = Float64(abs(cbrt(d)) * sqrt(Float64(cbrt(d) / l))) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)) * Float64(h / l)))) <= -8.226158848812984e-212) tmp = Float64(Float64(Float64(sqrt(Float64(Float64(cbrt(d) * cbrt(d)) / Float64(cbrt(h) * cbrt(h)))) * t_0) * t_1) * fma((Float64(Float64(M / d) * Float64(D / 2.0)) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0)); else tmp = Float64(t_1 * Float64(t_0 * Float64(t_0 * t_0))); 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[Sqrt[N[(N[Power[d, 1/3], $MachinePrecision] / N[Power[h, 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[N[Power[d, 1/3], $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(N[Power[d, 1/3], $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -8.226158848812984e-212], N[(N[(N[(N[Sqrt[N[(N[(N[Power[d, 1/3], $MachinePrecision] * N[Power[d, 1/3], $MachinePrecision]), $MachinePrecision] / N[(N[Power[h, 1/3], $MachinePrecision] * N[Power[h, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision] * 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]), $MachinePrecision], N[(t$95$1 * N[(t$95$0 * N[(t$95$0 * t$95$0), $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 := \sqrt{\frac{\sqrt[3]{d}}{\sqrt[3]{h}}}\\
t_1 := \left|\sqrt[3]{d}\right| \cdot \sqrt{\frac{\sqrt[3]{d}}{\ell}}\\
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -8.226158848812984 \cdot 10^{-212}:\\
\;\;\;\;\left(\left(\sqrt{\frac{\sqrt[3]{d} \cdot \sqrt[3]{d}}{\sqrt[3]{h} \cdot \sqrt[3]{h}}} \cdot t_0\right) \cdot t_1\right) \cdot \mathsf{fma}\left({\left(\frac{M}{d} \cdot \frac{D}{2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(t_0 \cdot \left(t_0 \cdot t_0\right)\right)\\
\end{array}



Bits error versus d



Bits error versus h



Bits error versus l



Bits error versus M



Bits error versus D
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < -8.2261588488129841e-212Initial program 28.3
Simplified28.3
Applied add-cube-cbrt_binary6428.5
Applied add-cube-cbrt_binary6428.5
Applied times-frac_binary6428.5
Applied sqrt-prod_binary6428.0
Applied *-un-lft-identity_binary6428.0
Applied add-cube-cbrt_binary6428.2
Applied times-frac_binary6428.2
Applied sqrt-prod_binary6427.7
Simplified27.7
Applied times-frac_binary6428.5
if -8.2261588488129841e-212 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) Initial program 26.1
Simplified26.1
Applied add-cube-cbrt_binary6426.4
Applied add-cube-cbrt_binary6426.5
Applied times-frac_binary6426.5
Applied sqrt-prod_binary6419.7
Applied *-un-lft-identity_binary6419.7
Applied add-cube-cbrt_binary6419.9
Applied times-frac_binary6419.9
Applied sqrt-prod_binary6415.7
Simplified15.7
Applied add-sqr-sqrt_binary6415.7
Simplified15.7
Simplified14.9
Taylor expanded in M around 0 12.1
Final simplification15.0
herbie shell --seed 2022137
(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)))))