Average Error: 13.9 → 10.1
Time: 15.1s
Precision: binary64
Cost: 8132
\[ \begin{array}{c}[M, D] = \mathsf{sort}([M, D])\\ \end{array} \]
\[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
\[\begin{array}{l} t_0 := D \cdot \left(0.5 \cdot \frac{M}{d}\right)\\ \mathbf{if}\;\frac{h}{\ell} \leq -5 \cdot 10^{-28}:\\ \;\;\;\;w0 \cdot \sqrt{1 - h \cdot \left(t_0 \cdot \frac{t_0}{\ell}\right)}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{M \cdot \frac{D \cdot 0.5}{\frac{d}{h}}}{\frac{\frac{d}{D}}{M} \cdot \frac{\ell}{0.5}}}\\ \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
 (let* ((t_0 (* D (* 0.5 (/ M d)))))
   (if (<= (/ h l) -5e-28)
     (* w0 (sqrt (- 1.0 (* h (* t_0 (/ t_0 l))))))
     (*
      w0
      (sqrt
       (- 1.0 (/ (* M (/ (* D 0.5) (/ d h))) (* (/ (/ d D) M) (/ l 0.5)))))))))
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 t_0 = D * (0.5 * (M / d));
	double tmp;
	if ((h / l) <= -5e-28) {
		tmp = w0 * sqrt((1.0 - (h * (t_0 * (t_0 / l)))));
	} else {
		tmp = w0 * sqrt((1.0 - ((M * ((D * 0.5) / (d / h))) / (((d / D) / M) * (l / 0.5)))));
	}
	return tmp;
}
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    code = w0 * sqrt((1.0d0 - ((((m * d) / (2.0d0 * d_1)) ** 2.0d0) * (h / l))))
end function
real(8) function code(w0, m, d, h, l, d_1)
    real(8), intent (in) :: w0
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: d_1
    real(8) :: t_0
    real(8) :: tmp
    t_0 = d * (0.5d0 * (m / d_1))
    if ((h / l) <= (-5d-28)) then
        tmp = w0 * sqrt((1.0d0 - (h * (t_0 * (t_0 / l)))))
    else
        tmp = w0 * sqrt((1.0d0 - ((m * ((d * 0.5d0) / (d_1 / h))) / (((d_1 / d) / m) * (l / 0.5d0)))))
    end if
    code = tmp
end function
public static double code(double w0, double M, double D, double h, double l, double d) {
	return w0 * Math.sqrt((1.0 - (Math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
public static double code(double w0, double M, double D, double h, double l, double d) {
	double t_0 = D * (0.5 * (M / d));
	double tmp;
	if ((h / l) <= -5e-28) {
		tmp = w0 * Math.sqrt((1.0 - (h * (t_0 * (t_0 / l)))));
	} else {
		tmp = w0 * Math.sqrt((1.0 - ((M * ((D * 0.5) / (d / h))) / (((d / D) / M) * (l / 0.5)))));
	}
	return tmp;
}
def code(w0, M, D, h, l, d):
	return w0 * math.sqrt((1.0 - (math.pow(((M * D) / (2.0 * d)), 2.0) * (h / l))))
def code(w0, M, D, h, l, d):
	t_0 = D * (0.5 * (M / d))
	tmp = 0
	if (h / l) <= -5e-28:
		tmp = w0 * math.sqrt((1.0 - (h * (t_0 * (t_0 / l)))))
	else:
		tmp = w0 * math.sqrt((1.0 - ((M * ((D * 0.5) / (d / h))) / (((d / D) / M) * (l / 0.5)))))
	return tmp
function code(w0, M, D, h, l, d)
	return Float64(w0 * sqrt(Float64(1.0 - Float64((Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0) * Float64(h / l)))))
end
function code(w0, M, D, h, l, d)
	t_0 = Float64(D * Float64(0.5 * Float64(M / d)))
	tmp = 0.0
	if (Float64(h / l) <= -5e-28)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(h * Float64(t_0 * Float64(t_0 / l))))));
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(M * Float64(Float64(D * 0.5) / Float64(d / h))) / Float64(Float64(Float64(d / D) / M) * Float64(l / 0.5))))));
	end
	return tmp
end
function tmp = code(w0, M, D, h, l, d)
	tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l))));
end
function tmp_2 = code(w0, M, D, h, l, d)
	t_0 = D * (0.5 * (M / d));
	tmp = 0.0;
	if ((h / l) <= -5e-28)
		tmp = w0 * sqrt((1.0 - (h * (t_0 * (t_0 / l)))));
	else
		tmp = w0 * sqrt((1.0 - ((M * ((D * 0.5) / (d / h))) / (((d / D) / M) * (l / 0.5)))));
	end
	tmp_2 = tmp;
end
code[w0_, M_, D_, h_, l_, d_] := N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(h / l), $MachinePrecision], -5e-28], N[(w0 * N[Sqrt[N[(1.0 - N[(h * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(M * N[(N[(D * 0.5), $MachinePrecision] / N[(d / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(d / D), $MachinePrecision] / M), $MachinePrecision] * N[(l / 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\begin{array}{l}
t_0 := D \cdot \left(0.5 \cdot \frac{M}{d}\right)\\
\mathbf{if}\;\frac{h}{\ell} \leq -5 \cdot 10^{-28}:\\
\;\;\;\;w0 \cdot \sqrt{1 - h \cdot \left(t_0 \cdot \frac{t_0}{\ell}\right)}\\

\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{M \cdot \frac{D \cdot 0.5}{\frac{d}{h}}}{\frac{\frac{d}{D}}{M} \cdot \frac{\ell}{0.5}}}\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (/.f64 h l) < -5.0000000000000002e-28

    1. Initial program 23.8

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
      Proof
      (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (*.f64 (/.f64 M 2) (/.f64 D d)) 2) (/.f64 h l))))): 0 points increase in error, 0 points decrease in error
      (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 M D) (*.f64 2 d))) 2) (/.f64 h l))))): 7 points increase in error, 1 points decrease in error
    3. Applied egg-rr22.7

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{h \cdot \frac{{\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}}{\ell}}} \]
      Proof
      (*.f64 h (/.f64 (pow.f64 (*.f64 D (/.f64 M (*.f64 2 d))) 2) l)): 0 points increase in error, 0 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (Rewrite<= *-commutative_binary64 (*.f64 (/.f64 M (*.f64 2 d)) D)) 2) l)): 0 points increase in error, 0 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 M D) (*.f64 2 d))) 2) l)): 9 points increase in error, 14 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (/.f64 (Rewrite<= remove-double-neg_binary64 (neg.f64 (neg.f64 (*.f64 M D)))) (*.f64 2 d)) 2) l)): 0 points increase in error, 0 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (/.f64 (neg.f64 (Rewrite=> neg-mul-1_binary64 (*.f64 -1 (*.f64 M D)))) (*.f64 2 d)) 2) l)): 0 points increase in error, 0 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (/.f64 (Rewrite=> distribute-lft-neg-in_binary64 (*.f64 (neg.f64 -1) (*.f64 M D))) (*.f64 2 d)) 2) l)): 0 points increase in error, 0 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (/.f64 (*.f64 (Rewrite=> metadata-eval 1) (*.f64 M D)) (*.f64 2 d)) 2) l)): 0 points increase in error, 0 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 1 (*.f64 2 d)) (*.f64 M D))) 2) l)): 7 points increase in error, 6 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (Rewrite<= associate-/r/_binary64 (/.f64 1 (/.f64 (*.f64 2 d) (*.f64 M D)))) 2) l)): 10 points increase in error, 11 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (/.f64 1 (Rewrite=> associate-/l*_binary64 (/.f64 2 (/.f64 (*.f64 M D) d)))) 2) l)): 3 points increase in error, 3 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (/.f64 1 (/.f64 2 (Rewrite<= associate-*r/_binary64 (*.f64 M (/.f64 D d))))) 2) l)): 8 points increase in error, 9 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (Rewrite=> associate-/r/_binary64 (*.f64 (/.f64 1 2) (*.f64 M (/.f64 D d)))) 2) l)): 1 points increase in error, 3 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (*.f64 (Rewrite=> metadata-eval 1/2) (*.f64 M (/.f64 D d))) 2) l)): 0 points increase in error, 0 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (Rewrite=> *-commutative_binary64 (*.f64 (*.f64 M (/.f64 D d)) 1/2)) 2) l)): 0 points increase in error, 0 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (Rewrite=> associate-*l*_binary64 (*.f64 M (*.f64 (/.f64 D d) 1/2))) 2) l)): 0 points increase in error, 0 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (*.f64 M (Rewrite<= *-commutative_binary64 (*.f64 1/2 (/.f64 D d)))) 2) l)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= *-commutative_binary64 (*.f64 (/.f64 (pow.f64 (*.f64 M (*.f64 1/2 (/.f64 D d))) 2) l) h)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-/r/_binary64 (/.f64 (pow.f64 (*.f64 M (*.f64 1/2 (/.f64 D d))) 2) (/.f64 l h))): 32 points increase in error, 14 points decrease in error
    5. Applied egg-rr16.4

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

    if -5.0000000000000002e-28 < (/.f64 h l)

    1. Initial program 9.5

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Simplified9.6

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
      Proof
      (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (*.f64 (/.f64 M 2) (/.f64 D d)) 2) (/.f64 h l))))): 0 points increase in error, 0 points decrease in error
      (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 M D) (*.f64 2 d))) 2) (/.f64 h l))))): 7 points increase in error, 1 points decrease in error
    3. Applied egg-rr9.3

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{h \cdot \frac{{\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2}}{\ell}}} \]
      Proof
      (*.f64 h (/.f64 (pow.f64 (*.f64 D (/.f64 M (*.f64 2 d))) 2) l)): 0 points increase in error, 0 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (Rewrite<= *-commutative_binary64 (*.f64 (/.f64 M (*.f64 2 d)) D)) 2) l)): 0 points increase in error, 0 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 M D) (*.f64 2 d))) 2) l)): 9 points increase in error, 14 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (/.f64 (Rewrite<= remove-double-neg_binary64 (neg.f64 (neg.f64 (*.f64 M D)))) (*.f64 2 d)) 2) l)): 0 points increase in error, 0 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (/.f64 (neg.f64 (Rewrite=> neg-mul-1_binary64 (*.f64 -1 (*.f64 M D)))) (*.f64 2 d)) 2) l)): 0 points increase in error, 0 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (/.f64 (Rewrite=> distribute-lft-neg-in_binary64 (*.f64 (neg.f64 -1) (*.f64 M D))) (*.f64 2 d)) 2) l)): 0 points increase in error, 0 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (/.f64 (*.f64 (Rewrite=> metadata-eval 1) (*.f64 M D)) (*.f64 2 d)) 2) l)): 0 points increase in error, 0 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 1 (*.f64 2 d)) (*.f64 M D))) 2) l)): 7 points increase in error, 6 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (Rewrite<= associate-/r/_binary64 (/.f64 1 (/.f64 (*.f64 2 d) (*.f64 M D)))) 2) l)): 10 points increase in error, 11 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (/.f64 1 (Rewrite=> associate-/l*_binary64 (/.f64 2 (/.f64 (*.f64 M D) d)))) 2) l)): 3 points increase in error, 3 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (/.f64 1 (/.f64 2 (Rewrite<= associate-*r/_binary64 (*.f64 M (/.f64 D d))))) 2) l)): 8 points increase in error, 9 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (Rewrite=> associate-/r/_binary64 (*.f64 (/.f64 1 2) (*.f64 M (/.f64 D d)))) 2) l)): 1 points increase in error, 3 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (*.f64 (Rewrite=> metadata-eval 1/2) (*.f64 M (/.f64 D d))) 2) l)): 0 points increase in error, 0 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (Rewrite=> *-commutative_binary64 (*.f64 (*.f64 M (/.f64 D d)) 1/2)) 2) l)): 0 points increase in error, 0 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (Rewrite=> associate-*l*_binary64 (*.f64 M (*.f64 (/.f64 D d) 1/2))) 2) l)): 0 points increase in error, 0 points decrease in error
      (*.f64 h (/.f64 (pow.f64 (*.f64 M (Rewrite<= *-commutative_binary64 (*.f64 1/2 (/.f64 D d)))) 2) l)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= *-commutative_binary64 (*.f64 (/.f64 (pow.f64 (*.f64 M (*.f64 1/2 (/.f64 D d))) 2) l) h)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-/r/_binary64 (/.f64 (pow.f64 (*.f64 M (*.f64 1/2 (/.f64 D d))) 2) (/.f64 l h))): 32 points increase in error, 14 points decrease in error
    5. Applied egg-rr5.8

      \[\leadsto w0 \cdot \sqrt{1 - h \cdot \color{blue}{\left(\frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{1} \cdot \frac{D \cdot \left(0.5 \cdot \frac{M}{d}\right)}{\ell}\right)}} \]
    6. Applied egg-rr5.8

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\left(\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right) \cdot h\right) \cdot \left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}{\ell}}} \]
    7. Applied egg-rr7.9

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{M}{d} \cdot \left(D \cdot \left(0.5 \cdot h\right)\right)\right) \cdot \frac{1}{\frac{d}{M} \cdot \frac{\ell}{D \cdot 0.5}}}} \]
    8. Simplified7.4

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{M \cdot \frac{0.5 \cdot D}{\frac{d}{h}}}{\frac{\frac{d}{D}}{M} \cdot \frac{\ell}{0.5}}}} \]
      Proof
      (/.f64 (*.f64 M (/.f64 (*.f64 1/2 D) (/.f64 d h))) (*.f64 (/.f64 (/.f64 d D) M) (/.f64 l 1/2))): 0 points increase in error, 0 points decrease in error
      (/.f64 (*.f64 M (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 D 1/2)) (/.f64 d h))) (*.f64 (/.f64 (/.f64 d D) M) (/.f64 l 1/2))): 0 points increase in error, 0 points decrease in error
      (/.f64 (*.f64 M (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (*.f64 D 1/2) h) d))) (*.f64 (/.f64 (/.f64 d D) M) (/.f64 l 1/2))): 27 points increase in error, 17 points decrease in error
      (/.f64 (*.f64 M (/.f64 (Rewrite<= associate-*r*_binary64 (*.f64 D (*.f64 1/2 h))) d)) (*.f64 (/.f64 (/.f64 d D) M) (/.f64 l 1/2))): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 (/.f64 (*.f64 D (*.f64 1/2 h)) d) M)) (*.f64 (/.f64 (/.f64 d D) M) (/.f64 l 1/2))): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 (*.f64 D (*.f64 1/2 h)) M) d)) (*.f64 (/.f64 (/.f64 d D) M) (/.f64 l 1/2))): 18 points increase in error, 18 points decrease in error
      (/.f64 (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 M (*.f64 D (*.f64 1/2 h)))) d) (*.f64 (/.f64 (/.f64 d D) M) (/.f64 l 1/2))): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 M d) (*.f64 D (*.f64 1/2 h)))) (*.f64 (/.f64 (/.f64 d D) M) (/.f64 l 1/2))): 19 points increase in error, 17 points decrease in error
      (/.f64 (Rewrite<= *-rgt-identity_binary64 (*.f64 (*.f64 (/.f64 M d) (*.f64 D (*.f64 1/2 h))) 1)) (*.f64 (/.f64 (/.f64 d D) M) (/.f64 l 1/2))): 0 points increase in error, 0 points decrease in error
      (/.f64 (*.f64 (*.f64 (/.f64 M d) (*.f64 D (*.f64 1/2 h))) 1) (*.f64 (Rewrite<= associate-/r*_binary64 (/.f64 d (*.f64 D M))) (/.f64 l 1/2))): 14 points increase in error, 15 points decrease in error
      (/.f64 (*.f64 (*.f64 (/.f64 M d) (*.f64 D (*.f64 1/2 h))) 1) (*.f64 (/.f64 d (Rewrite=> *-commutative_binary64 (*.f64 M D))) (/.f64 l 1/2))): 0 points increase in error, 0 points decrease in error
      (/.f64 (*.f64 (*.f64 (/.f64 M d) (*.f64 D (*.f64 1/2 h))) 1) (*.f64 (Rewrite=> associate-/r*_binary64 (/.f64 (/.f64 d M) D)) (/.f64 l 1/2))): 15 points increase in error, 11 points decrease in error
      (/.f64 (*.f64 (*.f64 (/.f64 M d) (*.f64 D (*.f64 1/2 h))) 1) (Rewrite<= times-frac_binary64 (/.f64 (*.f64 (/.f64 d M) l) (*.f64 D 1/2)))): 16 points increase in error, 14 points decrease in error
      (/.f64 (*.f64 (*.f64 (/.f64 M d) (*.f64 D (*.f64 1/2 h))) 1) (Rewrite<= associate-*r/_binary64 (*.f64 (/.f64 d M) (/.f64 l (*.f64 D 1/2))))): 20 points increase in error, 21 points decrease in error
      (Rewrite<= associate-*r/_binary64 (*.f64 (*.f64 (/.f64 M d) (*.f64 D (*.f64 1/2 h))) (/.f64 1 (*.f64 (/.f64 d M) (/.f64 l (*.f64 D 1/2)))))): 4 points increase in error, 5 points decrease in error
  3. Recombined 2 regimes into one program.
  4. Final simplification10.1

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

Alternatives

Alternative 1
Error14.6
Cost8004
\[\begin{array}{l} \mathbf{if}\;\frac{h}{\ell} \leq -1 \cdot 10^{+45}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{h}{\frac{\ell}{M \cdot M}}\right) \cdot -0.25}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \]
Alternative 2
Error12.0
Cost7872
\[w0 \cdot \sqrt{1 - \frac{M \cdot \frac{D \cdot 0.5}{\frac{d}{h}}}{\frac{\frac{d}{D}}{M} \cdot \frac{\ell}{0.5}}} \]
Alternative 3
Error9.0
Cost7872
\[\begin{array}{l} t_0 := \frac{M}{d} \cdot \left(D \cdot 0.5\right)\\ w0 \cdot \sqrt{1 - \frac{t_0 \cdot \left(h \cdot t_0\right)}{\ell}} \end{array} \]
Alternative 4
Error14.0
Cost64
\[w0 \]

Error

Reproduce

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