Average Error: 14.0 → 10.8
Time: 17.5s
Precision: binary64
\[[M, D]=\mathsf{sort}([M, D])\]
\[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\]
\[\begin{array}{l} \mathbf{if}\;M \cdot D \leq -3.94026349234034 \cdot 10^{+201} \lor \neg \left(M \cdot D \leq 1.1846669072932626 \cdot 10^{+225}\right):\\ \;\;\;\;w0 \cdot \left(D \cdot \sqrt{-0.25 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{d}\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{d \cdot 2} \cdot \sqrt[3]{h}\right)}^{2} \cdot \frac{\sqrt[3]{h}}{\ell}}\\ \end{array}\]
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\begin{array}{l}
\mathbf{if}\;M \cdot D \leq -3.94026349234034 \cdot 10^{+201} \lor \neg \left(M \cdot D \leq 1.1846669072932626 \cdot 10^{+225}\right):\\
\;\;\;\;w0 \cdot \left(D \cdot \sqrt{-0.25 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{d}\right)}^{2}\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{d \cdot 2} \cdot \sqrt[3]{h}\right)}^{2} \cdot \frac{\sqrt[3]{h}}{\ell}}\\

\end{array}
(FPCore (w0 M D h l d)
 :precision binary64
 (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))
(FPCore (w0 M D h l d)
 :precision binary64
 (if (or (<= (* M D) -3.94026349234034e+201)
         (not (<= (* M D) 1.1846669072932626e+225)))
   (* w0 (* D (sqrt (* -0.25 (* (/ h l) (pow (/ M d) 2.0))))))
   (*
    w0
    (sqrt
     (-
      1.0
      (* (pow (* (/ (* M D) (* d 2.0)) (cbrt h)) 2.0) (/ (cbrt h) l)))))))
double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * sqrt(1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l)));
}
double code(double w0, double M, double D, double h, double l, double d) {
	double tmp;
	if (((M * D) <= -3.94026349234034e+201) || !((M * D) <= 1.1846669072932626e+225)) {
		tmp = w0 * (D * sqrt(-0.25 * ((h / l) * pow((M / d), 2.0))));
	} else {
		tmp = w0 * sqrt(1.0 - (pow((((M * D) / (d * 2.0)) * cbrt(h)), 2.0) * (cbrt(h) / l)));
	}
	return tmp;
}

Error

Bits error versus w0

Bits error versus M

Bits error versus D

Bits error versus h

Bits error versus l

Bits error versus d

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (*.f64 M D) < -3.94026349234034022e201 or 1.18466690729326264e225 < (*.f64 M D)

    1. Initial program 46.6

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity_binary6446.6

      \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\color{blue}{1 \cdot \ell}}}\]
    4. Applied add-cube-cbrt_binary6446.6

      \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{\color{blue}{\left(\sqrt[3]{h} \cdot \sqrt[3]{h}\right) \cdot \sqrt[3]{h}}}{1 \cdot \ell}}\]
    5. Applied times-frac_binary6446.6

      \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \color{blue}{\left(\frac{\sqrt[3]{h} \cdot \sqrt[3]{h}}{1} \cdot \frac{\sqrt[3]{h}}{\ell}\right)}}\]
    6. Applied associate-*r*_binary6446.9

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{\sqrt[3]{h} \cdot \sqrt[3]{h}}{1}\right) \cdot \frac{\sqrt[3]{h}}{\ell}}}\]
    7. Simplified46.9

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\sqrt[3]{h} \cdot \sqrt[3]{h}\right)\right)} \cdot \frac{\sqrt[3]{h}}{\ell}}\]
    8. Using strategy rm
    9. Applied associate-/l*_binary6440.7

      \[\leadsto w0 \cdot \sqrt{1 - \left({\color{blue}{\left(\frac{M}{\frac{2 \cdot d}{D}}\right)}}^{2} \cdot \left(\sqrt[3]{h} \cdot \sqrt[3]{h}\right)\right) \cdot \frac{\sqrt[3]{h}}{\ell}}\]
    10. Simplified40.8

      \[\leadsto w0 \cdot \sqrt{1 - \left({\left(\frac{M}{\color{blue}{\frac{2}{\frac{D}{d}}}}\right)}^{2} \cdot \left(\sqrt[3]{h} \cdot \sqrt[3]{h}\right)\right) \cdot \frac{\sqrt[3]{h}}{\ell}}\]
    11. Taylor expanded around inf 59.3

      \[\leadsto w0 \cdot \color{blue}{\left(\sqrt{-0.25 \cdot \frac{{M}^{2} \cdot h}{{d}^{2} \cdot \ell}} \cdot D\right)}\]
    12. Simplified49.3

      \[\leadsto w0 \cdot \color{blue}{\left(D \cdot \sqrt{-0.25 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{d}\right)}^{2}\right)}\right)}\]

    if -3.94026349234034022e201 < (*.f64 M D) < 1.18466690729326264e225

    1. Initial program 10.8

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity_binary6410.8

      \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\color{blue}{1 \cdot \ell}}}\]
    4. Applied add-cube-cbrt_binary6410.9

      \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{\color{blue}{\left(\sqrt[3]{h} \cdot \sqrt[3]{h}\right) \cdot \sqrt[3]{h}}}{1 \cdot \ell}}\]
    5. Applied times-frac_binary6410.9

      \[\leadsto w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \color{blue}{\left(\frac{\sqrt[3]{h} \cdot \sqrt[3]{h}}{1} \cdot \frac{\sqrt[3]{h}}{\ell}\right)}}\]
    6. Applied associate-*r*_binary648.1

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{\sqrt[3]{h} \cdot \sqrt[3]{h}}{1}\right) \cdot \frac{\sqrt[3]{h}}{\ell}}}\]
    7. Simplified8.1

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\sqrt[3]{h} \cdot \sqrt[3]{h}\right)\right)} \cdot \frac{\sqrt[3]{h}}{\ell}}\]
    8. Using strategy rm
    9. Applied pow2_binary648.1

      \[\leadsto w0 \cdot \sqrt{1 - \left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \color{blue}{{\left(\sqrt[3]{h}\right)}^{2}}\right) \cdot \frac{\sqrt[3]{h}}{\ell}}\]
    10. Applied pow-prod-down_binary647.0

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d} \cdot \sqrt[3]{h}\right)}^{2}} \cdot \frac{\sqrt[3]{h}}{\ell}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification10.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \cdot D \leq -3.94026349234034 \cdot 10^{+201} \lor \neg \left(M \cdot D \leq 1.1846669072932626 \cdot 10^{+225}\right):\\ \;\;\;\;w0 \cdot \left(D \cdot \sqrt{-0.25 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M}{d}\right)}^{2}\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{d \cdot 2} \cdot \sqrt[3]{h}\right)}^{2} \cdot \frac{\sqrt[3]{h}}{\ell}}\\ \end{array}\]

Reproduce

herbie shell --seed 2021139 
(FPCore (w0 M D h l d)
  :name "Henrywood and Agarwal, Equation (9a)"
  :precision binary64
  (* w0 (sqrt (- 1.0 (* (pow (/ (* M D) (* 2.0 d)) 2.0) (/ h l))))))