Average Error: 26.6 → 21.6
Time: 23.0s
Precision: binary64
\[\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}\;\ell \leq 1.062904038339468 \cdot 10^{-264}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d} \cdot \sqrt{d}}{\frac{\sqrt{h} \cdot \sqrt{\ell}}{t_0}}\\ \end{array} \]
\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}\;\ell \leq 1.062904038339468 \cdot 10^{-264}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d} \cdot \sqrt{d}}{\frac{\sqrt{h} \cdot \sqrt{\ell}}{t_0}}\\


\end{array}
(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 (<= l 1.062904038339468e-264)
     (* (* (sqrt (/ d h)) (sqrt (/ d l))) t_0)
     (/ (* (sqrt d) (sqrt d)) (/ (* (sqrt h) (sqrt l)) 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 = fma(pow(((M * D) / (d * 2.0)), 2.0), ((h / l) * -0.5), 1.0);
	double tmp;
	if (l <= 1.062904038339468e-264) {
		tmp = (sqrt(d / h) * sqrt(d / l)) * t_0;
	} else {
		tmp = (sqrt(d) * sqrt(d)) / ((sqrt(h) * sqrt(l)) / t_0);
	}
	return tmp;
}

Error

Bits error versus d

Bits error versus h

Bits error versus l

Bits error versus M

Bits error versus D

Derivation

  1. Split input into 2 regimes
  2. if l < 1.06290403833946789e-264

    1. Initial program 26.8

      \[\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) \]
    2. Simplified26.8

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)} \]

    if 1.06290403833946789e-264 < l

    1. Initial program 26.3

      \[\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) \]
    2. Simplified26.3

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)} \]
    3. Applied sqrt-div_binary6422.2

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \color{blue}{\frac{\sqrt{d}}{\sqrt{\ell}}}\right) \cdot \mathsf{fma}\left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right) \]
    4. Applied sqrt-div_binary6416.3

      \[\leadsto \left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \mathsf{fma}\left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right) \]
    5. Applied frac-times_binary6416.3

      \[\leadsto \color{blue}{\frac{\sqrt{d} \cdot \sqrt{d}}{\sqrt{h} \cdot \sqrt{\ell}}} \cdot \mathsf{fma}\left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right) \]
    6. Applied associate-*l/_binary6416.0

      \[\leadsto \color{blue}{\frac{\left(\sqrt{d} \cdot \sqrt{d}\right) \cdot \mathsf{fma}\left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    7. Applied associate-/l*_binary6416.0

      \[\leadsto \color{blue}{\frac{\sqrt{d} \cdot \sqrt{d}}{\frac{\sqrt{h} \cdot \sqrt{\ell}}{\mathsf{fma}\left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification21.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq 1.062904038339468 \cdot 10^{-264}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d} \cdot \sqrt{d}}{\frac{\sqrt{h} \cdot \sqrt{\ell}}{\mathsf{fma}\left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}}\\ \end{array} \]

Reproduce

herbie shell --seed 2021215 
(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)))))