Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.6% → 73.4%
Time: 8.5s
Alternatives: 13
Speedup: 1.0×

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 13 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.6% 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: 73.4% accurate, 1.0× speedup?

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

\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(1 - \frac{h \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}}{\ell} \cdot 0.5\right) \cdot \left(\left(-d\right) \cdot t\_0\right)\\

\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot d\right) \cdot \left(1 - \frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -9.7999999999999995e66

    1. Initial program 55.8%

      \[\left({\left(\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. 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) \]
      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 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      4. 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{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right) \cdot \frac{h}{\ell}\right) \]
      5. 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 - \left(\frac{1}{2} \cdot {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      6. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{\color{blue}{2 \cdot d}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      7. 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 - \left(\frac{1}{2} \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      8. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
      9. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      10. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
    3. Applied rewrites55.1%

      \[\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{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}}\right) \]
    4. Taylor expanded in h around 0

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\sqrt{\frac{h}{\ell}}, d, \left(\sqrt{{\left(\frac{h}{\ell}\right)}^{3}} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot \frac{-1}{8}\right)}{h} \]
      8. unpow-prod-downN/A

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

        \[\leadsto \frac{\mathsf{fma}\left(\sqrt{\frac{h}{\ell}}, d, \frac{\sqrt{{\left(\frac{h}{\ell}\right)}^{3}} \cdot \left({D}^{2} \cdot {M}^{2}\right)}{d} \cdot \frac{-1}{8}\right)}{h} \]
      10. cube-divN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\sqrt{\frac{h}{\ell}}, d, \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot \sqrt{\frac{{h}^{3}}{{\ell}^{3}}}}{d} \cdot \frac{-1}{8}\right)}{h} \]
    7. Applied rewrites54.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sqrt{\frac{h}{\ell}}, d, \frac{{\left(\frac{h}{\ell}\right)}^{1.5} \cdot {\left(D \cdot M\right)}^{2}}{d} \cdot -0.125\right)}{h} \]

    if -9.7999999999999995e66 < l < -4.999999999999985e-310

    1. Initial program 72.7%

      \[\left({\left(\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 -inf

      \[\leadsto \color{blue}{\left(\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\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) \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left(\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}}\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. sqrt-pow2N/A

        \[\leadsto \left(\left(d \cdot {-1}^{\left(\frac{2}{2}\right)}\right) \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\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) \]
      3. metadata-evalN/A

        \[\leadsto \left(\left(d \cdot {-1}^{1}\right) \cdot \sqrt{\frac{1}{h \cdot \color{blue}{\ell}}}\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) \]
      4. metadata-evalN/A

        \[\leadsto \left(\left(d \cdot -1\right) \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\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) \]
      5. *-commutativeN/A

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}}\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) \]
      6. lower-*.f64N/A

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}}\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) \]
      7. lower-sqrt.f64N/A

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\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) \]
      8. inv-powN/A

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot \sqrt{{\left(h \cdot \ell\right)}^{-1}}\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) \]
      9. lower-pow.f64N/A

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot \sqrt{{\left(h \cdot \ell\right)}^{-1}}\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) \]
      10. *-commutativeN/A

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\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) \]
      11. lower-*.f6477.6

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\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) \]
    4. Applied rewrites77.6%

      \[\leadsto \color{blue}{\left(\left(-1 \cdot d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\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) \]
    5. Applied rewrites77.7%

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

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

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

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

        \[\leadsto \left(1 - \color{blue}{\frac{h \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}}{\ell}} \cdot \frac{1}{2}\right) \cdot \left(\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{\frac{-1}{2}}\right) \]
      5. lower-*.f6484.9

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

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

    if -4.999999999999985e-310 < l

    1. Initial program 67.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 \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. 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) \]
      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 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      4. 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{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right) \cdot \frac{h}{\ell}\right) \]
      5. 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 - \left(\frac{1}{2} \cdot {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      6. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{\color{blue}{2 \cdot d}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      7. 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 - \left(\frac{1}{2} \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      8. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
      9. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      10. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
    3. Applied rewrites68.1%

      \[\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{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}}\right) \]
    4. Taylor expanded in d around 0

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left({\left(\ell \cdot h\right)}^{\left(\frac{-1}{2}\right)} \cdot d\right) \cdot \left(1 - \frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      13. metadata-eval74.0

        \[\leadsto \left({\left(\ell \cdot h\right)}^{-0.5} \cdot d\right) \cdot \left(1 - \frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right) \]
    6. Applied rewrites74.0%

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

Alternative 2: 73.3% accurate, 1.0× speedup?

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

\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(1 - \left(\frac{h}{\ell} \cdot {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2}\right) \cdot 0.5\right) \cdot \left(\left(-d\right) \cdot t\_0\right)\\

\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot d\right) \cdot \left(1 - \frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if l < -9.7999999999999995e66

    1. Initial program 55.8%

      \[\left({\left(\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. 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) \]
      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 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      4. 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{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right) \cdot \frac{h}{\ell}\right) \]
      5. 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 - \left(\frac{1}{2} \cdot {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      6. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{\color{blue}{2 \cdot d}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      7. 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 - \left(\frac{1}{2} \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      8. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
      9. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      10. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
    3. Applied rewrites55.1%

      \[\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{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}}\right) \]
    4. Taylor expanded in h around 0

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\sqrt{\frac{h}{\ell}}, d, \left(\sqrt{{\left(\frac{h}{\ell}\right)}^{3}} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot \frac{-1}{8}\right)}{h} \]
      8. unpow-prod-downN/A

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

        \[\leadsto \frac{\mathsf{fma}\left(\sqrt{\frac{h}{\ell}}, d, \frac{\sqrt{{\left(\frac{h}{\ell}\right)}^{3}} \cdot \left({D}^{2} \cdot {M}^{2}\right)}{d} \cdot \frac{-1}{8}\right)}{h} \]
      10. cube-divN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\sqrt{\frac{h}{\ell}}, d, \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot \sqrt{\frac{{h}^{3}}{{\ell}^{3}}}}{d} \cdot \frac{-1}{8}\right)}{h} \]
    7. Applied rewrites54.0%

      \[\leadsto \frac{\mathsf{fma}\left(\sqrt{\frac{h}{\ell}}, d, \frac{{\left(\frac{h}{\ell}\right)}^{1.5} \cdot {\left(D \cdot M\right)}^{2}}{d} \cdot -0.125\right)}{h} \]

    if -9.7999999999999995e66 < l < -4.999999999999985e-310

    1. Initial program 72.7%

      \[\left({\left(\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 -inf

      \[\leadsto \color{blue}{\left(\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\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) \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left(\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}}\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. sqrt-pow2N/A

        \[\leadsto \left(\left(d \cdot {-1}^{\left(\frac{2}{2}\right)}\right) \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\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) \]
      3. metadata-evalN/A

        \[\leadsto \left(\left(d \cdot {-1}^{1}\right) \cdot \sqrt{\frac{1}{h \cdot \color{blue}{\ell}}}\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) \]
      4. metadata-evalN/A

        \[\leadsto \left(\left(d \cdot -1\right) \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}}\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) \]
      5. *-commutativeN/A

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}}\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) \]
      6. lower-*.f64N/A

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}}\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) \]
      7. lower-sqrt.f64N/A

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\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) \]
      8. inv-powN/A

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot \sqrt{{\left(h \cdot \ell\right)}^{-1}}\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) \]
      9. lower-pow.f64N/A

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot \sqrt{{\left(h \cdot \ell\right)}^{-1}}\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) \]
      10. *-commutativeN/A

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\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) \]
      11. lower-*.f6477.6

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\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) \]
    4. Applied rewrites77.6%

      \[\leadsto \color{blue}{\left(\left(-1 \cdot d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\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) \]
    5. Applied rewrites77.7%

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

    if -4.999999999999985e-310 < l

    1. Initial program 67.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 \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. 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) \]
      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 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      4. 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{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right) \cdot \frac{h}{\ell}\right) \]
      5. 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 - \left(\frac{1}{2} \cdot {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      6. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{\color{blue}{2 \cdot d}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      7. 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 - \left(\frac{1}{2} \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      8. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
      9. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      10. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
    3. Applied rewrites68.1%

      \[\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{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}}\right) \]
    4. Taylor expanded in d around 0

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left({\left(\ell \cdot h\right)}^{\left(\frac{-1}{2}\right)} \cdot d\right) \cdot \left(1 - \frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      13. metadata-eval74.0

        \[\leadsto \left({\left(\ell \cdot h\right)}^{-0.5} \cdot d\right) \cdot \left(1 - \frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right) \]
    6. Applied rewrites74.0%

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

Alternative 3: 71.2% accurate, 0.2× speedup?

\[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \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 \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_1 := \frac{\left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot -0.125}{h}\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{-221}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{-200}:\\ \;\;\;\;\sqrt{\frac{{h}^{-1}}{\ell}} \cdot d\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+214}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\ \mathbf{elif}\;t\_0 \leq \infty:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
 :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 D) (* 2.0 d)) 2.0)) (/ h l)))))
        (t_1 (/ (* (* (pow (/ h l) 1.5) (/ (pow (* D M) 2.0) d)) -0.125) h)))
   (if (<= t_0 -1e-221)
     t_1
     (if (<= t_0 4e-200)
       (* (sqrt (/ (pow h -1.0) l)) d)
       (if (<= t_0 2e+214)
         (* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
         (if (<= t_0 INFINITY) (/ (* (sqrt (/ h l)) d) h) t_1))))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
	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 * D) / (2.0 * d)), 2.0)) * (h / l)));
	double t_1 = ((pow((h / l), 1.5) * (pow((D * M), 2.0) / d)) * -0.125) / h;
	double tmp;
	if (t_0 <= -1e-221) {
		tmp = t_1;
	} else if (t_0 <= 4e-200) {
		tmp = sqrt((pow(h, -1.0) / l)) * d;
	} else if (t_0 <= 2e+214) {
		tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
	} else if (t_0 <= ((double) INFINITY)) {
		tmp = (sqrt((h / l)) * d) / h;
	} else {
		tmp = t_1;
	}
	return tmp;
}
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
	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 * D) / (2.0 * d)), 2.0)) * (h / l)));
	double t_1 = ((Math.pow((h / l), 1.5) * (Math.pow((D * M), 2.0) / d)) * -0.125) / h;
	double tmp;
	if (t_0 <= -1e-221) {
		tmp = t_1;
	} else if (t_0 <= 4e-200) {
		tmp = Math.sqrt((Math.pow(h, -1.0) / l)) * d;
	} else if (t_0 <= 2e+214) {
		tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
	} else if (t_0 <= Double.POSITIVE_INFINITY) {
		tmp = (Math.sqrt((h / l)) * d) / h;
	} else {
		tmp = t_1;
	}
	return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D])
def code(d, h, l, M, D):
	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 * D) / (2.0 * d)), 2.0)) * (h / l)))
	t_1 = ((math.pow((h / l), 1.5) * (math.pow((D * M), 2.0) / d)) * -0.125) / h
	tmp = 0
	if t_0 <= -1e-221:
		tmp = t_1
	elif t_0 <= 4e-200:
		tmp = math.sqrt((math.pow(h, -1.0) / l)) * d
	elif t_0 <= 2e+214:
		tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0
	elif t_0 <= math.inf:
		tmp = (math.sqrt((h / l)) * d) / h
	else:
		tmp = t_1
	return tmp
d, h, l, M, D = sort([d, h, l, M, D])
function code(d, h, l, M, D)
	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 * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
	t_1 = Float64(Float64(Float64((Float64(h / l) ^ 1.5) * Float64((Float64(D * M) ^ 2.0) / d)) * -0.125) / h)
	tmp = 0.0
	if (t_0 <= -1e-221)
		tmp = t_1;
	elseif (t_0 <= 4e-200)
		tmp = Float64(sqrt(Float64((h ^ -1.0) / l)) * d);
	elseif (t_0 <= 2e+214)
		tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0);
	elseif (t_0 <= Inf)
		tmp = Float64(Float64(sqrt(Float64(h / l)) * d) / h);
	else
		tmp = t_1;
	end
	return tmp
end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
	t_0 = (((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)));
	t_1 = ((((h / l) ^ 1.5) * (((D * M) ^ 2.0) / d)) * -0.125) / h;
	tmp = 0.0;
	if (t_0 <= -1e-221)
		tmp = t_1;
	elseif (t_0 <= 4e-200)
		tmp = sqrt(((h ^ -1.0) / l)) * d;
	elseif (t_0 <= 2e+214)
		tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
	elseif (t_0 <= Inf)
		tmp = (sqrt((h / l)) * d) / h;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := 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 * D), $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[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] * N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-221], t$95$1, If[LessEqual[t$95$0, 4e-200], N[(N[Sqrt[N[(N[Power[h, -1.0], $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision], If[LessEqual[t$95$0, 2e+214], 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[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / h), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\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 \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \frac{\left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot -0.125}{h}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-221}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{-200}:\\
\;\;\;\;\sqrt{\frac{{h}^{-1}}{\ell}} \cdot d\\

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+214}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\

\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\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)))) < -1.00000000000000002e-221 or +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 57.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 \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. 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) \]
      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 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      4. 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{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right) \cdot \frac{h}{\ell}\right) \]
      5. 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 - \left(\frac{1}{2} \cdot {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      6. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{\color{blue}{2 \cdot d}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      7. 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 - \left(\frac{1}{2} \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      8. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
      9. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      10. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
    3. Applied rewrites60.0%

      \[\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{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}}\right) \]
    4. Taylor expanded in h around 0

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\sqrt{\frac{h}{\ell}}, d, \left(\sqrt{{\left(\frac{h}{\ell}\right)}^{3}} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot -0.125\right)}{h}} \]
    6. Taylor expanded in d around 0

      \[\leadsto \frac{\frac{-1}{8} \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{{h}^{3}}{{\ell}^{3}}}\right)}{h} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

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

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

        \[\leadsto \frac{\left(\sqrt{\frac{{h}^{3}}{{\ell}^{3}}} \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right) \cdot \frac{-1}{8}}{h} \]
      4. cube-divN/A

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

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

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

        \[\leadsto \frac{\left(\sqrt{{\left(\frac{h}{\ell}\right)}^{3}} \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right) \cdot \frac{-1}{8}}{h} \]
      8. unpow-prod-downN/A

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

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

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

        \[\leadsto \frac{\left(\sqrt{{\left(\frac{h}{\ell}\right)}^{3}} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot \frac{-1}{8}}{h} \]
      12. lift-*.f6455.8

        \[\leadsto \frac{\left(\sqrt{{\left(\frac{h}{\ell}\right)}^{3}} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot -0.125}{h} \]
    8. Applied rewrites64.8%

      \[\leadsto \frac{\left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot -0.125}{h} \]

    if -1.00000000000000002e-221 < (*.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)))) < 3.9999999999999999e-200

    1. Initial program 46.3%

      \[\left({\left(\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 d around inf

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

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

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

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
      4. inv-powN/A

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

        \[\leadsto \sqrt{{\left(h \cdot \ell\right)}^{-1}} \cdot d \]
      6. *-commutativeN/A

        \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
      7. lower-*.f6448.7

        \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
    4. Applied rewrites48.7%

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

        \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
      2. lift-pow.f64N/A

        \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
      3. *-commutativeN/A

        \[\leadsto \sqrt{{\left(h \cdot \ell\right)}^{-1}} \cdot d \]
      4. inv-powN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
      5. associate-/r*N/A

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

        \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d \]
      7. inv-powN/A

        \[\leadsto \sqrt{\frac{{h}^{-1}}{\ell}} \cdot d \]
      8. lower-pow.f6449.2

        \[\leadsto \sqrt{\frac{{h}^{-1}}{\ell}} \cdot d \]
    6. Applied rewrites49.2%

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

    if 3.9999999999999999e-200 < (*.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.9999999999999999e214

    1. Initial program 98.9%

      \[\left({\left(\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 d around inf

      \[\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 \color{blue}{1} \]
    3. Step-by-step derivation
      1. Applied rewrites98.1%

        \[\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 \color{blue}{1} \]
      2. 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 1 \]
        2. lift-/.f64N/A

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

          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot 1 \]
        4. metadata-evalN/A

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

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

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

          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\frac{1}{2}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}}\right) \cdot 1 \]
        8. metadata-evalN/A

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

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

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

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

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

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

          \[\leadsto \left(\sqrt{\color{blue}{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\frac{1}{2}}\right) \cdot 1 \]
        15. pow1/2N/A

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

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

          \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\color{blue}{\frac{d}{h}}}\right) \cdot 1 \]
      3. Applied rewrites98.1%

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

      if 1.9999999999999999e214 < (*.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 56.3%

        \[\left({\left(\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. 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) \]
        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 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        4. 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{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right) \cdot \frac{h}{\ell}\right) \]
        5. 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 - \left(\frac{1}{2} \cdot {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        6. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{\color{blue}{2 \cdot d}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        7. 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 - \left(\frac{1}{2} \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        8. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
        9. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
        10. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      3. Applied rewrites56.3%

        \[\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{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}}\right) \]
      4. Taylor expanded in h around 0

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

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

        \[\leadsto \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
      7. Step-by-step derivation
        1. *-commutativeN/A

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

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

          \[\leadsto \frac{\sqrt{\frac{h}{\ell}} \cdot d}{h} \]
        4. lift-/.f6473.5

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

        \[\leadsto \frac{\sqrt{\frac{h}{\ell}} \cdot d}{h} \]
    4. Recombined 4 regimes into one program.
    5. Add Preprocessing

    Alternative 4: 70.1% accurate, 0.9× speedup?

    \[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} t_0 := 1 - \frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\\ \mathbf{if}\;d \leq -1.15 \cdot 10^{+157}:\\ \;\;\;\;\left(-1 \cdot d\right) \cdot \sqrt{\frac{{h}^{-1}}{\ell}}\\ \mathbf{elif}\;d \leq -2.55 \cdot 10^{-105}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot t\_0\\ \mathbf{elif}\;d \leq 5.8 \cdot 10^{-241}:\\ \;\;\;\;\frac{\left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot -0.125}{h}\\ \mathbf{else}:\\ \;\;\;\;\left({\left(\ell \cdot h\right)}^{-0.5} \cdot d\right) \cdot t\_0\\ \end{array} \end{array} \]
    NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
    (FPCore (d h l M D)
     :precision binary64
     (let* ((t_0 (- 1.0 (/ (* (* (pow (* (/ M 2.0) (/ D d)) 2.0) 0.5) h) l))))
       (if (<= d -1.15e+157)
         (* (* -1.0 d) (sqrt (/ (pow h -1.0) l)))
         (if (<= d -2.55e-105)
           (* (sqrt (* (/ d l) (/ d h))) t_0)
           (if (<= d 5.8e-241)
             (/ (* (* (pow (/ h l) 1.5) (/ (pow (* D M) 2.0) d)) -0.125) h)
             (* (* (pow (* l h) -0.5) d) t_0))))))
    assert(d < h && h < l && l < M && M < D);
    double code(double d, double h, double l, double M, double D) {
    	double t_0 = 1.0 - (((pow(((M / 2.0) * (D / d)), 2.0) * 0.5) * h) / l);
    	double tmp;
    	if (d <= -1.15e+157) {
    		tmp = (-1.0 * d) * sqrt((pow(h, -1.0) / l));
    	} else if (d <= -2.55e-105) {
    		tmp = sqrt(((d / l) * (d / h))) * t_0;
    	} else if (d <= 5.8e-241) {
    		tmp = ((pow((h / l), 1.5) * (pow((D * M), 2.0) / d)) * -0.125) / h;
    	} else {
    		tmp = (pow((l * h), -0.5) * d) * t_0;
    	}
    	return tmp;
    }
    
    NOTE: d, h, l, M, and D 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, 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
        real(8) :: t_0
        real(8) :: tmp
        t_0 = 1.0d0 - ((((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * 0.5d0) * h) / l)
        if (d <= (-1.15d+157)) then
            tmp = ((-1.0d0) * d) * sqrt(((h ** (-1.0d0)) / l))
        else if (d <= (-2.55d-105)) then
            tmp = sqrt(((d / l) * (d / h))) * t_0
        else if (d <= 5.8d-241) then
            tmp = ((((h / l) ** 1.5d0) * (((d_1 * m) ** 2.0d0) / d)) * (-0.125d0)) / h
        else
            tmp = (((l * h) ** (-0.5d0)) * d) * t_0
        end if
        code = tmp
    end function
    
    assert d < h && h < l && l < M && M < D;
    public static double code(double d, double h, double l, double M, double D) {
    	double t_0 = 1.0 - (((Math.pow(((M / 2.0) * (D / d)), 2.0) * 0.5) * h) / l);
    	double tmp;
    	if (d <= -1.15e+157) {
    		tmp = (-1.0 * d) * Math.sqrt((Math.pow(h, -1.0) / l));
    	} else if (d <= -2.55e-105) {
    		tmp = Math.sqrt(((d / l) * (d / h))) * t_0;
    	} else if (d <= 5.8e-241) {
    		tmp = ((Math.pow((h / l), 1.5) * (Math.pow((D * M), 2.0) / d)) * -0.125) / h;
    	} else {
    		tmp = (Math.pow((l * h), -0.5) * d) * t_0;
    	}
    	return tmp;
    }
    
    [d, h, l, M, D] = sort([d, h, l, M, D])
    def code(d, h, l, M, D):
    	t_0 = 1.0 - (((math.pow(((M / 2.0) * (D / d)), 2.0) * 0.5) * h) / l)
    	tmp = 0
    	if d <= -1.15e+157:
    		tmp = (-1.0 * d) * math.sqrt((math.pow(h, -1.0) / l))
    	elif d <= -2.55e-105:
    		tmp = math.sqrt(((d / l) * (d / h))) * t_0
    	elif d <= 5.8e-241:
    		tmp = ((math.pow((h / l), 1.5) * (math.pow((D * M), 2.0) / d)) * -0.125) / h
    	else:
    		tmp = (math.pow((l * h), -0.5) * d) * t_0
    	return tmp
    
    d, h, l, M, D = sort([d, h, l, M, D])
    function code(d, h, l, M, D)
    	t_0 = Float64(1.0 - Float64(Float64(Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * 0.5) * h) / l))
    	tmp = 0.0
    	if (d <= -1.15e+157)
    		tmp = Float64(Float64(-1.0 * d) * sqrt(Float64((h ^ -1.0) / l)));
    	elseif (d <= -2.55e-105)
    		tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * t_0);
    	elseif (d <= 5.8e-241)
    		tmp = Float64(Float64(Float64((Float64(h / l) ^ 1.5) * Float64((Float64(D * M) ^ 2.0) / d)) * -0.125) / h);
    	else
    		tmp = Float64(Float64((Float64(l * h) ^ -0.5) * d) * t_0);
    	end
    	return tmp
    end
    
    d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
    function tmp_2 = code(d, h, l, M, D)
    	t_0 = 1.0 - ((((((M / 2.0) * (D / d)) ^ 2.0) * 0.5) * h) / l);
    	tmp = 0.0;
    	if (d <= -1.15e+157)
    		tmp = (-1.0 * d) * sqrt(((h ^ -1.0) / l));
    	elseif (d <= -2.55e-105)
    		tmp = sqrt(((d / l) * (d / h))) * t_0;
    	elseif (d <= 5.8e-241)
    		tmp = ((((h / l) ^ 1.5) * (((D * M) ^ 2.0) / d)) * -0.125) / h;
    	else
    		tmp = (((l * h) ^ -0.5) * d) * t_0;
    	end
    	tmp_2 = tmp;
    end
    
    NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
    code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 - N[(N[(N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.15e+157], N[(N[(-1.0 * d), $MachinePrecision] * N[Sqrt[N[(N[Power[h, -1.0], $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2.55e-105], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[d, 5.8e-241], N[(N[(N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] * N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision] * d), $MachinePrecision] * t$95$0), $MachinePrecision]]]]]
    
    \begin{array}{l}
    [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
    \\
    \begin{array}{l}
    t_0 := 1 - \frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\\
    \mathbf{if}\;d \leq -1.15 \cdot 10^{+157}:\\
    \;\;\;\;\left(-1 \cdot d\right) \cdot \sqrt{\frac{{h}^{-1}}{\ell}}\\
    
    \mathbf{elif}\;d \leq -2.55 \cdot 10^{-105}:\\
    \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot t\_0\\
    
    \mathbf{elif}\;d \leq 5.8 \cdot 10^{-241}:\\
    \;\;\;\;\frac{\left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot -0.125}{h}\\
    
    \mathbf{else}:\\
    \;\;\;\;\left({\left(\ell \cdot h\right)}^{-0.5} \cdot d\right) \cdot t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if d < -1.15000000000000002e157

      1. Initial program 68.7%

        \[\left({\left(\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 l around -inf

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(-1 \cdot d\right) \cdot \sqrt{{\left(h \cdot \ell\right)}^{-1}} \]
        10. *-commutativeN/A

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

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

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

          \[\leadsto \left(-1 \cdot d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}} \]
        2. lift-pow.f64N/A

          \[\leadsto \left(-1 \cdot d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}} \]
        3. *-commutativeN/A

          \[\leadsto \left(-1 \cdot d\right) \cdot \sqrt{{\left(h \cdot \ell\right)}^{-1}} \]
        4. inv-powN/A

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

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

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

          \[\leadsto \left(-1 \cdot d\right) \cdot \sqrt{\frac{{h}^{-1}}{\ell}} \]
        8. lower-pow.f6471.0

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

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

      if -1.15000000000000002e157 < d < -2.55000000000000004e-105

      1. Initial program 78.9%

        \[\left({\left(\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. 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) \]
        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 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        4. 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{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right) \cdot \frac{h}{\ell}\right) \]
        5. 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 - \left(\frac{1}{2} \cdot {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        6. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{\color{blue}{2 \cdot d}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        7. 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 - \left(\frac{1}{2} \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        8. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
        9. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
        10. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      3. Applied rewrites80.7%

        \[\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{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}}\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 - \frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
        2. lift-/.f64N/A

          \[\leadsto \left({\color{blue}{\left(\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{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
        3. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell}} \cdot \frac{d}{h}} \cdot \left(1 - \frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
        17. lift-/.f6470.0

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

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

      if -2.55000000000000004e-105 < d < 5.7999999999999998e-241

      1. Initial program 44.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 \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. 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) \]
        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 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        4. 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{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right) \cdot \frac{h}{\ell}\right) \]
        5. 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 - \left(\frac{1}{2} \cdot {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        6. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{\color{blue}{2 \cdot d}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        7. 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 - \left(\frac{1}{2} \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        8. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
        9. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
        10. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      3. Applied rewrites43.4%

        \[\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{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}}\right) \]
      4. Taylor expanded in h around 0

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

        \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\sqrt{\frac{h}{\ell}}, d, \left(\sqrt{{\left(\frac{h}{\ell}\right)}^{3}} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot -0.125\right)}{h}} \]
      6. Taylor expanded in d around 0

        \[\leadsto \frac{\frac{-1}{8} \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{{h}^{3}}{{\ell}^{3}}}\right)}{h} \]
      7. Step-by-step derivation
        1. *-commutativeN/A

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

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

          \[\leadsto \frac{\left(\sqrt{\frac{{h}^{3}}{{\ell}^{3}}} \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right) \cdot \frac{-1}{8}}{h} \]
        4. cube-divN/A

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

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

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

          \[\leadsto \frac{\left(\sqrt{{\left(\frac{h}{\ell}\right)}^{3}} \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right) \cdot \frac{-1}{8}}{h} \]
        8. unpow-prod-downN/A

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

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

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

          \[\leadsto \frac{\left(\sqrt{{\left(\frac{h}{\ell}\right)}^{3}} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot \frac{-1}{8}}{h} \]
        12. lift-*.f6447.6

          \[\leadsto \frac{\left(\sqrt{{\left(\frac{h}{\ell}\right)}^{3}} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot -0.125}{h} \]
      8. Applied rewrites56.4%

        \[\leadsto \frac{\left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot -0.125}{h} \]

      if 5.7999999999999998e-241 < d

      1. Initial program 70.7%

        \[\left({\left(\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. 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) \]
        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 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        4. 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{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right) \cdot \frac{h}{\ell}\right) \]
        5. 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 - \left(\frac{1}{2} \cdot {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        6. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{\color{blue}{2 \cdot d}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        7. 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 - \left(\frac{1}{2} \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        8. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
        9. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
        10. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
      3. Applied rewrites71.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}{\frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}}\right) \]
      4. Taylor expanded in d around 0

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left({\left(\ell \cdot h\right)}^{\left(\frac{-1}{2}\right)} \cdot d\right) \cdot \left(1 - \frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
        13. metadata-eval76.3

          \[\leadsto \left({\left(\ell \cdot h\right)}^{-0.5} \cdot d\right) \cdot \left(1 - \frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right) \]
      6. Applied rewrites76.3%

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

    Alternative 5: 54.0% accurate, 1.1× speedup?

    \[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} t_0 := \frac{{\left(D \cdot M\right)}^{2}}{d}\\ t_1 := \sqrt{\frac{h}{{\ell}^{3}}}\\ t_2 := \sqrt{\frac{{h}^{-1}}{\ell}}\\ \mathbf{if}\;d \leq -5.8 \cdot 10^{+152}:\\ \;\;\;\;\left(-1 \cdot d\right) \cdot t\_2\\ \mathbf{elif}\;d \leq -1.9 \cdot 10^{-47}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\ \mathbf{elif}\;d \leq -2.6 \cdot 10^{-302}:\\ \;\;\;\;\left(0.125 \cdot t\_0\right) \cdot t\_1\\ \mathbf{elif}\;d \leq 4.1 \cdot 10^{-85}:\\ \;\;\;\;\left(-0.125 \cdot t\_0\right) \cdot t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2 \cdot d\\ \end{array} \end{array} \]
    NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
    (FPCore (d h l M D)
     :precision binary64
     (let* ((t_0 (/ (pow (* D M) 2.0) d))
            (t_1 (sqrt (/ h (pow l 3.0))))
            (t_2 (sqrt (/ (pow h -1.0) l))))
       (if (<= d -5.8e+152)
         (* (* -1.0 d) t_2)
         (if (<= d -1.9e-47)
           (* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
           (if (<= d -2.6e-302)
             (* (* 0.125 t_0) t_1)
             (if (<= d 4.1e-85) (* (* -0.125 t_0) t_1) (* t_2 d)))))))
    assert(d < h && h < l && l < M && M < D);
    double code(double d, double h, double l, double M, double D) {
    	double t_0 = pow((D * M), 2.0) / d;
    	double t_1 = sqrt((h / pow(l, 3.0)));
    	double t_2 = sqrt((pow(h, -1.0) / l));
    	double tmp;
    	if (d <= -5.8e+152) {
    		tmp = (-1.0 * d) * t_2;
    	} else if (d <= -1.9e-47) {
    		tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
    	} else if (d <= -2.6e-302) {
    		tmp = (0.125 * t_0) * t_1;
    	} else if (d <= 4.1e-85) {
    		tmp = (-0.125 * t_0) * t_1;
    	} else {
    		tmp = t_2 * d;
    	}
    	return tmp;
    }
    
    NOTE: d, h, l, M, and D 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, 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
        real(8) :: t_0
        real(8) :: t_1
        real(8) :: t_2
        real(8) :: tmp
        t_0 = ((d_1 * m) ** 2.0d0) / d
        t_1 = sqrt((h / (l ** 3.0d0)))
        t_2 = sqrt(((h ** (-1.0d0)) / l))
        if (d <= (-5.8d+152)) then
            tmp = ((-1.0d0) * d) * t_2
        else if (d <= (-1.9d-47)) then
            tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
        else if (d <= (-2.6d-302)) then
            tmp = (0.125d0 * t_0) * t_1
        else if (d <= 4.1d-85) then
            tmp = ((-0.125d0) * t_0) * t_1
        else
            tmp = t_2 * d
        end if
        code = tmp
    end function
    
    assert d < h && h < l && l < M && M < D;
    public static double code(double d, double h, double l, double M, double D) {
    	double t_0 = Math.pow((D * M), 2.0) / d;
    	double t_1 = Math.sqrt((h / Math.pow(l, 3.0)));
    	double t_2 = Math.sqrt((Math.pow(h, -1.0) / l));
    	double tmp;
    	if (d <= -5.8e+152) {
    		tmp = (-1.0 * d) * t_2;
    	} else if (d <= -1.9e-47) {
    		tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
    	} else if (d <= -2.6e-302) {
    		tmp = (0.125 * t_0) * t_1;
    	} else if (d <= 4.1e-85) {
    		tmp = (-0.125 * t_0) * t_1;
    	} else {
    		tmp = t_2 * d;
    	}
    	return tmp;
    }
    
    [d, h, l, M, D] = sort([d, h, l, M, D])
    def code(d, h, l, M, D):
    	t_0 = math.pow((D * M), 2.0) / d
    	t_1 = math.sqrt((h / math.pow(l, 3.0)))
    	t_2 = math.sqrt((math.pow(h, -1.0) / l))
    	tmp = 0
    	if d <= -5.8e+152:
    		tmp = (-1.0 * d) * t_2
    	elif d <= -1.9e-47:
    		tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0
    	elif d <= -2.6e-302:
    		tmp = (0.125 * t_0) * t_1
    	elif d <= 4.1e-85:
    		tmp = (-0.125 * t_0) * t_1
    	else:
    		tmp = t_2 * d
    	return tmp
    
    d, h, l, M, D = sort([d, h, l, M, D])
    function code(d, h, l, M, D)
    	t_0 = Float64((Float64(D * M) ^ 2.0) / d)
    	t_1 = sqrt(Float64(h / (l ^ 3.0)))
    	t_2 = sqrt(Float64((h ^ -1.0) / l))
    	tmp = 0.0
    	if (d <= -5.8e+152)
    		tmp = Float64(Float64(-1.0 * d) * t_2);
    	elseif (d <= -1.9e-47)
    		tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0);
    	elseif (d <= -2.6e-302)
    		tmp = Float64(Float64(0.125 * t_0) * t_1);
    	elseif (d <= 4.1e-85)
    		tmp = Float64(Float64(-0.125 * t_0) * t_1);
    	else
    		tmp = Float64(t_2 * d);
    	end
    	return tmp
    end
    
    d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
    function tmp_2 = code(d, h, l, M, D)
    	t_0 = ((D * M) ^ 2.0) / d;
    	t_1 = sqrt((h / (l ^ 3.0)));
    	t_2 = sqrt(((h ^ -1.0) / l));
    	tmp = 0.0;
    	if (d <= -5.8e+152)
    		tmp = (-1.0 * d) * t_2;
    	elseif (d <= -1.9e-47)
    		tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
    	elseif (d <= -2.6e-302)
    		tmp = (0.125 * t_0) * t_1;
    	elseif (d <= 4.1e-85)
    		tmp = (-0.125 * t_0) * t_1;
    	else
    		tmp = t_2 * d;
    	end
    	tmp_2 = tmp;
    end
    
    NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
    code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(N[Power[h, -1.0], $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -5.8e+152], N[(N[(-1.0 * d), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[d, -1.9e-47], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[d, -2.6e-302], N[(N[(0.125 * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[d, 4.1e-85], N[(N[(-0.125 * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$2 * d), $MachinePrecision]]]]]]]]
    
    \begin{array}{l}
    [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
    \\
    \begin{array}{l}
    t_0 := \frac{{\left(D \cdot M\right)}^{2}}{d}\\
    t_1 := \sqrt{\frac{h}{{\ell}^{3}}}\\
    t_2 := \sqrt{\frac{{h}^{-1}}{\ell}}\\
    \mathbf{if}\;d \leq -5.8 \cdot 10^{+152}:\\
    \;\;\;\;\left(-1 \cdot d\right) \cdot t\_2\\
    
    \mathbf{elif}\;d \leq -1.9 \cdot 10^{-47}:\\
    \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
    
    \mathbf{elif}\;d \leq -2.6 \cdot 10^{-302}:\\
    \;\;\;\;\left(0.125 \cdot t\_0\right) \cdot t\_1\\
    
    \mathbf{elif}\;d \leq 4.1 \cdot 10^{-85}:\\
    \;\;\;\;\left(-0.125 \cdot t\_0\right) \cdot t\_1\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_2 \cdot d\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 5 regimes
    2. if d < -5.7999999999999997e152

      1. Initial program 68.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 l around -inf

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(-1 \cdot d\right) \cdot \sqrt{{\left(h \cdot \ell\right)}^{-1}} \]
        10. *-commutativeN/A

          \[\leadsto \left(-1 \cdot d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}} \]
        11. lower-*.f6471.0

          \[\leadsto \left(-1 \cdot d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}} \]
      4. Applied rewrites71.0%

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

          \[\leadsto \left(-1 \cdot d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}} \]
        2. lift-pow.f64N/A

          \[\leadsto \left(-1 \cdot d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}} \]
        3. *-commutativeN/A

          \[\leadsto \left(-1 \cdot d\right) \cdot \sqrt{{\left(h \cdot \ell\right)}^{-1}} \]
        4. inv-powN/A

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

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

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

          \[\leadsto \left(-1 \cdot d\right) \cdot \sqrt{\frac{{h}^{-1}}{\ell}} \]
        8. lower-pow.f6471.5

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

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

      if -5.7999999999999997e152 < d < -1.90000000000000007e-47

      1. Initial program 81.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 d around inf

        \[\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 \color{blue}{1} \]
      3. Step-by-step derivation
        1. Applied rewrites46.9%

          \[\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 \color{blue}{1} \]
        2. 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 1 \]
          2. lift-/.f64N/A

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

            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot 1 \]
          4. metadata-evalN/A

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

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

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

            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\frac{1}{2}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}}\right) \cdot 1 \]
          8. metadata-evalN/A

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

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

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

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

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

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

            \[\leadsto \left(\sqrt{\color{blue}{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\frac{1}{2}}\right) \cdot 1 \]
          15. pow1/2N/A

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

            \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}}\right) \cdot 1 \]
          17. lift-/.f6446.9

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

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

        if -1.90000000000000007e-47 < d < -2.60000000000000011e-302

        1. Initial program 53.3%

          \[\left({\left(\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 -inf

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

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

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

          \[\leadsto \color{blue}{\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2} \cdot -1}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}} \]
        5. Taylor expanded in d around 0

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

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

            \[\leadsto \left(\frac{1}{8} \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{\color{blue}{3}}}} \]
          3. unpow-prod-downN/A

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

            \[\leadsto \left(\frac{1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}} \]
          5. lift-*.f6444.0

            \[\leadsto \left(0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}} \]
        7. Applied rewrites44.0%

          \[\leadsto \left(0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot \sqrt{\color{blue}{\frac{h}{{\ell}^{3}}}} \]

        if -2.60000000000000011e-302 < d < 4.09999999999999994e-85

        1. Initial program 49.3%

          \[\left({\left(\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 d around 0

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(\frac{-1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}} \]
          12. lower-pow.f6449.0

            \[\leadsto \left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}} \]
        4. Applied rewrites49.0%

          \[\leadsto \color{blue}{\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}} \]

        if 4.09999999999999994e-85 < d

        1. Initial program 76.5%

          \[\left({\left(\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 d around inf

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

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

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

            \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
          4. inv-powN/A

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

            \[\leadsto \sqrt{{\left(h \cdot \ell\right)}^{-1}} \cdot d \]
          6. *-commutativeN/A

            \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
          7. lower-*.f6452.0

            \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
        4. Applied rewrites52.0%

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

            \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
          2. lift-pow.f64N/A

            \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
          3. *-commutativeN/A

            \[\leadsto \sqrt{{\left(h \cdot \ell\right)}^{-1}} \cdot d \]
          4. inv-powN/A

            \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
          5. associate-/r*N/A

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

            \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d \]
          7. inv-powN/A

            \[\leadsto \sqrt{\frac{{h}^{-1}}{\ell}} \cdot d \]
          8. lower-pow.f6452.3

            \[\leadsto \sqrt{\frac{{h}^{-1}}{\ell}} \cdot d \]
        6. Applied rewrites52.3%

          \[\leadsto \sqrt{\frac{{h}^{-1}}{\ell}} \cdot d \]
      4. Recombined 5 regimes into one program.
      5. Add Preprocessing

      Alternative 6: 51.6% accurate, 0.2× speedup?

      \[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \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 \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_1 := \sqrt{\frac{h}{\ell}}\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{+36}:\\ \;\;\;\;\left(0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{-200}:\\ \;\;\;\;{\left(\ell \cdot h\right)}^{-0.5} \cdot d\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+214}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\ \mathbf{elif}\;t\_0 \leq \infty:\\ \;\;\;\;\frac{t\_1 \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-d\right) \cdot t\_1}{h}\\ \end{array} \end{array} \]
      NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
      (FPCore (d h l M D)
       :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 D) (* 2.0 d)) 2.0)) (/ h l)))))
              (t_1 (sqrt (/ h l))))
         (if (<= t_0 -1e+36)
           (* (* 0.125 (/ (pow (* D M) 2.0) d)) (sqrt (/ h (pow l 3.0))))
           (if (<= t_0 4e-200)
             (* (pow (* l h) -0.5) d)
             (if (<= t_0 2e+214)
               (* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
               (if (<= t_0 INFINITY) (/ (* t_1 d) h) (/ (* (- d) t_1) h)))))))
      assert(d < h && h < l && l < M && M < D);
      double code(double d, double h, double l, double M, double D) {
      	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 * D) / (2.0 * d)), 2.0)) * (h / l)));
      	double t_1 = sqrt((h / l));
      	double tmp;
      	if (t_0 <= -1e+36) {
      		tmp = (0.125 * (pow((D * M), 2.0) / d)) * sqrt((h / pow(l, 3.0)));
      	} else if (t_0 <= 4e-200) {
      		tmp = pow((l * h), -0.5) * d;
      	} else if (t_0 <= 2e+214) {
      		tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
      	} else if (t_0 <= ((double) INFINITY)) {
      		tmp = (t_1 * d) / h;
      	} else {
      		tmp = (-d * t_1) / h;
      	}
      	return tmp;
      }
      
      assert d < h && h < l && l < M && M < D;
      public static double code(double d, double h, double l, double M, double D) {
      	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 * D) / (2.0 * d)), 2.0)) * (h / l)));
      	double t_1 = Math.sqrt((h / l));
      	double tmp;
      	if (t_0 <= -1e+36) {
      		tmp = (0.125 * (Math.pow((D * M), 2.0) / d)) * Math.sqrt((h / Math.pow(l, 3.0)));
      	} else if (t_0 <= 4e-200) {
      		tmp = Math.pow((l * h), -0.5) * d;
      	} else if (t_0 <= 2e+214) {
      		tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
      	} else if (t_0 <= Double.POSITIVE_INFINITY) {
      		tmp = (t_1 * d) / h;
      	} else {
      		tmp = (-d * t_1) / h;
      	}
      	return tmp;
      }
      
      [d, h, l, M, D] = sort([d, h, l, M, D])
      def code(d, h, l, M, D):
      	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 * D) / (2.0 * d)), 2.0)) * (h / l)))
      	t_1 = math.sqrt((h / l))
      	tmp = 0
      	if t_0 <= -1e+36:
      		tmp = (0.125 * (math.pow((D * M), 2.0) / d)) * math.sqrt((h / math.pow(l, 3.0)))
      	elif t_0 <= 4e-200:
      		tmp = math.pow((l * h), -0.5) * d
      	elif t_0 <= 2e+214:
      		tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0
      	elif t_0 <= math.inf:
      		tmp = (t_1 * d) / h
      	else:
      		tmp = (-d * t_1) / h
      	return tmp
      
      d, h, l, M, D = sort([d, h, l, M, D])
      function code(d, h, l, M, D)
      	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 * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
      	t_1 = sqrt(Float64(h / l))
      	tmp = 0.0
      	if (t_0 <= -1e+36)
      		tmp = Float64(Float64(0.125 * Float64((Float64(D * M) ^ 2.0) / d)) * sqrt(Float64(h / (l ^ 3.0))));
      	elseif (t_0 <= 4e-200)
      		tmp = Float64((Float64(l * h) ^ -0.5) * d);
      	elseif (t_0 <= 2e+214)
      		tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0);
      	elseif (t_0 <= Inf)
      		tmp = Float64(Float64(t_1 * d) / h);
      	else
      		tmp = Float64(Float64(Float64(-d) * t_1) / h);
      	end
      	return tmp
      end
      
      d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
      function tmp_2 = code(d, h, l, M, D)
      	t_0 = (((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)));
      	t_1 = sqrt((h / l));
      	tmp = 0.0;
      	if (t_0 <= -1e+36)
      		tmp = (0.125 * (((D * M) ^ 2.0) / d)) * sqrt((h / (l ^ 3.0)));
      	elseif (t_0 <= 4e-200)
      		tmp = ((l * h) ^ -0.5) * d;
      	elseif (t_0 <= 2e+214)
      		tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
      	elseif (t_0 <= Inf)
      		tmp = (t_1 * d) / h;
      	else
      		tmp = (-d * t_1) / h;
      	end
      	tmp_2 = tmp;
      end
      
      NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
      code[d_, h_, l_, M_, D_] := 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 * D), $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[(h / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -1e+36], N[(N[(0.125 * N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e-200], N[(N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision] * d), $MachinePrecision], If[LessEqual[t$95$0, 2e+214], 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 * d), $MachinePrecision] / h), $MachinePrecision], N[(N[((-d) * t$95$1), $MachinePrecision] / h), $MachinePrecision]]]]]]]
      
      \begin{array}{l}
      [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
      \\
      \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 \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
      t_1 := \sqrt{\frac{h}{\ell}}\\
      \mathbf{if}\;t\_0 \leq -1 \cdot 10^{+36}:\\
      \;\;\;\;\left(0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}\\
      
      \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{-200}:\\
      \;\;\;\;{\left(\ell \cdot h\right)}^{-0.5} \cdot d\\
      
      \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+214}:\\
      \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
      
      \mathbf{elif}\;t\_0 \leq \infty:\\
      \;\;\;\;\frac{t\_1 \cdot d}{h}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\left(-d\right) \cdot t\_1}{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)))) < -1.00000000000000004e36

        1. Initial program 85.5%

          \[\left({\left(\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 -inf

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

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

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

          \[\leadsto \color{blue}{\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2} \cdot -1}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}} \]
        5. Taylor expanded in d around 0

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

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

            \[\leadsto \left(\frac{1}{8} \cdot \frac{{D}^{2} \cdot {M}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{\color{blue}{3}}}} \]
          3. unpow-prod-downN/A

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

            \[\leadsto \left(\frac{1}{8} \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}} \]
          5. lift-*.f6436.2

            \[\leadsto \left(0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}} \]
        7. Applied rewrites36.2%

          \[\leadsto \left(0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}\right) \cdot \sqrt{\color{blue}{\frac{h}{{\ell}^{3}}}} \]

        if -1.00000000000000004e36 < (*.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)))) < 3.9999999999999999e-200

        1. Initial program 59.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 d around inf

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

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

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

            \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
          4. inv-powN/A

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

            \[\leadsto \sqrt{{\left(h \cdot \ell\right)}^{-1}} \cdot d \]
          6. *-commutativeN/A

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

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

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

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

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

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

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

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

            \[\leadsto {\left(\ell \cdot h\right)}^{\left(\frac{-1}{2}\right)} \cdot d \]
          7. metadata-eval37.5

            \[\leadsto {\left(\ell \cdot h\right)}^{-0.5} \cdot d \]
        6. Applied rewrites37.5%

          \[\leadsto {\left(\ell \cdot h\right)}^{-0.5} \cdot d \]

        if 3.9999999999999999e-200 < (*.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.9999999999999999e214

        1. Initial program 98.9%

          \[\left({\left(\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 d around inf

          \[\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 \color{blue}{1} \]
        3. Step-by-step derivation
          1. Applied rewrites98.1%

            \[\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 \color{blue}{1} \]
          2. 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 1 \]
            2. lift-/.f64N/A

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

              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot 1 \]
            4. metadata-evalN/A

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

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

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

              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\frac{1}{2}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}}\right) \cdot 1 \]
            8. metadata-evalN/A

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

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

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

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

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

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

              \[\leadsto \left(\sqrt{\color{blue}{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\frac{1}{2}}\right) \cdot 1 \]
            15. pow1/2N/A

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

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

              \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\color{blue}{\frac{d}{h}}}\right) \cdot 1 \]
          3. Applied rewrites98.1%

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

          if 1.9999999999999999e214 < (*.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 56.3%

            \[\left({\left(\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. 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) \]
            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 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
            4. 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{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right) \cdot \frac{h}{\ell}\right) \]
            5. 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 - \left(\frac{1}{2} \cdot {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
            6. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{\color{blue}{2 \cdot d}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
            7. 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 - \left(\frac{1}{2} \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot \frac{h}{\ell}\right) \]
            8. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
            9. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
            10. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
          3. Applied rewrites56.3%

            \[\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{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}}\right) \]
          4. Taylor expanded in h around 0

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

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

            \[\leadsto \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
          7. Step-by-step derivation
            1. *-commutativeN/A

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

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

              \[\leadsto \frac{\sqrt{\frac{h}{\ell}} \cdot d}{h} \]
            4. lift-/.f6473.5

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

            \[\leadsto \frac{\sqrt{\frac{h}{\ell}} \cdot d}{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 0.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 \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. 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) \]
            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 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
            4. 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{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right) \cdot \frac{h}{\ell}\right) \]
            5. 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 - \left(\frac{1}{2} \cdot {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
            6. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{\color{blue}{2 \cdot d}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
            7. 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 - \left(\frac{1}{2} \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot \frac{h}{\ell}\right) \]
            8. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
            9. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
            10. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
          3. Applied rewrites11.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}{\frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}}\right) \]
          4. Taylor expanded in h around 0

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

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

            \[\leadsto \frac{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
          7. Step-by-step derivation
            1. sqrt-pow2N/A

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

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

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

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

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

              \[\leadsto \frac{\left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
            7. lift-neg.f64N/A

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

              \[\leadsto \frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
            9. lift-/.f6416.8

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

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

        Alternative 7: 43.9% accurate, 1.7× speedup?

        \[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq -6.5 \cdot 10^{+140}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\ \mathbf{elif}\;h \leq -1.75 \cdot 10^{-286}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{elif}\;h \leq 1.65 \cdot 10^{+190}:\\ \;\;\;\;\sqrt{\frac{{h}^{-1}}{\ell}} \cdot d\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \end{array} \end{array} \]
        NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
        (FPCore (d h l M D)
         :precision binary64
         (if (<= h -6.5e+140)
           (* (* (sqrt (/ d l)) (sqrt (/ d h))) 1.0)
           (if (<= h -1.75e-286)
             (* (- d) (sqrt (pow (* l h) -1.0)))
             (if (<= h 1.65e+190)
               (* (sqrt (/ (pow h -1.0) l)) d)
               (/ (* (- d) (sqrt (/ h l))) h)))))
        assert(d < h && h < l && l < M && M < D);
        double code(double d, double h, double l, double M, double D) {
        	double tmp;
        	if (h <= -6.5e+140) {
        		tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
        	} else if (h <= -1.75e-286) {
        		tmp = -d * sqrt(pow((l * h), -1.0));
        	} else if (h <= 1.65e+190) {
        		tmp = sqrt((pow(h, -1.0) / l)) * d;
        	} else {
        		tmp = (-d * sqrt((h / l))) / h;
        	}
        	return tmp;
        }
        
        NOTE: d, h, l, M, and D 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, 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
            real(8) :: tmp
            if (h <= (-6.5d+140)) then
                tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0d0
            else if (h <= (-1.75d-286)) then
                tmp = -d * sqrt(((l * h) ** (-1.0d0)))
            else if (h <= 1.65d+190) then
                tmp = sqrt(((h ** (-1.0d0)) / l)) * d
            else
                tmp = (-d * sqrt((h / l))) / h
            end if
            code = tmp
        end function
        
        assert d < h && h < l && l < M && M < D;
        public static double code(double d, double h, double l, double M, double D) {
        	double tmp;
        	if (h <= -6.5e+140) {
        		tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * 1.0;
        	} else if (h <= -1.75e-286) {
        		tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
        	} else if (h <= 1.65e+190) {
        		tmp = Math.sqrt((Math.pow(h, -1.0) / l)) * d;
        	} else {
        		tmp = (-d * Math.sqrt((h / l))) / h;
        	}
        	return tmp;
        }
        
        [d, h, l, M, D] = sort([d, h, l, M, D])
        def code(d, h, l, M, D):
        	tmp = 0
        	if h <= -6.5e+140:
        		tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * 1.0
        	elif h <= -1.75e-286:
        		tmp = -d * math.sqrt(math.pow((l * h), -1.0))
        	elif h <= 1.65e+190:
        		tmp = math.sqrt((math.pow(h, -1.0) / l)) * d
        	else:
        		tmp = (-d * math.sqrt((h / l))) / h
        	return tmp
        
        d, h, l, M, D = sort([d, h, l, M, D])
        function code(d, h, l, M, D)
        	tmp = 0.0
        	if (h <= -6.5e+140)
        		tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * 1.0);
        	elseif (h <= -1.75e-286)
        		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
        	elseif (h <= 1.65e+190)
        		tmp = Float64(sqrt(Float64((h ^ -1.0) / l)) * d);
        	else
        		tmp = Float64(Float64(Float64(-d) * sqrt(Float64(h / l))) / h);
        	end
        	return tmp
        end
        
        d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
        function tmp_2 = code(d, h, l, M, D)
        	tmp = 0.0;
        	if (h <= -6.5e+140)
        		tmp = (sqrt((d / l)) * sqrt((d / h))) * 1.0;
        	elseif (h <= -1.75e-286)
        		tmp = -d * sqrt(((l * h) ^ -1.0));
        	elseif (h <= 1.65e+190)
        		tmp = sqrt(((h ^ -1.0) / l)) * d;
        	else
        		tmp = (-d * sqrt((h / l))) / h;
        	end
        	tmp_2 = tmp;
        end
        
        NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
        code[d_, h_, l_, M_, D_] := If[LessEqual[h, -6.5e+140], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[h, -1.75e-286], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 1.65e+190], N[(N[Sqrt[N[(N[Power[h, -1.0], $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision], N[(N[((-d) * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]]
        
        \begin{array}{l}
        [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
        \\
        \begin{array}{l}
        \mathbf{if}\;h \leq -6.5 \cdot 10^{+140}:\\
        \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot 1\\
        
        \mathbf{elif}\;h \leq -1.75 \cdot 10^{-286}:\\
        \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
        
        \mathbf{elif}\;h \leq 1.65 \cdot 10^{+190}:\\
        \;\;\;\;\sqrt{\frac{{h}^{-1}}{\ell}} \cdot d\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 4 regimes
        2. if h < -6.4999999999999999e140

          1. Initial program 53.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 \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
          2. Taylor expanded in d around inf

            \[\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 \color{blue}{1} \]
          3. Step-by-step derivation
            1. Applied rewrites31.0%

              \[\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 \color{blue}{1} \]
            2. 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 1 \]
              2. lift-/.f64N/A

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

                \[\leadsto \left({\left(\frac{d}{h}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot 1 \]
              4. metadata-evalN/A

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

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

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

                \[\leadsto \left({\left(\frac{d}{h}\right)}^{\frac{1}{2}} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}}\right) \cdot 1 \]
              8. metadata-evalN/A

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

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

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

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

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

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

                \[\leadsto \left(\sqrt{\color{blue}{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\frac{1}{2}}\right) \cdot 1 \]
              15. pow1/2N/A

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

                \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{h}}}\right) \cdot 1 \]
              17. lift-/.f6431.0

                \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\color{blue}{\frac{d}{h}}}\right) \cdot 1 \]
            3. Applied rewrites31.0%

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

            if -6.4999999999999999e140 < h < -1.74999999999999994e-286

            1. Initial program 71.5%

              \[\left({\left(\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. 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) \]
              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 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              4. 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{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right) \cdot \frac{h}{\ell}\right) \]
              5. 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 - \left(\frac{1}{2} \cdot {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              6. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{\color{blue}{2 \cdot d}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              7. 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 - \left(\frac{1}{2} \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              8. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
              9. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
              10. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
            3. Applied rewrites72.6%

              \[\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{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}}\right) \]
            4. Taylor expanded in l around -inf

              \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
            5. Applied rewrites50.7%

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

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

                \[\leadsto \left(-d\right) \cdot {\left(\ell \cdot h\right)}^{\color{blue}{\frac{-1}{2}}} \]
              3. metadata-evalN/A

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

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

                \[\leadsto \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}} \]
              6. lift-*.f64N/A

                \[\leadsto \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}} \]
              7. lift-sqrt.f6450.5

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

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

            if -1.74999999999999994e-286 < h < 1.65e190

            1. Initial program 70.7%

              \[\left({\left(\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 d around inf

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

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

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

                \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
              4. inv-powN/A

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

                \[\leadsto \sqrt{{\left(h \cdot \ell\right)}^{-1}} \cdot d \]
              6. *-commutativeN/A

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
              7. lower-*.f6445.2

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
            4. Applied rewrites45.2%

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

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
              2. lift-pow.f64N/A

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
              3. *-commutativeN/A

                \[\leadsto \sqrt{{\left(h \cdot \ell\right)}^{-1}} \cdot d \]
              4. inv-powN/A

                \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
              5. associate-/r*N/A

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

                \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d \]
              7. inv-powN/A

                \[\leadsto \sqrt{\frac{{h}^{-1}}{\ell}} \cdot d \]
              8. lower-pow.f6445.5

                \[\leadsto \sqrt{\frac{{h}^{-1}}{\ell}} \cdot d \]
            6. Applied rewrites45.5%

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

            if 1.65e190 < h

            1. Initial program 50.3%

              \[\left({\left(\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. 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) \]
              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 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              4. 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{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right) \cdot \frac{h}{\ell}\right) \]
              5. 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 - \left(\frac{1}{2} \cdot {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              6. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{\color{blue}{2 \cdot d}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              7. 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 - \left(\frac{1}{2} \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              8. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
              9. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
              10. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
            3. Applied rewrites53.5%

              \[\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{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}}\right) \]
            4. Taylor expanded in h around 0

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

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

              \[\leadsto \frac{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
            7. Step-by-step derivation
              1. sqrt-pow2N/A

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

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

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

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

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

                \[\leadsto \frac{\left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
              7. lift-neg.f64N/A

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

                \[\leadsto \frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
              9. lift-/.f6431.0

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

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

          Alternative 8: 43.3% accurate, 2.1× speedup?

          \[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{{h}^{-1}}{\ell}}\\ \mathbf{if}\;h \leq -1.75 \cdot 10^{-286}:\\ \;\;\;\;\left(-1 \cdot d\right) \cdot t\_0\\ \mathbf{elif}\;h \leq 1.65 \cdot 10^{+190}:\\ \;\;\;\;t\_0 \cdot d\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \end{array} \end{array} \]
          NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
          (FPCore (d h l M D)
           :precision binary64
           (let* ((t_0 (sqrt (/ (pow h -1.0) l))))
             (if (<= h -1.75e-286)
               (* (* -1.0 d) t_0)
               (if (<= h 1.65e+190) (* t_0 d) (/ (* (- d) (sqrt (/ h l))) h)))))
          assert(d < h && h < l && l < M && M < D);
          double code(double d, double h, double l, double M, double D) {
          	double t_0 = sqrt((pow(h, -1.0) / l));
          	double tmp;
          	if (h <= -1.75e-286) {
          		tmp = (-1.0 * d) * t_0;
          	} else if (h <= 1.65e+190) {
          		tmp = t_0 * d;
          	} else {
          		tmp = (-d * sqrt((h / l))) / h;
          	}
          	return tmp;
          }
          
          NOTE: d, h, l, M, and D 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, 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
              real(8) :: t_0
              real(8) :: tmp
              t_0 = sqrt(((h ** (-1.0d0)) / l))
              if (h <= (-1.75d-286)) then
                  tmp = ((-1.0d0) * d) * t_0
              else if (h <= 1.65d+190) then
                  tmp = t_0 * d
              else
                  tmp = (-d * sqrt((h / l))) / h
              end if
              code = tmp
          end function
          
          assert d < h && h < l && l < M && M < D;
          public static double code(double d, double h, double l, double M, double D) {
          	double t_0 = Math.sqrt((Math.pow(h, -1.0) / l));
          	double tmp;
          	if (h <= -1.75e-286) {
          		tmp = (-1.0 * d) * t_0;
          	} else if (h <= 1.65e+190) {
          		tmp = t_0 * d;
          	} else {
          		tmp = (-d * Math.sqrt((h / l))) / h;
          	}
          	return tmp;
          }
          
          [d, h, l, M, D] = sort([d, h, l, M, D])
          def code(d, h, l, M, D):
          	t_0 = math.sqrt((math.pow(h, -1.0) / l))
          	tmp = 0
          	if h <= -1.75e-286:
          		tmp = (-1.0 * d) * t_0
          	elif h <= 1.65e+190:
          		tmp = t_0 * d
          	else:
          		tmp = (-d * math.sqrt((h / l))) / h
          	return tmp
          
          d, h, l, M, D = sort([d, h, l, M, D])
          function code(d, h, l, M, D)
          	t_0 = sqrt(Float64((h ^ -1.0) / l))
          	tmp = 0.0
          	if (h <= -1.75e-286)
          		tmp = Float64(Float64(-1.0 * d) * t_0);
          	elseif (h <= 1.65e+190)
          		tmp = Float64(t_0 * d);
          	else
          		tmp = Float64(Float64(Float64(-d) * sqrt(Float64(h / l))) / h);
          	end
          	return tmp
          end
          
          d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
          function tmp_2 = code(d, h, l, M, D)
          	t_0 = sqrt(((h ^ -1.0) / l));
          	tmp = 0.0;
          	if (h <= -1.75e-286)
          		tmp = (-1.0 * d) * t_0;
          	elseif (h <= 1.65e+190)
          		tmp = t_0 * d;
          	else
          		tmp = (-d * sqrt((h / l))) / h;
          	end
          	tmp_2 = tmp;
          end
          
          NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
          code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(N[Power[h, -1.0], $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -1.75e-286], N[(N[(-1.0 * d), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[h, 1.65e+190], N[(t$95$0 * d), $MachinePrecision], N[(N[((-d) * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]]
          
          \begin{array}{l}
          [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
          \\
          \begin{array}{l}
          t_0 := \sqrt{\frac{{h}^{-1}}{\ell}}\\
          \mathbf{if}\;h \leq -1.75 \cdot 10^{-286}:\\
          \;\;\;\;\left(-1 \cdot d\right) \cdot t\_0\\
          
          \mathbf{elif}\;h \leq 1.65 \cdot 10^{+190}:\\
          \;\;\;\;t\_0 \cdot d\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if h < -1.74999999999999994e-286

            1. Initial program 66.3%

              \[\left({\left(\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 l around -inf

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

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

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

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

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

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

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

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

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

                \[\leadsto \left(-1 \cdot d\right) \cdot \sqrt{{\left(h \cdot \ell\right)}^{-1}} \]
              10. *-commutativeN/A

                \[\leadsto \left(-1 \cdot d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}} \]
              11. lower-*.f6443.2

                \[\leadsto \left(-1 \cdot d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}} \]
            4. Applied rewrites43.2%

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

                \[\leadsto \left(-1 \cdot d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}} \]
              2. lift-pow.f64N/A

                \[\leadsto \left(-1 \cdot d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}} \]
              3. *-commutativeN/A

                \[\leadsto \left(-1 \cdot d\right) \cdot \sqrt{{\left(h \cdot \ell\right)}^{-1}} \]
              4. inv-powN/A

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

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

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

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

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

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

            if -1.74999999999999994e-286 < h < 1.65e190

            1. Initial program 70.7%

              \[\left({\left(\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 d around inf

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

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

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

                \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
              4. inv-powN/A

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

                \[\leadsto \sqrt{{\left(h \cdot \ell\right)}^{-1}} \cdot d \]
              6. *-commutativeN/A

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
              7. lower-*.f6445.2

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
            4. Applied rewrites45.2%

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

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
              2. lift-pow.f64N/A

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
              3. *-commutativeN/A

                \[\leadsto \sqrt{{\left(h \cdot \ell\right)}^{-1}} \cdot d \]
              4. inv-powN/A

                \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
              5. associate-/r*N/A

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

                \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d \]
              7. inv-powN/A

                \[\leadsto \sqrt{\frac{{h}^{-1}}{\ell}} \cdot d \]
              8. lower-pow.f6445.5

                \[\leadsto \sqrt{\frac{{h}^{-1}}{\ell}} \cdot d \]
            6. Applied rewrites45.5%

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

            if 1.65e190 < h

            1. Initial program 50.3%

              \[\left({\left(\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. 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) \]
              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 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              4. 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{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right) \cdot \frac{h}{\ell}\right) \]
              5. 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 - \left(\frac{1}{2} \cdot {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              6. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{\color{blue}{2 \cdot d}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              7. 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 - \left(\frac{1}{2} \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              8. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
              9. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
              10. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
            3. Applied rewrites53.5%

              \[\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{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}}\right) \]
            4. Taylor expanded in h around 0

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

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

              \[\leadsto \frac{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
            7. Step-by-step derivation
              1. sqrt-pow2N/A

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

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

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

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

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

                \[\leadsto \frac{\left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
              7. lift-neg.f64N/A

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

                \[\leadsto \frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
              9. lift-/.f6431.0

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

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

          Alternative 9: 43.3% accurate, 2.1× speedup?

          \[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq -1.75 \cdot 10^{-286}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{elif}\;h \leq 1.65 \cdot 10^{+190}:\\ \;\;\;\;\sqrt{\frac{{h}^{-1}}{\ell}} \cdot d\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \end{array} \end{array} \]
          NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
          (FPCore (d h l M D)
           :precision binary64
           (if (<= h -1.75e-286)
             (* (- d) (sqrt (pow (* l h) -1.0)))
             (if (<= h 1.65e+190)
               (* (sqrt (/ (pow h -1.0) l)) d)
               (/ (* (- d) (sqrt (/ h l))) h))))
          assert(d < h && h < l && l < M && M < D);
          double code(double d, double h, double l, double M, double D) {
          	double tmp;
          	if (h <= -1.75e-286) {
          		tmp = -d * sqrt(pow((l * h), -1.0));
          	} else if (h <= 1.65e+190) {
          		tmp = sqrt((pow(h, -1.0) / l)) * d;
          	} else {
          		tmp = (-d * sqrt((h / l))) / h;
          	}
          	return tmp;
          }
          
          NOTE: d, h, l, M, and D 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, 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
              real(8) :: tmp
              if (h <= (-1.75d-286)) then
                  tmp = -d * sqrt(((l * h) ** (-1.0d0)))
              else if (h <= 1.65d+190) then
                  tmp = sqrt(((h ** (-1.0d0)) / l)) * d
              else
                  tmp = (-d * sqrt((h / l))) / h
              end if
              code = tmp
          end function
          
          assert d < h && h < l && l < M && M < D;
          public static double code(double d, double h, double l, double M, double D) {
          	double tmp;
          	if (h <= -1.75e-286) {
          		tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
          	} else if (h <= 1.65e+190) {
          		tmp = Math.sqrt((Math.pow(h, -1.0) / l)) * d;
          	} else {
          		tmp = (-d * Math.sqrt((h / l))) / h;
          	}
          	return tmp;
          }
          
          [d, h, l, M, D] = sort([d, h, l, M, D])
          def code(d, h, l, M, D):
          	tmp = 0
          	if h <= -1.75e-286:
          		tmp = -d * math.sqrt(math.pow((l * h), -1.0))
          	elif h <= 1.65e+190:
          		tmp = math.sqrt((math.pow(h, -1.0) / l)) * d
          	else:
          		tmp = (-d * math.sqrt((h / l))) / h
          	return tmp
          
          d, h, l, M, D = sort([d, h, l, M, D])
          function code(d, h, l, M, D)
          	tmp = 0.0
          	if (h <= -1.75e-286)
          		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
          	elseif (h <= 1.65e+190)
          		tmp = Float64(sqrt(Float64((h ^ -1.0) / l)) * d);
          	else
          		tmp = Float64(Float64(Float64(-d) * sqrt(Float64(h / l))) / h);
          	end
          	return tmp
          end
          
          d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
          function tmp_2 = code(d, h, l, M, D)
          	tmp = 0.0;
          	if (h <= -1.75e-286)
          		tmp = -d * sqrt(((l * h) ^ -1.0));
          	elseif (h <= 1.65e+190)
          		tmp = sqrt(((h ^ -1.0) / l)) * d;
          	else
          		tmp = (-d * sqrt((h / l))) / h;
          	end
          	tmp_2 = tmp;
          end
          
          NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
          code[d_, h_, l_, M_, D_] := If[LessEqual[h, -1.75e-286], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 1.65e+190], N[(N[Sqrt[N[(N[Power[h, -1.0], $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision], N[(N[((-d) * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]
          
          \begin{array}{l}
          [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
          \\
          \begin{array}{l}
          \mathbf{if}\;h \leq -1.75 \cdot 10^{-286}:\\
          \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
          
          \mathbf{elif}\;h \leq 1.65 \cdot 10^{+190}:\\
          \;\;\;\;\sqrt{\frac{{h}^{-1}}{\ell}} \cdot d\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if h < -1.74999999999999994e-286

            1. Initial program 66.3%

              \[\left({\left(\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. 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) \]
              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 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              4. 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{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right) \cdot \frac{h}{\ell}\right) \]
              5. 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 - \left(\frac{1}{2} \cdot {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              6. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{\color{blue}{2 \cdot d}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              7. 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 - \left(\frac{1}{2} \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              8. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
              9. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
              10. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\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}{\frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}}\right) \]
            4. Taylor expanded in l around -inf

              \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
            5. Applied rewrites43.3%

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

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

                \[\leadsto \left(-d\right) \cdot {\left(\ell \cdot h\right)}^{\color{blue}{\frac{-1}{2}}} \]
              3. metadata-evalN/A

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

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

                \[\leadsto \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}} \]
              6. lift-*.f64N/A

                \[\leadsto \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}} \]
              7. lift-sqrt.f6443.2

                \[\leadsto \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}} \]
            7. Applied rewrites43.2%

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

            if -1.74999999999999994e-286 < h < 1.65e190

            1. Initial program 70.7%

              \[\left({\left(\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 d around inf

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

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

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

                \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
              4. inv-powN/A

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

                \[\leadsto \sqrt{{\left(h \cdot \ell\right)}^{-1}} \cdot d \]
              6. *-commutativeN/A

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
              7. lower-*.f6445.2

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
            4. Applied rewrites45.2%

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

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
              2. lift-pow.f64N/A

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
              3. *-commutativeN/A

                \[\leadsto \sqrt{{\left(h \cdot \ell\right)}^{-1}} \cdot d \]
              4. inv-powN/A

                \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
              5. associate-/r*N/A

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

                \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d \]
              7. inv-powN/A

                \[\leadsto \sqrt{\frac{{h}^{-1}}{\ell}} \cdot d \]
              8. lower-pow.f6445.5

                \[\leadsto \sqrt{\frac{{h}^{-1}}{\ell}} \cdot d \]
            6. Applied rewrites45.5%

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

            if 1.65e190 < h

            1. Initial program 50.3%

              \[\left({\left(\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. 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) \]
              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 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              4. 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{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right) \cdot \frac{h}{\ell}\right) \]
              5. 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 - \left(\frac{1}{2} \cdot {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              6. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{\color{blue}{2 \cdot d}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              7. 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 - \left(\frac{1}{2} \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              8. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
              9. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
              10. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
            3. Applied rewrites53.5%

              \[\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{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}}\right) \]
            4. Taylor expanded in h around 0

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

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

              \[\leadsto \frac{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
            7. Step-by-step derivation
              1. sqrt-pow2N/A

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

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

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

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

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

                \[\leadsto \frac{\left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
              7. lift-neg.f64N/A

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

                \[\leadsto \frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
              9. lift-/.f6431.0

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

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

          Alternative 10: 43.2% accurate, 2.7× speedup?

          \[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq 2 \cdot 10^{-221}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{{h}^{-1}}{\ell}} \cdot d\\ \end{array} \end{array} \]
          NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
          (FPCore (d h l M D)
           :precision binary64
           (if (<= l 2e-221)
             (* (- d) (sqrt (pow (* l h) -1.0)))
             (* (sqrt (/ (pow h -1.0) l)) d)))
          assert(d < h && h < l && l < M && M < D);
          double code(double d, double h, double l, double M, double D) {
          	double tmp;
          	if (l <= 2e-221) {
          		tmp = -d * sqrt(pow((l * h), -1.0));
          	} else {
          		tmp = sqrt((pow(h, -1.0) / l)) * d;
          	}
          	return tmp;
          }
          
          NOTE: d, h, l, M, and D 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, 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
              real(8) :: tmp
              if (l <= 2d-221) then
                  tmp = -d * sqrt(((l * h) ** (-1.0d0)))
              else
                  tmp = sqrt(((h ** (-1.0d0)) / l)) * d
              end if
              code = tmp
          end function
          
          assert d < h && h < l && l < M && M < D;
          public static double code(double d, double h, double l, double M, double D) {
          	double tmp;
          	if (l <= 2e-221) {
          		tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
          	} else {
          		tmp = Math.sqrt((Math.pow(h, -1.0) / l)) * d;
          	}
          	return tmp;
          }
          
          [d, h, l, M, D] = sort([d, h, l, M, D])
          def code(d, h, l, M, D):
          	tmp = 0
          	if l <= 2e-221:
          		tmp = -d * math.sqrt(math.pow((l * h), -1.0))
          	else:
          		tmp = math.sqrt((math.pow(h, -1.0) / l)) * d
          	return tmp
          
          d, h, l, M, D = sort([d, h, l, M, D])
          function code(d, h, l, M, D)
          	tmp = 0.0
          	if (l <= 2e-221)
          		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
          	else
          		tmp = Float64(sqrt(Float64((h ^ -1.0) / l)) * d);
          	end
          	return tmp
          end
          
          d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
          function tmp_2 = code(d, h, l, M, D)
          	tmp = 0.0;
          	if (l <= 2e-221)
          		tmp = -d * sqrt(((l * h) ^ -1.0));
          	else
          		tmp = sqrt(((h ^ -1.0) / l)) * d;
          	end
          	tmp_2 = tmp;
          end
          
          NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
          code[d_, h_, l_, M_, D_] := If[LessEqual[l, 2e-221], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[Power[h, -1.0], $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]]
          
          \begin{array}{l}
          [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
          \\
          \begin{array}{l}
          \mathbf{if}\;\ell \leq 2 \cdot 10^{-221}:\\
          \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
          
          \mathbf{else}:\\
          \;\;\;\;\sqrt{\frac{{h}^{-1}}{\ell}} \cdot d\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if l < 2.00000000000000003e-221

            1. Initial program 66.7%

              \[\left({\left(\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. 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) \]
              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 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              4. 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{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right) \cdot \frac{h}{\ell}\right) \]
              5. 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 - \left(\frac{1}{2} \cdot {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              6. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{\color{blue}{2 \cdot d}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              7. 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 - \left(\frac{1}{2} \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              8. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
              9. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
              10. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
            3. Applied rewrites68.7%

              \[\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{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}}\right) \]
            4. Taylor expanded in l around -inf

              \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
            5. Applied rewrites41.5%

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

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

                \[\leadsto \left(-d\right) \cdot {\left(\ell \cdot h\right)}^{\color{blue}{\frac{-1}{2}}} \]
              3. metadata-evalN/A

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

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

                \[\leadsto \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}} \]
              6. lift-*.f64N/A

                \[\leadsto \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}} \]
              7. lift-sqrt.f6441.5

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

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

            if 2.00000000000000003e-221 < l

            1. Initial program 66.4%

              \[\left({\left(\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 d around inf

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

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

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

                \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
              4. inv-powN/A

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

                \[\leadsto \sqrt{{\left(h \cdot \ell\right)}^{-1}} \cdot d \]
              6. *-commutativeN/A

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
              7. lower-*.f6445.3

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
            4. Applied rewrites45.3%

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

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
              2. lift-pow.f64N/A

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
              3. *-commutativeN/A

                \[\leadsto \sqrt{{\left(h \cdot \ell\right)}^{-1}} \cdot d \]
              4. inv-powN/A

                \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
              5. associate-/r*N/A

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

                \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d \]
              7. inv-powN/A

                \[\leadsto \sqrt{\frac{{h}^{-1}}{\ell}} \cdot d \]
              8. lower-pow.f6445.6

                \[\leadsto \sqrt{\frac{{h}^{-1}}{\ell}} \cdot d \]
            6. Applied rewrites45.6%

              \[\leadsto \sqrt{\frac{{h}^{-1}}{\ell}} \cdot d \]
          3. Recombined 2 regimes into one program.
          4. Add Preprocessing

          Alternative 11: 43.1% accurate, 2.9× speedup?

          \[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq 2 \cdot 10^{-221}:\\ \;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{{h}^{-1}}{\ell}} \cdot d\\ \end{array} \end{array} \]
          NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
          (FPCore (d h l M D)
           :precision binary64
           (if (<= l 2e-221)
             (* (- d) (pow (* l h) -0.5))
             (* (sqrt (/ (pow h -1.0) l)) d)))
          assert(d < h && h < l && l < M && M < D);
          double code(double d, double h, double l, double M, double D) {
          	double tmp;
          	if (l <= 2e-221) {
          		tmp = -d * pow((l * h), -0.5);
          	} else {
          		tmp = sqrt((pow(h, -1.0) / l)) * d;
          	}
          	return tmp;
          }
          
          NOTE: d, h, l, M, and D 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, 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
              real(8) :: tmp
              if (l <= 2d-221) then
                  tmp = -d * ((l * h) ** (-0.5d0))
              else
                  tmp = sqrt(((h ** (-1.0d0)) / l)) * d
              end if
              code = tmp
          end function
          
          assert d < h && h < l && l < M && M < D;
          public static double code(double d, double h, double l, double M, double D) {
          	double tmp;
          	if (l <= 2e-221) {
          		tmp = -d * Math.pow((l * h), -0.5);
          	} else {
          		tmp = Math.sqrt((Math.pow(h, -1.0) / l)) * d;
          	}
          	return tmp;
          }
          
          [d, h, l, M, D] = sort([d, h, l, M, D])
          def code(d, h, l, M, D):
          	tmp = 0
          	if l <= 2e-221:
          		tmp = -d * math.pow((l * h), -0.5)
          	else:
          		tmp = math.sqrt((math.pow(h, -1.0) / l)) * d
          	return tmp
          
          d, h, l, M, D = sort([d, h, l, M, D])
          function code(d, h, l, M, D)
          	tmp = 0.0
          	if (l <= 2e-221)
          		tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5));
          	else
          		tmp = Float64(sqrt(Float64((h ^ -1.0) / l)) * d);
          	end
          	return tmp
          end
          
          d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
          function tmp_2 = code(d, h, l, M, D)
          	tmp = 0.0;
          	if (l <= 2e-221)
          		tmp = -d * ((l * h) ^ -0.5);
          	else
          		tmp = sqrt(((h ^ -1.0) / l)) * d;
          	end
          	tmp_2 = tmp;
          end
          
          NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
          code[d_, h_, l_, M_, D_] := If[LessEqual[l, 2e-221], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[Power[h, -1.0], $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]]
          
          \begin{array}{l}
          [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
          \\
          \begin{array}{l}
          \mathbf{if}\;\ell \leq 2 \cdot 10^{-221}:\\
          \;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
          
          \mathbf{else}:\\
          \;\;\;\;\sqrt{\frac{{h}^{-1}}{\ell}} \cdot d\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if l < 2.00000000000000003e-221

            1. Initial program 66.7%

              \[\left({\left(\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. 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) \]
              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 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              4. 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{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right) \cdot \frac{h}{\ell}\right) \]
              5. 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 - \left(\frac{1}{2} \cdot {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              6. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{\color{blue}{2 \cdot d}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              7. 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 - \left(\frac{1}{2} \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              8. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
              9. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
              10. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
            3. Applied rewrites68.7%

              \[\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{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}}\right) \]
            4. Taylor expanded in l around -inf

              \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
            5. Applied rewrites41.5%

              \[\leadsto \color{blue}{\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}} \]

            if 2.00000000000000003e-221 < l

            1. Initial program 66.4%

              \[\left({\left(\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 d around inf

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

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

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

                \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
              4. inv-powN/A

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

                \[\leadsto \sqrt{{\left(h \cdot \ell\right)}^{-1}} \cdot d \]
              6. *-commutativeN/A

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
              7. lower-*.f6445.3

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
            4. Applied rewrites45.3%

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

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
              2. lift-pow.f64N/A

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
              3. *-commutativeN/A

                \[\leadsto \sqrt{{\left(h \cdot \ell\right)}^{-1}} \cdot d \]
              4. inv-powN/A

                \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
              5. associate-/r*N/A

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

                \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d \]
              7. inv-powN/A

                \[\leadsto \sqrt{\frac{{h}^{-1}}{\ell}} \cdot d \]
              8. lower-pow.f6445.6

                \[\leadsto \sqrt{\frac{{h}^{-1}}{\ell}} \cdot d \]
            6. Applied rewrites45.6%

              \[\leadsto \sqrt{\frac{{h}^{-1}}{\ell}} \cdot d \]
          3. Recombined 2 regimes into one program.
          4. Add Preprocessing

          Alternative 12: 43.0% accurate, 2.9× speedup?

          \[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ \begin{array}{l} t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\ \mathbf{if}\;\ell \leq 2 \cdot 10^{-221}:\\ \;\;\;\;\left(-d\right) \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot d\\ \end{array} \end{array} \]
          NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
          (FPCore (d h l M D)
           :precision binary64
           (let* ((t_0 (pow (* l h) -0.5))) (if (<= l 2e-221) (* (- d) t_0) (* t_0 d))))
          assert(d < h && h < l && l < M && M < D);
          double code(double d, double h, double l, double M, double D) {
          	double t_0 = pow((l * h), -0.5);
          	double tmp;
          	if (l <= 2e-221) {
          		tmp = -d * t_0;
          	} else {
          		tmp = t_0 * d;
          	}
          	return tmp;
          }
          
          NOTE: d, h, l, M, and D 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, 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
              real(8) :: t_0
              real(8) :: tmp
              t_0 = (l * h) ** (-0.5d0)
              if (l <= 2d-221) then
                  tmp = -d * t_0
              else
                  tmp = t_0 * d
              end if
              code = tmp
          end function
          
          assert d < h && h < l && l < M && M < D;
          public static double code(double d, double h, double l, double M, double D) {
          	double t_0 = Math.pow((l * h), -0.5);
          	double tmp;
          	if (l <= 2e-221) {
          		tmp = -d * t_0;
          	} else {
          		tmp = t_0 * d;
          	}
          	return tmp;
          }
          
          [d, h, l, M, D] = sort([d, h, l, M, D])
          def code(d, h, l, M, D):
          	t_0 = math.pow((l * h), -0.5)
          	tmp = 0
          	if l <= 2e-221:
          		tmp = -d * t_0
          	else:
          		tmp = t_0 * d
          	return tmp
          
          d, h, l, M, D = sort([d, h, l, M, D])
          function code(d, h, l, M, D)
          	t_0 = Float64(l * h) ^ -0.5
          	tmp = 0.0
          	if (l <= 2e-221)
          		tmp = Float64(Float64(-d) * t_0);
          	else
          		tmp = Float64(t_0 * d);
          	end
          	return tmp
          end
          
          d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
          function tmp_2 = code(d, h, l, M, D)
          	t_0 = (l * h) ^ -0.5;
          	tmp = 0.0;
          	if (l <= 2e-221)
          		tmp = -d * t_0;
          	else
          		tmp = t_0 * d;
          	end
          	tmp_2 = tmp;
          end
          
          NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
          code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, 2e-221], N[((-d) * t$95$0), $MachinePrecision], N[(t$95$0 * d), $MachinePrecision]]]
          
          \begin{array}{l}
          [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
          \\
          \begin{array}{l}
          t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
          \mathbf{if}\;\ell \leq 2 \cdot 10^{-221}:\\
          \;\;\;\;\left(-d\right) \cdot t\_0\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0 \cdot d\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if l < 2.00000000000000003e-221

            1. Initial program 66.7%

              \[\left({\left(\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. 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) \]
              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 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              4. 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{1}{2} \cdot \color{blue}{{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}}\right) \cdot \frac{h}{\ell}\right) \]
              5. 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 - \left(\frac{1}{2} \cdot {\left(\frac{\color{blue}{M \cdot D}}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              6. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{\color{blue}{2 \cdot d}}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              7. 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 - \left(\frac{1}{2} \cdot {\color{blue}{\left(\frac{M \cdot D}{2 \cdot d}\right)}}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              8. 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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
              9. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
              10. 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}{\frac{\left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot h}{\ell}}\right) \]
            3. Applied rewrites68.7%

              \[\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{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}}\right) \]
            4. Taylor expanded in l around -inf

              \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
            5. Applied rewrites41.5%

              \[\leadsto \color{blue}{\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}} \]

            if 2.00000000000000003e-221 < l

            1. Initial program 66.4%

              \[\left({\left(\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 d around inf

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

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

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

                \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
              4. inv-powN/A

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

                \[\leadsto \sqrt{{\left(h \cdot \ell\right)}^{-1}} \cdot d \]
              6. *-commutativeN/A

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
              7. lower-*.f6445.3

                \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
            4. Applied rewrites45.3%

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

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

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

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

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

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

                \[\leadsto {\left(\ell \cdot h\right)}^{\left(\frac{-1}{2}\right)} \cdot d \]
              7. metadata-eval45.5

                \[\leadsto {\left(\ell \cdot h\right)}^{-0.5} \cdot d \]
            6. Applied rewrites45.5%

              \[\leadsto {\left(\ell \cdot h\right)}^{-0.5} \cdot d \]
          3. Recombined 2 regimes into one program.
          4. Add Preprocessing

          Alternative 13: 25.9% accurate, 5.0× speedup?

          \[\begin{array}{l} [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\ \\ {\left(\ell \cdot h\right)}^{-0.5} \cdot d \end{array} \]
          NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
          (FPCore (d h l M D) :precision binary64 (* (pow (* l h) -0.5) d))
          assert(d < h && h < l && l < M && M < D);
          double code(double d, double h, double l, double M, double D) {
          	return pow((l * h), -0.5) * d;
          }
          
          NOTE: d, h, l, M, and D 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, 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 = ((l * h) ** (-0.5d0)) * d
          end function
          
          assert d < h && h < l && l < M && M < D;
          public static double code(double d, double h, double l, double M, double D) {
          	return Math.pow((l * h), -0.5) * d;
          }
          
          [d, h, l, M, D] = sort([d, h, l, M, D])
          def code(d, h, l, M, D):
          	return math.pow((l * h), -0.5) * d
          
          d, h, l, M, D = sort([d, h, l, M, D])
          function code(d, h, l, M, D)
          	return Float64((Float64(l * h) ^ -0.5) * d)
          end
          
          d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
          function tmp = code(d, h, l, M, D)
          	tmp = ((l * h) ^ -0.5) * d;
          end
          
          NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
          code[d_, h_, l_, M_, D_] := N[(N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision] * d), $MachinePrecision]
          
          \begin{array}{l}
          [d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
          \\
          {\left(\ell \cdot h\right)}^{-0.5} \cdot d
          \end{array}
          
          Derivation
          1. Initial program 66.6%

            \[\left({\left(\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 d around inf

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

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

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

              \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
            4. inv-powN/A

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

              \[\leadsto \sqrt{{\left(h \cdot \ell\right)}^{-1}} \cdot d \]
            6. *-commutativeN/A

              \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
            7. lower-*.f6426.0

              \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
          4. Applied rewrites26.0%

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

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

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

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

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

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

              \[\leadsto {\left(\ell \cdot h\right)}^{\left(\frac{-1}{2}\right)} \cdot d \]
            7. metadata-eval25.9

              \[\leadsto {\left(\ell \cdot h\right)}^{-0.5} \cdot d \]
          6. Applied rewrites25.9%

            \[\leadsto {\left(\ell \cdot h\right)}^{-0.5} \cdot d \]
          7. Add Preprocessing

          Reproduce

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