Average Error: 14.1 → 9.9
Time: 18.0s
Precision: binary64
Cost: 16404
\[ \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 := \frac{D \cdot M}{2 \cdot d}\\ \mathbf{if}\;t_0 \leq -4 \cdot 10^{+158}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \left(\frac{D}{\ell} \cdot \left(\left(\frac{M}{d} \cdot \left(M \cdot h\right)\right) \cdot \frac{D}{d}\right)\right) \cdot -0.25}\\ \mathbf{elif}\;t_0 \leq -2 \cdot 10^{-68}:\\ \;\;\;\;w0 \cdot \sqrt{1 - {t_0}^{2} \cdot \frac{h}{\ell}}\\ \mathbf{elif}\;t_0 \leq -2 \cdot 10^{-191}:\\ \;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(\left(D \cdot M\right) \cdot \frac{M \cdot \left(h \cdot \frac{D}{d \cdot \ell}\right)}{d}\right)}\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{-152}:\\ \;\;\;\;w0\\ \mathbf{elif}\;t_0 \leq 10^{+146}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \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 M) (* 2.0 d))))
   (if (<= t_0 -4e+158)
     (*
      w0
      (sqrt (+ 1.0 (* (* (/ D l) (* (* (/ M d) (* M h)) (/ D d))) -0.25))))
     (if (<= t_0 -2e-68)
       (* w0 (sqrt (- 1.0 (* (pow t_0 2.0) (/ h l)))))
       (if (<= t_0 -2e-191)
         (*
          w0
          (sqrt (- 1.0 (* 0.25 (* (* D M) (/ (* M (* h (/ D (* d l)))) d))))))
         (if (<= t_0 5e-152)
           w0
           (if (<= t_0 1e+146)
             (* w0 (sqrt (- 1.0 (* (/ h l) (pow (* (/ D d) (/ M 2.0)) 2.0)))))
             w0)))))))
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 * M) / (2.0 * d);
	double tmp;
	if (t_0 <= -4e+158) {
		tmp = w0 * sqrt((1.0 + (((D / l) * (((M / d) * (M * h)) * (D / d))) * -0.25)));
	} else if (t_0 <= -2e-68) {
		tmp = w0 * sqrt((1.0 - (pow(t_0, 2.0) * (h / l))));
	} else if (t_0 <= -2e-191) {
		tmp = w0 * sqrt((1.0 - (0.25 * ((D * M) * ((M * (h * (D / (d * l)))) / d)))));
	} else if (t_0 <= 5e-152) {
		tmp = w0;
	} else if (t_0 <= 1e+146) {
		tmp = w0 * sqrt((1.0 - ((h / l) * pow(((D / d) * (M / 2.0)), 2.0))));
	} else {
		tmp = w0;
	}
	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 * m) / (2.0d0 * d_1)
    if (t_0 <= (-4d+158)) then
        tmp = w0 * sqrt((1.0d0 + (((d / l) * (((m / d_1) * (m * h)) * (d / d_1))) * (-0.25d0))))
    else if (t_0 <= (-2d-68)) then
        tmp = w0 * sqrt((1.0d0 - ((t_0 ** 2.0d0) * (h / l))))
    else if (t_0 <= (-2d-191)) then
        tmp = w0 * sqrt((1.0d0 - (0.25d0 * ((d * m) * ((m * (h * (d / (d_1 * l)))) / d_1)))))
    else if (t_0 <= 5d-152) then
        tmp = w0
    else if (t_0 <= 1d+146) then
        tmp = w0 * sqrt((1.0d0 - ((h / l) * (((d / d_1) * (m / 2.0d0)) ** 2.0d0))))
    else
        tmp = w0
    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 * M) / (2.0 * d);
	double tmp;
	if (t_0 <= -4e+158) {
		tmp = w0 * Math.sqrt((1.0 + (((D / l) * (((M / d) * (M * h)) * (D / d))) * -0.25)));
	} else if (t_0 <= -2e-68) {
		tmp = w0 * Math.sqrt((1.0 - (Math.pow(t_0, 2.0) * (h / l))));
	} else if (t_0 <= -2e-191) {
		tmp = w0 * Math.sqrt((1.0 - (0.25 * ((D * M) * ((M * (h * (D / (d * l)))) / d)))));
	} else if (t_0 <= 5e-152) {
		tmp = w0;
	} else if (t_0 <= 1e+146) {
		tmp = w0 * Math.sqrt((1.0 - ((h / l) * Math.pow(((D / d) * (M / 2.0)), 2.0))));
	} else {
		tmp = w0;
	}
	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 * M) / (2.0 * d)
	tmp = 0
	if t_0 <= -4e+158:
		tmp = w0 * math.sqrt((1.0 + (((D / l) * (((M / d) * (M * h)) * (D / d))) * -0.25)))
	elif t_0 <= -2e-68:
		tmp = w0 * math.sqrt((1.0 - (math.pow(t_0, 2.0) * (h / l))))
	elif t_0 <= -2e-191:
		tmp = w0 * math.sqrt((1.0 - (0.25 * ((D * M) * ((M * (h * (D / (d * l)))) / d)))))
	elif t_0 <= 5e-152:
		tmp = w0
	elif t_0 <= 1e+146:
		tmp = w0 * math.sqrt((1.0 - ((h / l) * math.pow(((D / d) * (M / 2.0)), 2.0))))
	else:
		tmp = w0
	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(Float64(D * M) / Float64(2.0 * d))
	tmp = 0.0
	if (t_0 <= -4e+158)
		tmp = Float64(w0 * sqrt(Float64(1.0 + Float64(Float64(Float64(D / l) * Float64(Float64(Float64(M / d) * Float64(M * h)) * Float64(D / d))) * -0.25))));
	elseif (t_0 <= -2e-68)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64((t_0 ^ 2.0) * Float64(h / l)))));
	elseif (t_0 <= -2e-191)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(0.25 * Float64(Float64(D * M) * Float64(Float64(M * Float64(h * Float64(D / Float64(d * l)))) / d))))));
	elseif (t_0 <= 5e-152)
		tmp = w0;
	elseif (t_0 <= 1e+146)
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(h / l) * (Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0)))));
	else
		tmp = w0;
	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 * M) / (2.0 * d);
	tmp = 0.0;
	if (t_0 <= -4e+158)
		tmp = w0 * sqrt((1.0 + (((D / l) * (((M / d) * (M * h)) * (D / d))) * -0.25)));
	elseif (t_0 <= -2e-68)
		tmp = w0 * sqrt((1.0 - ((t_0 ^ 2.0) * (h / l))));
	elseif (t_0 <= -2e-191)
		tmp = w0 * sqrt((1.0 - (0.25 * ((D * M) * ((M * (h * (D / (d * l)))) / d)))));
	elseif (t_0 <= 5e-152)
		tmp = w0;
	elseif (t_0 <= 1e+146)
		tmp = w0 * sqrt((1.0 - ((h / l) * (((D / d) * (M / 2.0)) ^ 2.0))));
	else
		tmp = w0;
	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[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -4e+158], N[(w0 * N[Sqrt[N[(1.0 + N[(N[(N[(D / l), $MachinePrecision] * N[(N[(N[(M / d), $MachinePrecision] * N[(M * h), $MachinePrecision]), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -2e-68], N[(w0 * N[Sqrt[N[(1.0 - N[(N[Power[t$95$0, 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -2e-191], N[(w0 * N[Sqrt[N[(1.0 - N[(0.25 * N[(N[(D * M), $MachinePrecision] * N[(N[(M * N[(h * N[(D / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e-152], w0, If[LessEqual[t$95$0, 1e+146], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], w0]]]]]]
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}
\begin{array}{l}
t_0 := \frac{D \cdot M}{2 \cdot d}\\
\mathbf{if}\;t_0 \leq -4 \cdot 10^{+158}:\\
\;\;\;\;w0 \cdot \sqrt{1 + \left(\frac{D}{\ell} \cdot \left(\left(\frac{M}{d} \cdot \left(M \cdot h\right)\right) \cdot \frac{D}{d}\right)\right) \cdot -0.25}\\

\mathbf{elif}\;t_0 \leq -2 \cdot 10^{-68}:\\
\;\;\;\;w0 \cdot \sqrt{1 - {t_0}^{2} \cdot \frac{h}{\ell}}\\

\mathbf{elif}\;t_0 \leq -2 \cdot 10^{-191}:\\
\;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(\left(D \cdot M\right) \cdot \frac{M \cdot \left(h \cdot \frac{D}{d \cdot \ell}\right)}{d}\right)}\\

\mathbf{elif}\;t_0 \leq 5 \cdot 10^{-152}:\\
\;\;\;\;w0\\

\mathbf{elif}\;t_0 \leq 10^{+146}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}}\\

\mathbf{else}:\\
\;\;\;\;w0\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 5 regimes
  2. if (/.f64 (*.f64 M D) (*.f64 2 d)) < -3.99999999999999981e158

    1. Initial program 64.0

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
      Proof
      (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (*.f64 (/.f64 D 2) (/.f64 M 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 D M) (*.f64 2 d))) 2) (/.f64 h l))))): 5 points increase in error, 3 points decrease in error
      (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 M D)) (*.f64 2 d)) 2) (/.f64 h l))))): 0 points increase in error, 0 points decrease in error
    3. Taylor expanded in D around 0 61.2

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{0.25 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(\frac{h}{d} \cdot \frac{M \cdot M}{d}\right)\right)}} \]
      Proof
      (*.f64 1/4 (*.f64 (/.f64 D (/.f64 l D)) (*.f64 (/.f64 h d) (/.f64 (*.f64 M M) d)))): 0 points increase in error, 0 points decrease in error
      (*.f64 1/4 (*.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 D D) l)) (*.f64 (/.f64 h d) (/.f64 (*.f64 M M) d)))): 14 points increase in error, 10 points decrease in error
      (*.f64 1/4 (*.f64 (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 D 2)) l) (*.f64 (/.f64 h d) (/.f64 (*.f64 M M) d)))): 0 points increase in error, 0 points decrease in error
      (*.f64 1/4 (*.f64 (/.f64 (pow.f64 D 2) l) (*.f64 (/.f64 h d) (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 M 2)) d)))): 0 points increase in error, 0 points decrease in error
      (*.f64 1/4 (*.f64 (/.f64 (pow.f64 D 2) l) (Rewrite<= times-frac_binary64 (/.f64 (*.f64 h (pow.f64 M 2)) (*.f64 d d))))): 33 points increase in error, 9 points decrease in error
      (*.f64 1/4 (*.f64 (/.f64 (pow.f64 D 2) l) (/.f64 (Rewrite=> *-commutative_binary64 (*.f64 (pow.f64 M 2) h)) (*.f64 d d)))): 0 points increase in error, 0 points decrease in error
      (*.f64 1/4 (*.f64 (/.f64 (pow.f64 D 2) l) (/.f64 (*.f64 (pow.f64 M 2) h) (Rewrite<= unpow2_binary64 (pow.f64 d 2))))): 0 points increase in error, 0 points decrease in error
      (*.f64 1/4 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 (pow.f64 D 2) (*.f64 (pow.f64 M 2) h)) (*.f64 l (pow.f64 d 2))))): 19 points increase in error, 15 points decrease in error
    5. Taylor expanded in D around 0 61.2

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

      \[\leadsto w0 \cdot \sqrt{1 - 0.25 \cdot \color{blue}{\left(\frac{D}{\ell} \cdot \left(\left(\frac{M}{d} \cdot \left(M \cdot h\right)\right) \cdot \frac{D}{d}\right)\right)}} \]
      Proof
      (*.f64 (/.f64 D l) (*.f64 (*.f64 (/.f64 M d) (*.f64 M h)) (/.f64 D d))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 D l) (*.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 (/.f64 M d) M) h)) (/.f64 D d))): 23 points increase in error, 16 points decrease in error
      (*.f64 (/.f64 D l) (*.f64 (*.f64 (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 M M) d)) h) (/.f64 D d))): 23 points increase in error, 3 points decrease in error
      (*.f64 (/.f64 D l) (*.f64 (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 (*.f64 M M) h) d)) (/.f64 D d))): 18 points increase in error, 12 points decrease in error
      (*.f64 (/.f64 D l) (*.f64 (/.f64 (Rewrite=> *-commutative_binary64 (*.f64 h (*.f64 M M))) d) (/.f64 D d))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 D l) (Rewrite<= times-frac_binary64 (/.f64 (*.f64 (*.f64 h (*.f64 M M)) D) (*.f64 d d)))): 28 points increase in error, 7 points decrease in error
      (*.f64 (/.f64 D l) (/.f64 (Rewrite=> associate-*l*_binary64 (*.f64 h (*.f64 (*.f64 M M) D))) (*.f64 d d))): 8 points increase in error, 15 points decrease in error
      (*.f64 (/.f64 D l) (Rewrite=> times-frac_binary64 (*.f64 (/.f64 h d) (/.f64 (*.f64 (*.f64 M M) D) d)))): 10 points increase in error, 31 points decrease in error
      (*.f64 (/.f64 D l) (*.f64 (/.f64 h d) (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 (*.f64 M M) d) D)))): 9 points increase in error, 10 points decrease in error
      (*.f64 (/.f64 D l) (*.f64 (/.f64 h d) (*.f64 (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 M d) M)) D))): 3 points increase in error, 24 points decrease in error
      (*.f64 (/.f64 D l) (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 (/.f64 h d) (*.f64 (/.f64 M d) M)) D))): 17 points increase in error, 11 points decrease in error
      (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 (/.f64 D l) (*.f64 (/.f64 h d) (*.f64 (/.f64 M d) M))) D)): 9 points increase in error, 8 points decrease in error
      (*.f64 (Rewrite=> *-commutative_binary64 (*.f64 (*.f64 (/.f64 h d) (*.f64 (/.f64 M d) M)) (/.f64 D l))) D): 0 points increase in error, 0 points decrease in error
      (Rewrite=> associate-*l*_binary64 (*.f64 (*.f64 (/.f64 h d) (*.f64 (/.f64 M d) M)) (*.f64 (/.f64 D l) D))): 26 points increase in error, 12 points decrease in error
      (*.f64 (*.f64 (/.f64 h d) (*.f64 (/.f64 M d) M)) (Rewrite<= associate-/r/_binary64 (/.f64 D (/.f64 l D)))): 11 points increase in error, 5 points decrease in error
      (Rewrite=> associate-*l*_binary64 (*.f64 (/.f64 h d) (*.f64 (*.f64 (/.f64 M d) M) (/.f64 D (/.f64 l D))))): 14 points increase in error, 15 points decrease in error
      (*.f64 (/.f64 h d) (*.f64 (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 M M) d)) (/.f64 D (/.f64 l D)))): 19 points increase in error, 3 points decrease in error
      (*.f64 (/.f64 h d) (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 (*.f64 M M) (/.f64 D (/.f64 l D))) d))): 16 points increase in error, 10 points decrease in error
      (Rewrite<= times-frac_binary64 (/.f64 (*.f64 h (*.f64 (*.f64 M M) (/.f64 D (/.f64 l D)))) (*.f64 d d))): 22 points increase in error, 15 points decrease in error
      (/.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 h (*.f64 M M)) (/.f64 D (/.f64 l D)))) (*.f64 d d)): 21 points increase in error, 7 points decrease in error
      (Rewrite<= associate-*l/_binary64 (*.f64 (/.f64 (*.f64 h (*.f64 M M)) (*.f64 d d)) (/.f64 D (/.f64 l D)))): 8 points increase in error, 9 points decrease in error
      (*.f64 (/.f64 (*.f64 h (*.f64 M M)) (*.f64 d d)) (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 D D) l))): 10 points increase in error, 8 points decrease in error
      (*.f64 (/.f64 (*.f64 h (*.f64 M M)) (*.f64 d d)) (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 D 2)) l)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= times-frac_binary64 (/.f64 (*.f64 (*.f64 h (*.f64 M M)) (pow.f64 D 2)) (*.f64 (*.f64 d d) l))): 19 points increase in error, 15 points decrease in error
      (/.f64 (*.f64 (Rewrite<= *-commutative_binary64 (*.f64 (*.f64 M M) h)) (pow.f64 D 2)) (*.f64 (*.f64 d d) l)): 0 points increase in error, 0 points decrease in error
      (/.f64 (*.f64 (*.f64 (Rewrite<= unpow2_binary64 (pow.f64 M 2)) h) (pow.f64 D 2)) (*.f64 (*.f64 d d) l)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 (pow.f64 D 2) (*.f64 (pow.f64 M 2) h))) (*.f64 (*.f64 d d) l)): 0 points increase in error, 0 points decrease in error
      (/.f64 (*.f64 (pow.f64 D 2) (*.f64 (pow.f64 M 2) h)) (*.f64 (Rewrite<= unpow2_binary64 (pow.f64 d 2)) l)): 0 points increase in error, 0 points decrease in error

    if -3.99999999999999981e158 < (/.f64 (*.f64 M D) (*.f64 2 d)) < -2.00000000000000013e-68

    1. Initial program 8.7

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

    if -2.00000000000000013e-68 < (/.f64 (*.f64 M D) (*.f64 2 d)) < -2e-191

    1. Initial program 3.9

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
      Proof
      (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (*.f64 (/.f64 D 2) (/.f64 M 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 D M) (*.f64 2 d))) 2) (/.f64 h l))))): 5 points increase in error, 3 points decrease in error
      (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 M D)) (*.f64 2 d)) 2) (/.f64 h l))))): 0 points increase in error, 0 points decrease in error
    3. Taylor expanded in D around 0 33.5

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

      \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{0.25 \cdot \left(\frac{D}{\frac{\ell}{D}} \cdot \left(\frac{h}{d} \cdot \frac{M \cdot M}{d}\right)\right)}} \]
      Proof
      (*.f64 1/4 (*.f64 (/.f64 D (/.f64 l D)) (*.f64 (/.f64 h d) (/.f64 (*.f64 M M) d)))): 0 points increase in error, 0 points decrease in error
      (*.f64 1/4 (*.f64 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 D D) l)) (*.f64 (/.f64 h d) (/.f64 (*.f64 M M) d)))): 14 points increase in error, 10 points decrease in error
      (*.f64 1/4 (*.f64 (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 D 2)) l) (*.f64 (/.f64 h d) (/.f64 (*.f64 M M) d)))): 0 points increase in error, 0 points decrease in error
      (*.f64 1/4 (*.f64 (/.f64 (pow.f64 D 2) l) (*.f64 (/.f64 h d) (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 M 2)) d)))): 0 points increase in error, 0 points decrease in error
      (*.f64 1/4 (*.f64 (/.f64 (pow.f64 D 2) l) (Rewrite<= times-frac_binary64 (/.f64 (*.f64 h (pow.f64 M 2)) (*.f64 d d))))): 33 points increase in error, 9 points decrease in error
      (*.f64 1/4 (*.f64 (/.f64 (pow.f64 D 2) l) (/.f64 (Rewrite=> *-commutative_binary64 (*.f64 (pow.f64 M 2) h)) (*.f64 d d)))): 0 points increase in error, 0 points decrease in error
      (*.f64 1/4 (*.f64 (/.f64 (pow.f64 D 2) l) (/.f64 (*.f64 (pow.f64 M 2) h) (Rewrite<= unpow2_binary64 (pow.f64 d 2))))): 0 points increase in error, 0 points decrease in error
      (*.f64 1/4 (Rewrite<= times-frac_binary64 (/.f64 (*.f64 (pow.f64 D 2) (*.f64 (pow.f64 M 2) h)) (*.f64 l (pow.f64 d 2))))): 19 points increase in error, 15 points decrease in error
    5. Applied egg-rr12.5

      \[\leadsto w0 \cdot \sqrt{1 - 0.25 \cdot \color{blue}{\frac{\left(D \cdot \left(\frac{D}{\ell} \cdot \frac{h}{d}\right)\right) \cdot M}{\frac{d}{M}}}} \]
    6. Taylor expanded in D around 0 33.5

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

      \[\leadsto w0 \cdot \sqrt{1 - 0.25 \cdot \color{blue}{\left(\left(D \cdot M\right) \cdot \frac{M \cdot \left(h \cdot \frac{\frac{D}{d}}{\ell}\right)}{d}\right)}} \]
      Proof
      (*.f64 (*.f64 D M) (/.f64 (*.f64 M (*.f64 h (/.f64 (/.f64 D d) l))) d)): 0 points increase in error, 0 points decrease in error
      (*.f64 (Rewrite=> *-commutative_binary64 (*.f64 M D)) (/.f64 (*.f64 M (*.f64 h (/.f64 (/.f64 D d) l))) d)): 0 points increase in error, 0 points decrease in error
      (*.f64 (*.f64 M D) (/.f64 (*.f64 M (*.f64 h (Rewrite<= associate-/r*_binary64 (/.f64 D (*.f64 d l))))) d)): 11 points increase in error, 12 points decrease in error
      (*.f64 (*.f64 M D) (/.f64 (*.f64 M (*.f64 h (/.f64 D (Rewrite=> *-commutative_binary64 (*.f64 l d))))) d)): 0 points increase in error, 0 points decrease in error
      (*.f64 (*.f64 M D) (/.f64 (*.f64 M (Rewrite<= *-commutative_binary64 (*.f64 (/.f64 D (*.f64 l d)) h))) d)): 0 points increase in error, 0 points decrease in error
      (*.f64 (*.f64 M D) (/.f64 (*.f64 M (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 D h) (*.f64 l d)))) d)): 14 points increase in error, 10 points decrease in error
      (*.f64 (*.f64 M D) (/.f64 (*.f64 M (Rewrite=> times-frac_binary64 (*.f64 (/.f64 D l) (/.f64 h d)))) d)): 17 points increase in error, 25 points decrease in error
      (*.f64 (*.f64 M D) (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 (*.f64 (/.f64 D l) (/.f64 h d)) M)) d)): 0 points increase in error, 0 points decrease in error
      (*.f64 (*.f64 M D) (/.f64 (Rewrite<= associate-*r*_binary64 (*.f64 (/.f64 D l) (*.f64 (/.f64 h d) M))) d)): 16 points increase in error, 12 points decrease in error
      (*.f64 (*.f64 M D) (/.f64 (Rewrite=> associate-*r*_binary64 (*.f64 (*.f64 (/.f64 D l) (/.f64 h d)) M)) d)): 12 points increase in error, 16 points decrease in error
      (*.f64 (*.f64 M D) (Rewrite<= associate-*r/_binary64 (*.f64 (*.f64 (/.f64 D l) (/.f64 h d)) (/.f64 M d)))): 14 points increase in error, 8 points decrease in error
      (Rewrite<= associate-*r*_binary64 (*.f64 M (*.f64 D (*.f64 (*.f64 (/.f64 D l) (/.f64 h d)) (/.f64 M d))))): 9 points increase in error, 20 points decrease in error
      (*.f64 M (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 D (*.f64 (/.f64 D l) (/.f64 h d))) (/.f64 M d)))): 19 points increase in error, 7 points decrease in error
      (Rewrite=> *-commutative_binary64 (*.f64 (*.f64 (*.f64 D (*.f64 (/.f64 D l) (/.f64 h d))) (/.f64 M d)) M)): 0 points increase in error, 0 points decrease in error
      (Rewrite=> associate-*l*_binary64 (*.f64 (*.f64 D (*.f64 (/.f64 D l) (/.f64 h d))) (*.f64 (/.f64 M d) M))): 27 points increase in error, 18 points decrease in error
      (*.f64 (*.f64 D (*.f64 (/.f64 D l) (/.f64 h d))) (Rewrite<= *-commutative_binary64 (*.f64 M (/.f64 M d)))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> associate-*l*_binary64 (*.f64 D (*.f64 (*.f64 (/.f64 D l) (/.f64 h d)) (*.f64 M (/.f64 M d))))): 14 points increase in error, 17 points decrease in error
      (*.f64 D (Rewrite=> associate-*l*_binary64 (*.f64 (/.f64 D l) (*.f64 (/.f64 h d) (*.f64 M (/.f64 M d)))))): 15 points increase in error, 7 points decrease in error
      (*.f64 D (*.f64 (/.f64 D l) (*.f64 (/.f64 h d) (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 M M) d))))): 23 points increase in error, 4 points decrease in error
      (*.f64 D (*.f64 (/.f64 D l) (*.f64 (/.f64 h d) (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 M 2)) d)))): 0 points increase in error, 0 points decrease in error
      (*.f64 D (*.f64 (/.f64 D l) (Rewrite<= times-frac_binary64 (/.f64 (*.f64 h (pow.f64 M 2)) (*.f64 d d))))): 37 points increase in error, 9 points decrease in error
      (*.f64 D (*.f64 (/.f64 D l) (/.f64 (*.f64 h (pow.f64 M 2)) (Rewrite<= unpow2_binary64 (pow.f64 d 2))))): 0 points increase in error, 0 points decrease in error
      (Rewrite=> associate-*r*_binary64 (*.f64 (*.f64 D (/.f64 D l)) (/.f64 (*.f64 h (pow.f64 M 2)) (pow.f64 d 2)))): 16 points increase in error, 6 points decrease in error
      (*.f64 (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 D D) l)) (/.f64 (*.f64 h (pow.f64 M 2)) (pow.f64 d 2))): 9 points increase in error, 6 points decrease in error
      (*.f64 (/.f64 (Rewrite<= unpow2_binary64 (pow.f64 D 2)) l) (/.f64 (*.f64 h (pow.f64 M 2)) (pow.f64 d 2))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (pow.f64 D 2) l) (/.f64 (Rewrite=> *-commutative_binary64 (*.f64 (pow.f64 M 2) h)) (pow.f64 d 2))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= times-frac_binary64 (/.f64 (*.f64 (pow.f64 D 2) (*.f64 (pow.f64 M 2) h)) (*.f64 l (pow.f64 d 2)))): 19 points increase in error, 15 points decrease in error
    8. Taylor expanded in M around 0 10.0

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

      \[\leadsto w0 \cdot \sqrt{1 - 0.25 \cdot \left(\left(D \cdot M\right) \cdot \frac{\color{blue}{\left(h \cdot \frac{D}{d \cdot \ell}\right) \cdot M}}{d}\right)} \]
      Proof
      (*.f64 (*.f64 h (/.f64 D (*.f64 d l))) M): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-*r*_binary64 (*.f64 h (*.f64 (/.f64 D (*.f64 d l)) M))): 24 points increase in error, 26 points decrease in error
      (*.f64 h (Rewrite=> associate-*l/_binary64 (/.f64 (*.f64 D M) (*.f64 d l)))): 27 points increase in error, 28 points decrease in error
      (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 h (*.f64 D M)) (*.f64 d l))): 29 points increase in error, 26 points decrease in error
      (/.f64 (*.f64 h (Rewrite=> *-commutative_binary64 (*.f64 M D))) (*.f64 d l)): 0 points increase in error, 0 points decrease in error
      (/.f64 (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 h M) D)) (*.f64 d l)): 38 points increase in error, 21 points decrease in error
      (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 D (*.f64 h M))) (*.f64 d l)): 0 points increase in error, 0 points decrease in error
      (/.f64 (*.f64 D (*.f64 h M)) (Rewrite<= *-commutative_binary64 (*.f64 l d))): 0 points increase in error, 0 points decrease in error

    if -2e-191 < (/.f64 (*.f64 M D) (*.f64 2 d)) < 4.9999999999999997e-152 or 9.99999999999999934e145 < (/.f64 (*.f64 M D) (*.f64 2 d))

    1. Initial program 14.3

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

      \[\leadsto \color{blue}{w0 \cdot \sqrt{1 - {\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
      Proof
      (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (*.f64 (/.f64 D 2) (/.f64 M 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 D M) (*.f64 2 d))) 2) (/.f64 h l))))): 5 points increase in error, 3 points decrease in error
      (*.f64 w0 (sqrt.f64 (-.f64 1 (*.f64 (pow.f64 (/.f64 (Rewrite<= *-commutative_binary64 (*.f64 M D)) (*.f64 2 d)) 2) (/.f64 h l))))): 0 points increase in error, 0 points decrease in error
    3. Taylor expanded in D around 0 6.8

      \[\leadsto \color{blue}{w0} \]

    if 4.9999999999999997e-152 < (/.f64 (*.f64 M D) (*.f64 2 d)) < 9.99999999999999934e145

    1. Initial program 6.1

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Simplified7.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))))): 5 points increase in error, 1 points decrease in error
  3. Recombined 5 regimes into one program.
  4. Final simplification9.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{D \cdot M}{2 \cdot d} \leq -4 \cdot 10^{+158}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \left(\frac{D}{\ell} \cdot \left(\left(\frac{M}{d} \cdot \left(M \cdot h\right)\right) \cdot \frac{D}{d}\right)\right) \cdot -0.25}\\ \mathbf{elif}\;\frac{D \cdot M}{2 \cdot d} \leq -2 \cdot 10^{-68}:\\ \;\;\;\;w0 \cdot \sqrt{1 - {\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\\ \mathbf{elif}\;\frac{D \cdot M}{2 \cdot d} \leq -2 \cdot 10^{-191}:\\ \;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(\left(D \cdot M\right) \cdot \frac{M \cdot \left(h \cdot \frac{D}{d \cdot \ell}\right)}{d}\right)}\\ \mathbf{elif}\;\frac{D \cdot M}{2 \cdot d} \leq 5 \cdot 10^{-152}:\\ \;\;\;\;w0\\ \mathbf{elif}\;\frac{D \cdot M}{2 \cdot d} \leq 10^{+146}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \]

Alternatives

Alternative 1
Error11.3
Cost14864
\[\begin{array}{l} t_0 := w0 \cdot \sqrt{1 - \frac{{\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot h}{\ell}}\\ \mathbf{if}\;2 \cdot d \leq -2:\\ \;\;\;\;t_0\\ \mathbf{elif}\;2 \cdot d \leq -2 \cdot 10^{-174}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \left(\frac{D}{\ell} \cdot \left(\left(\frac{M}{d} \cdot \left(M \cdot h\right)\right) \cdot \frac{D}{d}\right)\right) \cdot -0.25}\\ \mathbf{elif}\;2 \cdot d \leq 10^{-126}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \frac{\left(M \cdot \left(D \cdot M\right)\right) \cdot \frac{D \cdot h}{d \cdot \ell}}{d} \cdot -0.25}\\ \mathbf{elif}\;2 \cdot d \leq 4 \cdot 10^{+69}:\\ \;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(\left(D \cdot M\right) \cdot \frac{\frac{\frac{D}{d} \cdot \left(M \cdot h\right)}{\ell}}{d}\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error13.3
Cost8272
\[\begin{array}{l} t_0 := \frac{D \cdot h}{d \cdot \ell}\\ \mathbf{if}\;d \leq -1.46 \cdot 10^{-5}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \frac{M \cdot \left(D \cdot t_0\right)}{\frac{d}{M}} \cdot -0.25}\\ \mathbf{elif}\;d \leq -5 \cdot 10^{-177}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \left(\frac{D}{\ell} \cdot \left(\left(\frac{M}{d} \cdot \left(M \cdot h\right)\right) \cdot \frac{D}{d}\right)\right) \cdot -0.25}\\ \mathbf{elif}\;d \leq 4.4 \cdot 10^{-126}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \frac{\left(M \cdot \left(D \cdot M\right)\right) \cdot t_0}{d} \cdot -0.25}\\ \mathbf{elif}\;d \leq 2.5 \cdot 10^{+69}:\\ \;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(\left(D \cdot M\right) \cdot \frac{\frac{\frac{D}{d} \cdot \left(M \cdot h\right)}{\ell}}{d}\right)}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(\left(D \cdot M\right) \cdot \frac{M \cdot \left(h \cdot \frac{D}{d \cdot \ell}\right)}{d}\right)}\\ \end{array} \]
Alternative 3
Error12.3
Cost8140
\[\begin{array}{l} \mathbf{if}\;D \leq 4 \cdot 10^{-146}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \left(\left(D \cdot M\right) \cdot \frac{M \cdot \left(h \cdot \frac{\frac{D}{d}}{\ell}\right)}{d}\right) \cdot -0.25}\\ \mathbf{elif}\;D \leq 5 \cdot 10^{-48}:\\ \;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(\frac{D}{\ell} \cdot \left(\left(D \cdot M\right) \cdot \frac{\frac{h}{d}}{\frac{d}{M}}\right)\right)}\\ \mathbf{elif}\;D \leq 2.05 \cdot 10^{+96}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \left(\frac{D}{\ell} \cdot \left(\left(\frac{M}{d} \cdot \left(M \cdot h\right)\right) \cdot \frac{D}{d}\right)\right) \cdot -0.25}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \]
Alternative 4
Error11.7
Cost7876
\[\begin{array}{l} \mathbf{if}\;M \leq -1.1 \cdot 10^{-23}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \left(\left(D \cdot M\right) \cdot \frac{M \cdot \left(h \cdot \frac{\frac{D}{d}}{\ell}\right)}{d}\right) \cdot -0.25}\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array} \]
Alternative 5
Error10.6
Cost7876
\[\begin{array}{l} \mathbf{if}\;M \leq -2 \cdot 10^{+23}:\\ \;\;\;\;w0 \cdot \sqrt{1 + \left(\left(D \cdot M\right) \cdot \frac{M \cdot \left(h \cdot \frac{\frac{D}{d}}{\ell}\right)}{d}\right) \cdot -0.25}\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - 0.25 \cdot \left(\left(D \cdot M\right) \cdot \frac{\frac{\frac{D}{d} \cdot \left(M \cdot h\right)}{\ell}}{d}\right)}\\ \end{array} \]
Alternative 6
Error13.6
Cost64
\[w0 \]

Error

Reproduce

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