Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.2% → 71.9%
Time: 10.3s
Alternatives: 20
Speedup: 0.6×

Specification

?
\[\begin{array}{l} \\ \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (*
  (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
  (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
	return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.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(d, h, l, m, d_1)
use fmin_fmax_functions
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
	return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D):
	return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D)
	return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
end
function tmp = code(d, h, l, M, D)
	tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)));
end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}

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 20 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: 66.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (*
  (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
  (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
	return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.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(d, h, l, m, d_1)
use fmin_fmax_functions
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
	return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D):
	return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D)
	return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
end
function tmp = code(d, h, l, M, D)
	tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)));
end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}

Alternative 1: 71.9% accurate, 0.6× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \frac{D\_m \cdot M\_m}{d + d}\\ \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+262}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot 0.5\right) \cdot t\_0\right) \cdot t\_0\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\left(D\_m \cdot M\_m\right) \cdot h}{\left(-2 \cdot d\right) \cdot \ell} \cdot \left(0.25 \cdot \frac{D\_m}{d}\right), M\_m, 1\right) \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (let* ((t_0 (/ (* D_m M_m) (+ d d))))
   (if (<=
        (*
         (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
         (-
          1.0
          (* (* (/ 1.0 2.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)) (/ h l))))
        5e+262)
     (*
      (* (sqrt (/ d l)) (sqrt (/ d h)))
      (- 1.0 (* (* (* (/ h l) 0.5) t_0) t_0)))
     (*
      (fma
       (* (/ (* (* D_m M_m) h) (* (* -2.0 d) l)) (* 0.25 (/ D_m d)))
       M_m
       1.0)
      (sqrt (* (/ d (* l h)) d))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double t_0 = (D_m * M_m) / (d + d);
	double tmp;
	if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+262) {
		tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((((h / l) * 0.5) * t_0) * t_0));
	} else {
		tmp = fma(((((D_m * M_m) * h) / ((-2.0 * d) * l)) * (0.25 * (D_m / d))), M_m, 1.0) * sqrt(((d / (l * h)) * d));
	}
	return tmp;
}
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	t_0 = Float64(Float64(D_m * M_m) / Float64(d + d))
	tmp = 0.0
	if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 5e+262)
		tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(Float64(h / l) * 0.5) * t_0) * t_0)));
	else
		tmp = Float64(fma(Float64(Float64(Float64(Float64(D_m * M_m) * h) / Float64(Float64(-2.0 * d) * l)) * Float64(0.25 * Float64(D_m / d))), M_m, 1.0) * sqrt(Float64(Float64(d / Float64(l * h)) * d)));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(d + d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+262], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(h / l), $MachinePrecision] * 0.5), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] / N[(N[(-2.0 * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * M$95$m + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / N[(l * h), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{D\_m \cdot M\_m}{d + d}\\
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+262}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot 0.5\right) \cdot t\_0\right) \cdot t\_0\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(D\_m \cdot M\_m\right) \cdot h}{\left(-2 \cdot d\right) \cdot \ell} \cdot \left(0.25 \cdot \frac{D\_m}{d}\right), M\_m, 1\right) \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}\\


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

    1. Initial program 66.2%

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

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

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

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

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

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

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

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
    3. Applied rewrites67.8%

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

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

        \[\leadsto \color{blue}{\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
      3. lower-*.f6467.8

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

        \[\leadsto \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
      5. metadata-eval67.8

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

        \[\leadsto \left(\color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
      7. pow1/2N/A

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
      8. lift-sqrt.f6467.8

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

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
      13. lower-sqrt.f6467.8

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{D \cdot M}{d + d}\right) \cdot \frac{\color{blue}{D \cdot M}}{d + d}\right) \]
      6. lower-/.f6467.9

        \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot 0.5\right) \cdot \frac{D \cdot M}{d + d}\right) \cdot \color{blue}{\frac{D \cdot M}{d + d}}\right) \]
    9. Applied rewrites67.9%

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

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

    1. Initial program 66.2%

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

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

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

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

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

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

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

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
    3. Applied rewrites67.8%

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot 0.5\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)}\right) \]
    4. Applied rewrites51.4%

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

Alternative 2: 71.8% accurate, 0.6× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \frac{M\_m}{d + d} \cdot D\_m\\ \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+262}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot 0.5\right) \cdot t\_0\right) \cdot t\_0\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\left(D\_m \cdot M\_m\right) \cdot h}{\left(-2 \cdot d\right) \cdot \ell} \cdot \left(0.25 \cdot \frac{D\_m}{d}\right), M\_m, 1\right) \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (let* ((t_0 (* (/ M_m (+ d d)) D_m)))
   (if (<=
        (*
         (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
         (-
          1.0
          (* (* (/ 1.0 2.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)) (/ h l))))
        5e+262)
     (*
      (* (sqrt (/ d l)) (sqrt (/ d h)))
      (- 1.0 (* (* (* (/ h l) 0.5) t_0) t_0)))
     (*
      (fma
       (* (/ (* (* D_m M_m) h) (* (* -2.0 d) l)) (* 0.25 (/ D_m d)))
       M_m
       1.0)
      (sqrt (* (/ d (* l h)) d))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double t_0 = (M_m / (d + d)) * D_m;
	double tmp;
	if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+262) {
		tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((((h / l) * 0.5) * t_0) * t_0));
	} else {
		tmp = fma(((((D_m * M_m) * h) / ((-2.0 * d) * l)) * (0.25 * (D_m / d))), M_m, 1.0) * sqrt(((d / (l * h)) * d));
	}
	return tmp;
}
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	t_0 = Float64(Float64(M_m / Float64(d + d)) * D_m)
	tmp = 0.0
	if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 5e+262)
		tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(Float64(h / l) * 0.5) * t_0) * t_0)));
	else
		tmp = Float64(fma(Float64(Float64(Float64(Float64(D_m * M_m) * h) / Float64(Float64(-2.0 * d) * l)) * Float64(0.25 * Float64(D_m / d))), M_m, 1.0) * sqrt(Float64(Float64(d / Float64(l * h)) * d)));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(M$95$m / N[(d + d), $MachinePrecision]), $MachinePrecision] * D$95$m), $MachinePrecision]}, If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+262], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(h / l), $MachinePrecision] * 0.5), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] / N[(N[(-2.0 * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * M$95$m + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / N[(l * h), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M\_m}{d + d} \cdot D\_m\\
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+262}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot 0.5\right) \cdot t\_0\right) \cdot t\_0\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(D\_m \cdot M\_m\right) \cdot h}{\left(-2 \cdot d\right) \cdot \ell} \cdot \left(0.25 \cdot \frac{D\_m}{d}\right), M\_m, 1\right) \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}\\


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

    1. Initial program 66.2%

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

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

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

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

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

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

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

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
    3. Applied rewrites67.8%

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

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

        \[\leadsto \color{blue}{\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
      3. lower-*.f6467.8

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

        \[\leadsto \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
      5. metadata-eval67.8

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

        \[\leadsto \left(\color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
      7. pow1/2N/A

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
      8. lift-sqrt.f6467.8

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

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
      13. lower-sqrt.f6467.8

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

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

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

    1. Initial program 66.2%

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

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

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

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

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

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

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

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
    3. Applied rewrites67.8%

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot 0.5\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)}\right) \]
    4. Applied rewrites51.4%

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

Alternative 3: 71.7% accurate, 0.6× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := D\_m \cdot \frac{M\_m}{d + d}\\ \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+262}:\\ \;\;\;\;\left(\mathsf{fma}\left(t\_0 \cdot \left(t\_0 \cdot \frac{h}{\ell}\right), -0.5, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\left(D\_m \cdot M\_m\right) \cdot h}{\left(-2 \cdot d\right) \cdot \ell} \cdot \left(0.25 \cdot \frac{D\_m}{d}\right), M\_m, 1\right) \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (let* ((t_0 (* D_m (/ M_m (+ d d)))))
   (if (<=
        (*
         (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
         (-
          1.0
          (* (* (/ 1.0 2.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)) (/ h l))))
        5e+262)
     (*
      (* (fma (* t_0 (* t_0 (/ h l))) -0.5 1.0) (sqrt (/ d l)))
      (sqrt (/ d h)))
     (*
      (fma
       (* (/ (* (* D_m M_m) h) (* (* -2.0 d) l)) (* 0.25 (/ D_m d)))
       M_m
       1.0)
      (sqrt (* (/ d (* l h)) d))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double t_0 = D_m * (M_m / (d + d));
	double tmp;
	if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+262) {
		tmp = (fma((t_0 * (t_0 * (h / l))), -0.5, 1.0) * sqrt((d / l))) * sqrt((d / h));
	} else {
		tmp = fma(((((D_m * M_m) * h) / ((-2.0 * d) * l)) * (0.25 * (D_m / d))), M_m, 1.0) * sqrt(((d / (l * h)) * d));
	}
	return tmp;
}
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	t_0 = Float64(D_m * Float64(M_m / Float64(d + d)))
	tmp = 0.0
	if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 5e+262)
		tmp = Float64(Float64(fma(Float64(t_0 * Float64(t_0 * Float64(h / l))), -0.5, 1.0) * sqrt(Float64(d / l))) * sqrt(Float64(d / h)));
	else
		tmp = Float64(fma(Float64(Float64(Float64(Float64(D_m * M_m) * h) / Float64(Float64(-2.0 * d) * l)) * Float64(0.25 * Float64(D_m / d))), M_m, 1.0) * sqrt(Float64(Float64(d / Float64(l * h)) * d)));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(M$95$m / N[(d + d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+262], N[(N[(N[(N[(t$95$0 * N[(t$95$0 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] / N[(N[(-2.0 * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * M$95$m + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / N[(l * h), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \frac{M\_m}{d + d}\\
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+262}:\\
\;\;\;\;\left(\mathsf{fma}\left(t\_0 \cdot \left(t\_0 \cdot \frac{h}{\ell}\right), -0.5, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(D\_m \cdot M\_m\right) \cdot h}{\left(-2 \cdot d\right) \cdot \ell} \cdot \left(0.25 \cdot \frac{D\_m}{d}\right), M\_m, 1\right) \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}\\


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

    1. Initial program 66.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Applied rewrites43.1%

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

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

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

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

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

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

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

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

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

    1. Initial program 66.2%

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

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

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

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

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

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

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

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
    3. Applied rewrites67.8%

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot 0.5\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)}\right) \]
    4. Applied rewrites51.4%

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

Alternative 4: 71.5% accurate, 0.6× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+262}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{h \cdot \frac{0.25 \cdot \left(D\_m \cdot M\_m\right)}{d}}{\ell} \cdot \left(\frac{M\_m}{d + d} \cdot D\_m\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\left(D\_m \cdot M\_m\right) \cdot h}{\left(-2 \cdot d\right) \cdot \ell} \cdot \left(0.25 \cdot \frac{D\_m}{d}\right), M\_m, 1\right) \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<=
      (*
       (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
       (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)) (/ h l))))
      5e+262)
   (*
    (* (sqrt (/ d l)) (sqrt (/ d h)))
    (- 1.0 (* (/ (* h (/ (* 0.25 (* D_m M_m)) d)) l) (* (/ M_m (+ d d)) D_m))))
   (*
    (fma (* (/ (* (* D_m M_m) h) (* (* -2.0 d) l)) (* 0.25 (/ D_m d))) M_m 1.0)
    (sqrt (* (/ d (* l h)) d)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)))) <= 5e+262) {
		tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (((h * ((0.25 * (D_m * M_m)) / d)) / l) * ((M_m / (d + d)) * D_m)));
	} else {
		tmp = fma(((((D_m * M_m) * h) / ((-2.0 * d) * l)) * (0.25 * (D_m / d))), M_m, 1.0) * sqrt(((d / (l * h)) * d));
	}
	return tmp;
}
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= 5e+262)
		tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(h * Float64(Float64(0.25 * Float64(D_m * M_m)) / d)) / l) * Float64(Float64(M_m / Float64(d + d)) * D_m))));
	else
		tmp = Float64(fma(Float64(Float64(Float64(Float64(D_m * M_m) * h) / Float64(Float64(-2.0 * d) * l)) * Float64(0.25 * Float64(D_m / d))), M_m, 1.0) * sqrt(Float64(Float64(d / Float64(l * h)) * d)));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+262], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(h * N[(N[(0.25 * N[(D$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(M$95$m / N[(d + d), $MachinePrecision]), $MachinePrecision] * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] / N[(N[(-2.0 * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * M$95$m + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / N[(l * h), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{+262}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{h \cdot \frac{0.25 \cdot \left(D\_m \cdot M\_m\right)}{d}}{\ell} \cdot \left(\frac{M\_m}{d + d} \cdot D\_m\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(D\_m \cdot M\_m\right) \cdot h}{\left(-2 \cdot d\right) \cdot \ell} \cdot \left(0.25 \cdot \frac{D\_m}{d}\right), M\_m, 1\right) \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}\\


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

    1. Initial program 66.2%

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

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

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

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

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

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

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

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
    3. Applied rewrites67.8%

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

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

        \[\leadsto \color{blue}{\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
      3. lower-*.f6467.8

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

        \[\leadsto \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
      5. metadata-eval67.8

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

        \[\leadsto \left(\color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
      7. pow1/2N/A

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
      8. lift-sqrt.f6467.8

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

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
      13. lower-sqrt.f6467.8

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

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

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

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

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

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

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

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

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

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

    1. Initial program 66.2%

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

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

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

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

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

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

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

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
    3. Applied rewrites67.8%

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot 0.5\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)}\right) \]
    4. Applied rewrites51.4%

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

Alternative 5: 68.3% accurate, 0.2× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(\frac{\left(D\_m \cdot M\_m\right) \cdot h}{\left(-2 \cdot d\right) \cdot \ell} \cdot \left(0.25 \cdot \frac{D\_m}{d}\right), M\_m, 1\right)\\ t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_2 := \sqrt{\frac{d}{h}}\\ t_3 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{+114}:\\ \;\;\;\;\left(t\_0 \cdot t\_2\right) \cdot t\_3\\ \mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-155}:\\ \;\;\;\;\left(\mathsf{fma}\left(\left(\left(\left(\left(D\_m \cdot M\_m\right) \cdot D\_m\right) \cdot M\_m\right) \cdot \frac{0.25}{d \cdot d}\right) \cdot \frac{h}{\ell}, -0.5, 1\right) \cdot t\_3\right) \cdot t\_2\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-227}:\\ \;\;\;\;\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell}\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+262}:\\ \;\;\;\;\left(t\_3 \cdot t\_2\right) \cdot 1\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (let* ((t_0
         (fma
          (* (/ (* (* D_m M_m) h) (* (* -2.0 d) l)) (* 0.25 (/ D_m d)))
          M_m
          1.0))
        (t_1
         (*
          (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
          (-
           1.0
           (* (* (/ 1.0 2.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)) (/ h l)))))
        (t_2 (sqrt (/ d h)))
        (t_3 (sqrt (/ d l))))
   (if (<= t_1 -2e+114)
     (* (* t_0 t_2) t_3)
     (if (<= t_1 -2e-155)
       (*
        (*
         (fma
          (* (* (* (* (* D_m M_m) D_m) M_m) (/ 0.25 (* d d))) (/ h l))
          -0.5
          1.0)
         t_3)
        t_2)
       (if (<= t_1 2e-227)
         (/ (* (sqrt (* d h)) (sqrt (* d l))) (* h l))
         (if (<= t_1 5e+262)
           (* (* t_3 t_2) 1.0)
           (* t_0 (sqrt (* (/ d (* l h)) d)))))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double t_0 = fma(((((D_m * M_m) * h) / ((-2.0 * d) * l)) * (0.25 * (D_m / d))), M_m, 1.0);
	double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
	double t_2 = sqrt((d / h));
	double t_3 = sqrt((d / l));
	double tmp;
	if (t_1 <= -2e+114) {
		tmp = (t_0 * t_2) * t_3;
	} else if (t_1 <= -2e-155) {
		tmp = (fma((((((D_m * M_m) * D_m) * M_m) * (0.25 / (d * d))) * (h / l)), -0.5, 1.0) * t_3) * t_2;
	} else if (t_1 <= 2e-227) {
		tmp = (sqrt((d * h)) * sqrt((d * l))) / (h * l);
	} else if (t_1 <= 5e+262) {
		tmp = (t_3 * t_2) * 1.0;
	} else {
		tmp = t_0 * sqrt(((d / (l * h)) * d));
	}
	return tmp;
}
M_m = abs(M)
D_m = abs(D)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	t_0 = fma(Float64(Float64(Float64(Float64(D_m * M_m) * h) / Float64(Float64(-2.0 * d) * l)) * Float64(0.25 * Float64(D_m / d))), M_m, 1.0)
	t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
	t_2 = sqrt(Float64(d / h))
	t_3 = sqrt(Float64(d / l))
	tmp = 0.0
	if (t_1 <= -2e+114)
		tmp = Float64(Float64(t_0 * t_2) * t_3);
	elseif (t_1 <= -2e-155)
		tmp = Float64(Float64(fma(Float64(Float64(Float64(Float64(Float64(D_m * M_m) * D_m) * M_m) * Float64(0.25 / Float64(d * d))) * Float64(h / l)), -0.5, 1.0) * t_3) * t_2);
	elseif (t_1 <= 2e-227)
		tmp = Float64(Float64(sqrt(Float64(d * h)) * sqrt(Float64(d * l))) / Float64(h * l));
	elseif (t_1 <= 5e+262)
		tmp = Float64(Float64(t_3 * t_2) * 1.0);
	else
		tmp = Float64(t_0 * sqrt(Float64(Float64(d / Float64(l * h)) * d)));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] / N[(N[(-2.0 * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * M$95$m + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -2e+114], N[(N[(t$95$0 * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[t$95$1, -2e-155], N[(N[(N[(N[(N[(N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] * N[(0.25 / N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$1, 2e-227], N[(N[(N[Sqrt[N[(d * h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(h * l), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+262], N[(N[(t$95$3 * t$95$2), $MachinePrecision] * 1.0), $MachinePrecision], N[(t$95$0 * N[Sqrt[N[(N[(d / N[(l * h), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{\left(D\_m \cdot M\_m\right) \cdot h}{\left(-2 \cdot d\right) \cdot \ell} \cdot \left(0.25 \cdot \frac{D\_m}{d}\right), M\_m, 1\right)\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_2 := \sqrt{\frac{d}{h}}\\
t_3 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+114}:\\
\;\;\;\;\left(t\_0 \cdot t\_2\right) \cdot t\_3\\

\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-155}:\\
\;\;\;\;\left(\mathsf{fma}\left(\left(\left(\left(\left(D\_m \cdot M\_m\right) \cdot D\_m\right) \cdot M\_m\right) \cdot \frac{0.25}{d \cdot d}\right) \cdot \frac{h}{\ell}, -0.5, 1\right) \cdot t\_3\right) \cdot t\_2\\

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-227}:\\
\;\;\;\;\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell}\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+262}:\\
\;\;\;\;\left(t\_3 \cdot t\_2\right) \cdot 1\\

\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}\\


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

    1. Initial program 66.2%

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

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

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

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

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

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

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

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
    3. Applied rewrites67.8%

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

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

    if -2e114 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.00000000000000003e-155

    1. Initial program 66.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Applied rewrites43.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{fma}\left(\frac{h \cdot \left(\left(\left(M \cdot M\right) \cdot \color{blue}{\left(D \cdot D\right)}\right) \cdot \frac{1}{4}\right)}{\ell \cdot \left(d \cdot d\right)}, \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
      11. unswap-sqrN/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{h \cdot \left(\color{blue}{\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right)} \cdot \frac{1}{4}\right)}{\ell \cdot \left(d \cdot d\right)}, \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
      12. metadata-evalN/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{h \cdot \left(\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{2}\right)}\right)}{\ell \cdot \left(d \cdot d\right)}, \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
      13. swap-sqrN/A

        \[\leadsto \left(\mathsf{fma}\left(\frac{h \cdot \color{blue}{\left(\left(\left(M \cdot D\right) \cdot \frac{1}{2}\right) \cdot \left(\left(M \cdot D\right) \cdot \frac{1}{2}\right)\right)}}{\ell \cdot \left(d \cdot d\right)}, \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
      14. metadata-evalN/A

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

        \[\leadsto \left(\mathsf{fma}\left(\frac{h \cdot \left(\color{blue}{\frac{M \cdot D}{2}} \cdot \left(\left(M \cdot D\right) \cdot \frac{1}{2}\right)\right)}{\ell \cdot \left(d \cdot d\right)}, \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
      16. metadata-evalN/A

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

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

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

        \[\leadsto \left(\mathsf{fma}\left(\frac{h \cdot \left(\color{blue}{\left(\left(M \cdot D\right) \cdot \frac{1}{2}\right)} \cdot \frac{M \cdot D}{2}\right)}{\ell \cdot \left(d \cdot d\right)}, \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
      20. metadata-evalN/A

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

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

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

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

        \[\leadsto \left(\mathsf{fma}\left(\frac{h \cdot \left(\left(\left(D \cdot M\right) \cdot \frac{1}{2}\right) \cdot \color{blue}{\left(\left(M \cdot D\right) \cdot \frac{1}{2}\right)}\right)}{\ell \cdot \left(d \cdot d\right)}, \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
      25. metadata-evalN/A

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

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

        \[\leadsto \left(\mathsf{fma}\left(\frac{h \cdot \left(\left(\left(D \cdot M\right) \cdot \frac{1}{2}\right) \cdot \left(\color{blue}{\left(D \cdot M\right)} \cdot \frac{1}{2}\right)\right)}{\ell \cdot \left(d \cdot d\right)}, \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
      28. lower-*.f6452.7

        \[\leadsto \left(\mathsf{fma}\left(\frac{h \cdot \left(\left(\left(D \cdot M\right) \cdot 0.5\right) \cdot \left(\color{blue}{\left(D \cdot M\right)} \cdot 0.5\right)\right)}{\ell \cdot \left(d \cdot d\right)}, -0.5, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
    4. Applied rewrites52.7%

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

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{fma}\left(\frac{h}{\ell} \cdot \frac{\left(\left(D \cdot M\right) \cdot \frac{1}{2}\right) \cdot \left(\left(D \cdot M\right) \cdot \frac{1}{2}\right)}{\color{blue}{d \cdot d}}, \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
      8. times-fracN/A

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

        \[\leadsto \left(\mathsf{fma}\left(\frac{h}{\ell} \cdot \left(\frac{\color{blue}{\left(D \cdot M\right) \cdot \frac{1}{2}}}{d} \cdot \frac{\left(D \cdot M\right) \cdot \frac{1}{2}}{d}\right), \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
      10. metadata-evalN/A

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

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

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

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

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

        \[\leadsto \left(\mathsf{fma}\left(\frac{h}{\ell} \cdot \left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{\color{blue}{\left(D \cdot M\right) \cdot \frac{1}{2}}}{d}\right), \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
      16. metadata-evalN/A

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

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

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

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

        \[\leadsto \left(\mathsf{fma}\left(\frac{h}{\ell} \cdot \left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{\color{blue}{M \cdot D}}{2 \cdot d}\right), \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
    6. Applied rewrites51.7%

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

    if -2.00000000000000003e-155 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1.99999999999999989e-227

    1. Initial program 66.2%

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

      \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
      3. lower-sqrt.f64N/A

        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
      5. lower-sqrt.f64N/A

        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
      6. lower-/.f6422.7

        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
    4. Applied rewrites22.7%

      \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
    5. Taylor expanded in l around 0

      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\color{blue}{h \cdot \ell}} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \color{blue}{\ell}} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
      3. lower-sqrt.f64N/A

        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
      5. lower-sqrt.f64N/A

        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
      6. lower-*.f64N/A

        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
      7. lower-*.f6429.6

        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
    7. Applied rewrites29.6%

      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\color{blue}{h \cdot \ell}} \]

    if 1.99999999999999989e-227 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.00000000000000008e262

    1. Initial program 66.2%

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

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

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

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

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

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

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

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
    3. Applied rewrites67.8%

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

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

        \[\leadsto \color{blue}{\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
      3. lower-*.f6467.8

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

        \[\leadsto \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
      5. metadata-eval67.8

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

        \[\leadsto \left(\color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
      7. pow1/2N/A

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
      8. lift-sqrt.f6467.8

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

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
      13. lower-sqrt.f6467.8

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \color{blue}{1} \]

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

      1. Initial program 66.2%

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

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

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

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

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

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

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

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

          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
      3. Applied rewrites67.8%

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot 0.5\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)}\right) \]
      4. Applied rewrites51.4%

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

    Alternative 6: 67.7% accurate, 0.3× speedup?

    \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_1 := \sqrt{\frac{d}{\ell}}\\ t_2 := \sqrt{\frac{d}{h}}\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-155}:\\ \;\;\;\;\left(\mathsf{fma}\left(\frac{\frac{\left(h \cdot \left(D\_m \cdot M\_m\right)\right) \cdot \left(0.25 \cdot \left(D\_m \cdot M\_m\right)\right)}{\ell \cdot d}}{d}, -0.5, 1\right) \cdot t\_1\right) \cdot t\_2\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-227}:\\ \;\;\;\;\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell}\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+262}:\\ \;\;\;\;\left(t\_1 \cdot t\_2\right) \cdot 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\left(D\_m \cdot M\_m\right) \cdot h}{\left(-2 \cdot d\right) \cdot \ell} \cdot \left(0.25 \cdot \frac{D\_m}{d}\right), M\_m, 1\right) \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}\\ \end{array} \end{array} \]
    M_m = (fabs.f64 M)
    D_m = (fabs.f64 D)
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    (FPCore (d h l M_m D_m)
     :precision binary64
     (let* ((t_0
             (*
              (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
              (-
               1.0
               (* (* (/ 1.0 2.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)) (/ h l)))))
            (t_1 (sqrt (/ d l)))
            (t_2 (sqrt (/ d h))))
       (if (<= t_0 -2e-155)
         (*
          (*
           (fma
            (/ (/ (* (* h (* D_m M_m)) (* 0.25 (* D_m M_m))) (* l d)) d)
            -0.5
            1.0)
           t_1)
          t_2)
         (if (<= t_0 2e-227)
           (/ (* (sqrt (* d h)) (sqrt (* d l))) (* h l))
           (if (<= t_0 5e+262)
             (* (* t_1 t_2) 1.0)
             (*
              (fma
               (* (/ (* (* D_m M_m) h) (* (* -2.0 d) l)) (* 0.25 (/ D_m d)))
               M_m
               1.0)
              (sqrt (* (/ d (* l h)) d))))))))
    M_m = fabs(M);
    D_m = fabs(D);
    assert(d < h && h < l && l < M_m && M_m < D_m);
    double code(double d, double h, double l, double M_m, double D_m) {
    	double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
    	double t_1 = sqrt((d / l));
    	double t_2 = sqrt((d / h));
    	double tmp;
    	if (t_0 <= -2e-155) {
    		tmp = (fma(((((h * (D_m * M_m)) * (0.25 * (D_m * M_m))) / (l * d)) / d), -0.5, 1.0) * t_1) * t_2;
    	} else if (t_0 <= 2e-227) {
    		tmp = (sqrt((d * h)) * sqrt((d * l))) / (h * l);
    	} else if (t_0 <= 5e+262) {
    		tmp = (t_1 * t_2) * 1.0;
    	} else {
    		tmp = fma(((((D_m * M_m) * h) / ((-2.0 * d) * l)) * (0.25 * (D_m / d))), M_m, 1.0) * sqrt(((d / (l * h)) * d));
    	}
    	return tmp;
    }
    
    M_m = abs(M)
    D_m = abs(D)
    d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
    function code(d, h, l, M_m, D_m)
    	t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
    	t_1 = sqrt(Float64(d / l))
    	t_2 = sqrt(Float64(d / h))
    	tmp = 0.0
    	if (t_0 <= -2e-155)
    		tmp = Float64(Float64(fma(Float64(Float64(Float64(Float64(h * Float64(D_m * M_m)) * Float64(0.25 * Float64(D_m * M_m))) / Float64(l * d)) / d), -0.5, 1.0) * t_1) * t_2);
    	elseif (t_0 <= 2e-227)
    		tmp = Float64(Float64(sqrt(Float64(d * h)) * sqrt(Float64(d * l))) / Float64(h * l));
    	elseif (t_0 <= 5e+262)
    		tmp = Float64(Float64(t_1 * t_2) * 1.0);
    	else
    		tmp = Float64(fma(Float64(Float64(Float64(Float64(D_m * M_m) * h) / Float64(Float64(-2.0 * d) * l)) * Float64(0.25 * Float64(D_m / d))), M_m, 1.0) * sqrt(Float64(Float64(d / Float64(l * h)) * d)));
    	end
    	return tmp
    end
    
    M_m = N[Abs[M], $MachinePrecision]
    D_m = N[Abs[D], $MachinePrecision]
    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -2e-155], N[(N[(N[(N[(N[(N[(N[(h * N[(D$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(D$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$0, 2e-227], N[(N[(N[Sqrt[N[(d * h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(h * l), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+262], N[(N[(t$95$1 * t$95$2), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[(N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] / N[(N[(-2.0 * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * M$95$m + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / N[(l * h), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
    
    \begin{array}{l}
    M_m = \left|M\right|
    \\
    D_m = \left|D\right|
    \\
    [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
    \\
    \begin{array}{l}
    t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
    t_1 := \sqrt{\frac{d}{\ell}}\\
    t_2 := \sqrt{\frac{d}{h}}\\
    \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-155}:\\
    \;\;\;\;\left(\mathsf{fma}\left(\frac{\frac{\left(h \cdot \left(D\_m \cdot M\_m\right)\right) \cdot \left(0.25 \cdot \left(D\_m \cdot M\_m\right)\right)}{\ell \cdot d}}{d}, -0.5, 1\right) \cdot t\_1\right) \cdot t\_2\\
    
    \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-227}:\\
    \;\;\;\;\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell}\\
    
    \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+262}:\\
    \;\;\;\;\left(t\_1 \cdot t\_2\right) \cdot 1\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(\frac{\left(D\_m \cdot M\_m\right) \cdot h}{\left(-2 \cdot d\right) \cdot \ell} \cdot \left(0.25 \cdot \frac{D\_m}{d}\right), M\_m, 1\right) \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.00000000000000003e-155

      1. Initial program 66.2%

        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. Applied rewrites43.1%

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\mathsf{fma}\left(\frac{h \cdot \left(\left(\left(M \cdot M\right) \cdot \color{blue}{\left(D \cdot D\right)}\right) \cdot \frac{1}{4}\right)}{\ell \cdot \left(d \cdot d\right)}, \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
        11. unswap-sqrN/A

          \[\leadsto \left(\mathsf{fma}\left(\frac{h \cdot \left(\color{blue}{\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right)} \cdot \frac{1}{4}\right)}{\ell \cdot \left(d \cdot d\right)}, \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
        12. metadata-evalN/A

          \[\leadsto \left(\mathsf{fma}\left(\frac{h \cdot \left(\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{2}\right)}\right)}{\ell \cdot \left(d \cdot d\right)}, \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
        13. swap-sqrN/A

          \[\leadsto \left(\mathsf{fma}\left(\frac{h \cdot \color{blue}{\left(\left(\left(M \cdot D\right) \cdot \frac{1}{2}\right) \cdot \left(\left(M \cdot D\right) \cdot \frac{1}{2}\right)\right)}}{\ell \cdot \left(d \cdot d\right)}, \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
        14. metadata-evalN/A

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

          \[\leadsto \left(\mathsf{fma}\left(\frac{h \cdot \left(\color{blue}{\frac{M \cdot D}{2}} \cdot \left(\left(M \cdot D\right) \cdot \frac{1}{2}\right)\right)}{\ell \cdot \left(d \cdot d\right)}, \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
        16. metadata-evalN/A

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

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

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

          \[\leadsto \left(\mathsf{fma}\left(\frac{h \cdot \left(\color{blue}{\left(\left(M \cdot D\right) \cdot \frac{1}{2}\right)} \cdot \frac{M \cdot D}{2}\right)}{\ell \cdot \left(d \cdot d\right)}, \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
        20. metadata-evalN/A

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

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

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

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

          \[\leadsto \left(\mathsf{fma}\left(\frac{h \cdot \left(\left(\left(D \cdot M\right) \cdot \frac{1}{2}\right) \cdot \color{blue}{\left(\left(M \cdot D\right) \cdot \frac{1}{2}\right)}\right)}{\ell \cdot \left(d \cdot d\right)}, \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
        25. metadata-evalN/A

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

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

          \[\leadsto \left(\mathsf{fma}\left(\frac{h \cdot \left(\left(\left(D \cdot M\right) \cdot \frac{1}{2}\right) \cdot \left(\color{blue}{\left(D \cdot M\right)} \cdot \frac{1}{2}\right)\right)}{\ell \cdot \left(d \cdot d\right)}, \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
        28. lower-*.f6452.7

          \[\leadsto \left(\mathsf{fma}\left(\frac{h \cdot \left(\left(\left(D \cdot M\right) \cdot 0.5\right) \cdot \left(\color{blue}{\left(D \cdot M\right)} \cdot 0.5\right)\right)}{\ell \cdot \left(d \cdot d\right)}, -0.5, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
      4. Applied rewrites52.7%

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

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

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

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

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

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

          \[\leadsto \left(\mathsf{fma}\left(\color{blue}{\frac{\frac{h \cdot \left(\left(\left(D \cdot M\right) \cdot \frac{1}{2}\right) \cdot \left(\left(D \cdot M\right) \cdot \frac{1}{2}\right)\right)}{\ell \cdot d}}{d}}, \frac{-1}{2}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}} \]
      6. Applied rewrites63.1%

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

      if -2.00000000000000003e-155 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1.99999999999999989e-227

      1. Initial program 66.2%

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

        \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
      3. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
        2. lower-*.f64N/A

          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
        3. lower-sqrt.f64N/A

          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
        4. lower-*.f64N/A

          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
        5. lower-sqrt.f64N/A

          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
        6. lower-/.f6422.7

          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
      4. Applied rewrites22.7%

        \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
      5. Taylor expanded in l around 0

        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\color{blue}{h \cdot \ell}} \]
      6. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \color{blue}{\ell}} \]
        2. lower-*.f64N/A

          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
        3. lower-sqrt.f64N/A

          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
        4. lower-*.f64N/A

          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
        5. lower-sqrt.f64N/A

          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
        6. lower-*.f64N/A

          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
        7. lower-*.f6429.6

          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
      7. Applied rewrites29.6%

        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\color{blue}{h \cdot \ell}} \]

      if 1.99999999999999989e-227 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.00000000000000008e262

      1. Initial program 66.2%

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

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

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

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

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

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

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

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

          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
      3. Applied rewrites67.8%

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

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

          \[\leadsto \color{blue}{\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
        3. lower-*.f6467.8

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

          \[\leadsto \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
        5. metadata-eval67.8

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

          \[\leadsto \left(\color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
        7. pow1/2N/A

          \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
        8. lift-sqrt.f6467.8

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

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

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

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

          \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
        13. lower-sqrt.f6467.8

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

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

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

          \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \color{blue}{1} \]

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

        1. Initial program 66.2%

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

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

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

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

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

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

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

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

            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
        3. Applied rewrites67.8%

          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot 0.5\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)}\right) \]
        4. Applied rewrites51.4%

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

      Alternative 7: 66.9% accurate, 0.3× speedup?

      \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell \cdot h} \cdot d}\\ t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_2 := 0.25 \cdot \frac{D\_m}{d}\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{-88}:\\ \;\;\;\;-\mathsf{fma}\left(\frac{h}{\left(d + d\right) \cdot \ell} \cdot \left(D\_m \cdot M\_m\right), t\_2 \cdot M\_m, -1\right) \cdot t\_0\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-227}:\\ \;\;\;\;\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell}\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+262}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\left(D\_m \cdot M\_m\right) \cdot h}{\left(-2 \cdot d\right) \cdot \ell} \cdot t\_2, M\_m, 1\right) \cdot t\_0\\ \end{array} \end{array} \]
      M_m = (fabs.f64 M)
      D_m = (fabs.f64 D)
      NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
      (FPCore (d h l M_m D_m)
       :precision binary64
       (let* ((t_0 (sqrt (* (/ d (* l h)) d)))
              (t_1
               (*
                (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                (-
                 1.0
                 (* (* (/ 1.0 2.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)) (/ h l)))))
              (t_2 (* 0.25 (/ D_m d))))
         (if (<= t_1 -5e-88)
           (- (* (fma (* (/ h (* (+ d d) l)) (* D_m M_m)) (* t_2 M_m) -1.0) t_0))
           (if (<= t_1 2e-227)
             (/ (* (sqrt (* d h)) (sqrt (* d l))) (* h l))
             (if (<= t_1 5e+262)
               (* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
               (*
                (fma (* (/ (* (* D_m M_m) h) (* (* -2.0 d) l)) t_2) M_m 1.0)
                t_0))))))
      M_m = fabs(M);
      D_m = fabs(D);
      assert(d < h && h < l && l < M_m && M_m < D_m);
      double code(double d, double h, double l, double M_m, double D_m) {
      	double t_0 = sqrt(((d / (l * h)) * d));
      	double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
      	double t_2 = 0.25 * (D_m / d);
      	double tmp;
      	if (t_1 <= -5e-88) {
      		tmp = -(fma(((h / ((d + d) * l)) * (D_m * M_m)), (t_2 * M_m), -1.0) * t_0);
      	} else if (t_1 <= 2e-227) {
      		tmp = (sqrt((d * h)) * sqrt((d * l))) / (h * l);
      	} else if (t_1 <= 5e+262) {
      		tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
      	} else {
      		tmp = fma(((((D_m * M_m) * h) / ((-2.0 * d) * l)) * t_2), M_m, 1.0) * t_0;
      	}
      	return tmp;
      }
      
      M_m = abs(M)
      D_m = abs(D)
      d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
      function code(d, h, l, M_m, D_m)
      	t_0 = sqrt(Float64(Float64(d / Float64(l * h)) * d))
      	t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
      	t_2 = Float64(0.25 * Float64(D_m / d))
      	tmp = 0.0
      	if (t_1 <= -5e-88)
      		tmp = Float64(-Float64(fma(Float64(Float64(h / Float64(Float64(d + d) * l)) * Float64(D_m * M_m)), Float64(t_2 * M_m), -1.0) * t_0));
      	elseif (t_1 <= 2e-227)
      		tmp = Float64(Float64(sqrt(Float64(d * h)) * sqrt(Float64(d * l))) / Float64(h * l));
      	elseif (t_1 <= 5e+262)
      		tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0);
      	else
      		tmp = Float64(fma(Float64(Float64(Float64(Float64(D_m * M_m) * h) / Float64(Float64(-2.0 * d) * l)) * t_2), M_m, 1.0) * t_0);
      	end
      	return tmp
      end
      
      M_m = N[Abs[M], $MachinePrecision]
      D_m = N[Abs[D], $MachinePrecision]
      NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
      code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(N[(d / N[(l * h), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.25 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-88], (-N[(N[(N[(N[(h / N[(N[(d + d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * N[(D$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * M$95$m), $MachinePrecision] + -1.0), $MachinePrecision] * t$95$0), $MachinePrecision]), If[LessEqual[t$95$1, 2e-227], N[(N[(N[Sqrt[N[(d * h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(h * l), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+262], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[(N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] / N[(N[(-2.0 * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] * M$95$m + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision]]]]]]]
      
      \begin{array}{l}
      M_m = \left|M\right|
      \\
      D_m = \left|D\right|
      \\
      [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
      \\
      \begin{array}{l}
      t_0 := \sqrt{\frac{d}{\ell \cdot h} \cdot d}\\
      t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
      t_2 := 0.25 \cdot \frac{D\_m}{d}\\
      \mathbf{if}\;t\_1 \leq -5 \cdot 10^{-88}:\\
      \;\;\;\;-\mathsf{fma}\left(\frac{h}{\left(d + d\right) \cdot \ell} \cdot \left(D\_m \cdot M\_m\right), t\_2 \cdot M\_m, -1\right) \cdot t\_0\\
      
      \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-227}:\\
      \;\;\;\;\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell}\\
      
      \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+262}:\\
      \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
      
      \mathbf{else}:\\
      \;\;\;\;\mathsf{fma}\left(\frac{\left(D\_m \cdot M\_m\right) \cdot h}{\left(-2 \cdot d\right) \cdot \ell} \cdot t\_2, M\_m, 1\right) \cdot t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.00000000000000009e-88

        1. Initial program 66.2%

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

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

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

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

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

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

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

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

            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
        3. Applied rewrites67.8%

          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot 0.5\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)}\right) \]
        4. Applied rewrites50.0%

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

        if -5.00000000000000009e-88 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1.99999999999999989e-227

        1. Initial program 66.2%

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

          \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
        3. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
          2. lower-*.f64N/A

            \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
          3. lower-sqrt.f64N/A

            \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
          4. lower-*.f64N/A

            \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
          5. lower-sqrt.f64N/A

            \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
          6. lower-/.f6422.7

            \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
        4. Applied rewrites22.7%

          \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
        5. Taylor expanded in l around 0

          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\color{blue}{h \cdot \ell}} \]
        6. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \color{blue}{\ell}} \]
          2. lower-*.f64N/A

            \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
          3. lower-sqrt.f64N/A

            \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
          4. lower-*.f64N/A

            \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
          5. lower-sqrt.f64N/A

            \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
          6. lower-*.f64N/A

            \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
          7. lower-*.f6429.6

            \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
        7. Applied rewrites29.6%

          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\color{blue}{h \cdot \ell}} \]

        if 1.99999999999999989e-227 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.00000000000000008e262

        1. Initial program 66.2%

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

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

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

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

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

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

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

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

            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
        3. Applied rewrites67.8%

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

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

            \[\leadsto \color{blue}{\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
          3. lower-*.f6467.8

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

            \[\leadsto \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
          5. metadata-eval67.8

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

            \[\leadsto \left(\color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
          7. pow1/2N/A

            \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
          8. lift-sqrt.f6467.8

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

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

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

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

            \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
          13. lower-sqrt.f6467.8

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

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

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

            \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \color{blue}{1} \]

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

          1. Initial program 66.2%

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

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

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

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

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

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

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

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

              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
          3. Applied rewrites67.8%

            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot 0.5\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)}\right) \]
          4. Applied rewrites51.4%

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

        Alternative 8: 64.3% accurate, 0.3× speedup?

        \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_1 \leq 0:\\ \;\;\;\;\mathsf{fma}\left(\frac{\frac{\left(\left(D\_m \cdot D\_m\right) \cdot M\_m\right) \cdot M\_m}{d} \cdot 0.125}{d}, \frac{-h}{\ell}, 1\right) \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+262}:\\ \;\;\;\;\left(t\_0 \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;\frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h}\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \frac{\left(-d\right) \cdot \sqrt{\frac{h}{d}}}{h}\\ \end{array} \end{array} \]
        M_m = (fabs.f64 M)
        D_m = (fabs.f64 D)
        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
        (FPCore (d h l M_m D_m)
         :precision binary64
         (let* ((t_0 (sqrt (/ d l)))
                (t_1
                 (*
                  (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                  (-
                   1.0
                   (* (* (/ 1.0 2.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)) (/ h l))))))
           (if (<= t_1 0.0)
             (*
              (fma (/ (* (/ (* (* (* D_m D_m) M_m) M_m) d) 0.125) d) (/ (- h) l) 1.0)
              (sqrt (* (/ d (* l h)) d)))
             (if (<= t_1 5e+262)
               (* (* t_0 (sqrt (/ d h))) 1.0)
               (if (<= t_1 INFINITY)
                 (/ (/ (* (sqrt (* d h)) (sqrt (* d l))) l) h)
                 (* t_0 (/ (* (- d) (sqrt (/ h d))) h)))))))
        M_m = fabs(M);
        D_m = fabs(D);
        assert(d < h && h < l && l < M_m && M_m < D_m);
        double code(double d, double h, double l, double M_m, double D_m) {
        	double t_0 = sqrt((d / l));
        	double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
        	double tmp;
        	if (t_1 <= 0.0) {
        		tmp = fma(((((((D_m * D_m) * M_m) * M_m) / d) * 0.125) / d), (-h / l), 1.0) * sqrt(((d / (l * h)) * d));
        	} else if (t_1 <= 5e+262) {
        		tmp = (t_0 * sqrt((d / h))) * 1.0;
        	} else if (t_1 <= ((double) INFINITY)) {
        		tmp = ((sqrt((d * h)) * sqrt((d * l))) / l) / h;
        	} else {
        		tmp = t_0 * ((-d * sqrt((h / d))) / h);
        	}
        	return tmp;
        }
        
        M_m = abs(M)
        D_m = abs(D)
        d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
        function code(d, h, l, M_m, D_m)
        	t_0 = sqrt(Float64(d / l))
        	t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
        	tmp = 0.0
        	if (t_1 <= 0.0)
        		tmp = Float64(fma(Float64(Float64(Float64(Float64(Float64(Float64(D_m * D_m) * M_m) * M_m) / d) * 0.125) / d), Float64(Float64(-h) / l), 1.0) * sqrt(Float64(Float64(d / Float64(l * h)) * d)));
        	elseif (t_1 <= 5e+262)
        		tmp = Float64(Float64(t_0 * sqrt(Float64(d / h))) * 1.0);
        	elseif (t_1 <= Inf)
        		tmp = Float64(Float64(Float64(sqrt(Float64(d * h)) * sqrt(Float64(d * l))) / l) / h);
        	else
        		tmp = Float64(t_0 * Float64(Float64(Float64(-d) * sqrt(Float64(h / d))) / h));
        	end
        	return tmp
        end
        
        M_m = N[Abs[M], $MachinePrecision]
        D_m = N[Abs[D], $MachinePrecision]
        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
        code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(N[(N[(N[(N[(N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] / d), $MachinePrecision] * 0.125), $MachinePrecision] / d), $MachinePrecision] * N[((-h) / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / N[(l * h), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+262], N[(N[(t$95$0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[(N[Sqrt[N[(d * h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] / h), $MachinePrecision], N[(t$95$0 * N[(N[((-d) * N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]]]]]]
        
        \begin{array}{l}
        M_m = \left|M\right|
        \\
        D_m = \left|D\right|
        \\
        [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
        \\
        \begin{array}{l}
        t_0 := \sqrt{\frac{d}{\ell}}\\
        t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
        \mathbf{if}\;t\_1 \leq 0:\\
        \;\;\;\;\mathsf{fma}\left(\frac{\frac{\left(\left(D\_m \cdot D\_m\right) \cdot M\_m\right) \cdot M\_m}{d} \cdot 0.125}{d}, \frac{-h}{\ell}, 1\right) \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}\\
        
        \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+262}:\\
        \;\;\;\;\left(t\_0 \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
        
        \mathbf{elif}\;t\_1 \leq \infty:\\
        \;\;\;\;\frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h}\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0 \cdot \frac{\left(-d\right) \cdot \sqrt{\frac{h}{d}}}{h}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 4 regimes
        2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0

          1. Initial program 66.2%

            \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
          2. Applied rewrites24.8%

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

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

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

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

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

              \[\leadsto \color{blue}{\left(\frac{-h}{\ell} \cdot \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot \frac{1}{4}\right)}{\left(d + d\right) \cdot d} + 1\right) \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}} \]
          4. Applied rewrites43.0%

            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\frac{\left(\left(D \cdot D\right) \cdot M\right) \cdot M}{d} \cdot 0.125}{d}, \frac{-h}{\ell}, 1\right) \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}} \]

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

          1. Initial program 66.2%

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

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

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

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

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

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

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

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

              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
          3. Applied rewrites67.8%

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

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

              \[\leadsto \color{blue}{\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
            3. lower-*.f6467.8

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

              \[\leadsto \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
            5. metadata-eval67.8

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

              \[\leadsto \left(\color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
            7. pow1/2N/A

              \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
            8. lift-sqrt.f6467.8

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

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

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

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

              \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
            13. lower-sqrt.f6467.8

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

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

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

              \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \color{blue}{1} \]

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

            1. Initial program 66.2%

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

              \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
            3. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
              2. lower-*.f64N/A

                \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
              3. lower-sqrt.f64N/A

                \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
              4. lower-*.f64N/A

                \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
              5. lower-sqrt.f64N/A

                \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
              6. lower-/.f6422.7

                \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
            4. Applied rewrites22.7%

              \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
            5. Taylor expanded in l around 0

              \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
            6. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
              2. lower-*.f64N/A

                \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
              3. lower-sqrt.f64N/A

                \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
              4. lower-*.f64N/A

                \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
              5. lower-sqrt.f64N/A

                \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
              6. lower-*.f6431.9

                \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
            7. Applied rewrites31.9%

              \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]

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

            1. Initial program 66.2%

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

              \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
            3. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
              2. lower-*.f64N/A

                \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
              3. lower-sqrt.f64N/A

                \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
              4. lower-*.f64N/A

                \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
              5. lower-sqrt.f64N/A

                \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
              6. lower-/.f6422.7

                \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
            4. Applied rewrites22.7%

              \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
            5. Taylor expanded in d around -inf

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

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

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

                \[\leadsto \frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot \sqrt{\frac{d}{\ell}}}{h} \]
              4. lower-/.f6411.8

                \[\leadsto \frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot \sqrt{\frac{d}{\ell}}}{h} \]
            7. Applied rewrites11.8%

              \[\leadsto \frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot \sqrt{\frac{d}{\ell}}}{h} \]
            8. Step-by-step derivation
              1. lift-/.f64N/A

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

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

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

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

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

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

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

                \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot \frac{1}{\color{blue}{h}}\right) \]
              9. mult-flip-revN/A

                \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \frac{-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)}{\color{blue}{h}} \]
              10. lower-/.f6411.4

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

              \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \color{blue}{\frac{\left(-d\right) \cdot \sqrt{\frac{h}{d}}}{h}} \]
          8. Recombined 4 regimes into one program.
          9. Add Preprocessing

          Alternative 9: 63.5% accurate, 0.4× speedup?

          \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_1 := \mathsf{fma}\left(\frac{\left(D\_m \cdot M\_m\right) \cdot h}{\left(-2 \cdot d\right) \cdot \ell} \cdot \left(0.25 \cdot \frac{D\_m}{d}\right), M\_m, 1\right) \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}\\ \mathbf{if}\;t\_0 \leq 0:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+262}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
          M_m = (fabs.f64 M)
          D_m = (fabs.f64 D)
          NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
          (FPCore (d h l M_m D_m)
           :precision binary64
           (let* ((t_0
                   (*
                    (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                    (-
                     1.0
                     (* (* (/ 1.0 2.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)) (/ h l)))))
                  (t_1
                   (*
                    (fma
                     (* (/ (* (* D_m M_m) h) (* (* -2.0 d) l)) (* 0.25 (/ D_m d)))
                     M_m
                     1.0)
                    (sqrt (* (/ d (* l h)) d)))))
             (if (<= t_0 0.0)
               t_1
               (if (<= t_0 5e+262) (* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0) t_1))))
          M_m = fabs(M);
          D_m = fabs(D);
          assert(d < h && h < l && l < M_m && M_m < D_m);
          double code(double d, double h, double l, double M_m, double D_m) {
          	double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
          	double t_1 = fma(((((D_m * M_m) * h) / ((-2.0 * d) * l)) * (0.25 * (D_m / d))), M_m, 1.0) * sqrt(((d / (l * h)) * d));
          	double tmp;
          	if (t_0 <= 0.0) {
          		tmp = t_1;
          	} else if (t_0 <= 5e+262) {
          		tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
          	} else {
          		tmp = t_1;
          	}
          	return tmp;
          }
          
          M_m = abs(M)
          D_m = abs(D)
          d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
          function code(d, h, l, M_m, D_m)
          	t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
          	t_1 = Float64(fma(Float64(Float64(Float64(Float64(D_m * M_m) * h) / Float64(Float64(-2.0 * d) * l)) * Float64(0.25 * Float64(D_m / d))), M_m, 1.0) * sqrt(Float64(Float64(d / Float64(l * h)) * d)))
          	tmp = 0.0
          	if (t_0 <= 0.0)
          		tmp = t_1;
          	elseif (t_0 <= 5e+262)
          		tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0);
          	else
          		tmp = t_1;
          	end
          	return tmp
          end
          
          M_m = N[Abs[M], $MachinePrecision]
          D_m = N[Abs[D], $MachinePrecision]
          NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
          code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] / N[(N[(-2.0 * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * M$95$m + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / N[(l * h), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], t$95$1, If[LessEqual[t$95$0, 5e+262], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], t$95$1]]]]
          
          \begin{array}{l}
          M_m = \left|M\right|
          \\
          D_m = \left|D\right|
          \\
          [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
          \\
          \begin{array}{l}
          t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
          t_1 := \mathsf{fma}\left(\frac{\left(D\_m \cdot M\_m\right) \cdot h}{\left(-2 \cdot d\right) \cdot \ell} \cdot \left(0.25 \cdot \frac{D\_m}{d}\right), M\_m, 1\right) \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}\\
          \mathbf{if}\;t\_0 \leq 0:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+262}:\\
          \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_1\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0 or 5.00000000000000008e262 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

            1. Initial program 66.2%

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

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

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

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

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

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

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

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

                \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
            3. Applied rewrites67.8%

              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot 0.5\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)}\right) \]
            4. Applied rewrites51.4%

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

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

            1. Initial program 66.2%

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

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

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

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

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

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

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

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

                \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
            3. Applied rewrites67.8%

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

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

                \[\leadsto \color{blue}{\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
              3. lower-*.f6467.8

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

                \[\leadsto \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
              5. metadata-eval67.8

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

                \[\leadsto \left(\color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
              7. pow1/2N/A

                \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
              8. lift-sqrt.f6467.8

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

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

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

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

                \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
              13. lower-sqrt.f6467.8

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

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

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

                \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \color{blue}{1} \]
            8. Recombined 2 regimes into one program.
            9. Add Preprocessing

            Alternative 10: 55.3% accurate, 0.2× speedup?

            \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}\\ t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_2 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{-88}:\\ \;\;\;\;\frac{\left(-1 \cdot \left(d \cdot \sqrt{\sqrt{\frac{h}{d} \cdot \frac{h}{d}}}\right)\right) \cdot t\_2}{h}\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-227}:\\ \;\;\;\;\frac{t\_0}{h \cdot \ell}\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+262}:\\ \;\;\;\;\left(t\_2 \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;\frac{\frac{t\_0}{\ell}}{h}\\ \mathbf{else}:\\ \;\;\;\;t\_2 \cdot \frac{\left(-d\right) \cdot \sqrt{\frac{h}{d}}}{h}\\ \end{array} \end{array} \]
            M_m = (fabs.f64 M)
            D_m = (fabs.f64 D)
            NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
            (FPCore (d h l M_m D_m)
             :precision binary64
             (let* ((t_0 (* (sqrt (* d h)) (sqrt (* d l))))
                    (t_1
                     (*
                      (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                      (-
                       1.0
                       (* (* (/ 1.0 2.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)) (/ h l)))))
                    (t_2 (sqrt (/ d l))))
               (if (<= t_1 -5e-88)
                 (/ (* (* -1.0 (* d (sqrt (sqrt (* (/ h d) (/ h d)))))) t_2) h)
                 (if (<= t_1 2e-227)
                   (/ t_0 (* h l))
                   (if (<= t_1 5e+262)
                     (* (* t_2 (sqrt (/ d h))) 1.0)
                     (if (<= t_1 INFINITY)
                       (/ (/ t_0 l) h)
                       (* t_2 (/ (* (- d) (sqrt (/ h d))) h))))))))
            M_m = fabs(M);
            D_m = fabs(D);
            assert(d < h && h < l && l < M_m && M_m < D_m);
            double code(double d, double h, double l, double M_m, double D_m) {
            	double t_0 = sqrt((d * h)) * sqrt((d * l));
            	double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
            	double t_2 = sqrt((d / l));
            	double tmp;
            	if (t_1 <= -5e-88) {
            		tmp = ((-1.0 * (d * sqrt(sqrt(((h / d) * (h / d)))))) * t_2) / h;
            	} else if (t_1 <= 2e-227) {
            		tmp = t_0 / (h * l);
            	} else if (t_1 <= 5e+262) {
            		tmp = (t_2 * sqrt((d / h))) * 1.0;
            	} else if (t_1 <= ((double) INFINITY)) {
            		tmp = (t_0 / l) / h;
            	} else {
            		tmp = t_2 * ((-d * sqrt((h / d))) / h);
            	}
            	return tmp;
            }
            
            M_m = Math.abs(M);
            D_m = Math.abs(D);
            assert d < h && h < l && l < M_m && M_m < D_m;
            public static double code(double d, double h, double l, double M_m, double D_m) {
            	double t_0 = Math.sqrt((d * h)) * Math.sqrt((d * l));
            	double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
            	double t_2 = Math.sqrt((d / l));
            	double tmp;
            	if (t_1 <= -5e-88) {
            		tmp = ((-1.0 * (d * Math.sqrt(Math.sqrt(((h / d) * (h / d)))))) * t_2) / h;
            	} else if (t_1 <= 2e-227) {
            		tmp = t_0 / (h * l);
            	} else if (t_1 <= 5e+262) {
            		tmp = (t_2 * Math.sqrt((d / h))) * 1.0;
            	} else if (t_1 <= Double.POSITIVE_INFINITY) {
            		tmp = (t_0 / l) / h;
            	} else {
            		tmp = t_2 * ((-d * Math.sqrt((h / d))) / h);
            	}
            	return tmp;
            }
            
            M_m = math.fabs(M)
            D_m = math.fabs(D)
            [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
            def code(d, h, l, M_m, D_m):
            	t_0 = math.sqrt((d * h)) * math.sqrt((d * l))
            	t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)))
            	t_2 = math.sqrt((d / l))
            	tmp = 0
            	if t_1 <= -5e-88:
            		tmp = ((-1.0 * (d * math.sqrt(math.sqrt(((h / d) * (h / d)))))) * t_2) / h
            	elif t_1 <= 2e-227:
            		tmp = t_0 / (h * l)
            	elif t_1 <= 5e+262:
            		tmp = (t_2 * math.sqrt((d / h))) * 1.0
            	elif t_1 <= math.inf:
            		tmp = (t_0 / l) / h
            	else:
            		tmp = t_2 * ((-d * math.sqrt((h / d))) / h)
            	return tmp
            
            M_m = abs(M)
            D_m = abs(D)
            d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
            function code(d, h, l, M_m, D_m)
            	t_0 = Float64(sqrt(Float64(d * h)) * sqrt(Float64(d * l)))
            	t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
            	t_2 = sqrt(Float64(d / l))
            	tmp = 0.0
            	if (t_1 <= -5e-88)
            		tmp = Float64(Float64(Float64(-1.0 * Float64(d * sqrt(sqrt(Float64(Float64(h / d) * Float64(h / d)))))) * t_2) / h);
            	elseif (t_1 <= 2e-227)
            		tmp = Float64(t_0 / Float64(h * l));
            	elseif (t_1 <= 5e+262)
            		tmp = Float64(Float64(t_2 * sqrt(Float64(d / h))) * 1.0);
            	elseif (t_1 <= Inf)
            		tmp = Float64(Float64(t_0 / l) / h);
            	else
            		tmp = Float64(t_2 * Float64(Float64(Float64(-d) * sqrt(Float64(h / d))) / h));
            	end
            	return tmp
            end
            
            M_m = abs(M);
            D_m = abs(D);
            d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
            function tmp_2 = code(d, h, l, M_m, D_m)
            	t_0 = sqrt((d * h)) * sqrt((d * l));
            	t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M_m * D_m) / (2.0 * d)) ^ 2.0)) * (h / l)));
            	t_2 = sqrt((d / l));
            	tmp = 0.0;
            	if (t_1 <= -5e-88)
            		tmp = ((-1.0 * (d * sqrt(sqrt(((h / d) * (h / d)))))) * t_2) / h;
            	elseif (t_1 <= 2e-227)
            		tmp = t_0 / (h * l);
            	elseif (t_1 <= 5e+262)
            		tmp = (t_2 * sqrt((d / h))) * 1.0;
            	elseif (t_1 <= Inf)
            		tmp = (t_0 / l) / h;
            	else
            		tmp = t_2 * ((-d * sqrt((h / d))) / h);
            	end
            	tmp_2 = tmp;
            end
            
            M_m = N[Abs[M], $MachinePrecision]
            D_m = N[Abs[D], $MachinePrecision]
            NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
            code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[Sqrt[N[(d * h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -5e-88], N[(N[(N[(-1.0 * N[(d * N[Sqrt[N[Sqrt[N[(N[(h / d), $MachinePrecision] * N[(h / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$1, 2e-227], N[(t$95$0 / N[(h * l), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+262], N[(N[(t$95$2 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(t$95$0 / l), $MachinePrecision] / h), $MachinePrecision], N[(t$95$2 * N[(N[((-d) * N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]]]]]]]]
            
            \begin{array}{l}
            M_m = \left|M\right|
            \\
            D_m = \left|D\right|
            \\
            [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
            \\
            \begin{array}{l}
            t_0 := \sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}\\
            t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
            t_2 := \sqrt{\frac{d}{\ell}}\\
            \mathbf{if}\;t\_1 \leq -5 \cdot 10^{-88}:\\
            \;\;\;\;\frac{\left(-1 \cdot \left(d \cdot \sqrt{\sqrt{\frac{h}{d} \cdot \frac{h}{d}}}\right)\right) \cdot t\_2}{h}\\
            
            \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-227}:\\
            \;\;\;\;\frac{t\_0}{h \cdot \ell}\\
            
            \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+262}:\\
            \;\;\;\;\left(t\_2 \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
            
            \mathbf{elif}\;t\_1 \leq \infty:\\
            \;\;\;\;\frac{\frac{t\_0}{\ell}}{h}\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_2 \cdot \frac{\left(-d\right) \cdot \sqrt{\frac{h}{d}}}{h}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 5 regimes
            2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.00000000000000009e-88

              1. Initial program 66.2%

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

                \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
              3. Step-by-step derivation
                1. lower-/.f64N/A

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
                2. lower-*.f64N/A

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                3. lower-sqrt.f64N/A

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                4. lower-*.f64N/A

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                5. lower-sqrt.f64N/A

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                6. lower-/.f6422.7

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
              4. Applied rewrites22.7%

                \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
              5. Taylor expanded in d around -inf

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

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

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

                  \[\leadsto \frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                4. lower-/.f6411.8

                  \[\leadsto \frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot \sqrt{\frac{d}{\ell}}}{h} \]
              7. Applied rewrites11.8%

                \[\leadsto \frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot \sqrt{\frac{d}{\ell}}}{h} \]
              8. Step-by-step derivation
                1. rem-square-sqrtN/A

                  \[\leadsto \frac{\left(-1 \cdot \left(d \cdot \sqrt{\sqrt{\frac{h}{d}} \cdot \sqrt{\frac{h}{d}}}\right)\right) \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                2. sqrt-unprodN/A

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

                  \[\leadsto \frac{\left(-1 \cdot \left(d \cdot \sqrt{\sqrt{\frac{h}{d} \cdot \frac{h}{d}}}\right)\right) \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                4. lower-*.f6415.6

                  \[\leadsto \frac{\left(-1 \cdot \left(d \cdot \sqrt{\sqrt{\frac{h}{d} \cdot \frac{h}{d}}}\right)\right) \cdot \sqrt{\frac{d}{\ell}}}{h} \]
              9. Applied rewrites15.6%

                \[\leadsto \frac{\left(-1 \cdot \left(d \cdot \sqrt{\sqrt{\frac{h}{d} \cdot \frac{h}{d}}}\right)\right) \cdot \sqrt{\frac{d}{\ell}}}{h} \]

              if -5.00000000000000009e-88 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1.99999999999999989e-227

              1. Initial program 66.2%

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

                \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
              3. Step-by-step derivation
                1. lower-/.f64N/A

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
                2. lower-*.f64N/A

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                3. lower-sqrt.f64N/A

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                4. lower-*.f64N/A

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                5. lower-sqrt.f64N/A

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                6. lower-/.f6422.7

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
              4. Applied rewrites22.7%

                \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
              5. Taylor expanded in l around 0

                \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\color{blue}{h \cdot \ell}} \]
              6. Step-by-step derivation
                1. lower-/.f64N/A

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \color{blue}{\ell}} \]
                2. lower-*.f64N/A

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                3. lower-sqrt.f64N/A

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                4. lower-*.f64N/A

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                5. lower-sqrt.f64N/A

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                6. lower-*.f64N/A

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                7. lower-*.f6429.6

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
              7. Applied rewrites29.6%

                \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\color{blue}{h \cdot \ell}} \]

              if 1.99999999999999989e-227 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.00000000000000008e262

              1. Initial program 66.2%

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

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

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

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

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

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

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

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

                  \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
              3. Applied rewrites67.8%

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

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

                  \[\leadsto \color{blue}{\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                3. lower-*.f6467.8

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

                  \[\leadsto \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                5. metadata-eval67.8

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

                  \[\leadsto \left(\color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                7. pow1/2N/A

                  \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                8. lift-sqrt.f6467.8

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

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

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

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

                  \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                13. lower-sqrt.f6467.8

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

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

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

                  \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \color{blue}{1} \]

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

                1. Initial program 66.2%

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

                  \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                3. Step-by-step derivation
                  1. lower-/.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
                  2. lower-*.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                  3. lower-sqrt.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                  4. lower-*.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                  5. lower-sqrt.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                  6. lower-/.f6422.7

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                4. Applied rewrites22.7%

                  \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                5. Taylor expanded in l around 0

                  \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                6. Step-by-step derivation
                  1. lower-/.f64N/A

                    \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                  2. lower-*.f64N/A

                    \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                  3. lower-sqrt.f64N/A

                    \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                  4. lower-*.f64N/A

                    \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                  5. lower-sqrt.f64N/A

                    \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                  6. lower-*.f6431.9

                    \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                7. Applied rewrites31.9%

                  \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]

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

                1. Initial program 66.2%

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

                  \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                3. Step-by-step derivation
                  1. lower-/.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
                  2. lower-*.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                  3. lower-sqrt.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                  4. lower-*.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                  5. lower-sqrt.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                  6. lower-/.f6422.7

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                4. Applied rewrites22.7%

                  \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                5. Taylor expanded in d around -inf

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

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

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

                    \[\leadsto \frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                  4. lower-/.f6411.8

                    \[\leadsto \frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                7. Applied rewrites11.8%

                  \[\leadsto \frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                8. Step-by-step derivation
                  1. lift-/.f64N/A

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

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

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

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

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

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

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

                    \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot \frac{1}{\color{blue}{h}}\right) \]
                  9. mult-flip-revN/A

                    \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \frac{-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)}{\color{blue}{h}} \]
                  10. lower-/.f6411.4

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

                  \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \color{blue}{\frac{\left(-d\right) \cdot \sqrt{\frac{h}{d}}}{h}} \]
              8. Recombined 5 regimes into one program.
              9. Add Preprocessing

              Alternative 11: 53.0% accurate, 0.2× speedup?

              \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_2 := \sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-155}:\\ \;\;\;\;-1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-227}:\\ \;\;\;\;\frac{t\_2}{h \cdot \ell}\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+262}:\\ \;\;\;\;\left(t\_0 \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;\frac{\frac{t\_2}{\ell}}{h}\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \frac{\left(-d\right) \cdot \sqrt{\frac{h}{d}}}{h}\\ \end{array} \end{array} \]
              M_m = (fabs.f64 M)
              D_m = (fabs.f64 D)
              NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
              (FPCore (d h l M_m D_m)
               :precision binary64
               (let* ((t_0 (sqrt (/ d l)))
                      (t_1
                       (*
                        (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                        (-
                         1.0
                         (* (* (/ 1.0 2.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)) (/ h l)))))
                      (t_2 (* (sqrt (* d h)) (sqrt (* d l)))))
                 (if (<= t_1 -2e-155)
                   (* -1.0 (/ (* d (sqrt (/ h l))) h))
                   (if (<= t_1 2e-227)
                     (/ t_2 (* h l))
                     (if (<= t_1 5e+262)
                       (* (* t_0 (sqrt (/ d h))) 1.0)
                       (if (<= t_1 INFINITY)
                         (/ (/ t_2 l) h)
                         (* t_0 (/ (* (- d) (sqrt (/ h d))) h))))))))
              M_m = fabs(M);
              D_m = fabs(D);
              assert(d < h && h < l && l < M_m && M_m < D_m);
              double code(double d, double h, double l, double M_m, double D_m) {
              	double t_0 = sqrt((d / l));
              	double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
              	double t_2 = sqrt((d * h)) * sqrt((d * l));
              	double tmp;
              	if (t_1 <= -2e-155) {
              		tmp = -1.0 * ((d * sqrt((h / l))) / h);
              	} else if (t_1 <= 2e-227) {
              		tmp = t_2 / (h * l);
              	} else if (t_1 <= 5e+262) {
              		tmp = (t_0 * sqrt((d / h))) * 1.0;
              	} else if (t_1 <= ((double) INFINITY)) {
              		tmp = (t_2 / l) / h;
              	} else {
              		tmp = t_0 * ((-d * sqrt((h / d))) / h);
              	}
              	return tmp;
              }
              
              M_m = Math.abs(M);
              D_m = Math.abs(D);
              assert d < h && h < l && l < M_m && M_m < D_m;
              public static double code(double d, double h, double l, double M_m, double D_m) {
              	double t_0 = Math.sqrt((d / l));
              	double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
              	double t_2 = Math.sqrt((d * h)) * Math.sqrt((d * l));
              	double tmp;
              	if (t_1 <= -2e-155) {
              		tmp = -1.0 * ((d * Math.sqrt((h / l))) / h);
              	} else if (t_1 <= 2e-227) {
              		tmp = t_2 / (h * l);
              	} else if (t_1 <= 5e+262) {
              		tmp = (t_0 * Math.sqrt((d / h))) * 1.0;
              	} else if (t_1 <= Double.POSITIVE_INFINITY) {
              		tmp = (t_2 / l) / h;
              	} else {
              		tmp = t_0 * ((-d * Math.sqrt((h / d))) / h);
              	}
              	return tmp;
              }
              
              M_m = math.fabs(M)
              D_m = math.fabs(D)
              [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
              def code(d, h, l, M_m, D_m):
              	t_0 = math.sqrt((d / l))
              	t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)))
              	t_2 = math.sqrt((d * h)) * math.sqrt((d * l))
              	tmp = 0
              	if t_1 <= -2e-155:
              		tmp = -1.0 * ((d * math.sqrt((h / l))) / h)
              	elif t_1 <= 2e-227:
              		tmp = t_2 / (h * l)
              	elif t_1 <= 5e+262:
              		tmp = (t_0 * math.sqrt((d / h))) * 1.0
              	elif t_1 <= math.inf:
              		tmp = (t_2 / l) / h
              	else:
              		tmp = t_0 * ((-d * math.sqrt((h / d))) / h)
              	return tmp
              
              M_m = abs(M)
              D_m = abs(D)
              d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
              function code(d, h, l, M_m, D_m)
              	t_0 = sqrt(Float64(d / l))
              	t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
              	t_2 = Float64(sqrt(Float64(d * h)) * sqrt(Float64(d * l)))
              	tmp = 0.0
              	if (t_1 <= -2e-155)
              		tmp = Float64(-1.0 * Float64(Float64(d * sqrt(Float64(h / l))) / h));
              	elseif (t_1 <= 2e-227)
              		tmp = Float64(t_2 / Float64(h * l));
              	elseif (t_1 <= 5e+262)
              		tmp = Float64(Float64(t_0 * sqrt(Float64(d / h))) * 1.0);
              	elseif (t_1 <= Inf)
              		tmp = Float64(Float64(t_2 / l) / h);
              	else
              		tmp = Float64(t_0 * Float64(Float64(Float64(-d) * sqrt(Float64(h / d))) / h));
              	end
              	return tmp
              end
              
              M_m = abs(M);
              D_m = abs(D);
              d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
              function tmp_2 = code(d, h, l, M_m, D_m)
              	t_0 = sqrt((d / l));
              	t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M_m * D_m) / (2.0 * d)) ^ 2.0)) * (h / l)));
              	t_2 = sqrt((d * h)) * sqrt((d * l));
              	tmp = 0.0;
              	if (t_1 <= -2e-155)
              		tmp = -1.0 * ((d * sqrt((h / l))) / h);
              	elseif (t_1 <= 2e-227)
              		tmp = t_2 / (h * l);
              	elseif (t_1 <= 5e+262)
              		tmp = (t_0 * sqrt((d / h))) * 1.0;
              	elseif (t_1 <= Inf)
              		tmp = (t_2 / l) / h;
              	else
              		tmp = t_0 * ((-d * sqrt((h / d))) / h);
              	end
              	tmp_2 = tmp;
              end
              
              M_m = N[Abs[M], $MachinePrecision]
              D_m = N[Abs[D], $MachinePrecision]
              NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
              code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(d * h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-155], N[(-1.0 * N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-227], N[(t$95$2 / N[(h * l), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+262], N[(N[(t$95$0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(t$95$2 / l), $MachinePrecision] / h), $MachinePrecision], N[(t$95$0 * N[(N[((-d) * N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]]]]]]]]
              
              \begin{array}{l}
              M_m = \left|M\right|
              \\
              D_m = \left|D\right|
              \\
              [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
              \\
              \begin{array}{l}
              t_0 := \sqrt{\frac{d}{\ell}}\\
              t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
              t_2 := \sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}\\
              \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-155}:\\
              \;\;\;\;-1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
              
              \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-227}:\\
              \;\;\;\;\frac{t\_2}{h \cdot \ell}\\
              
              \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+262}:\\
              \;\;\;\;\left(t\_0 \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
              
              \mathbf{elif}\;t\_1 \leq \infty:\\
              \;\;\;\;\frac{\frac{t\_2}{\ell}}{h}\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_0 \cdot \frac{\left(-d\right) \cdot \sqrt{\frac{h}{d}}}{h}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 5 regimes
              2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.00000000000000003e-155

                1. Initial program 66.2%

                  \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                2. Applied rewrites24.8%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-h}{\ell}, \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)}{\left(d + d\right) \cdot d} \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}, \sqrt{\frac{d}{\ell \cdot h} \cdot d}\right)} \]
                3. Taylor expanded in d around -inf

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

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

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

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

                    \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                  5. lower-*.f6427.1

                    \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                5. Applied rewrites27.1%

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

                  \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{\color{blue}{h}} \]
                7. Step-by-step derivation
                  1. lower-/.f64N/A

                    \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                  2. lower-*.f64N/A

                    \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                  3. lower-sqrt.f64N/A

                    \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                  4. lower-/.f6413.5

                    \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                8. Applied rewrites13.5%

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

                if -2.00000000000000003e-155 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1.99999999999999989e-227

                1. Initial program 66.2%

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

                  \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                3. Step-by-step derivation
                  1. lower-/.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
                  2. lower-*.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                  3. lower-sqrt.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                  4. lower-*.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                  5. lower-sqrt.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                  6. lower-/.f6422.7

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                4. Applied rewrites22.7%

                  \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                5. Taylor expanded in l around 0

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\color{blue}{h \cdot \ell}} \]
                6. Step-by-step derivation
                  1. lower-/.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \color{blue}{\ell}} \]
                  2. lower-*.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                  3. lower-sqrt.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                  4. lower-*.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                  5. lower-sqrt.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                  6. lower-*.f64N/A

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                  7. lower-*.f6429.6

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                7. Applied rewrites29.6%

                  \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\color{blue}{h \cdot \ell}} \]

                if 1.99999999999999989e-227 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.00000000000000008e262

                1. Initial program 66.2%

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

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

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

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

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

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

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

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

                    \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
                3. Applied rewrites67.8%

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

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

                    \[\leadsto \color{blue}{\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                  3. lower-*.f6467.8

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

                    \[\leadsto \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                  5. metadata-eval67.8

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

                    \[\leadsto \left(\color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                  7. pow1/2N/A

                    \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                  8. lift-sqrt.f6467.8

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

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

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

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

                    \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                  13. lower-sqrt.f6467.8

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

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

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

                    \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \color{blue}{1} \]

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

                  1. Initial program 66.2%

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

                    \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                  3. Step-by-step derivation
                    1. lower-/.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
                    2. lower-*.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                    3. lower-sqrt.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                    4. lower-*.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                    5. lower-sqrt.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                    6. lower-/.f6422.7

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                  4. Applied rewrites22.7%

                    \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                  5. Taylor expanded in l around 0

                    \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                  6. Step-by-step derivation
                    1. lower-/.f64N/A

                      \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                    2. lower-*.f64N/A

                      \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                    3. lower-sqrt.f64N/A

                      \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                    4. lower-*.f64N/A

                      \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                    5. lower-sqrt.f64N/A

                      \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                    6. lower-*.f6431.9

                      \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                  7. Applied rewrites31.9%

                    \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]

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

                  1. Initial program 66.2%

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

                    \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                  3. Step-by-step derivation
                    1. lower-/.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
                    2. lower-*.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                    3. lower-sqrt.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                    4. lower-*.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                    5. lower-sqrt.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                    6. lower-/.f6422.7

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                  4. Applied rewrites22.7%

                    \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                  5. Taylor expanded in d around -inf

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

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

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

                      \[\leadsto \frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                    4. lower-/.f6411.8

                      \[\leadsto \frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                  7. Applied rewrites11.8%

                    \[\leadsto \frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                  8. Step-by-step derivation
                    1. lift-/.f64N/A

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

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

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

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

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

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

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

                      \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot \frac{1}{\color{blue}{h}}\right) \]
                    9. mult-flip-revN/A

                      \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \frac{-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)}{\color{blue}{h}} \]
                    10. lower-/.f6411.4

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

                    \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \color{blue}{\frac{\left(-d\right) \cdot \sqrt{\frac{h}{d}}}{h}} \]
                8. Recombined 5 regimes into one program.
                9. Add Preprocessing

                Alternative 12: 53.0% accurate, 0.2× speedup?

                \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_2 := \sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-155}:\\ \;\;\;\;-1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-227}:\\ \;\;\;\;\frac{t\_2}{h \cdot \ell}\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+262}:\\ \;\;\;\;\left(t\_0 \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;\frac{\frac{t\_2}{\ell}}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_0 \cdot \left(\left(-d\right) \cdot \sqrt{\frac{h}{d}}\right)}{h}\\ \end{array} \end{array} \]
                M_m = (fabs.f64 M)
                D_m = (fabs.f64 D)
                NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                (FPCore (d h l M_m D_m)
                 :precision binary64
                 (let* ((t_0 (sqrt (/ d l)))
                        (t_1
                         (*
                          (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                          (-
                           1.0
                           (* (* (/ 1.0 2.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)) (/ h l)))))
                        (t_2 (* (sqrt (* d h)) (sqrt (* d l)))))
                   (if (<= t_1 -2e-155)
                     (* -1.0 (/ (* d (sqrt (/ h l))) h))
                     (if (<= t_1 2e-227)
                       (/ t_2 (* h l))
                       (if (<= t_1 5e+262)
                         (* (* t_0 (sqrt (/ d h))) 1.0)
                         (if (<= t_1 INFINITY)
                           (/ (/ t_2 l) h)
                           (/ (* t_0 (* (- d) (sqrt (/ h d)))) h)))))))
                M_m = fabs(M);
                D_m = fabs(D);
                assert(d < h && h < l && l < M_m && M_m < D_m);
                double code(double d, double h, double l, double M_m, double D_m) {
                	double t_0 = sqrt((d / l));
                	double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
                	double t_2 = sqrt((d * h)) * sqrt((d * l));
                	double tmp;
                	if (t_1 <= -2e-155) {
                		tmp = -1.0 * ((d * sqrt((h / l))) / h);
                	} else if (t_1 <= 2e-227) {
                		tmp = t_2 / (h * l);
                	} else if (t_1 <= 5e+262) {
                		tmp = (t_0 * sqrt((d / h))) * 1.0;
                	} else if (t_1 <= ((double) INFINITY)) {
                		tmp = (t_2 / l) / h;
                	} else {
                		tmp = (t_0 * (-d * sqrt((h / d)))) / h;
                	}
                	return tmp;
                }
                
                M_m = Math.abs(M);
                D_m = Math.abs(D);
                assert d < h && h < l && l < M_m && M_m < D_m;
                public static double code(double d, double h, double l, double M_m, double D_m) {
                	double t_0 = Math.sqrt((d / l));
                	double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
                	double t_2 = Math.sqrt((d * h)) * Math.sqrt((d * l));
                	double tmp;
                	if (t_1 <= -2e-155) {
                		tmp = -1.0 * ((d * Math.sqrt((h / l))) / h);
                	} else if (t_1 <= 2e-227) {
                		tmp = t_2 / (h * l);
                	} else if (t_1 <= 5e+262) {
                		tmp = (t_0 * Math.sqrt((d / h))) * 1.0;
                	} else if (t_1 <= Double.POSITIVE_INFINITY) {
                		tmp = (t_2 / l) / h;
                	} else {
                		tmp = (t_0 * (-d * Math.sqrt((h / d)))) / h;
                	}
                	return tmp;
                }
                
                M_m = math.fabs(M)
                D_m = math.fabs(D)
                [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                def code(d, h, l, M_m, D_m):
                	t_0 = math.sqrt((d / l))
                	t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)))
                	t_2 = math.sqrt((d * h)) * math.sqrt((d * l))
                	tmp = 0
                	if t_1 <= -2e-155:
                		tmp = -1.0 * ((d * math.sqrt((h / l))) / h)
                	elif t_1 <= 2e-227:
                		tmp = t_2 / (h * l)
                	elif t_1 <= 5e+262:
                		tmp = (t_0 * math.sqrt((d / h))) * 1.0
                	elif t_1 <= math.inf:
                		tmp = (t_2 / l) / h
                	else:
                		tmp = (t_0 * (-d * math.sqrt((h / d)))) / h
                	return tmp
                
                M_m = abs(M)
                D_m = abs(D)
                d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                function code(d, h, l, M_m, D_m)
                	t_0 = sqrt(Float64(d / l))
                	t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
                	t_2 = Float64(sqrt(Float64(d * h)) * sqrt(Float64(d * l)))
                	tmp = 0.0
                	if (t_1 <= -2e-155)
                		tmp = Float64(-1.0 * Float64(Float64(d * sqrt(Float64(h / l))) / h));
                	elseif (t_1 <= 2e-227)
                		tmp = Float64(t_2 / Float64(h * l));
                	elseif (t_1 <= 5e+262)
                		tmp = Float64(Float64(t_0 * sqrt(Float64(d / h))) * 1.0);
                	elseif (t_1 <= Inf)
                		tmp = Float64(Float64(t_2 / l) / h);
                	else
                		tmp = Float64(Float64(t_0 * Float64(Float64(-d) * sqrt(Float64(h / d)))) / h);
                	end
                	return tmp
                end
                
                M_m = abs(M);
                D_m = abs(D);
                d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                function tmp_2 = code(d, h, l, M_m, D_m)
                	t_0 = sqrt((d / l));
                	t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M_m * D_m) / (2.0 * d)) ^ 2.0)) * (h / l)));
                	t_2 = sqrt((d * h)) * sqrt((d * l));
                	tmp = 0.0;
                	if (t_1 <= -2e-155)
                		tmp = -1.0 * ((d * sqrt((h / l))) / h);
                	elseif (t_1 <= 2e-227)
                		tmp = t_2 / (h * l);
                	elseif (t_1 <= 5e+262)
                		tmp = (t_0 * sqrt((d / h))) * 1.0;
                	elseif (t_1 <= Inf)
                		tmp = (t_2 / l) / h;
                	else
                		tmp = (t_0 * (-d * sqrt((h / d)))) / h;
                	end
                	tmp_2 = tmp;
                end
                
                M_m = N[Abs[M], $MachinePrecision]
                D_m = N[Abs[D], $MachinePrecision]
                NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(d * h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-155], N[(-1.0 * N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-227], N[(t$95$2 / N[(h * l), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+262], N[(N[(t$95$0 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(t$95$2 / l), $MachinePrecision] / h), $MachinePrecision], N[(N[(t$95$0 * N[((-d) * N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]]]]]]
                
                \begin{array}{l}
                M_m = \left|M\right|
                \\
                D_m = \left|D\right|
                \\
                [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                \\
                \begin{array}{l}
                t_0 := \sqrt{\frac{d}{\ell}}\\
                t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
                t_2 := \sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}\\
                \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-155}:\\
                \;\;\;\;-1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
                
                \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-227}:\\
                \;\;\;\;\frac{t\_2}{h \cdot \ell}\\
                
                \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+262}:\\
                \;\;\;\;\left(t\_0 \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
                
                \mathbf{elif}\;t\_1 \leq \infty:\\
                \;\;\;\;\frac{\frac{t\_2}{\ell}}{h}\\
                
                \mathbf{else}:\\
                \;\;\;\;\frac{t\_0 \cdot \left(\left(-d\right) \cdot \sqrt{\frac{h}{d}}\right)}{h}\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 5 regimes
                2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.00000000000000003e-155

                  1. Initial program 66.2%

                    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                  2. Applied rewrites24.8%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-h}{\ell}, \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)}{\left(d + d\right) \cdot d} \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}, \sqrt{\frac{d}{\ell \cdot h} \cdot d}\right)} \]
                  3. Taylor expanded in d around -inf

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

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

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

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

                      \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                    5. lower-*.f6427.1

                      \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                  5. Applied rewrites27.1%

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

                    \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{\color{blue}{h}} \]
                  7. Step-by-step derivation
                    1. lower-/.f64N/A

                      \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                    2. lower-*.f64N/A

                      \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                    3. lower-sqrt.f64N/A

                      \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                    4. lower-/.f6413.5

                      \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                  8. Applied rewrites13.5%

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

                  if -2.00000000000000003e-155 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1.99999999999999989e-227

                  1. Initial program 66.2%

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

                    \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                  3. Step-by-step derivation
                    1. lower-/.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
                    2. lower-*.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                    3. lower-sqrt.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                    4. lower-*.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                    5. lower-sqrt.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                    6. lower-/.f6422.7

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                  4. Applied rewrites22.7%

                    \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                  5. Taylor expanded in l around 0

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\color{blue}{h \cdot \ell}} \]
                  6. Step-by-step derivation
                    1. lower-/.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \color{blue}{\ell}} \]
                    2. lower-*.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                    3. lower-sqrt.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                    4. lower-*.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                    5. lower-sqrt.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                    6. lower-*.f64N/A

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                    7. lower-*.f6429.6

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                  7. Applied rewrites29.6%

                    \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\color{blue}{h \cdot \ell}} \]

                  if 1.99999999999999989e-227 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.00000000000000008e262

                  1. Initial program 66.2%

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

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

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

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

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

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

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

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

                      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
                  3. Applied rewrites67.8%

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

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

                      \[\leadsto \color{blue}{\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                    3. lower-*.f6467.8

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

                      \[\leadsto \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                    5. metadata-eval67.8

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

                      \[\leadsto \left(\color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                    7. pow1/2N/A

                      \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                    8. lift-sqrt.f6467.8

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

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

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

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

                      \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                    13. lower-sqrt.f6467.8

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

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

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

                      \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \color{blue}{1} \]

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

                    1. Initial program 66.2%

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

                      \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                    3. Step-by-step derivation
                      1. lower-/.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
                      2. lower-*.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                      3. lower-sqrt.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                      4. lower-*.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                      5. lower-sqrt.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                      6. lower-/.f6422.7

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                    4. Applied rewrites22.7%

                      \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                    5. Taylor expanded in l around 0

                      \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                    6. Step-by-step derivation
                      1. lower-/.f64N/A

                        \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                      2. lower-*.f64N/A

                        \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                      3. lower-sqrt.f64N/A

                        \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                      4. lower-*.f64N/A

                        \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                      5. lower-sqrt.f64N/A

                        \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                      6. lower-*.f6431.9

                        \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                    7. Applied rewrites31.9%

                      \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]

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

                    1. Initial program 66.2%

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

                      \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                    3. Step-by-step derivation
                      1. lower-/.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
                      2. lower-*.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                      3. lower-sqrt.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                      4. lower-*.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                      5. lower-sqrt.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                      6. lower-/.f6422.7

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                    4. Applied rewrites22.7%

                      \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                    5. Taylor expanded in d around -inf

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

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

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

                        \[\leadsto \frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                      4. lower-/.f6411.8

                        \[\leadsto \frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                    7. Applied rewrites11.8%

                      \[\leadsto \frac{\left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right) \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                    8. Step-by-step derivation
                      1. lift-*.f64N/A

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

                        \[\leadsto \frac{\sqrt{\frac{d}{\ell}} \cdot \left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right)}{h} \]
                      3. lower-*.f6411.8

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

                        \[\leadsto \frac{\sqrt{\frac{d}{\ell}} \cdot \left(-1 \cdot \left(d \cdot \sqrt{\frac{h}{d}}\right)\right)}{h} \]
                      5. mul-1-negN/A

                        \[\leadsto \frac{\sqrt{\frac{d}{\ell}} \cdot \left(\mathsf{neg}\left(d \cdot \sqrt{\frac{h}{d}}\right)\right)}{h} \]
                      6. lift-*.f64N/A

                        \[\leadsto \frac{\sqrt{\frac{d}{\ell}} \cdot \left(\mathsf{neg}\left(d \cdot \sqrt{\frac{h}{d}}\right)\right)}{h} \]
                      7. distribute-lft-neg-inN/A

                        \[\leadsto \frac{\sqrt{\frac{d}{\ell}} \cdot \left(\left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\frac{h}{d}}\right)}{h} \]
                      8. lower-*.f64N/A

                        \[\leadsto \frac{\sqrt{\frac{d}{\ell}} \cdot \left(\left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\frac{h}{d}}\right)}{h} \]
                      9. lower-neg.f6411.8

                        \[\leadsto \frac{\sqrt{\frac{d}{\ell}} \cdot \left(\left(-d\right) \cdot \sqrt{\frac{h}{d}}\right)}{h} \]
                    9. Applied rewrites11.8%

                      \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{\ell}} \cdot \left(\left(-d\right) \cdot \sqrt{\frac{h}{d}}\right)}{h}} \]
                  8. Recombined 5 regimes into one program.
                  9. Add Preprocessing

                  Alternative 13: 50.2% accurate, 0.2× speedup?

                  \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_1 := \sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-155}:\\ \;\;\;\;-1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-227}:\\ \;\;\;\;\frac{t\_1}{h \cdot \ell}\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+262}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\ \mathbf{elif}\;t\_0 \leq \infty:\\ \;\;\;\;\frac{\frac{t\_1}{\ell}}{h}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \end{array} \]
                  M_m = (fabs.f64 M)
                  D_m = (fabs.f64 D)
                  NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                  (FPCore (d h l M_m D_m)
                   :precision binary64
                   (let* ((t_0
                           (*
                            (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                            (-
                             1.0
                             (* (* (/ 1.0 2.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)) (/ h l)))))
                          (t_1 (* (sqrt (* d h)) (sqrt (* d l)))))
                     (if (<= t_0 -2e-155)
                       (* -1.0 (/ (* d (sqrt (/ h l))) h))
                       (if (<= t_0 2e-227)
                         (/ t_1 (* h l))
                         (if (<= t_0 5e+262)
                           (* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
                           (if (<= t_0 INFINITY)
                             (/ (/ t_1 l) h)
                             (* d (sqrt (/ 1.0 (* h l))))))))))
                  M_m = fabs(M);
                  D_m = fabs(D);
                  assert(d < h && h < l && l < M_m && M_m < D_m);
                  double code(double d, double h, double l, double M_m, double D_m) {
                  	double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
                  	double t_1 = sqrt((d * h)) * sqrt((d * l));
                  	double tmp;
                  	if (t_0 <= -2e-155) {
                  		tmp = -1.0 * ((d * sqrt((h / l))) / h);
                  	} else if (t_0 <= 2e-227) {
                  		tmp = t_1 / (h * l);
                  	} else if (t_0 <= 5e+262) {
                  		tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
                  	} else if (t_0 <= ((double) INFINITY)) {
                  		tmp = (t_1 / l) / h;
                  	} else {
                  		tmp = d * sqrt((1.0 / (h * l)));
                  	}
                  	return tmp;
                  }
                  
                  M_m = Math.abs(M);
                  D_m = Math.abs(D);
                  assert d < h && h < l && l < M_m && M_m < D_m;
                  public static double code(double d, double h, double l, double M_m, double D_m) {
                  	double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
                  	double t_1 = Math.sqrt((d * h)) * Math.sqrt((d * l));
                  	double tmp;
                  	if (t_0 <= -2e-155) {
                  		tmp = -1.0 * ((d * Math.sqrt((h / l))) / h);
                  	} else if (t_0 <= 2e-227) {
                  		tmp = t_1 / (h * l);
                  	} else if (t_0 <= 5e+262) {
                  		tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
                  	} else if (t_0 <= Double.POSITIVE_INFINITY) {
                  		tmp = (t_1 / l) / h;
                  	} else {
                  		tmp = d * Math.sqrt((1.0 / (h * l)));
                  	}
                  	return tmp;
                  }
                  
                  M_m = math.fabs(M)
                  D_m = math.fabs(D)
                  [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                  def code(d, h, l, M_m, D_m):
                  	t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)))
                  	t_1 = math.sqrt((d * h)) * math.sqrt((d * l))
                  	tmp = 0
                  	if t_0 <= -2e-155:
                  		tmp = -1.0 * ((d * math.sqrt((h / l))) / h)
                  	elif t_0 <= 2e-227:
                  		tmp = t_1 / (h * l)
                  	elif t_0 <= 5e+262:
                  		tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0
                  	elif t_0 <= math.inf:
                  		tmp = (t_1 / l) / h
                  	else:
                  		tmp = d * math.sqrt((1.0 / (h * l)))
                  	return tmp
                  
                  M_m = abs(M)
                  D_m = abs(D)
                  d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                  function code(d, h, l, M_m, D_m)
                  	t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
                  	t_1 = Float64(sqrt(Float64(d * h)) * sqrt(Float64(d * l)))
                  	tmp = 0.0
                  	if (t_0 <= -2e-155)
                  		tmp = Float64(-1.0 * Float64(Float64(d * sqrt(Float64(h / l))) / h));
                  	elseif (t_0 <= 2e-227)
                  		tmp = Float64(t_1 / Float64(h * l));
                  	elseif (t_0 <= 5e+262)
                  		tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0);
                  	elseif (t_0 <= Inf)
                  		tmp = Float64(Float64(t_1 / l) / h);
                  	else
                  		tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l))));
                  	end
                  	return tmp
                  end
                  
                  M_m = abs(M);
                  D_m = abs(D);
                  d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                  function tmp_2 = code(d, h, l, M_m, D_m)
                  	t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M_m * D_m) / (2.0 * d)) ^ 2.0)) * (h / l)));
                  	t_1 = sqrt((d * h)) * sqrt((d * l));
                  	tmp = 0.0;
                  	if (t_0 <= -2e-155)
                  		tmp = -1.0 * ((d * sqrt((h / l))) / h);
                  	elseif (t_0 <= 2e-227)
                  		tmp = t_1 / (h * l);
                  	elseif (t_0 <= 5e+262)
                  		tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
                  	elseif (t_0 <= Inf)
                  		tmp = (t_1 / l) / h;
                  	else
                  		tmp = d * sqrt((1.0 / (h * l)));
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  M_m = N[Abs[M], $MachinePrecision]
                  D_m = N[Abs[D], $MachinePrecision]
                  NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                  code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(d * h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-155], N[(-1.0 * N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e-227], N[(t$95$1 / N[(h * l), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+262], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(t$95$1 / l), $MachinePrecision] / h), $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
                  
                  \begin{array}{l}
                  M_m = \left|M\right|
                  \\
                  D_m = \left|D\right|
                  \\
                  [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                  \\
                  \begin{array}{l}
                  t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
                  t_1 := \sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}\\
                  \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-155}:\\
                  \;\;\;\;-1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
                  
                  \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-227}:\\
                  \;\;\;\;\frac{t\_1}{h \cdot \ell}\\
                  
                  \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+262}:\\
                  \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
                  
                  \mathbf{elif}\;t\_0 \leq \infty:\\
                  \;\;\;\;\frac{\frac{t\_1}{\ell}}{h}\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 5 regimes
                  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.00000000000000003e-155

                    1. Initial program 66.2%

                      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                    2. Applied rewrites24.8%

                      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-h}{\ell}, \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)}{\left(d + d\right) \cdot d} \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}, \sqrt{\frac{d}{\ell \cdot h} \cdot d}\right)} \]
                    3. Taylor expanded in d around -inf

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

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

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

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

                        \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                      5. lower-*.f6427.1

                        \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                    5. Applied rewrites27.1%

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

                      \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{\color{blue}{h}} \]
                    7. Step-by-step derivation
                      1. lower-/.f64N/A

                        \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                      2. lower-*.f64N/A

                        \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                      3. lower-sqrt.f64N/A

                        \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                      4. lower-/.f6413.5

                        \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                    8. Applied rewrites13.5%

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

                    if -2.00000000000000003e-155 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1.99999999999999989e-227

                    1. Initial program 66.2%

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

                      \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                    3. Step-by-step derivation
                      1. lower-/.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
                      2. lower-*.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                      3. lower-sqrt.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                      4. lower-*.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                      5. lower-sqrt.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                      6. lower-/.f6422.7

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                    4. Applied rewrites22.7%

                      \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                    5. Taylor expanded in l around 0

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\color{blue}{h \cdot \ell}} \]
                    6. Step-by-step derivation
                      1. lower-/.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \color{blue}{\ell}} \]
                      2. lower-*.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                      3. lower-sqrt.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                      4. lower-*.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                      5. lower-sqrt.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                      6. lower-*.f64N/A

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                      7. lower-*.f6429.6

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                    7. Applied rewrites29.6%

                      \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\color{blue}{h \cdot \ell}} \]

                    if 1.99999999999999989e-227 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.00000000000000008e262

                    1. Initial program 66.2%

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

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

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

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

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

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

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

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

                        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
                    3. Applied rewrites67.8%

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

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

                        \[\leadsto \color{blue}{\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                      3. lower-*.f6467.8

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

                        \[\leadsto \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                      5. metadata-eval67.8

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

                        \[\leadsto \left(\color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                      7. pow1/2N/A

                        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                      8. lift-sqrt.f6467.8

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

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

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

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

                        \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                      13. lower-sqrt.f6467.8

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

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

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

                        \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \color{blue}{1} \]

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

                      1. Initial program 66.2%

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

                        \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                      3. Step-by-step derivation
                        1. lower-/.f64N/A

                          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
                        2. lower-*.f64N/A

                          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                        3. lower-sqrt.f64N/A

                          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                        4. lower-*.f64N/A

                          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                        5. lower-sqrt.f64N/A

                          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                        6. lower-/.f6422.7

                          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                      4. Applied rewrites22.7%

                        \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                      5. Taylor expanded in l around 0

                        \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                      6. Step-by-step derivation
                        1. lower-/.f64N/A

                          \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                        2. lower-*.f64N/A

                          \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                        3. lower-sqrt.f64N/A

                          \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                        4. lower-*.f64N/A

                          \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                        5. lower-sqrt.f64N/A

                          \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                        6. lower-*.f6431.9

                          \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]
                      7. Applied rewrites31.9%

                        \[\leadsto \frac{\frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\ell}}{h} \]

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

                      1. Initial program 66.2%

                        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                      2. Applied rewrites24.8%

                        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-h}{\ell}, \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)}{\left(d + d\right) \cdot d} \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}, \sqrt{\frac{d}{\ell \cdot h} \cdot d}\right)} \]
                      3. Taylor expanded in d around -inf

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

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

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

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

                          \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                        5. lower-*.f6427.1

                          \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                      5. Applied rewrites27.1%

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

                          \[\leadsto -1 \cdot \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
                        2. mul-1-negN/A

                          \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                        3. lift-*.f64N/A

                          \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                        4. *-commutativeN/A

                          \[\leadsto \mathsf{neg}\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot d\right) \]
                        5. distribute-rgt-neg-inN/A

                          \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                        6. lower-*.f64N/A

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

                          \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                        8. *-commutativeN/A

                          \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                        9. lower-*.f64N/A

                          \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                        10. lower-neg.f6427.1

                          \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right) \]
                      7. Applied rewrites27.1%

                        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \color{blue}{\left(-d\right)} \]
                      8. Taylor expanded in d around inf

                        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                      9. Step-by-step derivation
                        1. lower-*.f64N/A

                          \[\leadsto d \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                        2. lower-sqrt.f64N/A

                          \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                        3. lower-/.f64N/A

                          \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                        4. lower-*.f6425.8

                          \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                      10. Applied rewrites25.8%

                        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                    8. Recombined 5 regimes into one program.
                    9. Add Preprocessing

                    Alternative 14: 49.8% accurate, 0.2× speedup?

                    \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell}\\ t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-155}:\\ \;\;\;\;-1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-227}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+262}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \end{array} \]
                    M_m = (fabs.f64 M)
                    D_m = (fabs.f64 D)
                    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                    (FPCore (d h l M_m D_m)
                     :precision binary64
                     (let* ((t_0 (/ (* (sqrt (* d h)) (sqrt (* d l))) (* h l)))
                            (t_1
                             (*
                              (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                              (-
                               1.0
                               (* (* (/ 1.0 2.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)) (/ h l))))))
                       (if (<= t_1 -2e-155)
                         (* -1.0 (/ (* d (sqrt (/ h l))) h))
                         (if (<= t_1 2e-227)
                           t_0
                           (if (<= t_1 5e+262)
                             (* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
                             (if (<= t_1 INFINITY) t_0 (* d (sqrt (/ 1.0 (* h l))))))))))
                    M_m = fabs(M);
                    D_m = fabs(D);
                    assert(d < h && h < l && l < M_m && M_m < D_m);
                    double code(double d, double h, double l, double M_m, double D_m) {
                    	double t_0 = (sqrt((d * h)) * sqrt((d * l))) / (h * l);
                    	double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
                    	double tmp;
                    	if (t_1 <= -2e-155) {
                    		tmp = -1.0 * ((d * sqrt((h / l))) / h);
                    	} else if (t_1 <= 2e-227) {
                    		tmp = t_0;
                    	} else if (t_1 <= 5e+262) {
                    		tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
                    	} else if (t_1 <= ((double) INFINITY)) {
                    		tmp = t_0;
                    	} else {
                    		tmp = d * sqrt((1.0 / (h * l)));
                    	}
                    	return tmp;
                    }
                    
                    M_m = Math.abs(M);
                    D_m = Math.abs(D);
                    assert d < h && h < l && l < M_m && M_m < D_m;
                    public static double code(double d, double h, double l, double M_m, double D_m) {
                    	double t_0 = (Math.sqrt((d * h)) * Math.sqrt((d * l))) / (h * l);
                    	double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
                    	double tmp;
                    	if (t_1 <= -2e-155) {
                    		tmp = -1.0 * ((d * Math.sqrt((h / l))) / h);
                    	} else if (t_1 <= 2e-227) {
                    		tmp = t_0;
                    	} else if (t_1 <= 5e+262) {
                    		tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
                    	} else if (t_1 <= Double.POSITIVE_INFINITY) {
                    		tmp = t_0;
                    	} else {
                    		tmp = d * Math.sqrt((1.0 / (h * l)));
                    	}
                    	return tmp;
                    }
                    
                    M_m = math.fabs(M)
                    D_m = math.fabs(D)
                    [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                    def code(d, h, l, M_m, D_m):
                    	t_0 = (math.sqrt((d * h)) * math.sqrt((d * l))) / (h * l)
                    	t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)))
                    	tmp = 0
                    	if t_1 <= -2e-155:
                    		tmp = -1.0 * ((d * math.sqrt((h / l))) / h)
                    	elif t_1 <= 2e-227:
                    		tmp = t_0
                    	elif t_1 <= 5e+262:
                    		tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0
                    	elif t_1 <= math.inf:
                    		tmp = t_0
                    	else:
                    		tmp = d * math.sqrt((1.0 / (h * l)))
                    	return tmp
                    
                    M_m = abs(M)
                    D_m = abs(D)
                    d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                    function code(d, h, l, M_m, D_m)
                    	t_0 = Float64(Float64(sqrt(Float64(d * h)) * sqrt(Float64(d * l))) / Float64(h * l))
                    	t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
                    	tmp = 0.0
                    	if (t_1 <= -2e-155)
                    		tmp = Float64(-1.0 * Float64(Float64(d * sqrt(Float64(h / l))) / h));
                    	elseif (t_1 <= 2e-227)
                    		tmp = t_0;
                    	elseif (t_1 <= 5e+262)
                    		tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0);
                    	elseif (t_1 <= Inf)
                    		tmp = t_0;
                    	else
                    		tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l))));
                    	end
                    	return tmp
                    end
                    
                    M_m = abs(M);
                    D_m = abs(D);
                    d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                    function tmp_2 = code(d, h, l, M_m, D_m)
                    	t_0 = (sqrt((d * h)) * sqrt((d * l))) / (h * l);
                    	t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M_m * D_m) / (2.0 * d)) ^ 2.0)) * (h / l)));
                    	tmp = 0.0;
                    	if (t_1 <= -2e-155)
                    		tmp = -1.0 * ((d * sqrt((h / l))) / h);
                    	elseif (t_1 <= 2e-227)
                    		tmp = t_0;
                    	elseif (t_1 <= 5e+262)
                    		tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
                    	elseif (t_1 <= Inf)
                    		tmp = t_0;
                    	else
                    		tmp = d * sqrt((1.0 / (h * l)));
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    M_m = N[Abs[M], $MachinePrecision]
                    D_m = N[Abs[D], $MachinePrecision]
                    NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                    code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(d * h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(h * l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-155], N[(-1.0 * N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-227], t$95$0, If[LessEqual[t$95$1, 5e+262], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$0, N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
                    
                    \begin{array}{l}
                    M_m = \left|M\right|
                    \\
                    D_m = \left|D\right|
                    \\
                    [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                    \\
                    \begin{array}{l}
                    t_0 := \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell}\\
                    t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
                    \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-155}:\\
                    \;\;\;\;-1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
                    
                    \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-227}:\\
                    \;\;\;\;t\_0\\
                    
                    \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+262}:\\
                    \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
                    
                    \mathbf{elif}\;t\_1 \leq \infty:\\
                    \;\;\;\;t\_0\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 4 regimes
                    2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.00000000000000003e-155

                      1. Initial program 66.2%

                        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                      2. Applied rewrites24.8%

                        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-h}{\ell}, \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)}{\left(d + d\right) \cdot d} \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}, \sqrt{\frac{d}{\ell \cdot h} \cdot d}\right)} \]
                      3. Taylor expanded in d around -inf

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

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

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

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

                          \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                        5. lower-*.f6427.1

                          \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                      5. Applied rewrites27.1%

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

                        \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{\color{blue}{h}} \]
                      7. Step-by-step derivation
                        1. lower-/.f64N/A

                          \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                        2. lower-*.f64N/A

                          \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                        3. lower-sqrt.f64N/A

                          \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                        4. lower-/.f6413.5

                          \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                      8. Applied rewrites13.5%

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

                      if -2.00000000000000003e-155 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1.99999999999999989e-227 or 5.00000000000000008e262 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

                      1. Initial program 66.2%

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

                        \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                      3. Step-by-step derivation
                        1. lower-/.f64N/A

                          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
                        2. lower-*.f64N/A

                          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                        3. lower-sqrt.f64N/A

                          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                        4. lower-*.f64N/A

                          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                        5. lower-sqrt.f64N/A

                          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                        6. lower-/.f6422.7

                          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                      4. Applied rewrites22.7%

                        \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                      5. Taylor expanded in l around 0

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\color{blue}{h \cdot \ell}} \]
                      6. Step-by-step derivation
                        1. lower-/.f64N/A

                          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \color{blue}{\ell}} \]
                        2. lower-*.f64N/A

                          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                        3. lower-sqrt.f64N/A

                          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                        4. lower-*.f64N/A

                          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                        5. lower-sqrt.f64N/A

                          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                        6. lower-*.f64N/A

                          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                        7. lower-*.f6429.6

                          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{h \cdot \ell} \]
                      7. Applied rewrites29.6%

                        \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}}{\color{blue}{h \cdot \ell}} \]

                      if 1.99999999999999989e-227 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.00000000000000008e262

                      1. Initial program 66.2%

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

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

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

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

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

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

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

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

                          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
                      3. Applied rewrites67.8%

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

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

                          \[\leadsto \color{blue}{\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                        3. lower-*.f6467.8

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

                          \[\leadsto \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                        5. metadata-eval67.8

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

                          \[\leadsto \left(\color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                        7. pow1/2N/A

                          \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                        8. lift-sqrt.f6467.8

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

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

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

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

                          \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                        13. lower-sqrt.f6467.8

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

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

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

                          \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \color{blue}{1} \]

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

                        1. Initial program 66.2%

                          \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                        2. Applied rewrites24.8%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-h}{\ell}, \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)}{\left(d + d\right) \cdot d} \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}, \sqrt{\frac{d}{\ell \cdot h} \cdot d}\right)} \]
                        3. Taylor expanded in d around -inf

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

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

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

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

                            \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                          5. lower-*.f6427.1

                            \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                        5. Applied rewrites27.1%

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

                            \[\leadsto -1 \cdot \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
                          2. mul-1-negN/A

                            \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                          3. lift-*.f64N/A

                            \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                          4. *-commutativeN/A

                            \[\leadsto \mathsf{neg}\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot d\right) \]
                          5. distribute-rgt-neg-inN/A

                            \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                          6. lower-*.f64N/A

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

                            \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                          8. *-commutativeN/A

                            \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                          9. lower-*.f64N/A

                            \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                          10. lower-neg.f6427.1

                            \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right) \]
                        7. Applied rewrites27.1%

                          \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \color{blue}{\left(-d\right)} \]
                        8. Taylor expanded in d around inf

                          \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                        9. Step-by-step derivation
                          1. lower-*.f64N/A

                            \[\leadsto d \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                          2. lower-sqrt.f64N/A

                            \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                          3. lower-/.f64N/A

                            \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                          4. lower-*.f6425.8

                            \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                        10. Applied rewrites25.8%

                          \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                      8. Recombined 4 regimes into one program.
                      9. Add Preprocessing

                      Alternative 15: 46.9% accurate, 0.4× speedup?

                      \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-155}:\\ \;\;\;\;-1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-227}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\ \end{array} \end{array} \]
                      M_m = (fabs.f64 M)
                      D_m = (fabs.f64 D)
                      NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                      (FPCore (d h l M_m D_m)
                       :precision binary64
                       (let* ((t_0
                               (*
                                (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
                                (-
                                 1.0
                                 (* (* (/ 1.0 2.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0)) (/ h l))))))
                         (if (<= t_0 -2e-155)
                           (* -1.0 (/ (* d (sqrt (/ h l))) h))
                           (if (<= t_0 2e-227)
                             (* d (sqrt (/ 1.0 (* h l))))
                             (* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)))))
                      M_m = fabs(M);
                      D_m = fabs(D);
                      assert(d < h && h < l && l < M_m && M_m < D_m);
                      double code(double d, double h, double l, double M_m, double D_m) {
                      	double t_0 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
                      	double tmp;
                      	if (t_0 <= -2e-155) {
                      		tmp = -1.0 * ((d * sqrt((h / l))) / h);
                      	} else if (t_0 <= 2e-227) {
                      		tmp = d * sqrt((1.0 / (h * l)));
                      	} else {
                      		tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
                      	}
                      	return tmp;
                      }
                      
                      M_m =     private
                      D_m =     private
                      NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                      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(d, h, l, m_m, d_m)
                      use fmin_fmax_functions
                          real(8), intent (in) :: d
                          real(8), intent (in) :: h
                          real(8), intent (in) :: l
                          real(8), intent (in) :: m_m
                          real(8), intent (in) :: d_m
                          real(8) :: t_0
                          real(8) :: tmp
                          t_0 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m_m * d_m) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
                          if (t_0 <= (-2d-155)) then
                              tmp = (-1.0d0) * ((d * sqrt((h / l))) / h)
                          else if (t_0 <= 2d-227) then
                              tmp = d * sqrt((1.0d0 / (h * l)))
                          else
                              tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
                          end if
                          code = tmp
                      end function
                      
                      M_m = Math.abs(M);
                      D_m = Math.abs(D);
                      assert d < h && h < l && l < M_m && M_m < D_m;
                      public static double code(double d, double h, double l, double M_m, double D_m) {
                      	double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
                      	double tmp;
                      	if (t_0 <= -2e-155) {
                      		tmp = -1.0 * ((d * Math.sqrt((h / l))) / h);
                      	} else if (t_0 <= 2e-227) {
                      		tmp = d * Math.sqrt((1.0 / (h * l)));
                      	} else {
                      		tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
                      	}
                      	return tmp;
                      }
                      
                      M_m = math.fabs(M)
                      D_m = math.fabs(D)
                      [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                      def code(d, h, l, M_m, D_m):
                      	t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)))
                      	tmp = 0
                      	if t_0 <= -2e-155:
                      		tmp = -1.0 * ((d * math.sqrt((h / l))) / h)
                      	elif t_0 <= 2e-227:
                      		tmp = d * math.sqrt((1.0 / (h * l)))
                      	else:
                      		tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0
                      	return tmp
                      
                      M_m = abs(M)
                      D_m = abs(D)
                      d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                      function code(d, h, l, M_m, D_m)
                      	t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
                      	tmp = 0.0
                      	if (t_0 <= -2e-155)
                      		tmp = Float64(-1.0 * Float64(Float64(d * sqrt(Float64(h / l))) / h));
                      	elseif (t_0 <= 2e-227)
                      		tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l))));
                      	else
                      		tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0);
                      	end
                      	return tmp
                      end
                      
                      M_m = abs(M);
                      D_m = abs(D);
                      d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                      function tmp_2 = code(d, h, l, M_m, D_m)
                      	t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M_m * D_m) / (2.0 * d)) ^ 2.0)) * (h / l)));
                      	tmp = 0.0;
                      	if (t_0 <= -2e-155)
                      		tmp = -1.0 * ((d * sqrt((h / l))) / h);
                      	elseif (t_0 <= 2e-227)
                      		tmp = d * sqrt((1.0 / (h * l)));
                      	else
                      		tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      M_m = N[Abs[M], $MachinePrecision]
                      D_m = N[Abs[D], $MachinePrecision]
                      NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                      code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-155], N[(-1.0 * N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e-227], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]]]]
                      
                      \begin{array}{l}
                      M_m = \left|M\right|
                      \\
                      D_m = \left|D\right|
                      \\
                      [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                      \\
                      \begin{array}{l}
                      t_0 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
                      \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-155}:\\
                      \;\;\;\;-1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
                      
                      \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-227}:\\
                      \;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.00000000000000003e-155

                        1. Initial program 66.2%

                          \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                        2. Applied rewrites24.8%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-h}{\ell}, \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)}{\left(d + d\right) \cdot d} \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}, \sqrt{\frac{d}{\ell \cdot h} \cdot d}\right)} \]
                        3. Taylor expanded in d around -inf

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

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

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

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

                            \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                          5. lower-*.f6427.1

                            \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                        5. Applied rewrites27.1%

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

                          \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{\color{blue}{h}} \]
                        7. Step-by-step derivation
                          1. lower-/.f64N/A

                            \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                          2. lower-*.f64N/A

                            \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                          3. lower-sqrt.f64N/A

                            \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                          4. lower-/.f6413.5

                            \[\leadsto -1 \cdot \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
                        8. Applied rewrites13.5%

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

                        if -2.00000000000000003e-155 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1.99999999999999989e-227

                        1. Initial program 66.2%

                          \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                        2. Applied rewrites24.8%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-h}{\ell}, \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)}{\left(d + d\right) \cdot d} \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}, \sqrt{\frac{d}{\ell \cdot h} \cdot d}\right)} \]
                        3. Taylor expanded in d around -inf

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

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

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

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

                            \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                          5. lower-*.f6427.1

                            \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                        5. Applied rewrites27.1%

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

                            \[\leadsto -1 \cdot \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
                          2. mul-1-negN/A

                            \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                          3. lift-*.f64N/A

                            \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                          4. *-commutativeN/A

                            \[\leadsto \mathsf{neg}\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot d\right) \]
                          5. distribute-rgt-neg-inN/A

                            \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                          6. lower-*.f64N/A

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

                            \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                          8. *-commutativeN/A

                            \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                          9. lower-*.f64N/A

                            \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                          10. lower-neg.f6427.1

                            \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right) \]
                        7. Applied rewrites27.1%

                          \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \color{blue}{\left(-d\right)} \]
                        8. Taylor expanded in d around inf

                          \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                        9. Step-by-step derivation
                          1. lower-*.f64N/A

                            \[\leadsto d \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                          2. lower-sqrt.f64N/A

                            \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                          3. lower-/.f64N/A

                            \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                          4. lower-*.f6425.8

                            \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                        10. Applied rewrites25.8%

                          \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]

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

                        1. Initial program 66.2%

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

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

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

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

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

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

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

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

                            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{M \cdot D}{2 \cdot d}}\right) \]
                        3. Applied rewrites67.8%

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

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

                            \[\leadsto \color{blue}{\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                          3. lower-*.f6467.8

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

                            \[\leadsto \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                          5. metadata-eval67.8

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

                            \[\leadsto \left(\color{blue}{{\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                          7. pow1/2N/A

                            \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                          8. lift-sqrt.f6467.8

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

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

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

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

                            \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}}\right) \cdot \left(1 - \left(\left(\frac{h}{\ell} \cdot \frac{1}{2}\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \cdot \left(\frac{M}{d + d} \cdot D\right)\right) \]
                          13. lower-sqrt.f6467.8

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

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

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

                            \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \color{blue}{1} \]
                        8. Recombined 3 regimes into one program.
                        9. Add Preprocessing

                        Alternative 16: 42.7% accurate, 3.7× speedup?

                        \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq 7.4 \cdot 10^{-175}:\\ \;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)\\ \mathbf{elif}\;d \leq 5.7 \cdot 10^{+119}:\\ \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{h \cdot d}}{h}\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \end{array} \]
                        M_m = (fabs.f64 M)
                        D_m = (fabs.f64 D)
                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                        (FPCore (d h l M_m D_m)
                         :precision binary64
                         (if (<= d 7.4e-175)
                           (* (sqrt (/ (/ 1.0 l) h)) (- d))
                           (if (<= d 5.7e+119)
                             (* (sqrt (/ d l)) (/ (sqrt (* h d)) h))
                             (* d (sqrt (/ 1.0 (* h l)))))))
                        M_m = fabs(M);
                        D_m = fabs(D);
                        assert(d < h && h < l && l < M_m && M_m < D_m);
                        double code(double d, double h, double l, double M_m, double D_m) {
                        	double tmp;
                        	if (d <= 7.4e-175) {
                        		tmp = sqrt(((1.0 / l) / h)) * -d;
                        	} else if (d <= 5.7e+119) {
                        		tmp = sqrt((d / l)) * (sqrt((h * d)) / h);
                        	} else {
                        		tmp = d * sqrt((1.0 / (h * l)));
                        	}
                        	return tmp;
                        }
                        
                        M_m =     private
                        D_m =     private
                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                        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(d, h, l, m_m, d_m)
                        use fmin_fmax_functions
                            real(8), intent (in) :: d
                            real(8), intent (in) :: h
                            real(8), intent (in) :: l
                            real(8), intent (in) :: m_m
                            real(8), intent (in) :: d_m
                            real(8) :: tmp
                            if (d <= 7.4d-175) then
                                tmp = sqrt(((1.0d0 / l) / h)) * -d
                            else if (d <= 5.7d+119) then
                                tmp = sqrt((d / l)) * (sqrt((h * d)) / h)
                            else
                                tmp = d * sqrt((1.0d0 / (h * l)))
                            end if
                            code = tmp
                        end function
                        
                        M_m = Math.abs(M);
                        D_m = Math.abs(D);
                        assert d < h && h < l && l < M_m && M_m < D_m;
                        public static double code(double d, double h, double l, double M_m, double D_m) {
                        	double tmp;
                        	if (d <= 7.4e-175) {
                        		tmp = Math.sqrt(((1.0 / l) / h)) * -d;
                        	} else if (d <= 5.7e+119) {
                        		tmp = Math.sqrt((d / l)) * (Math.sqrt((h * d)) / h);
                        	} else {
                        		tmp = d * Math.sqrt((1.0 / (h * l)));
                        	}
                        	return tmp;
                        }
                        
                        M_m = math.fabs(M)
                        D_m = math.fabs(D)
                        [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                        def code(d, h, l, M_m, D_m):
                        	tmp = 0
                        	if d <= 7.4e-175:
                        		tmp = math.sqrt(((1.0 / l) / h)) * -d
                        	elif d <= 5.7e+119:
                        		tmp = math.sqrt((d / l)) * (math.sqrt((h * d)) / h)
                        	else:
                        		tmp = d * math.sqrt((1.0 / (h * l)))
                        	return tmp
                        
                        M_m = abs(M)
                        D_m = abs(D)
                        d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                        function code(d, h, l, M_m, D_m)
                        	tmp = 0.0
                        	if (d <= 7.4e-175)
                        		tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * Float64(-d));
                        	elseif (d <= 5.7e+119)
                        		tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(h * d)) / h));
                        	else
                        		tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l))));
                        	end
                        	return tmp
                        end
                        
                        M_m = abs(M);
                        D_m = abs(D);
                        d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                        function tmp_2 = code(d, h, l, M_m, D_m)
                        	tmp = 0.0;
                        	if (d <= 7.4e-175)
                        		tmp = sqrt(((1.0 / l) / h)) * -d;
                        	elseif (d <= 5.7e+119)
                        		tmp = sqrt((d / l)) * (sqrt((h * d)) / h);
                        	else
                        		tmp = d * sqrt((1.0 / (h * l)));
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        M_m = N[Abs[M], $MachinePrecision]
                        D_m = N[Abs[D], $MachinePrecision]
                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                        code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, 7.4e-175], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[d, 5.7e+119], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(h * d), $MachinePrecision]], $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
                        
                        \begin{array}{l}
                        M_m = \left|M\right|
                        \\
                        D_m = \left|D\right|
                        \\
                        [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;d \leq 7.4 \cdot 10^{-175}:\\
                        \;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)\\
                        
                        \mathbf{elif}\;d \leq 5.7 \cdot 10^{+119}:\\
                        \;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{h \cdot d}}{h}\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 3 regimes
                        2. if d < 7.39999999999999997e-175

                          1. Initial program 66.2%

                            \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                          2. Applied rewrites24.8%

                            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-h}{\ell}, \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)}{\left(d + d\right) \cdot d} \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}, \sqrt{\frac{d}{\ell \cdot h} \cdot d}\right)} \]
                          3. Taylor expanded in d around -inf

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

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

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

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

                              \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            5. lower-*.f6427.1

                              \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                          5. Applied rewrites27.1%

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

                              \[\leadsto -1 \cdot \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
                            2. mul-1-negN/A

                              \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            3. lift-*.f64N/A

                              \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            4. *-commutativeN/A

                              \[\leadsto \mathsf{neg}\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot d\right) \]
                            5. distribute-rgt-neg-inN/A

                              \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                            6. lower-*.f64N/A

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

                              \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            8. *-commutativeN/A

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            9. lower-*.f64N/A

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            10. lower-neg.f6427.1

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right) \]
                          7. Applied rewrites27.1%

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

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

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

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

                              \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right) \]
                            5. lower-/.f6427.2

                              \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right) \]
                          9. Applied rewrites27.2%

                            \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right) \]

                          if 7.39999999999999997e-175 < d < 5.7000000000000002e119

                          1. Initial program 66.2%

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

                            \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                          3. Step-by-step derivation
                            1. lower-/.f64N/A

                              \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
                            2. lower-*.f64N/A

                              \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                            3. lower-sqrt.f64N/A

                              \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                            4. lower-*.f64N/A

                              \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                            5. lower-sqrt.f64N/A

                              \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                            6. lower-/.f6422.7

                              \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h} \]
                          4. Applied rewrites22.7%

                            \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
                          5. Step-by-step derivation
                            1. lift-/.f64N/A

                              \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
                            2. mult-flipN/A

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

                              \[\leadsto \left(\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \frac{1}{h} \]
                            4. pow1/2N/A

                              \[\leadsto \left(\sqrt{d \cdot h} \cdot {\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}\right) \cdot \frac{1}{h} \]
                            5. lift-pow.f64N/A

                              \[\leadsto \left(\sqrt{d \cdot h} \cdot {\left(\frac{d}{\ell}\right)}^{\frac{1}{2}}\right) \cdot \frac{1}{h} \]
                            6. metadata-evalN/A

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

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

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

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

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

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

                              \[\leadsto {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(\sqrt{d \cdot h} \cdot \frac{1}{h}\right) \]
                            13. metadata-evalN/A

                              \[\leadsto {\left(\frac{d}{\ell}\right)}^{\frac{1}{2}} \cdot \left(\sqrt{d \cdot h} \cdot \frac{1}{h}\right) \]
                            14. lift-pow.f64N/A

                              \[\leadsto {\left(\frac{d}{\ell}\right)}^{\frac{1}{2}} \cdot \left(\color{blue}{\sqrt{d \cdot h}} \cdot \frac{1}{h}\right) \]
                            15. pow1/2N/A

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

                              \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \left(\color{blue}{\sqrt{d \cdot h}} \cdot \frac{1}{h}\right) \]
                            17. mult-flip-revN/A

                              \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{d \cdot h}}{\color{blue}{h}} \]
                            18. lower-/.f6422.7

                              \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{d \cdot h}}{\color{blue}{h}} \]
                            19. lift-*.f64N/A

                              \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{d \cdot h}}{h} \]
                            20. *-commutativeN/A

                              \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{h \cdot d}}{h} \]
                            21. lower-*.f6422.7

                              \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{h \cdot d}}{h} \]
                          6. Applied rewrites22.7%

                            \[\leadsto \sqrt{\frac{d}{\ell}} \cdot \color{blue}{\frac{\sqrt{h \cdot d}}{h}} \]

                          if 5.7000000000000002e119 < d

                          1. Initial program 66.2%

                            \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                          2. Applied rewrites24.8%

                            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-h}{\ell}, \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)}{\left(d + d\right) \cdot d} \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}, \sqrt{\frac{d}{\ell \cdot h} \cdot d}\right)} \]
                          3. Taylor expanded in d around -inf

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

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

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

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

                              \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            5. lower-*.f6427.1

                              \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                          5. Applied rewrites27.1%

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

                              \[\leadsto -1 \cdot \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
                            2. mul-1-negN/A

                              \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            3. lift-*.f64N/A

                              \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            4. *-commutativeN/A

                              \[\leadsto \mathsf{neg}\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot d\right) \]
                            5. distribute-rgt-neg-inN/A

                              \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                            6. lower-*.f64N/A

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

                              \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            8. *-commutativeN/A

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            9. lower-*.f64N/A

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            10. lower-neg.f6427.1

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right) \]
                          7. Applied rewrites27.1%

                            \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \color{blue}{\left(-d\right)} \]
                          8. Taylor expanded in d around inf

                            \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                          9. Step-by-step derivation
                            1. lower-*.f64N/A

                              \[\leadsto d \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                            2. lower-sqrt.f64N/A

                              \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                            3. lower-/.f64N/A

                              \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                            4. lower-*.f6425.8

                              \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                          10. Applied rewrites25.8%

                            \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                        3. Recombined 3 regimes into one program.
                        4. Add Preprocessing

                        Alternative 17: 42.7% accurate, 5.4× speedup?

                        \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -6.7 \cdot 10^{-276}:\\ \;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \end{array} \]
                        M_m = (fabs.f64 M)
                        D_m = (fabs.f64 D)
                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                        (FPCore (d h l M_m D_m)
                         :precision binary64
                         (if (<= l -6.7e-276)
                           (* (sqrt (/ (/ 1.0 l) h)) (- d))
                           (* d (sqrt (/ 1.0 (* h l))))))
                        M_m = fabs(M);
                        D_m = fabs(D);
                        assert(d < h && h < l && l < M_m && M_m < D_m);
                        double code(double d, double h, double l, double M_m, double D_m) {
                        	double tmp;
                        	if (l <= -6.7e-276) {
                        		tmp = sqrt(((1.0 / l) / h)) * -d;
                        	} else {
                        		tmp = d * sqrt((1.0 / (h * l)));
                        	}
                        	return tmp;
                        }
                        
                        M_m =     private
                        D_m =     private
                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                        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(d, h, l, m_m, d_m)
                        use fmin_fmax_functions
                            real(8), intent (in) :: d
                            real(8), intent (in) :: h
                            real(8), intent (in) :: l
                            real(8), intent (in) :: m_m
                            real(8), intent (in) :: d_m
                            real(8) :: tmp
                            if (l <= (-6.7d-276)) then
                                tmp = sqrt(((1.0d0 / l) / h)) * -d
                            else
                                tmp = d * sqrt((1.0d0 / (h * l)))
                            end if
                            code = tmp
                        end function
                        
                        M_m = Math.abs(M);
                        D_m = Math.abs(D);
                        assert d < h && h < l && l < M_m && M_m < D_m;
                        public static double code(double d, double h, double l, double M_m, double D_m) {
                        	double tmp;
                        	if (l <= -6.7e-276) {
                        		tmp = Math.sqrt(((1.0 / l) / h)) * -d;
                        	} else {
                        		tmp = d * Math.sqrt((1.0 / (h * l)));
                        	}
                        	return tmp;
                        }
                        
                        M_m = math.fabs(M)
                        D_m = math.fabs(D)
                        [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                        def code(d, h, l, M_m, D_m):
                        	tmp = 0
                        	if l <= -6.7e-276:
                        		tmp = math.sqrt(((1.0 / l) / h)) * -d
                        	else:
                        		tmp = d * math.sqrt((1.0 / (h * l)))
                        	return tmp
                        
                        M_m = abs(M)
                        D_m = abs(D)
                        d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                        function code(d, h, l, M_m, D_m)
                        	tmp = 0.0
                        	if (l <= -6.7e-276)
                        		tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * Float64(-d));
                        	else
                        		tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l))));
                        	end
                        	return tmp
                        end
                        
                        M_m = abs(M);
                        D_m = abs(D);
                        d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                        function tmp_2 = code(d, h, l, M_m, D_m)
                        	tmp = 0.0;
                        	if (l <= -6.7e-276)
                        		tmp = sqrt(((1.0 / l) / h)) * -d;
                        	else
                        		tmp = d * sqrt((1.0 / (h * l)));
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        M_m = N[Abs[M], $MachinePrecision]
                        D_m = N[Abs[D], $MachinePrecision]
                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                        code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -6.7e-276], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
                        
                        \begin{array}{l}
                        M_m = \left|M\right|
                        \\
                        D_m = \left|D\right|
                        \\
                        [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;\ell \leq -6.7 \cdot 10^{-276}:\\
                        \;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right)\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if l < -6.69999999999999983e-276

                          1. Initial program 66.2%

                            \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                          2. Applied rewrites24.8%

                            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-h}{\ell}, \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)}{\left(d + d\right) \cdot d} \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}, \sqrt{\frac{d}{\ell \cdot h} \cdot d}\right)} \]
                          3. Taylor expanded in d around -inf

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

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

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

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

                              \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            5. lower-*.f6427.1

                              \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                          5. Applied rewrites27.1%

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

                              \[\leadsto -1 \cdot \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
                            2. mul-1-negN/A

                              \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            3. lift-*.f64N/A

                              \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            4. *-commutativeN/A

                              \[\leadsto \mathsf{neg}\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot d\right) \]
                            5. distribute-rgt-neg-inN/A

                              \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                            6. lower-*.f64N/A

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

                              \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            8. *-commutativeN/A

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            9. lower-*.f64N/A

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            10. lower-neg.f6427.1

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right) \]
                          7. Applied rewrites27.1%

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

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

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

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

                              \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right) \]
                            5. lower-/.f6427.2

                              \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right) \]
                          9. Applied rewrites27.2%

                            \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot \left(-d\right) \]

                          if -6.69999999999999983e-276 < l

                          1. Initial program 66.2%

                            \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                          2. Applied rewrites24.8%

                            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-h}{\ell}, \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)}{\left(d + d\right) \cdot d} \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}, \sqrt{\frac{d}{\ell \cdot h} \cdot d}\right)} \]
                          3. Taylor expanded in d around -inf

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

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

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

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

                              \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            5. lower-*.f6427.1

                              \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                          5. Applied rewrites27.1%

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

                              \[\leadsto -1 \cdot \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
                            2. mul-1-negN/A

                              \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            3. lift-*.f64N/A

                              \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            4. *-commutativeN/A

                              \[\leadsto \mathsf{neg}\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot d\right) \]
                            5. distribute-rgt-neg-inN/A

                              \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                            6. lower-*.f64N/A

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

                              \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            8. *-commutativeN/A

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            9. lower-*.f64N/A

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            10. lower-neg.f6427.1

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right) \]
                          7. Applied rewrites27.1%

                            \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \color{blue}{\left(-d\right)} \]
                          8. Taylor expanded in d around inf

                            \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                          9. Step-by-step derivation
                            1. lower-*.f64N/A

                              \[\leadsto d \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                            2. lower-sqrt.f64N/A

                              \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                            3. lower-/.f64N/A

                              \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                            4. lower-*.f6425.8

                              \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                          10. Applied rewrites25.8%

                            \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                        3. Recombined 2 regimes into one program.
                        4. Add Preprocessing

                        Alternative 18: 42.5% accurate, 5.4× speedup?

                        \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -6.7 \cdot 10^{-276}:\\ \;\;\;\;\sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(-d\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \end{array} \]
                        M_m = (fabs.f64 M)
                        D_m = (fabs.f64 D)
                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                        (FPCore (d h l M_m D_m)
                         :precision binary64
                         (if (<= l -6.7e-276)
                           (* (sqrt (/ (/ 1.0 h) l)) (- d))
                           (* d (sqrt (/ 1.0 (* h l))))))
                        M_m = fabs(M);
                        D_m = fabs(D);
                        assert(d < h && h < l && l < M_m && M_m < D_m);
                        double code(double d, double h, double l, double M_m, double D_m) {
                        	double tmp;
                        	if (l <= -6.7e-276) {
                        		tmp = sqrt(((1.0 / h) / l)) * -d;
                        	} else {
                        		tmp = d * sqrt((1.0 / (h * l)));
                        	}
                        	return tmp;
                        }
                        
                        M_m =     private
                        D_m =     private
                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                        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(d, h, l, m_m, d_m)
                        use fmin_fmax_functions
                            real(8), intent (in) :: d
                            real(8), intent (in) :: h
                            real(8), intent (in) :: l
                            real(8), intent (in) :: m_m
                            real(8), intent (in) :: d_m
                            real(8) :: tmp
                            if (l <= (-6.7d-276)) then
                                tmp = sqrt(((1.0d0 / h) / l)) * -d
                            else
                                tmp = d * sqrt((1.0d0 / (h * l)))
                            end if
                            code = tmp
                        end function
                        
                        M_m = Math.abs(M);
                        D_m = Math.abs(D);
                        assert d < h && h < l && l < M_m && M_m < D_m;
                        public static double code(double d, double h, double l, double M_m, double D_m) {
                        	double tmp;
                        	if (l <= -6.7e-276) {
                        		tmp = Math.sqrt(((1.0 / h) / l)) * -d;
                        	} else {
                        		tmp = d * Math.sqrt((1.0 / (h * l)));
                        	}
                        	return tmp;
                        }
                        
                        M_m = math.fabs(M)
                        D_m = math.fabs(D)
                        [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                        def code(d, h, l, M_m, D_m):
                        	tmp = 0
                        	if l <= -6.7e-276:
                        		tmp = math.sqrt(((1.0 / h) / l)) * -d
                        	else:
                        		tmp = d * math.sqrt((1.0 / (h * l)))
                        	return tmp
                        
                        M_m = abs(M)
                        D_m = abs(D)
                        d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                        function code(d, h, l, M_m, D_m)
                        	tmp = 0.0
                        	if (l <= -6.7e-276)
                        		tmp = Float64(sqrt(Float64(Float64(1.0 / h) / l)) * Float64(-d));
                        	else
                        		tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l))));
                        	end
                        	return tmp
                        end
                        
                        M_m = abs(M);
                        D_m = abs(D);
                        d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                        function tmp_2 = code(d, h, l, M_m, D_m)
                        	tmp = 0.0;
                        	if (l <= -6.7e-276)
                        		tmp = sqrt(((1.0 / h) / l)) * -d;
                        	else
                        		tmp = d * sqrt((1.0 / (h * l)));
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        M_m = N[Abs[M], $MachinePrecision]
                        D_m = N[Abs[D], $MachinePrecision]
                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                        code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -6.7e-276], N[(N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
                        
                        \begin{array}{l}
                        M_m = \left|M\right|
                        \\
                        D_m = \left|D\right|
                        \\
                        [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;\ell \leq -6.7 \cdot 10^{-276}:\\
                        \;\;\;\;\sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(-d\right)\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if l < -6.69999999999999983e-276

                          1. Initial program 66.2%

                            \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                          2. Applied rewrites24.8%

                            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-h}{\ell}, \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)}{\left(d + d\right) \cdot d} \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}, \sqrt{\frac{d}{\ell \cdot h} \cdot d}\right)} \]
                          3. Taylor expanded in d around -inf

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

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

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

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

                              \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            5. lower-*.f6427.1

                              \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                          5. Applied rewrites27.1%

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

                              \[\leadsto -1 \cdot \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
                            2. mul-1-negN/A

                              \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            3. lift-*.f64N/A

                              \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            4. *-commutativeN/A

                              \[\leadsto \mathsf{neg}\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot d\right) \]
                            5. distribute-rgt-neg-inN/A

                              \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                            6. lower-*.f64N/A

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

                              \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            8. *-commutativeN/A

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            9. lower-*.f64N/A

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            10. lower-neg.f6427.1

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right) \]
                          7. Applied rewrites27.1%

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

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

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right) \]
                            3. *-commutativeN/A

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

                              \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(-d\right) \]
                            5. lower-/.f64N/A

                              \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(-d\right) \]
                            6. lower-/.f6427.2

                              \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(-d\right) \]
                          9. Applied rewrites27.2%

                            \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot \left(-d\right) \]

                          if -6.69999999999999983e-276 < l

                          1. Initial program 66.2%

                            \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                          2. Applied rewrites24.8%

                            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-h}{\ell}, \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)}{\left(d + d\right) \cdot d} \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}, \sqrt{\frac{d}{\ell \cdot h} \cdot d}\right)} \]
                          3. Taylor expanded in d around -inf

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

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

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

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

                              \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            5. lower-*.f6427.1

                              \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                          5. Applied rewrites27.1%

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

                              \[\leadsto -1 \cdot \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
                            2. mul-1-negN/A

                              \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            3. lift-*.f64N/A

                              \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            4. *-commutativeN/A

                              \[\leadsto \mathsf{neg}\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot d\right) \]
                            5. distribute-rgt-neg-inN/A

                              \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                            6. lower-*.f64N/A

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

                              \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            8. *-commutativeN/A

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            9. lower-*.f64N/A

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            10. lower-neg.f6427.1

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right) \]
                          7. Applied rewrites27.1%

                            \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \color{blue}{\left(-d\right)} \]
                          8. Taylor expanded in d around inf

                            \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                          9. Step-by-step derivation
                            1. lower-*.f64N/A

                              \[\leadsto d \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                            2. lower-sqrt.f64N/A

                              \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                            3. lower-/.f64N/A

                              \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                            4. lower-*.f6425.8

                              \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                          10. Applied rewrites25.8%

                            \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                        3. Recombined 2 regimes into one program.
                        4. Add Preprocessing

                        Alternative 19: 42.1% accurate, 5.5× speedup?

                        \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -6.7 \cdot 10^{-276}:\\ \;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\ \mathbf{else}:\\ \;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \end{array} \end{array} \]
                        M_m = (fabs.f64 M)
                        D_m = (fabs.f64 D)
                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                        (FPCore (d h l M_m D_m)
                         :precision binary64
                         (if (<= l -6.7e-276)
                           (* (sqrt (/ 1.0 (* l h))) (- d))
                           (* d (sqrt (/ 1.0 (* h l))))))
                        M_m = fabs(M);
                        D_m = fabs(D);
                        assert(d < h && h < l && l < M_m && M_m < D_m);
                        double code(double d, double h, double l, double M_m, double D_m) {
                        	double tmp;
                        	if (l <= -6.7e-276) {
                        		tmp = sqrt((1.0 / (l * h))) * -d;
                        	} else {
                        		tmp = d * sqrt((1.0 / (h * l)));
                        	}
                        	return tmp;
                        }
                        
                        M_m =     private
                        D_m =     private
                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                        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(d, h, l, m_m, d_m)
                        use fmin_fmax_functions
                            real(8), intent (in) :: d
                            real(8), intent (in) :: h
                            real(8), intent (in) :: l
                            real(8), intent (in) :: m_m
                            real(8), intent (in) :: d_m
                            real(8) :: tmp
                            if (l <= (-6.7d-276)) then
                                tmp = sqrt((1.0d0 / (l * h))) * -d
                            else
                                tmp = d * sqrt((1.0d0 / (h * l)))
                            end if
                            code = tmp
                        end function
                        
                        M_m = Math.abs(M);
                        D_m = Math.abs(D);
                        assert d < h && h < l && l < M_m && M_m < D_m;
                        public static double code(double d, double h, double l, double M_m, double D_m) {
                        	double tmp;
                        	if (l <= -6.7e-276) {
                        		tmp = Math.sqrt((1.0 / (l * h))) * -d;
                        	} else {
                        		tmp = d * Math.sqrt((1.0 / (h * l)));
                        	}
                        	return tmp;
                        }
                        
                        M_m = math.fabs(M)
                        D_m = math.fabs(D)
                        [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                        def code(d, h, l, M_m, D_m):
                        	tmp = 0
                        	if l <= -6.7e-276:
                        		tmp = math.sqrt((1.0 / (l * h))) * -d
                        	else:
                        		tmp = d * math.sqrt((1.0 / (h * l)))
                        	return tmp
                        
                        M_m = abs(M)
                        D_m = abs(D)
                        d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                        function code(d, h, l, M_m, D_m)
                        	tmp = 0.0
                        	if (l <= -6.7e-276)
                        		tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d));
                        	else
                        		tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l))));
                        	end
                        	return tmp
                        end
                        
                        M_m = abs(M);
                        D_m = abs(D);
                        d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                        function tmp_2 = code(d, h, l, M_m, D_m)
                        	tmp = 0.0;
                        	if (l <= -6.7e-276)
                        		tmp = sqrt((1.0 / (l * h))) * -d;
                        	else
                        		tmp = d * sqrt((1.0 / (h * l)));
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        M_m = N[Abs[M], $MachinePrecision]
                        D_m = N[Abs[D], $MachinePrecision]
                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                        code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -6.7e-276], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
                        
                        \begin{array}{l}
                        M_m = \left|M\right|
                        \\
                        D_m = \left|D\right|
                        \\
                        [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;\ell \leq -6.7 \cdot 10^{-276}:\\
                        \;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if l < -6.69999999999999983e-276

                          1. Initial program 66.2%

                            \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                          2. Applied rewrites24.8%

                            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-h}{\ell}, \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)}{\left(d + d\right) \cdot d} \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}, \sqrt{\frac{d}{\ell \cdot h} \cdot d}\right)} \]
                          3. Taylor expanded in d around -inf

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

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

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

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

                              \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            5. lower-*.f6427.1

                              \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                          5. Applied rewrites27.1%

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

                              \[\leadsto -1 \cdot \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
                            2. mul-1-negN/A

                              \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            3. lift-*.f64N/A

                              \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            4. *-commutativeN/A

                              \[\leadsto \mathsf{neg}\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot d\right) \]
                            5. distribute-rgt-neg-inN/A

                              \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                            6. lower-*.f64N/A

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

                              \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            8. *-commutativeN/A

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            9. lower-*.f64N/A

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            10. lower-neg.f6427.1

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right) \]
                          7. Applied rewrites27.1%

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

                          if -6.69999999999999983e-276 < l

                          1. Initial program 66.2%

                            \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                          2. Applied rewrites24.8%

                            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-h}{\ell}, \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)}{\left(d + d\right) \cdot d} \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}, \sqrt{\frac{d}{\ell \cdot h} \cdot d}\right)} \]
                          3. Taylor expanded in d around -inf

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

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

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

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

                              \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            5. lower-*.f6427.1

                              \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                          5. Applied rewrites27.1%

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

                              \[\leadsto -1 \cdot \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
                            2. mul-1-negN/A

                              \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            3. lift-*.f64N/A

                              \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                            4. *-commutativeN/A

                              \[\leadsto \mathsf{neg}\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot d\right) \]
                            5. distribute-rgt-neg-inN/A

                              \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                            6. lower-*.f64N/A

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

                              \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            8. *-commutativeN/A

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            9. lower-*.f64N/A

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                            10. lower-neg.f6427.1

                              \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right) \]
                          7. Applied rewrites27.1%

                            \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \color{blue}{\left(-d\right)} \]
                          8. Taylor expanded in d around inf

                            \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                          9. Step-by-step derivation
                            1. lower-*.f64N/A

                              \[\leadsto d \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                            2. lower-sqrt.f64N/A

                              \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                            3. lower-/.f64N/A

                              \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                            4. lower-*.f6425.8

                              \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                          10. Applied rewrites25.8%

                            \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                        3. Recombined 2 regimes into one program.
                        4. Add Preprocessing

                        Alternative 20: 25.8% accurate, 7.7× speedup?

                        \[\begin{array}{l} M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ d \cdot \sqrt{\frac{1}{h \cdot \ell}} \end{array} \]
                        M_m = (fabs.f64 M)
                        D_m = (fabs.f64 D)
                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                        (FPCore (d h l M_m D_m) :precision binary64 (* d (sqrt (/ 1.0 (* h l)))))
                        M_m = fabs(M);
                        D_m = fabs(D);
                        assert(d < h && h < l && l < M_m && M_m < D_m);
                        double code(double d, double h, double l, double M_m, double D_m) {
                        	return d * sqrt((1.0 / (h * l)));
                        }
                        
                        M_m =     private
                        D_m =     private
                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                        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(d, h, l, m_m, d_m)
                        use fmin_fmax_functions
                            real(8), intent (in) :: d
                            real(8), intent (in) :: h
                            real(8), intent (in) :: l
                            real(8), intent (in) :: m_m
                            real(8), intent (in) :: d_m
                            code = d * sqrt((1.0d0 / (h * l)))
                        end function
                        
                        M_m = Math.abs(M);
                        D_m = Math.abs(D);
                        assert d < h && h < l && l < M_m && M_m < D_m;
                        public static double code(double d, double h, double l, double M_m, double D_m) {
                        	return d * Math.sqrt((1.0 / (h * l)));
                        }
                        
                        M_m = math.fabs(M)
                        D_m = math.fabs(D)
                        [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
                        def code(d, h, l, M_m, D_m):
                        	return d * math.sqrt((1.0 / (h * l)))
                        
                        M_m = abs(M)
                        D_m = abs(D)
                        d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
                        function code(d, h, l, M_m, D_m)
                        	return Float64(d * sqrt(Float64(1.0 / Float64(h * l))))
                        end
                        
                        M_m = abs(M);
                        D_m = abs(D);
                        d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
                        function tmp = code(d, h, l, M_m, D_m)
                        	tmp = d * sqrt((1.0 / (h * l)));
                        end
                        
                        M_m = N[Abs[M], $MachinePrecision]
                        D_m = N[Abs[D], $MachinePrecision]
                        NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
                        code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
                        
                        \begin{array}{l}
                        M_m = \left|M\right|
                        \\
                        D_m = \left|D\right|
                        \\
                        [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
                        \\
                        d \cdot \sqrt{\frac{1}{h \cdot \ell}}
                        \end{array}
                        
                        Derivation
                        1. Initial program 66.2%

                          \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
                        2. Applied rewrites24.8%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-h}{\ell}, \frac{\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot 0.25\right)}{\left(d + d\right) \cdot d} \cdot \sqrt{\frac{d}{\ell \cdot h} \cdot d}, \sqrt{\frac{d}{\ell \cdot h} \cdot d}\right)} \]
                        3. Taylor expanded in d around -inf

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

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

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

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

                            \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                          5. lower-*.f6427.1

                            \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                        5. Applied rewrites27.1%

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

                            \[\leadsto -1 \cdot \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
                          2. mul-1-negN/A

                            \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                          3. lift-*.f64N/A

                            \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                          4. *-commutativeN/A

                            \[\leadsto \mathsf{neg}\left(\sqrt{\frac{1}{h \cdot \ell}} \cdot d\right) \]
                          5. distribute-rgt-neg-inN/A

                            \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \]
                          6. lower-*.f64N/A

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

                            \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                          8. *-commutativeN/A

                            \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                          9. lower-*.f64N/A

                            \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(\mathsf{neg}\left(d\right)\right) \]
                          10. lower-neg.f6427.1

                            \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right) \]
                        7. Applied rewrites27.1%

                          \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot \color{blue}{\left(-d\right)} \]
                        8. Taylor expanded in d around inf

                          \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                        9. Step-by-step derivation
                          1. lower-*.f64N/A

                            \[\leadsto d \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
                          2. lower-sqrt.f64N/A

                            \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                          3. lower-/.f64N/A

                            \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                          4. lower-*.f6425.8

                            \[\leadsto d \cdot \sqrt{\frac{1}{h \cdot \ell}} \]
                        10. Applied rewrites25.8%

                          \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
                        11. Add Preprocessing

                        Reproduce

                        ?
                        herbie shell --seed 2025156 
                        (FPCore (d h l M D)
                          :name "Henrywood and Agarwal, Equation (12)"
                          :precision binary64
                          (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))