Average Error: 14.2 → 8.6
Time: 18.0s
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 6.72510121932254 \cdot 10^{+150}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{M \cdot D}{2 \cdot d} \cdot \frac{\frac{M \cdot D}{2 \cdot d} \cdot h}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - {\left(\frac{M}{\frac{2 \cdot d}{D}}\right)}^{2} \cdot \frac{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 6.72510121932254 \cdot 10^{+150}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{M \cdot D}{2 \cdot d} \cdot \frac{\frac{M \cdot D}{2 \cdot d} \cdot h}{\ell}}\\

\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - {\left(\frac{M}{\frac{2 \cdot d}{D}}\right)}^{2} \cdot \frac{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 (<= (* M D) 6.72510121932254e+150)
   (*
    w0
    (sqrt (- 1.0 (* (/ (* M D) (* 2.0 d)) (/ (* (/ (* M D) (* 2.0 d)) h) l)))))
   (* w0 (sqrt (- 1.0 (* (pow (/ M (/ (* 2.0 d) D)) 2.0) (/ 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) <= 6.72510121932254e+150) {
		tmp = w0 * sqrt(1.0 - (((M * D) / (2.0 * d)) * ((((M * D) / (2.0 * d)) * h) / l)));
	} else {
		tmp = w0 * sqrt(1.0 - (pow((M / ((2.0 * d) / D)), 2.0) * (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) < 6.72510121932254e150

    1. Initial program 12.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 unpow2_binary64_116612.6

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \cdot \frac{h}{\ell}}\]
    4. Applied associate-*l*_binary64_104211.2

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{h}{\ell}\right)}}\]
    5. Using strategy rm
    6. Applied associate-*r/_binary64_10436.8

      \[\leadsto w0 \cdot \sqrt{1 - \frac{M \cdot D}{2 \cdot d} \cdot \color{blue}{\frac{\frac{M \cdot D}{2 \cdot d} \cdot h}{\ell}}}\]

    if 6.72510121932254e150 < (*.f64 M D)

    1. Initial program 37.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 associate-/l*_binary64_104633.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \cdot D \leq 6.72510121932254 \cdot 10^{+150}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{M \cdot D}{2 \cdot d} \cdot \frac{\frac{M \cdot D}{2 \cdot d} \cdot h}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - {\left(\frac{M}{\frac{2 \cdot d}{D}}\right)}^{2} \cdot \frac{h}{\ell}}\\ \end{array}\]

Reproduce

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