Henrywood and Agarwal, Equation (9a)

Percentage Accurate: 80.8% → 92.4%
Time: 6.0s
Alternatives: 8
Speedup: 0.6×

Specification

?
\[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (* 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) {
	return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(w0, m, d, h, l, d_1)
use fmin_fmax_functions
    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
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))));
}
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))))
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 tmp = code(w0, M, D, h, l, d)
	tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l))));
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]
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 8 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 80.8% accurate, 1.0× speedup?

\[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (* 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) {
	return w0 * sqrt((1.0 - (pow(((M * D) / (2.0 * d)), 2.0) * (h / l))));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(w0, m, d, h, l, d_1)
use fmin_fmax_functions
    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
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))));
}
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))))
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 tmp = code(w0, M, D, h, l, d)
	tmp = w0 * sqrt((1.0 - ((((M * D) / (2.0 * d)) ^ 2.0) * (h / l))));
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]
w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}

Alternative 1: 92.4% accurate, 0.2× speedup?

\[\begin{array}{l} t_0 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\ t_1 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\ t_2 := \frac{t\_1}{\left|d\right|} \cdot t\_0\\ t_3 := \left|w0\right| \cdot \sqrt{1 - {\left(\frac{t\_0 \cdot t\_1}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell}}\\ \mathsf{copysign}\left(1, w0\right) \cdot \begin{array}{l} \mathbf{if}\;t\_3 \leq 2 \cdot 10^{+305}:\\ \;\;\;\;\left|w0\right| \cdot \sqrt{1 - \frac{t\_2 \cdot t\_2}{4} \cdot \frac{h}{\ell}}\\ \mathbf{elif}\;t\_3 \leq \infty:\\ \;\;\;\;\left|t\_1\right| \cdot \left(\left|t\_0\right| \cdot \left(\frac{\left|w0\right|}{\left|d\right|} \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left|w0\right| \cdot \sqrt{\mathsf{fma}\left(\left(\left(h \cdot t\_0\right) \cdot \frac{\frac{t\_1}{-2 \cdot \left|d\right|}}{\ell}\right) \cdot t\_0, \frac{t\_1}{\left|d\right| + \left|d\right|}, 1\right)}\\ \end{array} \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (let* ((t_0 (fmin (fabs M) (fabs D)))
        (t_1 (fmax (fabs M) (fabs D)))
        (t_2 (* (/ t_1 (fabs d)) t_0))
        (t_3
         (*
          (fabs w0)
          (sqrt
           (- 1.0 (* (pow (/ (* t_0 t_1) (* 2.0 (fabs d))) 2.0) (/ h l)))))))
   (*
    (copysign 1.0 w0)
    (if (<= t_3 2e+305)
      (* (fabs w0) (sqrt (- 1.0 (* (/ (* t_2 t_2) 4.0) (/ h l)))))
      (if (<= t_3 INFINITY)
        (*
         (fabs t_1)
         (* (fabs t_0) (* (/ (fabs w0) (fabs d)) (sqrt (* -0.25 (/ h l))))))
        (*
         (fabs w0)
         (sqrt
          (fma
           (* (* (* h t_0) (/ (/ t_1 (* -2.0 (fabs d))) l)) t_0)
           (/ t_1 (+ (fabs d) (fabs d)))
           1.0))))))))
double code(double w0, double M, double D, double h, double l, double d) {
	double t_0 = fmin(fabs(M), fabs(D));
	double t_1 = fmax(fabs(M), fabs(D));
	double t_2 = (t_1 / fabs(d)) * t_0;
	double t_3 = fabs(w0) * sqrt((1.0 - (pow(((t_0 * t_1) / (2.0 * fabs(d))), 2.0) * (h / l))));
	double tmp;
	if (t_3 <= 2e+305) {
		tmp = fabs(w0) * sqrt((1.0 - (((t_2 * t_2) / 4.0) * (h / l))));
	} else if (t_3 <= ((double) INFINITY)) {
		tmp = fabs(t_1) * (fabs(t_0) * ((fabs(w0) / fabs(d)) * sqrt((-0.25 * (h / l)))));
	} else {
		tmp = fabs(w0) * sqrt(fma((((h * t_0) * ((t_1 / (-2.0 * fabs(d))) / l)) * t_0), (t_1 / (fabs(d) + fabs(d))), 1.0));
	}
	return copysign(1.0, w0) * tmp;
}
function code(w0, M, D, h, l, d)
	t_0 = fmin(abs(M), abs(D))
	t_1 = fmax(abs(M), abs(D))
	t_2 = Float64(Float64(t_1 / abs(d)) * t_0)
	t_3 = Float64(abs(w0) * sqrt(Float64(1.0 - Float64((Float64(Float64(t_0 * t_1) / Float64(2.0 * abs(d))) ^ 2.0) * Float64(h / l)))))
	tmp = 0.0
	if (t_3 <= 2e+305)
		tmp = Float64(abs(w0) * sqrt(Float64(1.0 - Float64(Float64(Float64(t_2 * t_2) / 4.0) * Float64(h / l)))));
	elseif (t_3 <= Inf)
		tmp = Float64(abs(t_1) * Float64(abs(t_0) * Float64(Float64(abs(w0) / abs(d)) * sqrt(Float64(-0.25 * Float64(h / l))))));
	else
		tmp = Float64(abs(w0) * sqrt(fma(Float64(Float64(Float64(h * t_0) * Float64(Float64(t_1 / Float64(-2.0 * abs(d))) / l)) * t_0), Float64(t_1 / Float64(abs(d) + abs(d))), 1.0)));
	end
	return Float64(copysign(1.0, w0) * tmp)
end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 / N[Abs[d], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(t$95$0 * t$95$1), $MachinePrecision] / N[(2.0 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$3, 2e+305], N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(1.0 - N[(N[(N[(t$95$2 * t$95$2), $MachinePrecision] / 4.0), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(N[Abs[t$95$1], $MachinePrecision] * N[(N[Abs[t$95$0], $MachinePrecision] * N[(N[(N[Abs[w0], $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(-0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(N[(N[(N[(h * t$95$0), $MachinePrecision] * N[(N[(t$95$1 / N[(-2.0 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(t$95$1 / N[(N[Abs[d], $MachinePrecision] + N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_1 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := \frac{t\_1}{\left|d\right|} \cdot t\_0\\
t_3 := \left|w0\right| \cdot \sqrt{1 - {\left(\frac{t\_0 \cdot t\_1}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell}}\\
\mathsf{copysign}\left(1, w0\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_3 \leq 2 \cdot 10^{+305}:\\
\;\;\;\;\left|w0\right| \cdot \sqrt{1 - \frac{t\_2 \cdot t\_2}{4} \cdot \frac{h}{\ell}}\\

\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;\left|t\_1\right| \cdot \left(\left|t\_0\right| \cdot \left(\frac{\left|w0\right|}{\left|d\right|} \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left|w0\right| \cdot \sqrt{\mathsf{fma}\left(\left(\left(h \cdot t\_0\right) \cdot \frac{\frac{t\_1}{-2 \cdot \left|d\right|}}{\ell}\right) \cdot t\_0, \frac{t\_1}{\left|d\right| + \left|d\right|}, 1\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 w0 (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))))) < 1.9999999999999999e305

    1. Initial program 80.8%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. lift-pow.f64N/A

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

        \[\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}} \]
      3. lift-/.f64N/A

        \[\leadsto w0 \cdot \sqrt{1 - \left(\color{blue}{\frac{M \cdot D}{2 \cdot d}} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{h}{\ell}} \]
      4. lift-*.f64N/A

        \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{M \cdot D}{\color{blue}{2 \cdot d}} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{h}{\ell}} \]
      5. *-commutativeN/A

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

        \[\leadsto w0 \cdot \sqrt{1 - \left(\color{blue}{\frac{\frac{M \cdot D}{d}}{2}} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{h}{\ell}} \]
      7. lift-/.f64N/A

        \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{\frac{M \cdot D}{d}}{2} \cdot \color{blue}{\frac{M \cdot D}{2 \cdot d}}\right) \cdot \frac{h}{\ell}} \]
      8. lift-*.f64N/A

        \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{\frac{M \cdot D}{d}}{2} \cdot \frac{M \cdot D}{\color{blue}{2 \cdot d}}\right) \cdot \frac{h}{\ell}} \]
      9. *-commutativeN/A

        \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{\frac{M \cdot D}{d}}{2} \cdot \frac{M \cdot D}{\color{blue}{d \cdot 2}}\right) \cdot \frac{h}{\ell}} \]
      10. associate-/r*N/A

        \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{\frac{M \cdot D}{d}}{2} \cdot \color{blue}{\frac{\frac{M \cdot D}{d}}{2}}\right) \cdot \frac{h}{\ell}} \]
      11. frac-timesN/A

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{d}}{2 \cdot 2}} \cdot \frac{h}{\ell}} \]
      12. metadata-evalN/A

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{d}}{2 \cdot \color{blue}{\left(1 + 1\right)}} \cdot \frac{h}{\ell}} \]
      13. cosh-0-revN/A

        \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{d}}{2 \cdot \left(\color{blue}{\cosh 0} + 1\right)} \cdot \frac{h}{\ell}} \]
      14. lower-/.f64N/A

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{d}}{2 \cdot \left(\cosh 0 + 1\right)}} \cdot \frac{h}{\ell}} \]
    3. Applied rewrites80.9%

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

    if 1.9999999999999999e305 < (*.f64 w0 (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))))) < +inf.0

    1. Initial program 80.8%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Taylor expanded in d around 0

      \[\leadsto \color{blue}{\frac{w0 \cdot \sqrt{\mathsf{neg}\left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)}}{d}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{w0 \cdot \sqrt{\mathsf{neg}\left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)}}{\color{blue}{d}} \]
    4. Applied rewrites9.8%

      \[\leadsto \color{blue}{\frac{w0 \cdot \sqrt{-0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{w0 \cdot \sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{\color{blue}{d}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{w0 \cdot \sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d} \]
      3. associate-/l*N/A

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

        \[\leadsto \frac{\sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d} \cdot \color{blue}{w0} \]
      5. lower-*.f64N/A

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

      \[\leadsto \frac{\sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot -0.25}}{d} \cdot \color{blue}{w0} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot \frac{-1}{4}}}{d} \cdot \color{blue}{w0} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot \frac{-1}{4}}}{d} \cdot w0 \]
      3. associate-*l/N/A

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

        \[\leadsto \sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot \frac{-1}{4}} \cdot \color{blue}{\frac{w0}{d}} \]
      5. lower-*.f64N/A

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

      \[\leadsto \left(\left|D \cdot M\right| \cdot \sqrt{\frac{h}{\ell} \cdot -0.25}\right) \cdot \color{blue}{\frac{w0}{d}} \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\left|D \cdot M\right| \cdot \sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}\right) \cdot \color{blue}{\frac{w0}{d}} \]
      2. lift-*.f64N/A

        \[\leadsto \left(\left|D \cdot M\right| \cdot \sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}\right) \cdot \frac{\color{blue}{w0}}{d} \]
      3. associate-*l*N/A

        \[\leadsto \left|D \cdot M\right| \cdot \color{blue}{\left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)} \]
      4. lift-fabs.f64N/A

        \[\leadsto \left|D \cdot M\right| \cdot \left(\color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right) \]
      5. lift-*.f64N/A

        \[\leadsto \left|D \cdot M\right| \cdot \left(\sqrt{\color{blue}{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right) \]
      6. fabs-mulN/A

        \[\leadsto \left(\left|D\right| \cdot \left|M\right|\right) \cdot \left(\color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right) \]
      7. associate-*l*N/A

        \[\leadsto \left|D\right| \cdot \color{blue}{\left(\left|M\right| \cdot \left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)\right)} \]
      8. lower-*.f64N/A

        \[\leadsto \left|D\right| \cdot \color{blue}{\left(\left|M\right| \cdot \left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)\right)} \]
      9. lower-fabs.f64N/A

        \[\leadsto \left|D\right| \cdot \left(\color{blue}{\left|M\right|} \cdot \left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)\right) \]
      10. lower-*.f64N/A

        \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \color{blue}{\left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)}\right) \]
      11. lower-fabs.f64N/A

        \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}}\right)\right) \]
      13. lower-*.f6413.4%

        \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \color{blue}{\sqrt{\frac{h}{\ell} \cdot -0.25}}\right)\right) \]
      14. lift-*.f64N/A

        \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \sqrt{\frac{-1}{4} \cdot \frac{h}{\ell}}\right)\right) \]
      16. lower-*.f6413.4%

        \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right) \]
    10. Applied rewrites13.4%

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

    if +inf.0 < (*.f64 w0 (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)))))

    1. Initial program 80.8%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto w0 \cdot \sqrt{\color{blue}{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
      2. lift-*.f64N/A

        \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
      3. fp-cancel-sub-sign-invN/A

        \[\leadsto w0 \cdot \sqrt{\color{blue}{1 + \left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)\right) \cdot \frac{h}{\ell}}} \]
      4. +-commutativeN/A

        \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)\right) \cdot \frac{h}{\ell} + 1}} \]
      5. distribute-lft-neg-outN/A

        \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} + 1} \]
      6. distribute-rgt-neg-inN/A

        \[\leadsto w0 \cdot \sqrt{\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\mathsf{neg}\left(\frac{h}{\ell}\right)\right)} + 1} \]
      7. lift-/.f64N/A

        \[\leadsto w0 \cdot \sqrt{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\mathsf{neg}\left(\color{blue}{\frac{h}{\ell}}\right)\right) + 1} \]
      8. distribute-neg-frac2N/A

        \[\leadsto w0 \cdot \sqrt{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \color{blue}{\frac{h}{\mathsf{neg}\left(\ell\right)}} + 1} \]
      9. associate-/l*N/A

        \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot h}{\mathsf{neg}\left(\ell\right)}} + 1} \]
      10. lift-pow.f64N/A

        \[\leadsto w0 \cdot \sqrt{\frac{\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}} \cdot h}{\mathsf{neg}\left(\ell\right)} + 1} \]
      11. unpow2N/A

        \[\leadsto w0 \cdot \sqrt{\frac{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \cdot h}{\mathsf{neg}\left(\ell\right)} + 1} \]
      12. associate-*l*N/A

        \[\leadsto w0 \cdot \sqrt{\frac{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \left(\frac{M \cdot D}{2 \cdot d} \cdot h\right)}}{\mathsf{neg}\left(\ell\right)} + 1} \]
      13. associate-/l*N/A

        \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \frac{\frac{M \cdot D}{2 \cdot d} \cdot h}{\mathsf{neg}\left(\ell\right)}} + 1} \]
      14. lower-fma.f64N/A

        \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \frac{\frac{M \cdot D}{2 \cdot d} \cdot h}{\mathsf{neg}\left(\ell\right)}, 1\right)}} \]
    3. Applied rewrites84.0%

      \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\frac{M}{d + d} \cdot D, \frac{\frac{D}{d + d} \cdot \left(M \cdot h\right)}{-\ell}, 1\right)}} \]
    4. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\frac{M}{d + d} \cdot D\right) \cdot \frac{\frac{D}{d + d} \cdot \left(M \cdot h\right)}{-\ell} + 1}} \]
      2. *-commutativeN/A

        \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{\frac{D}{d + d} \cdot \left(M \cdot h\right)}{-\ell} \cdot \left(\frac{M}{d + d} \cdot D\right)} + 1} \]
      3. lift-*.f64N/A

        \[\leadsto w0 \cdot \sqrt{\frac{\frac{D}{d + d} \cdot \left(M \cdot h\right)}{-\ell} \cdot \color{blue}{\left(\frac{M}{d + d} \cdot D\right)} + 1} \]
      4. lift-/.f64N/A

        \[\leadsto w0 \cdot \sqrt{\frac{\frac{D}{d + d} \cdot \left(M \cdot h\right)}{-\ell} \cdot \left(\color{blue}{\frac{M}{d + d}} \cdot D\right) + 1} \]
      5. associate-*l/N/A

        \[\leadsto w0 \cdot \sqrt{\frac{\frac{D}{d + d} \cdot \left(M \cdot h\right)}{-\ell} \cdot \color{blue}{\frac{M \cdot D}{d + d}} + 1} \]
      6. associate-/l*N/A

        \[\leadsto w0 \cdot \sqrt{\frac{\frac{D}{d + d} \cdot \left(M \cdot h\right)}{-\ell} \cdot \color{blue}{\left(M \cdot \frac{D}{d + d}\right)} + 1} \]
      7. lift-/.f64N/A

        \[\leadsto w0 \cdot \sqrt{\frac{\frac{D}{d + d} \cdot \left(M \cdot h\right)}{-\ell} \cdot \left(M \cdot \color{blue}{\frac{D}{d + d}}\right) + 1} \]
      8. associate-*r*N/A

        \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\frac{\frac{D}{d + d} \cdot \left(M \cdot h\right)}{-\ell} \cdot M\right) \cdot \frac{D}{d + d}} + 1} \]
      9. lower-fma.f64N/A

        \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\frac{\frac{D}{d + d} \cdot \left(M \cdot h\right)}{-\ell} \cdot M, \frac{D}{d + d}, 1\right)}} \]
    5. Applied rewrites83.8%

      \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\left(\left(h \cdot M\right) \cdot \frac{\frac{D}{-2 \cdot d}}{\ell}\right) \cdot M, \frac{D}{d + d}, 1\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 2: 91.8% accurate, 0.2× speedup?

\[\begin{array}{l} t_0 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\ t_1 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\ t_2 := {\left(\frac{t\_1 \cdot t\_0}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell}\\ t_3 := t\_0 \cdot t\_1\\ \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;\left|t\_0\right| \cdot \left(\left|t\_1\right| \cdot \left(\frac{w0}{\left|d\right|} \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right)\\ \mathbf{elif}\;t\_2 \leq -2 \cdot 10^{+30}:\\ \;\;\;\;\frac{\left|t\_3\right| \cdot \sqrt{\frac{h}{\ell} \cdot -0.25}}{\left|d\right|} \cdot w0\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-30}:\\ \;\;\;\;w0 \cdot 1\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \left(\frac{0.25 \cdot \left(t\_3 \cdot h\right)}{\left|d\right| \cdot \left|d\right|} \cdot \frac{t\_1}{\ell}\right) \cdot t\_0}\\ \end{array} \]
(FPCore (w0 M D h l d)
 :precision binary64
 (let* ((t_0 (fmax (fabs M) (fabs D)))
        (t_1 (fmin (fabs M) (fabs D)))
        (t_2 (* (pow (/ (* t_1 t_0) (* 2.0 (fabs d))) 2.0) (/ h l)))
        (t_3 (* t_0 t_1)))
   (if (<= t_2 (- INFINITY))
     (* (fabs t_0) (* (fabs t_1) (* (/ w0 (fabs d)) (sqrt (* -0.25 (/ h l))))))
     (if (<= t_2 -2e+30)
       (* (/ (* (fabs t_3) (sqrt (* (/ h l) -0.25))) (fabs d)) w0)
       (if (<= t_2 5e-30)
         (* w0 1.0)
         (*
          w0
          (sqrt
           (-
            1.0
            (*
             (* (/ (* 0.25 (* t_3 h)) (* (fabs d) (fabs d))) (/ t_1 l))
             t_0)))))))))
double code(double w0, double M, double D, double h, double l, double d) {
	double t_0 = fmax(fabs(M), fabs(D));
	double t_1 = fmin(fabs(M), fabs(D));
	double t_2 = pow(((t_1 * t_0) / (2.0 * fabs(d))), 2.0) * (h / l);
	double t_3 = t_0 * t_1;
	double tmp;
	if (t_2 <= -((double) INFINITY)) {
		tmp = fabs(t_0) * (fabs(t_1) * ((w0 / fabs(d)) * sqrt((-0.25 * (h / l)))));
	} else if (t_2 <= -2e+30) {
		tmp = ((fabs(t_3) * sqrt(((h / l) * -0.25))) / fabs(d)) * w0;
	} else if (t_2 <= 5e-30) {
		tmp = w0 * 1.0;
	} else {
		tmp = w0 * sqrt((1.0 - ((((0.25 * (t_3 * h)) / (fabs(d) * fabs(d))) * (t_1 / l)) * t_0)));
	}
	return tmp;
}
public static double code(double w0, double M, double D, double h, double l, double d) {
	double t_0 = fmax(Math.abs(M), Math.abs(D));
	double t_1 = fmin(Math.abs(M), Math.abs(D));
	double t_2 = Math.pow(((t_1 * t_0) / (2.0 * Math.abs(d))), 2.0) * (h / l);
	double t_3 = t_0 * t_1;
	double tmp;
	if (t_2 <= -Double.POSITIVE_INFINITY) {
		tmp = Math.abs(t_0) * (Math.abs(t_1) * ((w0 / Math.abs(d)) * Math.sqrt((-0.25 * (h / l)))));
	} else if (t_2 <= -2e+30) {
		tmp = ((Math.abs(t_3) * Math.sqrt(((h / l) * -0.25))) / Math.abs(d)) * w0;
	} else if (t_2 <= 5e-30) {
		tmp = w0 * 1.0;
	} else {
		tmp = w0 * Math.sqrt((1.0 - ((((0.25 * (t_3 * h)) / (Math.abs(d) * Math.abs(d))) * (t_1 / l)) * t_0)));
	}
	return tmp;
}
def code(w0, M, D, h, l, d):
	t_0 = fmax(math.fabs(M), math.fabs(D))
	t_1 = fmin(math.fabs(M), math.fabs(D))
	t_2 = math.pow(((t_1 * t_0) / (2.0 * math.fabs(d))), 2.0) * (h / l)
	t_3 = t_0 * t_1
	tmp = 0
	if t_2 <= -math.inf:
		tmp = math.fabs(t_0) * (math.fabs(t_1) * ((w0 / math.fabs(d)) * math.sqrt((-0.25 * (h / l)))))
	elif t_2 <= -2e+30:
		tmp = ((math.fabs(t_3) * math.sqrt(((h / l) * -0.25))) / math.fabs(d)) * w0
	elif t_2 <= 5e-30:
		tmp = w0 * 1.0
	else:
		tmp = w0 * math.sqrt((1.0 - ((((0.25 * (t_3 * h)) / (math.fabs(d) * math.fabs(d))) * (t_1 / l)) * t_0)))
	return tmp
function code(w0, M, D, h, l, d)
	t_0 = fmax(abs(M), abs(D))
	t_1 = fmin(abs(M), abs(D))
	t_2 = Float64((Float64(Float64(t_1 * t_0) / Float64(2.0 * abs(d))) ^ 2.0) * Float64(h / l))
	t_3 = Float64(t_0 * t_1)
	tmp = 0.0
	if (t_2 <= Float64(-Inf))
		tmp = Float64(abs(t_0) * Float64(abs(t_1) * Float64(Float64(w0 / abs(d)) * sqrt(Float64(-0.25 * Float64(h / l))))));
	elseif (t_2 <= -2e+30)
		tmp = Float64(Float64(Float64(abs(t_3) * sqrt(Float64(Float64(h / l) * -0.25))) / abs(d)) * w0);
	elseif (t_2 <= 5e-30)
		tmp = Float64(w0 * 1.0);
	else
		tmp = Float64(w0 * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(0.25 * Float64(t_3 * h)) / Float64(abs(d) * abs(d))) * Float64(t_1 / l)) * t_0))));
	end
	return tmp
end
function tmp_2 = code(w0, M, D, h, l, d)
	t_0 = max(abs(M), abs(D));
	t_1 = min(abs(M), abs(D));
	t_2 = (((t_1 * t_0) / (2.0 * abs(d))) ^ 2.0) * (h / l);
	t_3 = t_0 * t_1;
	tmp = 0.0;
	if (t_2 <= -Inf)
		tmp = abs(t_0) * (abs(t_1) * ((w0 / abs(d)) * sqrt((-0.25 * (h / l)))));
	elseif (t_2 <= -2e+30)
		tmp = ((abs(t_3) * sqrt(((h / l) * -0.25))) / abs(d)) * w0;
	elseif (t_2 <= 5e-30)
		tmp = w0 * 1.0;
	else
		tmp = w0 * sqrt((1.0 - ((((0.25 * (t_3 * h)) / (abs(d) * abs(d))) * (t_1 / l)) * t_0)));
	end
	tmp_2 = tmp;
end
code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[N[(N[(t$95$1 * t$95$0), $MachinePrecision] / N[(2.0 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[Abs[t$95$0], $MachinePrecision] * N[(N[Abs[t$95$1], $MachinePrecision] * N[(N[(w0 / N[Abs[d], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(-0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -2e+30], N[(N[(N[(N[Abs[t$95$3], $MachinePrecision] * N[Sqrt[N[(N[(h / l), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision] * w0), $MachinePrecision], If[LessEqual[t$95$2, 5e-30], N[(w0 * 1.0), $MachinePrecision], N[(w0 * N[Sqrt[N[(1.0 - N[(N[(N[(N[(0.25 * N[(t$95$3 * h), $MachinePrecision]), $MachinePrecision] / N[(N[Abs[d], $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
t_0 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
t_1 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
t_2 := {\left(\frac{t\_1 \cdot t\_0}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell}\\
t_3 := t\_0 \cdot t\_1\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\left|t\_0\right| \cdot \left(\left|t\_1\right| \cdot \left(\frac{w0}{\left|d\right|} \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right)\\

\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{+30}:\\
\;\;\;\;\frac{\left|t\_3\right| \cdot \sqrt{\frac{h}{\ell} \cdot -0.25}}{\left|d\right|} \cdot w0\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-30}:\\
\;\;\;\;w0 \cdot 1\\

\mathbf{else}:\\
\;\;\;\;w0 \cdot \sqrt{1 - \left(\frac{0.25 \cdot \left(t\_3 \cdot h\right)}{\left|d\right| \cdot \left|d\right|} \cdot \frac{t\_1}{\ell}\right) \cdot t\_0}\\


\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -inf.0

    1. Initial program 80.8%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Taylor expanded in d around 0

      \[\leadsto \color{blue}{\frac{w0 \cdot \sqrt{\mathsf{neg}\left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)}}{d}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{w0 \cdot \sqrt{\mathsf{neg}\left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)}}{\color{blue}{d}} \]
    4. Applied rewrites9.8%

      \[\leadsto \color{blue}{\frac{w0 \cdot \sqrt{-0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{w0 \cdot \sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{\color{blue}{d}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{w0 \cdot \sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d} \]
      3. associate-/l*N/A

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

        \[\leadsto \frac{\sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d} \cdot \color{blue}{w0} \]
      5. lower-*.f64N/A

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

      \[\leadsto \frac{\sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot -0.25}}{d} \cdot \color{blue}{w0} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot \frac{-1}{4}}}{d} \cdot \color{blue}{w0} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot \frac{-1}{4}}}{d} \cdot w0 \]
      3. associate-*l/N/A

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

        \[\leadsto \sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot \frac{-1}{4}} \cdot \color{blue}{\frac{w0}{d}} \]
      5. lower-*.f64N/A

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

      \[\leadsto \left(\left|D \cdot M\right| \cdot \sqrt{\frac{h}{\ell} \cdot -0.25}\right) \cdot \color{blue}{\frac{w0}{d}} \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\left|D \cdot M\right| \cdot \sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}\right) \cdot \color{blue}{\frac{w0}{d}} \]
      2. lift-*.f64N/A

        \[\leadsto \left(\left|D \cdot M\right| \cdot \sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}\right) \cdot \frac{\color{blue}{w0}}{d} \]
      3. associate-*l*N/A

        \[\leadsto \left|D \cdot M\right| \cdot \color{blue}{\left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)} \]
      4. lift-fabs.f64N/A

        \[\leadsto \left|D \cdot M\right| \cdot \left(\color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right) \]
      5. lift-*.f64N/A

        \[\leadsto \left|D \cdot M\right| \cdot \left(\sqrt{\color{blue}{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right) \]
      6. fabs-mulN/A

        \[\leadsto \left(\left|D\right| \cdot \left|M\right|\right) \cdot \left(\color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right) \]
      7. associate-*l*N/A

        \[\leadsto \left|D\right| \cdot \color{blue}{\left(\left|M\right| \cdot \left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)\right)} \]
      8. lower-*.f64N/A

        \[\leadsto \left|D\right| \cdot \color{blue}{\left(\left|M\right| \cdot \left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)\right)} \]
      9. lower-fabs.f64N/A

        \[\leadsto \left|D\right| \cdot \left(\color{blue}{\left|M\right|} \cdot \left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)\right) \]
      10. lower-*.f64N/A

        \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \color{blue}{\left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)}\right) \]
      11. lower-fabs.f64N/A

        \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}}\right)\right) \]
      13. lower-*.f6413.4%

        \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \color{blue}{\sqrt{\frac{h}{\ell} \cdot -0.25}}\right)\right) \]
      14. lift-*.f64N/A

        \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \sqrt{\frac{-1}{4} \cdot \frac{h}{\ell}}\right)\right) \]
      16. lower-*.f6413.4%

        \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right) \]
    10. Applied rewrites13.4%

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

    if -inf.0 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -2e30

    1. Initial program 80.8%

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
    2. Taylor expanded in d around 0

      \[\leadsto \color{blue}{\frac{w0 \cdot \sqrt{\mathsf{neg}\left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)}}{d}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{w0 \cdot \sqrt{\mathsf{neg}\left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)}}{\color{blue}{d}} \]
    4. Applied rewrites9.8%

      \[\leadsto \color{blue}{\frac{w0 \cdot \sqrt{-0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{w0 \cdot \sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{\color{blue}{d}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{w0 \cdot \sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d} \]
      3. associate-/l*N/A

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

        \[\leadsto \frac{\sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d} \cdot \color{blue}{w0} \]
      5. lower-*.f64N/A

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

      \[\leadsto \frac{\sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot -0.25}}{d} \cdot \color{blue}{w0} \]
    7. Step-by-step derivation
      1. Applied rewrites13.7%

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

      if -2e30 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < 4.99999999999999972e-30

      1. Initial program 80.8%

        \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
      2. Taylor expanded in M around 0

        \[\leadsto w0 \cdot \color{blue}{1} \]
      3. Step-by-step derivation
        1. Applied rewrites68.0%

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

        if 4.99999999999999972e-30 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))

        1. Initial program 80.8%

          \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
        2. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
          2. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h}{\ell} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}} \]
          3. lift-pow.f64N/A

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

            \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}} \]
          5. lift-/.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \left(\color{blue}{\frac{M \cdot D}{2 \cdot d}} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \]
          6. mult-flipN/A

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

            \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \color{blue}{\left(\left(M \cdot D\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)\right)}} \]
          8. associate-*r*N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{h}{\ell} \cdot \left(M \cdot D\right)\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}} \]
          9. lower-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{h}{\ell} \cdot \left(M \cdot D\right)\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}} \]
          10. lower-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{h}{\ell} \cdot \left(M \cdot D\right)\right)} \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \]
          11. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \color{blue}{\left(M \cdot D\right)}\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \]
          12. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \color{blue}{\left(D \cdot M\right)}\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \]
          13. lower-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \color{blue}{\left(D \cdot M\right)}\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \]
          14. lift-/.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \color{blue}{\frac{M \cdot D}{2 \cdot d}}\right)} \]
          15. mult-flipN/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \color{blue}{\left(\left(M \cdot D\right) \cdot \frac{1}{2 \cdot d}\right)}\right)} \]
          16. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \color{blue}{\left(\frac{1}{2 \cdot d} \cdot \left(M \cdot D\right)\right)}\right)} \]
          17. associate-*r*N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \color{blue}{\left(\left(\frac{1}{2 \cdot d} \cdot \frac{1}{2 \cdot d}\right) \cdot \left(M \cdot D\right)\right)}} \]
          18. lower-*.f64N/A

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

          \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \left(\frac{0.25}{d \cdot d} \cdot \left(D \cdot M\right)\right)}} \]
        4. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \left(\frac{\frac{1}{4}}{d \cdot d} \cdot \left(D \cdot M\right)\right)}} \]
          2. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \color{blue}{\left(\frac{\frac{1}{4}}{d \cdot d} \cdot \left(D \cdot M\right)\right)}} \]
          3. associate-*r*N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \frac{\frac{1}{4}}{d \cdot d}\right) \cdot \left(D \cdot M\right)}} \]
          4. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \frac{\frac{1}{4}}{d \cdot d}\right) \cdot \color{blue}{\left(D \cdot M\right)}} \]
          5. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \frac{\frac{1}{4}}{d \cdot d}\right) \cdot \color{blue}{\left(M \cdot D\right)}} \]
          6. associate-*r*N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\left(\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \frac{\frac{1}{4}}{d \cdot d}\right) \cdot M\right) \cdot D}} \]
          7. lower-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\left(\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \frac{\frac{1}{4}}{d \cdot d}\right) \cdot M\right) \cdot D}} \]
        5. Applied rewrites73.7%

          \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{\left(\left(D \cdot M\right) \cdot h\right) \cdot 0.25}{\ell \cdot \left(d \cdot d\right)} \cdot M\right) \cdot D}} \]
        6. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}}{\ell \cdot \left(d \cdot d\right)} \cdot M\right)} \cdot D} \]
          2. lift-/.f64N/A

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

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\left(\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}\right) \cdot M}{\ell \cdot \left(d \cdot d\right)}} \cdot D} \]
          4. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \frac{\left(\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}\right) \cdot M}{\color{blue}{\ell \cdot \left(d \cdot d\right)}} \cdot D} \]
          5. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \frac{\left(\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}\right) \cdot M}{\color{blue}{\left(d \cdot d\right) \cdot \ell}} \cdot D} \]
          6. times-fracN/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}}{d \cdot d} \cdot \frac{M}{\ell}\right)} \cdot D} \]
          7. lower-*.f64N/A

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

            \[\leadsto w0 \cdot \sqrt{1 - \left(\color{blue}{\frac{\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}}{d \cdot d}} \cdot \frac{M}{\ell}\right) \cdot D} \]
          9. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{\color{blue}{\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}}}{d \cdot d} \cdot \frac{M}{\ell}\right) \cdot D} \]
          10. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{\color{blue}{\frac{1}{4} \cdot \left(\left(D \cdot M\right) \cdot h\right)}}{d \cdot d} \cdot \frac{M}{\ell}\right) \cdot D} \]
          11. lower-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{\color{blue}{\frac{1}{4} \cdot \left(\left(D \cdot M\right) \cdot h\right)}}{d \cdot d} \cdot \frac{M}{\ell}\right) \cdot D} \]
          12. lower-/.f6472.8%

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{0.25 \cdot \left(\left(D \cdot M\right) \cdot h\right)}{d \cdot d} \cdot \color{blue}{\frac{M}{\ell}}\right) \cdot D} \]
        7. Applied rewrites72.8%

          \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{0.25 \cdot \left(\left(D \cdot M\right) \cdot h\right)}{d \cdot d} \cdot \frac{M}{\ell}\right)} \cdot D} \]
      4. Recombined 4 regimes into one program.
      5. Add Preprocessing

      Alternative 3: 91.5% accurate, 0.2× speedup?

      \[\begin{array}{l} t_0 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\ t_1 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\ t_2 := \frac{t\_1}{\left|d\right|} \cdot t\_0\\ t_3 := \left|w0\right| \cdot \sqrt{1 - {\left(\frac{t\_0 \cdot t\_1}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell}}\\ \mathsf{copysign}\left(1, w0\right) \cdot \begin{array}{l} \mathbf{if}\;t\_3 \leq 2 \cdot 10^{+305}:\\ \;\;\;\;\left|w0\right| \cdot \sqrt{1 - \frac{t\_2 \cdot t\_2}{4} \cdot \frac{h}{\ell}}\\ \mathbf{elif}\;t\_3 \leq \infty:\\ \;\;\;\;\left|t\_1\right| \cdot \left(\left|t\_0\right| \cdot \left(\frac{\left|w0\right|}{\left|d\right|} \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left|w0\right| \cdot \sqrt{1 - \left(\frac{0.25 \cdot \left(\left(t\_1 \cdot t\_0\right) \cdot h\right)}{\left|d\right| \cdot \left|d\right|} \cdot \frac{t\_0}{\ell}\right) \cdot t\_1}\\ \end{array} \end{array} \]
      (FPCore (w0 M D h l d)
       :precision binary64
       (let* ((t_0 (fmin (fabs M) (fabs D)))
              (t_1 (fmax (fabs M) (fabs D)))
              (t_2 (* (/ t_1 (fabs d)) t_0))
              (t_3
               (*
                (fabs w0)
                (sqrt
                 (- 1.0 (* (pow (/ (* t_0 t_1) (* 2.0 (fabs d))) 2.0) (/ h l)))))))
         (*
          (copysign 1.0 w0)
          (if (<= t_3 2e+305)
            (* (fabs w0) (sqrt (- 1.0 (* (/ (* t_2 t_2) 4.0) (/ h l)))))
            (if (<= t_3 INFINITY)
              (*
               (fabs t_1)
               (* (fabs t_0) (* (/ (fabs w0) (fabs d)) (sqrt (* -0.25 (/ h l))))))
              (*
               (fabs w0)
               (sqrt
                (-
                 1.0
                 (*
                  (* (/ (* 0.25 (* (* t_1 t_0) h)) (* (fabs d) (fabs d))) (/ t_0 l))
                  t_1)))))))))
      double code(double w0, double M, double D, double h, double l, double d) {
      	double t_0 = fmin(fabs(M), fabs(D));
      	double t_1 = fmax(fabs(M), fabs(D));
      	double t_2 = (t_1 / fabs(d)) * t_0;
      	double t_3 = fabs(w0) * sqrt((1.0 - (pow(((t_0 * t_1) / (2.0 * fabs(d))), 2.0) * (h / l))));
      	double tmp;
      	if (t_3 <= 2e+305) {
      		tmp = fabs(w0) * sqrt((1.0 - (((t_2 * t_2) / 4.0) * (h / l))));
      	} else if (t_3 <= ((double) INFINITY)) {
      		tmp = fabs(t_1) * (fabs(t_0) * ((fabs(w0) / fabs(d)) * sqrt((-0.25 * (h / l)))));
      	} else {
      		tmp = fabs(w0) * sqrt((1.0 - ((((0.25 * ((t_1 * t_0) * h)) / (fabs(d) * fabs(d))) * (t_0 / l)) * t_1)));
      	}
      	return copysign(1.0, w0) * tmp;
      }
      
      public static double code(double w0, double M, double D, double h, double l, double d) {
      	double t_0 = fmin(Math.abs(M), Math.abs(D));
      	double t_1 = fmax(Math.abs(M), Math.abs(D));
      	double t_2 = (t_1 / Math.abs(d)) * t_0;
      	double t_3 = Math.abs(w0) * Math.sqrt((1.0 - (Math.pow(((t_0 * t_1) / (2.0 * Math.abs(d))), 2.0) * (h / l))));
      	double tmp;
      	if (t_3 <= 2e+305) {
      		tmp = Math.abs(w0) * Math.sqrt((1.0 - (((t_2 * t_2) / 4.0) * (h / l))));
      	} else if (t_3 <= Double.POSITIVE_INFINITY) {
      		tmp = Math.abs(t_1) * (Math.abs(t_0) * ((Math.abs(w0) / Math.abs(d)) * Math.sqrt((-0.25 * (h / l)))));
      	} else {
      		tmp = Math.abs(w0) * Math.sqrt((1.0 - ((((0.25 * ((t_1 * t_0) * h)) / (Math.abs(d) * Math.abs(d))) * (t_0 / l)) * t_1)));
      	}
      	return Math.copySign(1.0, w0) * tmp;
      }
      
      def code(w0, M, D, h, l, d):
      	t_0 = fmin(math.fabs(M), math.fabs(D))
      	t_1 = fmax(math.fabs(M), math.fabs(D))
      	t_2 = (t_1 / math.fabs(d)) * t_0
      	t_3 = math.fabs(w0) * math.sqrt((1.0 - (math.pow(((t_0 * t_1) / (2.0 * math.fabs(d))), 2.0) * (h / l))))
      	tmp = 0
      	if t_3 <= 2e+305:
      		tmp = math.fabs(w0) * math.sqrt((1.0 - (((t_2 * t_2) / 4.0) * (h / l))))
      	elif t_3 <= math.inf:
      		tmp = math.fabs(t_1) * (math.fabs(t_0) * ((math.fabs(w0) / math.fabs(d)) * math.sqrt((-0.25 * (h / l)))))
      	else:
      		tmp = math.fabs(w0) * math.sqrt((1.0 - ((((0.25 * ((t_1 * t_0) * h)) / (math.fabs(d) * math.fabs(d))) * (t_0 / l)) * t_1)))
      	return math.copysign(1.0, w0) * tmp
      
      function code(w0, M, D, h, l, d)
      	t_0 = fmin(abs(M), abs(D))
      	t_1 = fmax(abs(M), abs(D))
      	t_2 = Float64(Float64(t_1 / abs(d)) * t_0)
      	t_3 = Float64(abs(w0) * sqrt(Float64(1.0 - Float64((Float64(Float64(t_0 * t_1) / Float64(2.0 * abs(d))) ^ 2.0) * Float64(h / l)))))
      	tmp = 0.0
      	if (t_3 <= 2e+305)
      		tmp = Float64(abs(w0) * sqrt(Float64(1.0 - Float64(Float64(Float64(t_2 * t_2) / 4.0) * Float64(h / l)))));
      	elseif (t_3 <= Inf)
      		tmp = Float64(abs(t_1) * Float64(abs(t_0) * Float64(Float64(abs(w0) / abs(d)) * sqrt(Float64(-0.25 * Float64(h / l))))));
      	else
      		tmp = Float64(abs(w0) * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(0.25 * Float64(Float64(t_1 * t_0) * h)) / Float64(abs(d) * abs(d))) * Float64(t_0 / l)) * t_1))));
      	end
      	return Float64(copysign(1.0, w0) * tmp)
      end
      
      function tmp_2 = code(w0, M, D, h, l, d)
      	t_0 = min(abs(M), abs(D));
      	t_1 = max(abs(M), abs(D));
      	t_2 = (t_1 / abs(d)) * t_0;
      	t_3 = abs(w0) * sqrt((1.0 - ((((t_0 * t_1) / (2.0 * abs(d))) ^ 2.0) * (h / l))));
      	tmp = 0.0;
      	if (t_3 <= 2e+305)
      		tmp = abs(w0) * sqrt((1.0 - (((t_2 * t_2) / 4.0) * (h / l))));
      	elseif (t_3 <= Inf)
      		tmp = abs(t_1) * (abs(t_0) * ((abs(w0) / abs(d)) * sqrt((-0.25 * (h / l)))));
      	else
      		tmp = abs(w0) * sqrt((1.0 - ((((0.25 * ((t_1 * t_0) * h)) / (abs(d) * abs(d))) * (t_0 / l)) * t_1)));
      	end
      	tmp_2 = (sign(w0) * abs(1.0)) * tmp;
      end
      
      code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 / N[Abs[d], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(t$95$0 * t$95$1), $MachinePrecision] / N[(2.0 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$3, 2e+305], N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(1.0 - N[(N[(N[(t$95$2 * t$95$2), $MachinePrecision] / 4.0), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(N[Abs[t$95$1], $MachinePrecision] * N[(N[Abs[t$95$0], $MachinePrecision] * N[(N[(N[Abs[w0], $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(-0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(1.0 - N[(N[(N[(N[(0.25 * N[(N[(t$95$1 * t$95$0), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / N[(N[Abs[d], $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]]]
      
      \begin{array}{l}
      t_0 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
      t_1 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
      t_2 := \frac{t\_1}{\left|d\right|} \cdot t\_0\\
      t_3 := \left|w0\right| \cdot \sqrt{1 - {\left(\frac{t\_0 \cdot t\_1}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell}}\\
      \mathsf{copysign}\left(1, w0\right) \cdot \begin{array}{l}
      \mathbf{if}\;t\_3 \leq 2 \cdot 10^{+305}:\\
      \;\;\;\;\left|w0\right| \cdot \sqrt{1 - \frac{t\_2 \cdot t\_2}{4} \cdot \frac{h}{\ell}}\\
      
      \mathbf{elif}\;t\_3 \leq \infty:\\
      \;\;\;\;\left|t\_1\right| \cdot \left(\left|t\_0\right| \cdot \left(\frac{\left|w0\right|}{\left|d\right|} \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\left|w0\right| \cdot \sqrt{1 - \left(\frac{0.25 \cdot \left(\left(t\_1 \cdot t\_0\right) \cdot h\right)}{\left|d\right| \cdot \left|d\right|} \cdot \frac{t\_0}{\ell}\right) \cdot t\_1}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if (*.f64 w0 (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))))) < 1.9999999999999999e305

        1. Initial program 80.8%

          \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
        2. Step-by-step derivation
          1. lift-pow.f64N/A

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

            \[\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}} \]
          3. lift-/.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\color{blue}{\frac{M \cdot D}{2 \cdot d}} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{h}{\ell}} \]
          4. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{M \cdot D}{\color{blue}{2 \cdot d}} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{h}{\ell}} \]
          5. *-commutativeN/A

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

            \[\leadsto w0 \cdot \sqrt{1 - \left(\color{blue}{\frac{\frac{M \cdot D}{d}}{2}} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{h}{\ell}} \]
          7. lift-/.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{\frac{M \cdot D}{d}}{2} \cdot \color{blue}{\frac{M \cdot D}{2 \cdot d}}\right) \cdot \frac{h}{\ell}} \]
          8. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{\frac{M \cdot D}{d}}{2} \cdot \frac{M \cdot D}{\color{blue}{2 \cdot d}}\right) \cdot \frac{h}{\ell}} \]
          9. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{\frac{M \cdot D}{d}}{2} \cdot \frac{M \cdot D}{\color{blue}{d \cdot 2}}\right) \cdot \frac{h}{\ell}} \]
          10. associate-/r*N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{\frac{M \cdot D}{d}}{2} \cdot \color{blue}{\frac{\frac{M \cdot D}{d}}{2}}\right) \cdot \frac{h}{\ell}} \]
          11. frac-timesN/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{d}}{2 \cdot 2}} \cdot \frac{h}{\ell}} \]
          12. metadata-evalN/A

            \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{d}}{2 \cdot \color{blue}{\left(1 + 1\right)}} \cdot \frac{h}{\ell}} \]
          13. cosh-0-revN/A

            \[\leadsto w0 \cdot \sqrt{1 - \frac{\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{d}}{2 \cdot \left(\color{blue}{\cosh 0} + 1\right)} \cdot \frac{h}{\ell}} \]
          14. lower-/.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\frac{M \cdot D}{d} \cdot \frac{M \cdot D}{d}}{2 \cdot \left(\cosh 0 + 1\right)}} \cdot \frac{h}{\ell}} \]
        3. Applied rewrites80.9%

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

        if 1.9999999999999999e305 < (*.f64 w0 (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))))) < +inf.0

        1. Initial program 80.8%

          \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
        2. Taylor expanded in d around 0

          \[\leadsto \color{blue}{\frac{w0 \cdot \sqrt{\mathsf{neg}\left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)}}{d}} \]
        3. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{w0 \cdot \sqrt{\mathsf{neg}\left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)}}{\color{blue}{d}} \]
        4. Applied rewrites9.8%

          \[\leadsto \color{blue}{\frac{w0 \cdot \sqrt{-0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d}} \]
        5. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \frac{w0 \cdot \sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{\color{blue}{d}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{w0 \cdot \sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d} \]
          3. associate-/l*N/A

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

            \[\leadsto \frac{\sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d} \cdot \color{blue}{w0} \]
          5. lower-*.f64N/A

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

          \[\leadsto \frac{\sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot -0.25}}{d} \cdot \color{blue}{w0} \]
        7. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \frac{\sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot \frac{-1}{4}}}{d} \cdot \color{blue}{w0} \]
          2. lift-/.f64N/A

            \[\leadsto \frac{\sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot \frac{-1}{4}}}{d} \cdot w0 \]
          3. associate-*l/N/A

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

            \[\leadsto \sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot \frac{-1}{4}} \cdot \color{blue}{\frac{w0}{d}} \]
          5. lower-*.f64N/A

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

          \[\leadsto \left(\left|D \cdot M\right| \cdot \sqrt{\frac{h}{\ell} \cdot -0.25}\right) \cdot \color{blue}{\frac{w0}{d}} \]
        9. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \left(\left|D \cdot M\right| \cdot \sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}\right) \cdot \color{blue}{\frac{w0}{d}} \]
          2. lift-*.f64N/A

            \[\leadsto \left(\left|D \cdot M\right| \cdot \sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}\right) \cdot \frac{\color{blue}{w0}}{d} \]
          3. associate-*l*N/A

            \[\leadsto \left|D \cdot M\right| \cdot \color{blue}{\left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)} \]
          4. lift-fabs.f64N/A

            \[\leadsto \left|D \cdot M\right| \cdot \left(\color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right) \]
          5. lift-*.f64N/A

            \[\leadsto \left|D \cdot M\right| \cdot \left(\sqrt{\color{blue}{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right) \]
          6. fabs-mulN/A

            \[\leadsto \left(\left|D\right| \cdot \left|M\right|\right) \cdot \left(\color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right) \]
          7. associate-*l*N/A

            \[\leadsto \left|D\right| \cdot \color{blue}{\left(\left|M\right| \cdot \left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)\right)} \]
          8. lower-*.f64N/A

            \[\leadsto \left|D\right| \cdot \color{blue}{\left(\left|M\right| \cdot \left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)\right)} \]
          9. lower-fabs.f64N/A

            \[\leadsto \left|D\right| \cdot \left(\color{blue}{\left|M\right|} \cdot \left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)\right) \]
          10. lower-*.f64N/A

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \color{blue}{\left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)}\right) \]
          11. lower-fabs.f64N/A

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right)\right) \]
          12. *-commutativeN/A

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}}\right)\right) \]
          13. lower-*.f6413.4%

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \color{blue}{\sqrt{\frac{h}{\ell} \cdot -0.25}}\right)\right) \]
          14. lift-*.f64N/A

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \sqrt{\frac{-1}{4} \cdot \frac{h}{\ell}}\right)\right) \]
          16. lower-*.f6413.4%

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right) \]
        10. Applied rewrites13.4%

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

        if +inf.0 < (*.f64 w0 (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)))))

        1. Initial program 80.8%

          \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
        2. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
          2. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h}{\ell} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}} \]
          3. lift-pow.f64N/A

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

            \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}} \]
          5. lift-/.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \left(\color{blue}{\frac{M \cdot D}{2 \cdot d}} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \]
          6. mult-flipN/A

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

            \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \color{blue}{\left(\left(M \cdot D\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)\right)}} \]
          8. associate-*r*N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{h}{\ell} \cdot \left(M \cdot D\right)\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}} \]
          9. lower-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{h}{\ell} \cdot \left(M \cdot D\right)\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}} \]
          10. lower-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{h}{\ell} \cdot \left(M \cdot D\right)\right)} \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \]
          11. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \color{blue}{\left(M \cdot D\right)}\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \]
          12. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \color{blue}{\left(D \cdot M\right)}\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \]
          13. lower-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \color{blue}{\left(D \cdot M\right)}\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \]
          14. lift-/.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \color{blue}{\frac{M \cdot D}{2 \cdot d}}\right)} \]
          15. mult-flipN/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \color{blue}{\left(\left(M \cdot D\right) \cdot \frac{1}{2 \cdot d}\right)}\right)} \]
          16. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \color{blue}{\left(\frac{1}{2 \cdot d} \cdot \left(M \cdot D\right)\right)}\right)} \]
          17. associate-*r*N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \color{blue}{\left(\left(\frac{1}{2 \cdot d} \cdot \frac{1}{2 \cdot d}\right) \cdot \left(M \cdot D\right)\right)}} \]
          18. lower-*.f64N/A

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

          \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \left(\frac{0.25}{d \cdot d} \cdot \left(D \cdot M\right)\right)}} \]
        4. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \left(\frac{\frac{1}{4}}{d \cdot d} \cdot \left(D \cdot M\right)\right)}} \]
          2. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \color{blue}{\left(\frac{\frac{1}{4}}{d \cdot d} \cdot \left(D \cdot M\right)\right)}} \]
          3. associate-*r*N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \frac{\frac{1}{4}}{d \cdot d}\right) \cdot \left(D \cdot M\right)}} \]
          4. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \frac{\frac{1}{4}}{d \cdot d}\right) \cdot \color{blue}{\left(D \cdot M\right)}} \]
          5. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \frac{\frac{1}{4}}{d \cdot d}\right) \cdot \color{blue}{\left(M \cdot D\right)}} \]
          6. associate-*r*N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\left(\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \frac{\frac{1}{4}}{d \cdot d}\right) \cdot M\right) \cdot D}} \]
          7. lower-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\left(\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \frac{\frac{1}{4}}{d \cdot d}\right) \cdot M\right) \cdot D}} \]
        5. Applied rewrites73.7%

          \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{\left(\left(D \cdot M\right) \cdot h\right) \cdot 0.25}{\ell \cdot \left(d \cdot d\right)} \cdot M\right) \cdot D}} \]
        6. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}}{\ell \cdot \left(d \cdot d\right)} \cdot M\right)} \cdot D} \]
          2. lift-/.f64N/A

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

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\left(\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}\right) \cdot M}{\ell \cdot \left(d \cdot d\right)}} \cdot D} \]
          4. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \frac{\left(\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}\right) \cdot M}{\color{blue}{\ell \cdot \left(d \cdot d\right)}} \cdot D} \]
          5. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \frac{\left(\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}\right) \cdot M}{\color{blue}{\left(d \cdot d\right) \cdot \ell}} \cdot D} \]
          6. times-fracN/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}}{d \cdot d} \cdot \frac{M}{\ell}\right)} \cdot D} \]
          7. lower-*.f64N/A

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

            \[\leadsto w0 \cdot \sqrt{1 - \left(\color{blue}{\frac{\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}}{d \cdot d}} \cdot \frac{M}{\ell}\right) \cdot D} \]
          9. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{\color{blue}{\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}}}{d \cdot d} \cdot \frac{M}{\ell}\right) \cdot D} \]
          10. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{\color{blue}{\frac{1}{4} \cdot \left(\left(D \cdot M\right) \cdot h\right)}}{d \cdot d} \cdot \frac{M}{\ell}\right) \cdot D} \]
          11. lower-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{\color{blue}{\frac{1}{4} \cdot \left(\left(D \cdot M\right) \cdot h\right)}}{d \cdot d} \cdot \frac{M}{\ell}\right) \cdot D} \]
          12. lower-/.f6472.8%

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{0.25 \cdot \left(\left(D \cdot M\right) \cdot h\right)}{d \cdot d} \cdot \color{blue}{\frac{M}{\ell}}\right) \cdot D} \]
        7. Applied rewrites72.8%

          \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{0.25 \cdot \left(\left(D \cdot M\right) \cdot h\right)}{d \cdot d} \cdot \frac{M}{\ell}\right)} \cdot D} \]
      3. Recombined 3 regimes into one program.
      4. Add Preprocessing

      Alternative 4: 91.4% accurate, 0.4× speedup?

      \[\begin{array}{l} t_0 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\ t_1 := \left|d\right| + \left|d\right|\\ t_2 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\ \mathbf{if}\;{\left(\frac{t\_2 \cdot t\_0}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell} \leq -\infty:\\ \;\;\;\;\left|t\_0\right| \cdot \left(\left|t\_2\right| \cdot \left(\frac{w0}{\left|d\right|} \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{t\_2}{t\_1} \cdot t\_0, \frac{\frac{t\_0}{t\_1} \cdot \left(t\_2 \cdot h\right)}{-\ell}, 1\right)}\\ \end{array} \]
      (FPCore (w0 M D h l d)
       :precision binary64
       (let* ((t_0 (fmax (fabs M) (fabs D)))
              (t_1 (+ (fabs d) (fabs d)))
              (t_2 (fmin (fabs M) (fabs D))))
         (if (<= (* (pow (/ (* t_2 t_0) (* 2.0 (fabs d))) 2.0) (/ h l)) (- INFINITY))
           (* (fabs t_0) (* (fabs t_2) (* (/ w0 (fabs d)) (sqrt (* -0.25 (/ h l))))))
           (*
            w0
            (sqrt
             (fma (* (/ t_2 t_1) t_0) (/ (* (/ t_0 t_1) (* t_2 h)) (- l)) 1.0))))))
      double code(double w0, double M, double D, double h, double l, double d) {
      	double t_0 = fmax(fabs(M), fabs(D));
      	double t_1 = fabs(d) + fabs(d);
      	double t_2 = fmin(fabs(M), fabs(D));
      	double tmp;
      	if ((pow(((t_2 * t_0) / (2.0 * fabs(d))), 2.0) * (h / l)) <= -((double) INFINITY)) {
      		tmp = fabs(t_0) * (fabs(t_2) * ((w0 / fabs(d)) * sqrt((-0.25 * (h / l)))));
      	} else {
      		tmp = w0 * sqrt(fma(((t_2 / t_1) * t_0), (((t_0 / t_1) * (t_2 * h)) / -l), 1.0));
      	}
      	return tmp;
      }
      
      function code(w0, M, D, h, l, d)
      	t_0 = fmax(abs(M), abs(D))
      	t_1 = Float64(abs(d) + abs(d))
      	t_2 = fmin(abs(M), abs(D))
      	tmp = 0.0
      	if (Float64((Float64(Float64(t_2 * t_0) / Float64(2.0 * abs(d))) ^ 2.0) * Float64(h / l)) <= Float64(-Inf))
      		tmp = Float64(abs(t_0) * Float64(abs(t_2) * Float64(Float64(w0 / abs(d)) * sqrt(Float64(-0.25 * Float64(h / l))))));
      	else
      		tmp = Float64(w0 * sqrt(fma(Float64(Float64(t_2 / t_1) * t_0), Float64(Float64(Float64(t_0 / t_1) * Float64(t_2 * h)) / Float64(-l)), 1.0)));
      	end
      	return tmp
      end
      
      code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[Max[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[d], $MachinePrecision] + N[Abs[d], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Min[N[Abs[M], $MachinePrecision], N[Abs[D], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Power[N[(N[(t$95$2 * t$95$0), $MachinePrecision] / N[(2.0 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(N[Abs[t$95$0], $MachinePrecision] * N[(N[Abs[t$95$2], $MachinePrecision] * N[(N[(w0 / N[Abs[d], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(-0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w0 * N[Sqrt[N[(N[(N[(t$95$2 / t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(N[(N[(t$95$0 / t$95$1), $MachinePrecision] * N[(t$95$2 * h), $MachinePrecision]), $MachinePrecision] / (-l)), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
      
      \begin{array}{l}
      t_0 := \mathsf{max}\left(\left|M\right|, \left|D\right|\right)\\
      t_1 := \left|d\right| + \left|d\right|\\
      t_2 := \mathsf{min}\left(\left|M\right|, \left|D\right|\right)\\
      \mathbf{if}\;{\left(\frac{t\_2 \cdot t\_0}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell} \leq -\infty:\\
      \;\;\;\;\left|t\_0\right| \cdot \left(\left|t\_2\right| \cdot \left(\frac{w0}{\left|d\right|} \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;w0 \cdot \sqrt{\mathsf{fma}\left(\frac{t\_2}{t\_1} \cdot t\_0, \frac{\frac{t\_0}{t\_1} \cdot \left(t\_2 \cdot h\right)}{-\ell}, 1\right)}\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -inf.0

        1. Initial program 80.8%

          \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
        2. Taylor expanded in d around 0

          \[\leadsto \color{blue}{\frac{w0 \cdot \sqrt{\mathsf{neg}\left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)}}{d}} \]
        3. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{w0 \cdot \sqrt{\mathsf{neg}\left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)}}{\color{blue}{d}} \]
        4. Applied rewrites9.8%

          \[\leadsto \color{blue}{\frac{w0 \cdot \sqrt{-0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d}} \]
        5. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \frac{w0 \cdot \sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{\color{blue}{d}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{w0 \cdot \sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d} \]
          3. associate-/l*N/A

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

            \[\leadsto \frac{\sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d} \cdot \color{blue}{w0} \]
          5. lower-*.f64N/A

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

          \[\leadsto \frac{\sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot -0.25}}{d} \cdot \color{blue}{w0} \]
        7. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \frac{\sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot \frac{-1}{4}}}{d} \cdot \color{blue}{w0} \]
          2. lift-/.f64N/A

            \[\leadsto \frac{\sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot \frac{-1}{4}}}{d} \cdot w0 \]
          3. associate-*l/N/A

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

            \[\leadsto \sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot \frac{-1}{4}} \cdot \color{blue}{\frac{w0}{d}} \]
          5. lower-*.f64N/A

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

          \[\leadsto \left(\left|D \cdot M\right| \cdot \sqrt{\frac{h}{\ell} \cdot -0.25}\right) \cdot \color{blue}{\frac{w0}{d}} \]
        9. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \left(\left|D \cdot M\right| \cdot \sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}\right) \cdot \color{blue}{\frac{w0}{d}} \]
          2. lift-*.f64N/A

            \[\leadsto \left(\left|D \cdot M\right| \cdot \sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}\right) \cdot \frac{\color{blue}{w0}}{d} \]
          3. associate-*l*N/A

            \[\leadsto \left|D \cdot M\right| \cdot \color{blue}{\left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)} \]
          4. lift-fabs.f64N/A

            \[\leadsto \left|D \cdot M\right| \cdot \left(\color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right) \]
          5. lift-*.f64N/A

            \[\leadsto \left|D \cdot M\right| \cdot \left(\sqrt{\color{blue}{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right) \]
          6. fabs-mulN/A

            \[\leadsto \left(\left|D\right| \cdot \left|M\right|\right) \cdot \left(\color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right) \]
          7. associate-*l*N/A

            \[\leadsto \left|D\right| \cdot \color{blue}{\left(\left|M\right| \cdot \left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)\right)} \]
          8. lower-*.f64N/A

            \[\leadsto \left|D\right| \cdot \color{blue}{\left(\left|M\right| \cdot \left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)\right)} \]
          9. lower-fabs.f64N/A

            \[\leadsto \left|D\right| \cdot \left(\color{blue}{\left|M\right|} \cdot \left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)\right) \]
          10. lower-*.f64N/A

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \color{blue}{\left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)}\right) \]
          11. lower-fabs.f64N/A

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right)\right) \]
          12. *-commutativeN/A

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}}\right)\right) \]
          13. lower-*.f6413.4%

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \color{blue}{\sqrt{\frac{h}{\ell} \cdot -0.25}}\right)\right) \]
          14. lift-*.f64N/A

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \sqrt{\frac{-1}{4} \cdot \frac{h}{\ell}}\right)\right) \]
          16. lower-*.f6413.4%

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right) \]
        10. Applied rewrites13.4%

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

        if -inf.0 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))

        1. Initial program 80.8%

          \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
        2. Step-by-step derivation
          1. lift--.f64N/A

            \[\leadsto w0 \cdot \sqrt{\color{blue}{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
          2. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
          3. fp-cancel-sub-sign-invN/A

            \[\leadsto w0 \cdot \sqrt{\color{blue}{1 + \left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)\right) \cdot \frac{h}{\ell}}} \]
          4. +-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right)\right) \cdot \frac{h}{\ell} + 1}} \]
          5. distribute-lft-neg-outN/A

            \[\leadsto w0 \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left({\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} + 1} \]
          6. distribute-rgt-neg-inN/A

            \[\leadsto w0 \cdot \sqrt{\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\mathsf{neg}\left(\frac{h}{\ell}\right)\right)} + 1} \]
          7. lift-/.f64N/A

            \[\leadsto w0 \cdot \sqrt{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \left(\mathsf{neg}\left(\color{blue}{\frac{h}{\ell}}\right)\right) + 1} \]
          8. distribute-neg-frac2N/A

            \[\leadsto w0 \cdot \sqrt{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \color{blue}{\frac{h}{\mathsf{neg}\left(\ell\right)}} + 1} \]
          9. associate-/l*N/A

            \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot h}{\mathsf{neg}\left(\ell\right)}} + 1} \]
          10. lift-pow.f64N/A

            \[\leadsto w0 \cdot \sqrt{\frac{\color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}} \cdot h}{\mathsf{neg}\left(\ell\right)} + 1} \]
          11. unpow2N/A

            \[\leadsto w0 \cdot \sqrt{\frac{\color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \cdot h}{\mathsf{neg}\left(\ell\right)} + 1} \]
          12. associate-*l*N/A

            \[\leadsto w0 \cdot \sqrt{\frac{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \left(\frac{M \cdot D}{2 \cdot d} \cdot h\right)}}{\mathsf{neg}\left(\ell\right)} + 1} \]
          13. associate-/l*N/A

            \[\leadsto w0 \cdot \sqrt{\color{blue}{\frac{M \cdot D}{2 \cdot d} \cdot \frac{\frac{M \cdot D}{2 \cdot d} \cdot h}{\mathsf{neg}\left(\ell\right)}} + 1} \]
          14. lower-fma.f64N/A

            \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\frac{M \cdot D}{2 \cdot d}, \frac{\frac{M \cdot D}{2 \cdot d} \cdot h}{\mathsf{neg}\left(\ell\right)}, 1\right)}} \]
        3. Applied rewrites84.0%

          \[\leadsto w0 \cdot \sqrt{\color{blue}{\mathsf{fma}\left(\frac{M}{d + d} \cdot D, \frac{\frac{D}{d + d} \cdot \left(M \cdot h\right)}{-\ell}, 1\right)}} \]
      3. Recombined 2 regimes into one program.
      4. Add Preprocessing

      Alternative 5: 91.3% accurate, 0.2× speedup?

      \[\begin{array}{l} t_0 := \mathsf{min}\left(M, \left|D\right|\right)\\ t_1 := \mathsf{max}\left(M, \left|D\right|\right)\\ t_2 := t\_1 \cdot t\_0\\ t_3 := \left|w0\right| \cdot \sqrt{1 - {\left(\frac{t\_0 \cdot t\_1}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell}}\\ \mathsf{copysign}\left(1, w0\right) \cdot \begin{array}{l} \mathbf{if}\;t\_3 \leq 2 \cdot 10^{+305}:\\ \;\;\;\;\left|w0\right| \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot t\_2\right) \cdot \frac{\frac{0.25 \cdot t\_2}{\left|d\right|}}{\left|d\right|}}\\ \mathbf{elif}\;t\_3 \leq \infty:\\ \;\;\;\;\left|t\_1\right| \cdot \left(\left|t\_0\right| \cdot \left(\frac{\left|w0\right|}{\left|d\right|} \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left|w0\right| \cdot \sqrt{1 - \left(\frac{0.25 \cdot \left(t\_2 \cdot h\right)}{\left|d\right| \cdot \left|d\right|} \cdot \frac{t\_0}{\ell}\right) \cdot t\_1}\\ \end{array} \end{array} \]
      (FPCore (w0 M D h l d)
       :precision binary64
       (let* ((t_0 (fmin M (fabs D)))
              (t_1 (fmax M (fabs D)))
              (t_2 (* t_1 t_0))
              (t_3
               (*
                (fabs w0)
                (sqrt
                 (- 1.0 (* (pow (/ (* t_0 t_1) (* 2.0 (fabs d))) 2.0) (/ h l)))))))
         (*
          (copysign 1.0 w0)
          (if (<= t_3 2e+305)
            (*
             (fabs w0)
             (sqrt
              (- 1.0 (* (* (/ h l) t_2) (/ (/ (* 0.25 t_2) (fabs d)) (fabs d))))))
            (if (<= t_3 INFINITY)
              (*
               (fabs t_1)
               (* (fabs t_0) (* (/ (fabs w0) (fabs d)) (sqrt (* -0.25 (/ h l))))))
              (*
               (fabs w0)
               (sqrt
                (-
                 1.0
                 (*
                  (* (/ (* 0.25 (* t_2 h)) (* (fabs d) (fabs d))) (/ t_0 l))
                  t_1)))))))))
      double code(double w0, double M, double D, double h, double l, double d) {
      	double t_0 = fmin(M, fabs(D));
      	double t_1 = fmax(M, fabs(D));
      	double t_2 = t_1 * t_0;
      	double t_3 = fabs(w0) * sqrt((1.0 - (pow(((t_0 * t_1) / (2.0 * fabs(d))), 2.0) * (h / l))));
      	double tmp;
      	if (t_3 <= 2e+305) {
      		tmp = fabs(w0) * sqrt((1.0 - (((h / l) * t_2) * (((0.25 * t_2) / fabs(d)) / fabs(d)))));
      	} else if (t_3 <= ((double) INFINITY)) {
      		tmp = fabs(t_1) * (fabs(t_0) * ((fabs(w0) / fabs(d)) * sqrt((-0.25 * (h / l)))));
      	} else {
      		tmp = fabs(w0) * sqrt((1.0 - ((((0.25 * (t_2 * h)) / (fabs(d) * fabs(d))) * (t_0 / l)) * t_1)));
      	}
      	return copysign(1.0, w0) * tmp;
      }
      
      public static double code(double w0, double M, double D, double h, double l, double d) {
      	double t_0 = fmin(M, Math.abs(D));
      	double t_1 = fmax(M, Math.abs(D));
      	double t_2 = t_1 * t_0;
      	double t_3 = Math.abs(w0) * Math.sqrt((1.0 - (Math.pow(((t_0 * t_1) / (2.0 * Math.abs(d))), 2.0) * (h / l))));
      	double tmp;
      	if (t_3 <= 2e+305) {
      		tmp = Math.abs(w0) * Math.sqrt((1.0 - (((h / l) * t_2) * (((0.25 * t_2) / Math.abs(d)) / Math.abs(d)))));
      	} else if (t_3 <= Double.POSITIVE_INFINITY) {
      		tmp = Math.abs(t_1) * (Math.abs(t_0) * ((Math.abs(w0) / Math.abs(d)) * Math.sqrt((-0.25 * (h / l)))));
      	} else {
      		tmp = Math.abs(w0) * Math.sqrt((1.0 - ((((0.25 * (t_2 * h)) / (Math.abs(d) * Math.abs(d))) * (t_0 / l)) * t_1)));
      	}
      	return Math.copySign(1.0, w0) * tmp;
      }
      
      def code(w0, M, D, h, l, d):
      	t_0 = fmin(M, math.fabs(D))
      	t_1 = fmax(M, math.fabs(D))
      	t_2 = t_1 * t_0
      	t_3 = math.fabs(w0) * math.sqrt((1.0 - (math.pow(((t_0 * t_1) / (2.0 * math.fabs(d))), 2.0) * (h / l))))
      	tmp = 0
      	if t_3 <= 2e+305:
      		tmp = math.fabs(w0) * math.sqrt((1.0 - (((h / l) * t_2) * (((0.25 * t_2) / math.fabs(d)) / math.fabs(d)))))
      	elif t_3 <= math.inf:
      		tmp = math.fabs(t_1) * (math.fabs(t_0) * ((math.fabs(w0) / math.fabs(d)) * math.sqrt((-0.25 * (h / l)))))
      	else:
      		tmp = math.fabs(w0) * math.sqrt((1.0 - ((((0.25 * (t_2 * h)) / (math.fabs(d) * math.fabs(d))) * (t_0 / l)) * t_1)))
      	return math.copysign(1.0, w0) * tmp
      
      function code(w0, M, D, h, l, d)
      	t_0 = fmin(M, abs(D))
      	t_1 = fmax(M, abs(D))
      	t_2 = Float64(t_1 * t_0)
      	t_3 = Float64(abs(w0) * sqrt(Float64(1.0 - Float64((Float64(Float64(t_0 * t_1) / Float64(2.0 * abs(d))) ^ 2.0) * Float64(h / l)))))
      	tmp = 0.0
      	if (t_3 <= 2e+305)
      		tmp = Float64(abs(w0) * sqrt(Float64(1.0 - Float64(Float64(Float64(h / l) * t_2) * Float64(Float64(Float64(0.25 * t_2) / abs(d)) / abs(d))))));
      	elseif (t_3 <= Inf)
      		tmp = Float64(abs(t_1) * Float64(abs(t_0) * Float64(Float64(abs(w0) / abs(d)) * sqrt(Float64(-0.25 * Float64(h / l))))));
      	else
      		tmp = Float64(abs(w0) * sqrt(Float64(1.0 - Float64(Float64(Float64(Float64(0.25 * Float64(t_2 * h)) / Float64(abs(d) * abs(d))) * Float64(t_0 / l)) * t_1))));
      	end
      	return Float64(copysign(1.0, w0) * tmp)
      end
      
      function tmp_2 = code(w0, M, D, h, l, d)
      	t_0 = min(M, abs(D));
      	t_1 = max(M, abs(D));
      	t_2 = t_1 * t_0;
      	t_3 = abs(w0) * sqrt((1.0 - ((((t_0 * t_1) / (2.0 * abs(d))) ^ 2.0) * (h / l))));
      	tmp = 0.0;
      	if (t_3 <= 2e+305)
      		tmp = abs(w0) * sqrt((1.0 - (((h / l) * t_2) * (((0.25 * t_2) / abs(d)) / abs(d)))));
      	elseif (t_3 <= Inf)
      		tmp = abs(t_1) * (abs(t_0) * ((abs(w0) / abs(d)) * sqrt((-0.25 * (h / l)))));
      	else
      		tmp = abs(w0) * sqrt((1.0 - ((((0.25 * (t_2 * h)) / (abs(d) * abs(d))) * (t_0 / l)) * t_1)));
      	end
      	tmp_2 = (sign(w0) * abs(1.0)) * tmp;
      end
      
      code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[Min[M, N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Max[M, N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(t$95$0 * t$95$1), $MachinePrecision] / N[(2.0 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[w0]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$3, 2e+305], N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(1.0 - N[(N[(N[(h / l), $MachinePrecision] * t$95$2), $MachinePrecision] * N[(N[(N[(0.25 * t$95$2), $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(N[Abs[t$95$1], $MachinePrecision] * N[(N[Abs[t$95$0], $MachinePrecision] * N[(N[(N[Abs[w0], $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(-0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[w0], $MachinePrecision] * N[Sqrt[N[(1.0 - N[(N[(N[(N[(0.25 * N[(t$95$2 * h), $MachinePrecision]), $MachinePrecision] / N[(N[Abs[d], $MachinePrecision] * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]]]
      
      \begin{array}{l}
      t_0 := \mathsf{min}\left(M, \left|D\right|\right)\\
      t_1 := \mathsf{max}\left(M, \left|D\right|\right)\\
      t_2 := t\_1 \cdot t\_0\\
      t_3 := \left|w0\right| \cdot \sqrt{1 - {\left(\frac{t\_0 \cdot t\_1}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell}}\\
      \mathsf{copysign}\left(1, w0\right) \cdot \begin{array}{l}
      \mathbf{if}\;t\_3 \leq 2 \cdot 10^{+305}:\\
      \;\;\;\;\left|w0\right| \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot t\_2\right) \cdot \frac{\frac{0.25 \cdot t\_2}{\left|d\right|}}{\left|d\right|}}\\
      
      \mathbf{elif}\;t\_3 \leq \infty:\\
      \;\;\;\;\left|t\_1\right| \cdot \left(\left|t\_0\right| \cdot \left(\frac{\left|w0\right|}{\left|d\right|} \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\left|w0\right| \cdot \sqrt{1 - \left(\frac{0.25 \cdot \left(t\_2 \cdot h\right)}{\left|d\right| \cdot \left|d\right|} \cdot \frac{t\_0}{\ell}\right) \cdot t\_1}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if (*.f64 w0 (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))))) < 1.9999999999999999e305

        1. Initial program 80.8%

          \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
        2. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
          2. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h}{\ell} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}} \]
          3. lift-pow.f64N/A

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

            \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}} \]
          5. lift-/.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \left(\color{blue}{\frac{M \cdot D}{2 \cdot d}} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \]
          6. mult-flipN/A

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

            \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \color{blue}{\left(\left(M \cdot D\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)\right)}} \]
          8. associate-*r*N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{h}{\ell} \cdot \left(M \cdot D\right)\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}} \]
          9. lower-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{h}{\ell} \cdot \left(M \cdot D\right)\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}} \]
          10. lower-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{h}{\ell} \cdot \left(M \cdot D\right)\right)} \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \]
          11. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \color{blue}{\left(M \cdot D\right)}\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \]
          12. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \color{blue}{\left(D \cdot M\right)}\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \]
          13. lower-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \color{blue}{\left(D \cdot M\right)}\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \]
          14. lift-/.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \color{blue}{\frac{M \cdot D}{2 \cdot d}}\right)} \]
          15. mult-flipN/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \color{blue}{\left(\left(M \cdot D\right) \cdot \frac{1}{2 \cdot d}\right)}\right)} \]
          16. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \color{blue}{\left(\frac{1}{2 \cdot d} \cdot \left(M \cdot D\right)\right)}\right)} \]
          17. associate-*r*N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \color{blue}{\left(\left(\frac{1}{2 \cdot d} \cdot \frac{1}{2 \cdot d}\right) \cdot \left(M \cdot D\right)\right)}} \]
          18. lower-*.f64N/A

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

          \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \left(\frac{0.25}{d \cdot d} \cdot \left(D \cdot M\right)\right)}} \]
        4. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \color{blue}{\left(\frac{\frac{1}{4}}{d \cdot d} \cdot \left(D \cdot M\right)\right)}} \]
          2. lift-/.f64N/A

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

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \color{blue}{\frac{\frac{1}{4} \cdot \left(D \cdot M\right)}{d \cdot d}}} \]
          4. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \frac{\frac{1}{4} \cdot \left(D \cdot M\right)}{\color{blue}{d \cdot d}}} \]
          5. associate-/r*N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \color{blue}{\frac{\frac{\frac{1}{4} \cdot \left(D \cdot M\right)}{d}}{d}}} \]
          6. lower-/.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \color{blue}{\frac{\frac{\frac{1}{4} \cdot \left(D \cdot M\right)}{d}}{d}}} \]
          7. lower-/.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \frac{\color{blue}{\frac{\frac{1}{4} \cdot \left(D \cdot M\right)}{d}}}{d}} \]
          8. lower-*.f6479.2%

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

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

        if 1.9999999999999999e305 < (*.f64 w0 (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))))) < +inf.0

        1. Initial program 80.8%

          \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
        2. Taylor expanded in d around 0

          \[\leadsto \color{blue}{\frac{w0 \cdot \sqrt{\mathsf{neg}\left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)}}{d}} \]
        3. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{w0 \cdot \sqrt{\mathsf{neg}\left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)}}{\color{blue}{d}} \]
        4. Applied rewrites9.8%

          \[\leadsto \color{blue}{\frac{w0 \cdot \sqrt{-0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d}} \]
        5. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \frac{w0 \cdot \sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{\color{blue}{d}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{w0 \cdot \sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d} \]
          3. associate-/l*N/A

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

            \[\leadsto \frac{\sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d} \cdot \color{blue}{w0} \]
          5. lower-*.f64N/A

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

          \[\leadsto \frac{\sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot -0.25}}{d} \cdot \color{blue}{w0} \]
        7. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \frac{\sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot \frac{-1}{4}}}{d} \cdot \color{blue}{w0} \]
          2. lift-/.f64N/A

            \[\leadsto \frac{\sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot \frac{-1}{4}}}{d} \cdot w0 \]
          3. associate-*l/N/A

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

            \[\leadsto \sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot \frac{-1}{4}} \cdot \color{blue}{\frac{w0}{d}} \]
          5. lower-*.f64N/A

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

          \[\leadsto \left(\left|D \cdot M\right| \cdot \sqrt{\frac{h}{\ell} \cdot -0.25}\right) \cdot \color{blue}{\frac{w0}{d}} \]
        9. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \left(\left|D \cdot M\right| \cdot \sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}\right) \cdot \color{blue}{\frac{w0}{d}} \]
          2. lift-*.f64N/A

            \[\leadsto \left(\left|D \cdot M\right| \cdot \sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}\right) \cdot \frac{\color{blue}{w0}}{d} \]
          3. associate-*l*N/A

            \[\leadsto \left|D \cdot M\right| \cdot \color{blue}{\left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)} \]
          4. lift-fabs.f64N/A

            \[\leadsto \left|D \cdot M\right| \cdot \left(\color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right) \]
          5. lift-*.f64N/A

            \[\leadsto \left|D \cdot M\right| \cdot \left(\sqrt{\color{blue}{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right) \]
          6. fabs-mulN/A

            \[\leadsto \left(\left|D\right| \cdot \left|M\right|\right) \cdot \left(\color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right) \]
          7. associate-*l*N/A

            \[\leadsto \left|D\right| \cdot \color{blue}{\left(\left|M\right| \cdot \left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)\right)} \]
          8. lower-*.f64N/A

            \[\leadsto \left|D\right| \cdot \color{blue}{\left(\left|M\right| \cdot \left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)\right)} \]
          9. lower-fabs.f64N/A

            \[\leadsto \left|D\right| \cdot \left(\color{blue}{\left|M\right|} \cdot \left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)\right) \]
          10. lower-*.f64N/A

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \color{blue}{\left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)}\right) \]
          11. lower-fabs.f64N/A

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right)\right) \]
          12. *-commutativeN/A

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}}\right)\right) \]
          13. lower-*.f6413.4%

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \color{blue}{\sqrt{\frac{h}{\ell} \cdot -0.25}}\right)\right) \]
          14. lift-*.f64N/A

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \sqrt{\frac{-1}{4} \cdot \frac{h}{\ell}}\right)\right) \]
          16. lower-*.f6413.4%

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right) \]
        10. Applied rewrites13.4%

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

        if +inf.0 < (*.f64 w0 (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)))))

        1. Initial program 80.8%

          \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
        2. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}} \]
          2. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{h}{\ell} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}} \]
          3. lift-pow.f64N/A

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

            \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \color{blue}{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}} \]
          5. lift-/.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \left(\color{blue}{\frac{M \cdot D}{2 \cdot d}} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \]
          6. mult-flipN/A

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

            \[\leadsto w0 \cdot \sqrt{1 - \frac{h}{\ell} \cdot \color{blue}{\left(\left(M \cdot D\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)\right)}} \]
          8. associate-*r*N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{h}{\ell} \cdot \left(M \cdot D\right)\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}} \]
          9. lower-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{h}{\ell} \cdot \left(M \cdot D\right)\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)}} \]
          10. lower-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{h}{\ell} \cdot \left(M \cdot D\right)\right)} \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \]
          11. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \color{blue}{\left(M \cdot D\right)}\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \]
          12. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \color{blue}{\left(D \cdot M\right)}\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \]
          13. lower-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \color{blue}{\left(D \cdot M\right)}\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right)} \]
          14. lift-/.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \color{blue}{\frac{M \cdot D}{2 \cdot d}}\right)} \]
          15. mult-flipN/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \color{blue}{\left(\left(M \cdot D\right) \cdot \frac{1}{2 \cdot d}\right)}\right)} \]
          16. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \left(\frac{1}{2 \cdot d} \cdot \color{blue}{\left(\frac{1}{2 \cdot d} \cdot \left(M \cdot D\right)\right)}\right)} \]
          17. associate-*r*N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \color{blue}{\left(\left(\frac{1}{2 \cdot d} \cdot \frac{1}{2 \cdot d}\right) \cdot \left(M \cdot D\right)\right)}} \]
          18. lower-*.f64N/A

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

          \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \left(\frac{0.25}{d \cdot d} \cdot \left(D \cdot M\right)\right)}} \]
        4. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \left(\frac{\frac{1}{4}}{d \cdot d} \cdot \left(D \cdot M\right)\right)}} \]
          2. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \color{blue}{\left(\frac{\frac{1}{4}}{d \cdot d} \cdot \left(D \cdot M\right)\right)}} \]
          3. associate-*r*N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \frac{\frac{1}{4}}{d \cdot d}\right) \cdot \left(D \cdot M\right)}} \]
          4. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \frac{\frac{1}{4}}{d \cdot d}\right) \cdot \color{blue}{\left(D \cdot M\right)}} \]
          5. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \frac{\frac{1}{4}}{d \cdot d}\right) \cdot \color{blue}{\left(M \cdot D\right)}} \]
          6. associate-*r*N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\left(\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \frac{\frac{1}{4}}{d \cdot d}\right) \cdot M\right) \cdot D}} \]
          7. lower-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\left(\left(\frac{h}{\ell} \cdot \left(D \cdot M\right)\right) \cdot \frac{\frac{1}{4}}{d \cdot d}\right) \cdot M\right) \cdot D}} \]
        5. Applied rewrites73.7%

          \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{\left(\left(D \cdot M\right) \cdot h\right) \cdot 0.25}{\ell \cdot \left(d \cdot d\right)} \cdot M\right) \cdot D}} \]
        6. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}}{\ell \cdot \left(d \cdot d\right)} \cdot M\right)} \cdot D} \]
          2. lift-/.f64N/A

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

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\frac{\left(\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}\right) \cdot M}{\ell \cdot \left(d \cdot d\right)}} \cdot D} \]
          4. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \frac{\left(\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}\right) \cdot M}{\color{blue}{\ell \cdot \left(d \cdot d\right)}} \cdot D} \]
          5. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \frac{\left(\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}\right) \cdot M}{\color{blue}{\left(d \cdot d\right) \cdot \ell}} \cdot D} \]
          6. times-fracN/A

            \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}}{d \cdot d} \cdot \frac{M}{\ell}\right)} \cdot D} \]
          7. lower-*.f64N/A

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

            \[\leadsto w0 \cdot \sqrt{1 - \left(\color{blue}{\frac{\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}}{d \cdot d}} \cdot \frac{M}{\ell}\right) \cdot D} \]
          9. lift-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{\color{blue}{\left(\left(D \cdot M\right) \cdot h\right) \cdot \frac{1}{4}}}{d \cdot d} \cdot \frac{M}{\ell}\right) \cdot D} \]
          10. *-commutativeN/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{\color{blue}{\frac{1}{4} \cdot \left(\left(D \cdot M\right) \cdot h\right)}}{d \cdot d} \cdot \frac{M}{\ell}\right) \cdot D} \]
          11. lower-*.f64N/A

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{\color{blue}{\frac{1}{4} \cdot \left(\left(D \cdot M\right) \cdot h\right)}}{d \cdot d} \cdot \frac{M}{\ell}\right) \cdot D} \]
          12. lower-/.f6472.8%

            \[\leadsto w0 \cdot \sqrt{1 - \left(\frac{0.25 \cdot \left(\left(D \cdot M\right) \cdot h\right)}{d \cdot d} \cdot \color{blue}{\frac{M}{\ell}}\right) \cdot D} \]
        7. Applied rewrites72.8%

          \[\leadsto w0 \cdot \sqrt{1 - \color{blue}{\left(\frac{0.25 \cdot \left(\left(D \cdot M\right) \cdot h\right)}{d \cdot d} \cdot \frac{M}{\ell}\right)} \cdot D} \]
      3. Recombined 3 regimes into one program.
      4. Add Preprocessing

      Alternative 6: 89.9% accurate, 0.3× speedup?

      \[\begin{array}{l} t_0 := \mathsf{max}\left(M, \left|D\right|\right)\\ t_1 := \mathsf{min}\left(M, \left|D\right|\right)\\ t_2 := {\left(\frac{t\_1 \cdot t\_0}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell}\\ \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;\left|t\_0\right| \cdot \left(\left|t\_1\right| \cdot \left(\frac{w0}{\left|d\right|} \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right)\\ \mathbf{elif}\;t\_2 \leq -2 \cdot 10^{+30}:\\ \;\;\;\;\frac{\left|t\_0 \cdot t\_1\right| \cdot \sqrt{\frac{h}{\ell} \cdot -0.25}}{\left|d\right|} \cdot w0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot 1\\ \end{array} \]
      (FPCore (w0 M D h l d)
       :precision binary64
       (let* ((t_0 (fmax M (fabs D)))
              (t_1 (fmin M (fabs D)))
              (t_2 (* (pow (/ (* t_1 t_0) (* 2.0 (fabs d))) 2.0) (/ h l))))
         (if (<= t_2 (- INFINITY))
           (* (fabs t_0) (* (fabs t_1) (* (/ w0 (fabs d)) (sqrt (* -0.25 (/ h l))))))
           (if (<= t_2 -2e+30)
             (* (/ (* (fabs (* t_0 t_1)) (sqrt (* (/ h l) -0.25))) (fabs d)) w0)
             (* w0 1.0)))))
      double code(double w0, double M, double D, double h, double l, double d) {
      	double t_0 = fmax(M, fabs(D));
      	double t_1 = fmin(M, fabs(D));
      	double t_2 = pow(((t_1 * t_0) / (2.0 * fabs(d))), 2.0) * (h / l);
      	double tmp;
      	if (t_2 <= -((double) INFINITY)) {
      		tmp = fabs(t_0) * (fabs(t_1) * ((w0 / fabs(d)) * sqrt((-0.25 * (h / l)))));
      	} else if (t_2 <= -2e+30) {
      		tmp = ((fabs((t_0 * t_1)) * sqrt(((h / l) * -0.25))) / fabs(d)) * w0;
      	} else {
      		tmp = w0 * 1.0;
      	}
      	return tmp;
      }
      
      public static double code(double w0, double M, double D, double h, double l, double d) {
      	double t_0 = fmax(M, Math.abs(D));
      	double t_1 = fmin(M, Math.abs(D));
      	double t_2 = Math.pow(((t_1 * t_0) / (2.0 * Math.abs(d))), 2.0) * (h / l);
      	double tmp;
      	if (t_2 <= -Double.POSITIVE_INFINITY) {
      		tmp = Math.abs(t_0) * (Math.abs(t_1) * ((w0 / Math.abs(d)) * Math.sqrt((-0.25 * (h / l)))));
      	} else if (t_2 <= -2e+30) {
      		tmp = ((Math.abs((t_0 * t_1)) * Math.sqrt(((h / l) * -0.25))) / Math.abs(d)) * w0;
      	} else {
      		tmp = w0 * 1.0;
      	}
      	return tmp;
      }
      
      def code(w0, M, D, h, l, d):
      	t_0 = fmax(M, math.fabs(D))
      	t_1 = fmin(M, math.fabs(D))
      	t_2 = math.pow(((t_1 * t_0) / (2.0 * math.fabs(d))), 2.0) * (h / l)
      	tmp = 0
      	if t_2 <= -math.inf:
      		tmp = math.fabs(t_0) * (math.fabs(t_1) * ((w0 / math.fabs(d)) * math.sqrt((-0.25 * (h / l)))))
      	elif t_2 <= -2e+30:
      		tmp = ((math.fabs((t_0 * t_1)) * math.sqrt(((h / l) * -0.25))) / math.fabs(d)) * w0
      	else:
      		tmp = w0 * 1.0
      	return tmp
      
      function code(w0, M, D, h, l, d)
      	t_0 = fmax(M, abs(D))
      	t_1 = fmin(M, abs(D))
      	t_2 = Float64((Float64(Float64(t_1 * t_0) / Float64(2.0 * abs(d))) ^ 2.0) * Float64(h / l))
      	tmp = 0.0
      	if (t_2 <= Float64(-Inf))
      		tmp = Float64(abs(t_0) * Float64(abs(t_1) * Float64(Float64(w0 / abs(d)) * sqrt(Float64(-0.25 * Float64(h / l))))));
      	elseif (t_2 <= -2e+30)
      		tmp = Float64(Float64(Float64(abs(Float64(t_0 * t_1)) * sqrt(Float64(Float64(h / l) * -0.25))) / abs(d)) * w0);
      	else
      		tmp = Float64(w0 * 1.0);
      	end
      	return tmp
      end
      
      function tmp_2 = code(w0, M, D, h, l, d)
      	t_0 = max(M, abs(D));
      	t_1 = min(M, abs(D));
      	t_2 = (((t_1 * t_0) / (2.0 * abs(d))) ^ 2.0) * (h / l);
      	tmp = 0.0;
      	if (t_2 <= -Inf)
      		tmp = abs(t_0) * (abs(t_1) * ((w0 / abs(d)) * sqrt((-0.25 * (h / l)))));
      	elseif (t_2 <= -2e+30)
      		tmp = ((abs((t_0 * t_1)) * sqrt(((h / l) * -0.25))) / abs(d)) * w0;
      	else
      		tmp = w0 * 1.0;
      	end
      	tmp_2 = tmp;
      end
      
      code[w0_, M_, D_, h_, l_, d_] := Block[{t$95$0 = N[Max[M, N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Min[M, N[Abs[D], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[N[(N[(t$95$1 * t$95$0), $MachinePrecision] / N[(2.0 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[Abs[t$95$0], $MachinePrecision] * N[(N[Abs[t$95$1], $MachinePrecision] * N[(N[(w0 / N[Abs[d], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(-0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -2e+30], N[(N[(N[(N[Abs[N[(t$95$0 * t$95$1), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(N[(h / l), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision] * w0), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]]]]]
      
      \begin{array}{l}
      t_0 := \mathsf{max}\left(M, \left|D\right|\right)\\
      t_1 := \mathsf{min}\left(M, \left|D\right|\right)\\
      t_2 := {\left(\frac{t\_1 \cdot t\_0}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell}\\
      \mathbf{if}\;t\_2 \leq -\infty:\\
      \;\;\;\;\left|t\_0\right| \cdot \left(\left|t\_1\right| \cdot \left(\frac{w0}{\left|d\right|} \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right)\\
      
      \mathbf{elif}\;t\_2 \leq -2 \cdot 10^{+30}:\\
      \;\;\;\;\frac{\left|t\_0 \cdot t\_1\right| \cdot \sqrt{\frac{h}{\ell} \cdot -0.25}}{\left|d\right|} \cdot w0\\
      
      \mathbf{else}:\\
      \;\;\;\;w0 \cdot 1\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -inf.0

        1. Initial program 80.8%

          \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
        2. Taylor expanded in d around 0

          \[\leadsto \color{blue}{\frac{w0 \cdot \sqrt{\mathsf{neg}\left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)}}{d}} \]
        3. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{w0 \cdot \sqrt{\mathsf{neg}\left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)}}{\color{blue}{d}} \]
        4. Applied rewrites9.8%

          \[\leadsto \color{blue}{\frac{w0 \cdot \sqrt{-0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d}} \]
        5. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \frac{w0 \cdot \sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{\color{blue}{d}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{w0 \cdot \sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d} \]
          3. associate-/l*N/A

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

            \[\leadsto \frac{\sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d} \cdot \color{blue}{w0} \]
          5. lower-*.f64N/A

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

          \[\leadsto \frac{\sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot -0.25}}{d} \cdot \color{blue}{w0} \]
        7. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \frac{\sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot \frac{-1}{4}}}{d} \cdot \color{blue}{w0} \]
          2. lift-/.f64N/A

            \[\leadsto \frac{\sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot \frac{-1}{4}}}{d} \cdot w0 \]
          3. associate-*l/N/A

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

            \[\leadsto \sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot \frac{-1}{4}} \cdot \color{blue}{\frac{w0}{d}} \]
          5. lower-*.f64N/A

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

          \[\leadsto \left(\left|D \cdot M\right| \cdot \sqrt{\frac{h}{\ell} \cdot -0.25}\right) \cdot \color{blue}{\frac{w0}{d}} \]
        9. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \left(\left|D \cdot M\right| \cdot \sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}\right) \cdot \color{blue}{\frac{w0}{d}} \]
          2. lift-*.f64N/A

            \[\leadsto \left(\left|D \cdot M\right| \cdot \sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}\right) \cdot \frac{\color{blue}{w0}}{d} \]
          3. associate-*l*N/A

            \[\leadsto \left|D \cdot M\right| \cdot \color{blue}{\left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)} \]
          4. lift-fabs.f64N/A

            \[\leadsto \left|D \cdot M\right| \cdot \left(\color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right) \]
          5. lift-*.f64N/A

            \[\leadsto \left|D \cdot M\right| \cdot \left(\sqrt{\color{blue}{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right) \]
          6. fabs-mulN/A

            \[\leadsto \left(\left|D\right| \cdot \left|M\right|\right) \cdot \left(\color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right) \]
          7. associate-*l*N/A

            \[\leadsto \left|D\right| \cdot \color{blue}{\left(\left|M\right| \cdot \left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)\right)} \]
          8. lower-*.f64N/A

            \[\leadsto \left|D\right| \cdot \color{blue}{\left(\left|M\right| \cdot \left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)\right)} \]
          9. lower-fabs.f64N/A

            \[\leadsto \left|D\right| \cdot \left(\color{blue}{\left|M\right|} \cdot \left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)\right) \]
          10. lower-*.f64N/A

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \color{blue}{\left(\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}} \cdot \frac{w0}{d}\right)}\right) \]
          11. lower-fabs.f64N/A

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}} \cdot \frac{w0}{d}\right)\right) \]
          12. *-commutativeN/A

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \color{blue}{\sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}}\right)\right) \]
          13. lower-*.f6413.4%

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \color{blue}{\sqrt{\frac{h}{\ell} \cdot -0.25}}\right)\right) \]
          14. lift-*.f64N/A

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \sqrt{\frac{h}{\ell} \cdot \frac{-1}{4}}\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \sqrt{\frac{-1}{4} \cdot \frac{h}{\ell}}\right)\right) \]
          16. lower-*.f6413.4%

            \[\leadsto \left|D\right| \cdot \left(\left|M\right| \cdot \left(\frac{w0}{d} \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)\right) \]
        10. Applied rewrites13.4%

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

        if -inf.0 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -2e30

        1. Initial program 80.8%

          \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
        2. Taylor expanded in d around 0

          \[\leadsto \color{blue}{\frac{w0 \cdot \sqrt{\mathsf{neg}\left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)}}{d}} \]
        3. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{w0 \cdot \sqrt{\mathsf{neg}\left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)}}{\color{blue}{d}} \]
        4. Applied rewrites9.8%

          \[\leadsto \color{blue}{\frac{w0 \cdot \sqrt{-0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d}} \]
        5. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \frac{w0 \cdot \sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{\color{blue}{d}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{w0 \cdot \sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d} \]
          3. associate-/l*N/A

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

            \[\leadsto \frac{\sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d} \cdot \color{blue}{w0} \]
          5. lower-*.f64N/A

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

          \[\leadsto \frac{\sqrt{\frac{\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot M\right) \cdot h}{\ell} \cdot -0.25}}{d} \cdot \color{blue}{w0} \]
        7. Step-by-step derivation
          1. Applied rewrites13.7%

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

          if -2e30 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))

          1. Initial program 80.8%

            \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
          2. Taylor expanded in M around 0

            \[\leadsto w0 \cdot \color{blue}{1} \]
          3. Step-by-step derivation
            1. Applied rewrites68.0%

              \[\leadsto w0 \cdot \color{blue}{1} \]
          4. Recombined 3 regimes into one program.
          5. Add Preprocessing

          Alternative 7: 89.7% accurate, 0.6× speedup?

          \[\begin{array}{l} \mathbf{if}\;{\left(\frac{\left|M\right| \cdot \left|D\right|}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{+30}:\\ \;\;\;\;\frac{\left|D\right| \cdot \left(\left|M\right| \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)}{\left|d\right|} \cdot w0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot 1\\ \end{array} \]
          (FPCore (w0 M D h l d)
           :precision binary64
           (if (<=
                (* (pow (/ (* (fabs M) (fabs D)) (* 2.0 (fabs d))) 2.0) (/ h l))
                -2e+30)
             (* (/ (* (fabs D) (* (fabs M) (sqrt (* -0.25 (/ h l))))) (fabs d)) w0)
             (* w0 1.0)))
          double code(double w0, double M, double D, double h, double l, double d) {
          	double tmp;
          	if ((pow(((fabs(M) * fabs(D)) / (2.0 * fabs(d))), 2.0) * (h / l)) <= -2e+30) {
          		tmp = ((fabs(D) * (fabs(M) * sqrt((-0.25 * (h / l))))) / fabs(d)) * w0;
          	} else {
          		tmp = w0 * 1.0;
          	}
          	return tmp;
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(w0, m, d, h, l, d_1)
          use fmin_fmax_functions
              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) :: tmp
              if (((((abs(m) * abs(d)) / (2.0d0 * abs(d_1))) ** 2.0d0) * (h / l)) <= (-2d+30)) then
                  tmp = ((abs(d) * (abs(m) * sqrt(((-0.25d0) * (h / l))))) / abs(d_1)) * w0
              else
                  tmp = w0 * 1.0d0
              end if
              code = tmp
          end function
          
          public static double code(double w0, double M, double D, double h, double l, double d) {
          	double tmp;
          	if ((Math.pow(((Math.abs(M) * Math.abs(D)) / (2.0 * Math.abs(d))), 2.0) * (h / l)) <= -2e+30) {
          		tmp = ((Math.abs(D) * (Math.abs(M) * Math.sqrt((-0.25 * (h / l))))) / Math.abs(d)) * w0;
          	} else {
          		tmp = w0 * 1.0;
          	}
          	return tmp;
          }
          
          def code(w0, M, D, h, l, d):
          	tmp = 0
          	if (math.pow(((math.fabs(M) * math.fabs(D)) / (2.0 * math.fabs(d))), 2.0) * (h / l)) <= -2e+30:
          		tmp = ((math.fabs(D) * (math.fabs(M) * math.sqrt((-0.25 * (h / l))))) / math.fabs(d)) * w0
          	else:
          		tmp = w0 * 1.0
          	return tmp
          
          function code(w0, M, D, h, l, d)
          	tmp = 0.0
          	if (Float64((Float64(Float64(abs(M) * abs(D)) / Float64(2.0 * abs(d))) ^ 2.0) * Float64(h / l)) <= -2e+30)
          		tmp = Float64(Float64(Float64(abs(D) * Float64(abs(M) * sqrt(Float64(-0.25 * Float64(h / l))))) / abs(d)) * w0);
          	else
          		tmp = Float64(w0 * 1.0);
          	end
          	return tmp
          end
          
          function tmp_2 = code(w0, M, D, h, l, d)
          	tmp = 0.0;
          	if (((((abs(M) * abs(D)) / (2.0 * abs(d))) ^ 2.0) * (h / l)) <= -2e+30)
          		tmp = ((abs(D) * (abs(M) * sqrt((-0.25 * (h / l))))) / abs(d)) * w0;
          	else
          		tmp = w0 * 1.0;
          	end
          	tmp_2 = tmp;
          end
          
          code[w0_, M_, D_, h_, l_, d_] := If[LessEqual[N[(N[Power[N[(N[(N[Abs[M], $MachinePrecision] * N[Abs[D], $MachinePrecision]), $MachinePrecision] / N[(2.0 * N[Abs[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision], -2e+30], N[(N[(N[(N[Abs[D], $MachinePrecision] * N[(N[Abs[M], $MachinePrecision] * N[Sqrt[N[(-0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Abs[d], $MachinePrecision]), $MachinePrecision] * w0), $MachinePrecision], N[(w0 * 1.0), $MachinePrecision]]
          
          \begin{array}{l}
          \mathbf{if}\;{\left(\frac{\left|M\right| \cdot \left|D\right|}{2 \cdot \left|d\right|}\right)}^{2} \cdot \frac{h}{\ell} \leq -2 \cdot 10^{+30}:\\
          \;\;\;\;\frac{\left|D\right| \cdot \left(\left|M\right| \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)}{\left|d\right|} \cdot w0\\
          
          \mathbf{else}:\\
          \;\;\;\;w0 \cdot 1\\
          
          
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l)) < -2e30

            1. Initial program 80.8%

              \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
            2. Taylor expanded in d around 0

              \[\leadsto \color{blue}{\frac{w0 \cdot \sqrt{\mathsf{neg}\left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)}}{d}} \]
            3. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{w0 \cdot \sqrt{\mathsf{neg}\left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}\right)}}{\color{blue}{d}} \]
            4. Applied rewrites9.8%

              \[\leadsto \color{blue}{\frac{w0 \cdot \sqrt{-0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d}} \]
            5. Step-by-step derivation
              1. lift-/.f64N/A

                \[\leadsto \frac{w0 \cdot \sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{\color{blue}{d}} \]
              2. lift-*.f64N/A

                \[\leadsto \frac{w0 \cdot \sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d} \]
              3. associate-/l*N/A

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

                \[\leadsto \frac{\sqrt{-\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell}}}{d} \cdot \color{blue}{w0} \]
              5. lower-*.f64N/A

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

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

              \[\leadsto \frac{M \cdot \sqrt{\frac{-1}{4} \cdot \frac{{D}^{2} \cdot h}{\ell}}}{d} \cdot w0 \]
            8. Step-by-step derivation
              1. lower-*.f64N/A

                \[\leadsto \frac{M \cdot \sqrt{\frac{-1}{4} \cdot \frac{{D}^{2} \cdot h}{\ell}}}{d} \cdot w0 \]
              2. lower-sqrt.f64N/A

                \[\leadsto \frac{M \cdot \sqrt{\frac{-1}{4} \cdot \frac{{D}^{2} \cdot h}{\ell}}}{d} \cdot w0 \]
              3. lower-*.f64N/A

                \[\leadsto \frac{M \cdot \sqrt{\frac{-1}{4} \cdot \frac{{D}^{2} \cdot h}{\ell}}}{d} \cdot w0 \]
              4. lower-/.f64N/A

                \[\leadsto \frac{M \cdot \sqrt{\frac{-1}{4} \cdot \frac{{D}^{2} \cdot h}{\ell}}}{d} \cdot w0 \]
              5. lower-*.f64N/A

                \[\leadsto \frac{M \cdot \sqrt{\frac{-1}{4} \cdot \frac{{D}^{2} \cdot h}{\ell}}}{d} \cdot w0 \]
              6. lower-pow.f6411.6%

                \[\leadsto \frac{M \cdot \sqrt{-0.25 \cdot \frac{{D}^{2} \cdot h}{\ell}}}{d} \cdot w0 \]
            9. Applied rewrites11.6%

              \[\leadsto \frac{M \cdot \sqrt{-0.25 \cdot \frac{{D}^{2} \cdot h}{\ell}}}{d} \cdot w0 \]
            10. Taylor expanded in D around 0

              \[\leadsto \frac{D \cdot \left(M \cdot \sqrt{\frac{-1}{4} \cdot \frac{h}{\ell}}\right)}{d} \cdot w0 \]
            11. Step-by-step derivation
              1. lower-*.f64N/A

                \[\leadsto \frac{D \cdot \left(M \cdot \sqrt{\frac{-1}{4} \cdot \frac{h}{\ell}}\right)}{d} \cdot w0 \]
              2. lower-*.f64N/A

                \[\leadsto \frac{D \cdot \left(M \cdot \sqrt{\frac{-1}{4} \cdot \frac{h}{\ell}}\right)}{d} \cdot w0 \]
              3. lower-sqrt.f64N/A

                \[\leadsto \frac{D \cdot \left(M \cdot \sqrt{\frac{-1}{4} \cdot \frac{h}{\ell}}\right)}{d} \cdot w0 \]
              4. lower-*.f64N/A

                \[\leadsto \frac{D \cdot \left(M \cdot \sqrt{\frac{-1}{4} \cdot \frac{h}{\ell}}\right)}{d} \cdot w0 \]
              5. lower-/.f6414.2%

                \[\leadsto \frac{D \cdot \left(M \cdot \sqrt{-0.25 \cdot \frac{h}{\ell}}\right)}{d} \cdot w0 \]
            12. Applied rewrites14.2%

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

            if -2e30 < (*.f64 (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64)) (/.f64 h l))

            1. Initial program 80.8%

              \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
            2. Taylor expanded in M around 0

              \[\leadsto w0 \cdot \color{blue}{1} \]
            3. Step-by-step derivation
              1. Applied rewrites68.0%

                \[\leadsto w0 \cdot \color{blue}{1} \]
            4. Recombined 2 regimes into one program.
            5. Add Preprocessing

            Alternative 8: 68.0% accurate, 10.1× speedup?

            \[w0 \cdot 1 \]
            (FPCore (w0 M D h l d) :precision binary64 (* w0 1.0))
            double code(double w0, double M, double D, double h, double l, double d) {
            	return w0 * 1.0;
            }
            
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(w0, m, d, h, l, d_1)
            use fmin_fmax_functions
                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 * 1.0d0
            end function
            
            public static double code(double w0, double M, double D, double h, double l, double d) {
            	return w0 * 1.0;
            }
            
            def code(w0, M, D, h, l, d):
            	return w0 * 1.0
            
            function code(w0, M, D, h, l, d)
            	return Float64(w0 * 1.0)
            end
            
            function tmp = code(w0, M, D, h, l, d)
            	tmp = w0 * 1.0;
            end
            
            code[w0_, M_, D_, h_, l_, d_] := N[(w0 * 1.0), $MachinePrecision]
            
            w0 \cdot 1
            
            Derivation
            1. Initial program 80.8%

              \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}} \]
            2. Taylor expanded in M around 0

              \[\leadsto w0 \cdot \color{blue}{1} \]
            3. Step-by-step derivation
              1. Applied rewrites68.0%

                \[\leadsto w0 \cdot \color{blue}{1} \]
              2. Add Preprocessing

              Reproduce

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