Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.3% → 74.9%
Time: 8.3s
Alternatives: 14
Speedup: 3.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 14 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.3% 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: 74.9% accurate, 1.3× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} t_0 := \frac{M}{2} \cdot \frac{D\_m}{d}\\ \mathbf{if}\;d \leq -1.7 \cdot 10^{-81}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\ \mathbf{elif}\;d \leq 2.4 \cdot 10^{-161}:\\ \;\;\;\;\frac{\left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \frac{{\left(M \cdot D\_m\right)}^{2}}{d}\right) \cdot -0.125}{h}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left({t\_0}^{2} \cdot 0.5\right) \cdot h}{\ell}\right)\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (let* ((t_0 (* (/ M 2.0) (/ D_m d))))
   (if (<= d -1.7e-81)
     (*
      (* (sqrt (/ d l)) (sqrt (/ d h)))
      (- 1.0 (/ (* (* (* t_0 t_0) 0.5) h) l)))
     (if (<= d 2.4e-161)
       (/ (* (* (pow (/ h l) 1.5) (/ (pow (* M D_m) 2.0) d)) -0.125) h)
       (*
        (* (/ (sqrt d) (sqrt h)) (pow (/ d l) (/ 1.0 2.0)))
        (- 1.0 (/ (* (* (pow t_0 2.0) 0.5) h) l)))))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double t_0 = (M / 2.0) * (D_m / d);
	double tmp;
	if (d <= -1.7e-81) {
		tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
	} else if (d <= 2.4e-161) {
		tmp = ((pow((h / l), 1.5) * (pow((M * D_m), 2.0) / d)) * -0.125) / h;
	} else {
		tmp = ((sqrt(d) / sqrt(h)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((pow(t_0, 2.0) * 0.5) * h) / l));
	}
	return tmp;
}
D_m =     private
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(d, h, l, m, d_m)
use fmin_fmax_functions
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (m / 2.0d0) * (d_m / d)
    if (d <= (-1.7d-81)) then
        tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - ((((t_0 * t_0) * 0.5d0) * h) / l))
    else if (d <= 2.4d-161) then
        tmp = ((((h / l) ** 1.5d0) * (((m * d_m) ** 2.0d0) / d)) * (-0.125d0)) / h
    else
        tmp = ((sqrt(d) / sqrt(h)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - ((((t_0 ** 2.0d0) * 0.5d0) * h) / l))
    end if
    code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	double t_0 = (M / 2.0) * (D_m / d);
	double tmp;
	if (d <= -1.7e-81) {
		tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
	} else if (d <= 2.4e-161) {
		tmp = ((Math.pow((h / l), 1.5) * (Math.pow((M * D_m), 2.0) / d)) * -0.125) / h;
	} else {
		tmp = ((Math.sqrt(d) / Math.sqrt(h)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((Math.pow(t_0, 2.0) * 0.5) * h) / l));
	}
	return tmp;
}
D_m = math.fabs(D)
[d, h, l, M, D_m] = sort([d, h, l, M, D_m])
def code(d, h, l, M, D_m):
	t_0 = (M / 2.0) * (D_m / d)
	tmp = 0
	if d <= -1.7e-81:
		tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l))
	elif d <= 2.4e-161:
		tmp = ((math.pow((h / l), 1.5) * (math.pow((M * D_m), 2.0) / d)) * -0.125) / h
	else:
		tmp = ((math.sqrt(d) / math.sqrt(h)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((math.pow(t_0, 2.0) * 0.5) * h) / l))
	return tmp
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	t_0 = Float64(Float64(M / 2.0) * Float64(D_m / d))
	tmp = 0.0
	if (d <= -1.7e-81)
		tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * t_0) * 0.5) * h) / l)));
	elseif (d <= 2.4e-161)
		tmp = Float64(Float64(Float64((Float64(h / l) ^ 1.5) * Float64((Float64(M * D_m) ^ 2.0) / d)) * -0.125) / h);
	else
		tmp = Float64(Float64(Float64(sqrt(d) / sqrt(h)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64((t_0 ^ 2.0) * 0.5) * h) / l)));
	end
	return tmp
end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
	t_0 = (M / 2.0) * (D_m / d);
	tmp = 0.0;
	if (d <= -1.7e-81)
		tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
	elseif (d <= 2.4e-161)
		tmp = ((((h / l) ^ 1.5) * (((M * D_m) ^ 2.0) / d)) * -0.125) / h;
	else
		tmp = ((sqrt(d) / sqrt(h)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - ((((t_0 ^ 2.0) * 0.5) * h) / l));
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.7e-81], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.4e-161], N[(N[(N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] * N[(N[Power[N[(M * D$95$m), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[Power[t$95$0, 2.0], $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M}{2} \cdot \frac{D\_m}{d}\\
\mathbf{if}\;d \leq -1.7 \cdot 10^{-81}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\

\mathbf{elif}\;d \leq 2.4 \cdot 10^{-161}:\\
\;\;\;\;\frac{\left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \frac{{\left(M \cdot D\_m\right)}^{2}}{d}\right) \cdot -0.125}{h}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.6999999999999999e-81

    1. Initial program 76.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. Add Preprocessing
    3. 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) \]
    4. Applied rewrites79.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) \]
    5. 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 - \frac{\left({\left(\frac{M}{2} \cdot \color{blue}{\frac{D}{d}}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      2. 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 - \frac{\left({\color{blue}{\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)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left({\left(\color{blue}{\frac{M}{2}} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      4. frac-timesN/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left({\left(\frac{\color{blue}{D \cdot M}}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot 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 - \frac{\left({\left(\frac{\color{blue}{D \cdot M}}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      8. lift-*.f6479.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 - \frac{\left({\left(\frac{D \cdot M}{\color{blue}{2 \cdot d}}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right) \]
    6. Applied rewrites79.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 - \frac{\left({\color{blue}{\left(\frac{D \cdot M}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot h}{\ell}\right) \]
    7. 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      13. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.6999999999999999e-81 < d < 2.39999999999999999e-161

    1. Initial program 45.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. Add Preprocessing
    3. 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}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \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}}}{\color{blue}{h}} \]
    5. Applied rewrites47.9%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}}, \sqrt{\frac{h}{\ell}} \cdot d\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. lower-*.f64N/A

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

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

    if 2.39999999999999999e-161 < d

    1. Initial program 74.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. Add Preprocessing
    3. 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) \]
    4. Applied rewrites76.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) \]
    5. Step-by-step derivation
      1. 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) \]
      2. 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) \]
      3. 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) \]
      4. 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) \]
      5. pow1/2N/A

        \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{h}}} \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. sqrt-divN/A

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

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

        \[\leadsto \left(\frac{\color{blue}{\sqrt{d}}}{\sqrt{h}} \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) \]
      9. lower-sqrt.f6485.1

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

      \[\leadsto \left(\color{blue}{\frac{\sqrt{d}}{\sqrt{h}}} \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 0.5\right) \cdot h}{\ell}\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 2: 46.9% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.00000000000000009e-181 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 55.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. Add Preprocessing
    3. 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}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \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}}}{\color{blue}{h}} \]
    5. Applied rewrites40.8%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}}, \sqrt{\frac{h}{\ell}} \cdot d\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. associate-*l*N/A

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

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

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

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

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

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

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

    if -2.00000000000000009e-181 < (*.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 78.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. Add Preprocessing
    3. 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}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \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}}}{\color{blue}{h}} \]
    5. Applied rewrites59.2%

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

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

        \[\leadsto \frac{\sqrt{\frac{h}{\ell}} \cdot d}{h} \]
      4. lift-*.f6475.8

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

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

Alternative 3: 60.2% accurate, 0.8× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \sqrt{\frac{d}{h}}\\ \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -2 \cdot 10^{-62}:\\ \;\;\;\;t\_1 \cdot \left(t\_0 \cdot \left(\frac{\left(\left(M \cdot D\_m\right) \cdot \left(M \cdot D\_m\right)\right) \cdot h}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot t\_0\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (let* ((t_0 (sqrt (/ d l))) (t_1 (sqrt (/ d h))))
   (if (<=
        (*
         (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
         (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D_m) (* 2.0 d)) 2.0)) (/ h l))))
        -2e-62)
     (* t_1 (* t_0 (* (/ (* (* (* M D_m) (* M D_m)) h) (* (* d d) l)) -0.125)))
     (* t_1 t_0))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double t_0 = sqrt((d / l));
	double t_1 = sqrt((d / h));
	double tmp;
	if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D_m) / (2.0 * d)), 2.0)) * (h / l)))) <= -2e-62) {
		tmp = t_1 * (t_0 * (((((M * D_m) * (M * D_m)) * h) / ((d * d) * l)) * -0.125));
	} else {
		tmp = t_1 * t_0;
	}
	return tmp;
}
D_m =     private
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(d, h, l, m, d_m)
use fmin_fmax_functions
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = sqrt((d / l))
    t_1 = sqrt((d / h))
    if (((((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_m) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= (-2d-62)) then
        tmp = t_1 * (t_0 * (((((m * d_m) * (m * d_m)) * h) / ((d * d) * l)) * (-0.125d0)))
    else
        tmp = t_1 * t_0
    end if
    code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	double t_0 = Math.sqrt((d / l));
	double t_1 = Math.sqrt((d / h));
	double tmp;
	if (((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_m) / (2.0 * d)), 2.0)) * (h / l)))) <= -2e-62) {
		tmp = t_1 * (t_0 * (((((M * D_m) * (M * D_m)) * h) / ((d * d) * l)) * -0.125));
	} else {
		tmp = t_1 * t_0;
	}
	return tmp;
}
D_m = math.fabs(D)
[d, h, l, M, D_m] = sort([d, h, l, M, D_m])
def code(d, h, l, M, D_m):
	t_0 = math.sqrt((d / l))
	t_1 = math.sqrt((d / h))
	tmp = 0
	if ((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_m) / (2.0 * d)), 2.0)) * (h / l)))) <= -2e-62:
		tmp = t_1 * (t_0 * (((((M * D_m) * (M * D_m)) * h) / ((d * d) * l)) * -0.125))
	else:
		tmp = t_1 * t_0
	return tmp
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	t_0 = sqrt(Float64(d / l))
	t_1 = sqrt(Float64(d / h))
	tmp = 0.0
	if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= -2e-62)
		tmp = Float64(t_1 * Float64(t_0 * Float64(Float64(Float64(Float64(Float64(M * D_m) * Float64(M * D_m)) * h) / Float64(Float64(d * d) * l)) * -0.125)));
	else
		tmp = Float64(t_1 * t_0);
	end
	return tmp
end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
	t_0 = sqrt((d / l));
	t_1 = sqrt((d / h));
	tmp = 0.0;
	if (((((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D_m) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= -2e-62)
		tmp = t_1 * (t_0 * (((((M * D_m) * (M * D_m)) * h) / ((d * d) * l)) * -0.125));
	else
		tmp = t_1 * t_0;
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-62], N[(t$95$1 * N[(t$95$0 * N[(N[(N[(N[(N[(M * D$95$m), $MachinePrecision] * N[(M * D$95$m), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -2 \cdot 10^{-62}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 \cdot \left(\frac{\left(\left(M \cdot D\_m\right) \cdot \left(M \cdot D\_m\right)\right) \cdot h}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125\right)\right)\\

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


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

    1. Initial program 85.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. Add Preprocessing
    3. Taylor expanded in d around 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}{\left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)} \]
    4. Step-by-step derivation
      1. 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 \frac{\frac{-1}{8} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2} \cdot \ell}} \]
      2. 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 \frac{\frac{-1}{8} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2} \cdot \ell}} \]
      3. 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 \frac{\frac{-1}{8} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2}} \cdot \ell} \]
      4. associate-*r*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \frac{\frac{-1}{8} \cdot \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot h\right)}{{d}^{\color{blue}{2}} \cdot \ell} \]
      5. 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 \frac{\frac{-1}{8} \cdot \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot h\right)}{{d}^{\color{blue}{2}} \cdot \ell} \]
      6. pow-prod-downN/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \frac{\frac{-1}{8} \cdot \left({\left(M \cdot D\right)}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \]
      8. lower-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 \frac{\frac{-1}{8} \cdot \left({\left(M \cdot D\right)}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \]
      9. *-commutativeN/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \frac{\frac{-1}{8} \cdot \left({\left(D \cdot M\right)}^{2} \cdot h\right)}{\left(d \cdot d\right) \cdot \ell} \]
      13. lower-*.f6464.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 \frac{-0.125 \cdot \left({\left(D \cdot M\right)}^{2} \cdot h\right)}{\left(d \cdot d\right) \cdot \ell} \]
    5. Applied rewrites64.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 \color{blue}{\frac{-0.125 \cdot \left({\left(D \cdot M\right)}^{2} \cdot h\right)}{\left(d \cdot d\right) \cdot \ell}} \]
    6. Applied rewrites64.2%

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

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

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

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

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

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

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

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

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

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

    if -2.0000000000000001e-62 < (*.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. Add Preprocessing
    3. Taylor expanded in d around 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}{\left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)} \]
    4. Step-by-step derivation
      1. 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 \frac{\frac{-1}{8} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2} \cdot \ell}} \]
      2. 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 \frac{\frac{-1}{8} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2} \cdot \ell}} \]
      3. 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 \frac{\frac{-1}{8} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2}} \cdot \ell} \]
      4. associate-*r*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \frac{\frac{-1}{8} \cdot \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot h\right)}{{d}^{\color{blue}{2}} \cdot \ell} \]
      5. 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 \frac{\frac{-1}{8} \cdot \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot h\right)}{{d}^{\color{blue}{2}} \cdot \ell} \]
      6. pow-prod-downN/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \frac{\frac{-1}{8} \cdot \left({\left(M \cdot D\right)}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \]
      8. lower-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 \frac{\frac{-1}{8} \cdot \left({\left(M \cdot D\right)}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \]
      9. *-commutativeN/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \frac{\frac{-1}{8} \cdot \left({\left(D \cdot M\right)}^{2} \cdot h\right)}{\left(d \cdot d\right) \cdot \ell} \]
      13. lower-*.f643.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 \frac{-0.125 \cdot \left({\left(D \cdot M\right)}^{2} \cdot h\right)}{\left(d \cdot d\right) \cdot \ell} \]
    5. Applied rewrites3.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}{\frac{-0.125 \cdot \left({\left(D \cdot M\right)}^{2} \cdot h\right)}{\left(d \cdot d\right) \cdot \ell}} \]
    6. Applied rewrites3.1%

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}} \]
      2. lift-/.f6458.2

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

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

Alternative 4: 56.3% accurate, 0.8× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \sqrt{\frac{d}{h}}\\ \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{+41}:\\ \;\;\;\;t\_1 \cdot \left(t\_0 \cdot \left(\left(\left(D\_m \cdot D\_m\right) \cdot \left(\left(M \cdot M\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot -0.125\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot t\_0\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (let* ((t_0 (sqrt (/ d l))) (t_1 (sqrt (/ d h))))
   (if (<=
        (*
         (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
         (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D_m) (* 2.0 d)) 2.0)) (/ h l))))
        -5e+41)
     (* t_1 (* t_0 (* (* (* D_m D_m) (* (* M M) (/ h (* (* d d) l)))) -0.125)))
     (* t_1 t_0))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double t_0 = sqrt((d / l));
	double t_1 = sqrt((d / h));
	double tmp;
	if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D_m) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e+41) {
		tmp = t_1 * (t_0 * (((D_m * D_m) * ((M * M) * (h / ((d * d) * l)))) * -0.125));
	} else {
		tmp = t_1 * t_0;
	}
	return tmp;
}
D_m =     private
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(d, h, l, m, d_m)
use fmin_fmax_functions
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = sqrt((d / l))
    t_1 = sqrt((d / h))
    if (((((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_m) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= (-5d+41)) then
        tmp = t_1 * (t_0 * (((d_m * d_m) * ((m * m) * (h / ((d * d) * l)))) * (-0.125d0)))
    else
        tmp = t_1 * t_0
    end if
    code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	double t_0 = Math.sqrt((d / l));
	double t_1 = Math.sqrt((d / h));
	double tmp;
	if (((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_m) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e+41) {
		tmp = t_1 * (t_0 * (((D_m * D_m) * ((M * M) * (h / ((d * d) * l)))) * -0.125));
	} else {
		tmp = t_1 * t_0;
	}
	return tmp;
}
D_m = math.fabs(D)
[d, h, l, M, D_m] = sort([d, h, l, M, D_m])
def code(d, h, l, M, D_m):
	t_0 = math.sqrt((d / l))
	t_1 = math.sqrt((d / h))
	tmp = 0
	if ((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_m) / (2.0 * d)), 2.0)) * (h / l)))) <= -5e+41:
		tmp = t_1 * (t_0 * (((D_m * D_m) * ((M * M) * (h / ((d * d) * l)))) * -0.125))
	else:
		tmp = t_1 * t_0
	return tmp
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	t_0 = sqrt(Float64(d / l))
	t_1 = sqrt(Float64(d / h))
	tmp = 0.0
	if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= -5e+41)
		tmp = Float64(t_1 * Float64(t_0 * Float64(Float64(Float64(D_m * D_m) * Float64(Float64(M * M) * Float64(h / Float64(Float64(d * d) * l)))) * -0.125)));
	else
		tmp = Float64(t_1 * t_0);
	end
	return tmp
end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
	t_0 = sqrt((d / l));
	t_1 = sqrt((d / h));
	tmp = 0.0;
	if (((((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D_m) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= -5e+41)
		tmp = t_1 * (t_0 * (((D_m * D_m) * ((M * M) * (h / ((d * d) * l)))) * -0.125));
	else
		tmp = t_1 * t_0;
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e+41], N[(t$95$1 * N[(t$95$0 * N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] * N[(h / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{+41}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 \cdot \left(\left(\left(D\_m \cdot D\_m\right) \cdot \left(\left(M \cdot M\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot -0.125\right)\right)\\

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


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

    1. Initial program 84.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. Add Preprocessing
    3. Taylor expanded in d around 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}{\left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)} \]
    4. Step-by-step derivation
      1. 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 \frac{\frac{-1}{8} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2} \cdot \ell}} \]
      2. 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 \frac{\frac{-1}{8} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2} \cdot \ell}} \]
      3. 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 \frac{\frac{-1}{8} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2}} \cdot \ell} \]
      4. associate-*r*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \frac{\frac{-1}{8} \cdot \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot h\right)}{{d}^{\color{blue}{2}} \cdot \ell} \]
      5. 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 \frac{\frac{-1}{8} \cdot \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot h\right)}{{d}^{\color{blue}{2}} \cdot \ell} \]
      6. pow-prod-downN/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \frac{\frac{-1}{8} \cdot \left({\left(M \cdot D\right)}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \]
      8. lower-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 \frac{\frac{-1}{8} \cdot \left({\left(M \cdot D\right)}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \]
      9. *-commutativeN/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \frac{\frac{-1}{8} \cdot \left({\left(D \cdot M\right)}^{2} \cdot h\right)}{\left(d \cdot d\right) \cdot \ell} \]
      13. lower-*.f6465.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 \frac{-0.125 \cdot \left({\left(D \cdot M\right)}^{2} \cdot h\right)}{\left(d \cdot d\right) \cdot \ell} \]
    5. Applied rewrites65.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 \color{blue}{\frac{-0.125 \cdot \left({\left(D \cdot M\right)}^{2} \cdot h\right)}{\left(d \cdot d\right) \cdot \ell}} \]
    6. Applied rewrites64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(\left(\left(D \cdot D\right) \cdot \left(\left(M \cdot M\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot \frac{-1}{8}\right)\right) \]
      21. lift-*.f6454.4

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

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

    if -5.00000000000000022e41 < (*.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.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. Add Preprocessing
    3. Taylor expanded in d around 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}{\left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)} \]
    4. Step-by-step derivation
      1. 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 \frac{\frac{-1}{8} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2} \cdot \ell}} \]
      2. 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 \frac{\frac{-1}{8} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2} \cdot \ell}} \]
      3. 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 \frac{\frac{-1}{8} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2}} \cdot \ell} \]
      4. associate-*r*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \frac{\frac{-1}{8} \cdot \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot h\right)}{{d}^{\color{blue}{2}} \cdot \ell} \]
      5. 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 \frac{\frac{-1}{8} \cdot \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot h\right)}{{d}^{\color{blue}{2}} \cdot \ell} \]
      6. pow-prod-downN/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \frac{\frac{-1}{8} \cdot \left({\left(M \cdot D\right)}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \]
      8. lower-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 \frac{\frac{-1}{8} \cdot \left({\left(M \cdot D\right)}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \]
      9. *-commutativeN/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \frac{\frac{-1}{8} \cdot \left({\left(D \cdot M\right)}^{2} \cdot h\right)}{\left(d \cdot d\right) \cdot \ell} \]
      13. lower-*.f643.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 \frac{-0.125 \cdot \left({\left(D \cdot M\right)}^{2} \cdot h\right)}{\left(d \cdot d\right) \cdot \ell} \]
    5. Applied rewrites3.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}{\frac{-0.125 \cdot \left({\left(D \cdot M\right)}^{2} \cdot h\right)}{\left(d \cdot d\right) \cdot \ell}} \]
    6. Applied rewrites3.9%

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}} \]
      2. lift-/.f6457.2

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

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

Alternative 5: 46.4% accurate, 0.9× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -2 \cdot 10^{-181}:\\ \;\;\;\;\frac{d \cdot \left(-\sqrt{\frac{h}{\ell}}\right)}{h}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (if (<=
      (*
       (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
       (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D_m) (* 2.0 d)) 2.0)) (/ h l))))
      -2e-181)
   (/ (* d (- (sqrt (/ h l)))) h)
   (* (sqrt (/ d h)) (sqrt (/ d l)))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double tmp;
	if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D_m) / (2.0 * d)), 2.0)) * (h / l)))) <= -2e-181) {
		tmp = (d * -sqrt((h / l))) / h;
	} else {
		tmp = sqrt((d / h)) * sqrt((d / l));
	}
	return tmp;
}
D_m =     private
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(d, h, l, m, d_m)
use fmin_fmax_functions
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_m
    real(8) :: tmp
    if (((((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_m) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= (-2d-181)) then
        tmp = (d * -sqrt((h / l))) / h
    else
        tmp = sqrt((d / h)) * sqrt((d / l))
    end if
    code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	double tmp;
	if (((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_m) / (2.0 * d)), 2.0)) * (h / l)))) <= -2e-181) {
		tmp = (d * -Math.sqrt((h / l))) / h;
	} else {
		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
	}
	return tmp;
}
D_m = math.fabs(D)
[d, h, l, M, D_m] = sort([d, h, l, M, D_m])
def code(d, h, l, M, D_m):
	tmp = 0
	if ((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_m) / (2.0 * d)), 2.0)) * (h / l)))) <= -2e-181:
		tmp = (d * -math.sqrt((h / l))) / h
	else:
		tmp = math.sqrt((d / h)) * math.sqrt((d / l))
	return tmp
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	tmp = 0.0
	if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= -2e-181)
		tmp = Float64(Float64(d * Float64(-sqrt(Float64(h / l)))) / h);
	else
		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
	end
	return tmp
end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
	tmp = 0.0;
	if (((((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D_m) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= -2e-181)
		tmp = (d * -sqrt((h / l))) / h;
	else
		tmp = sqrt((d / h)) * sqrt((d / l));
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-181], N[(N[(d * (-N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / h), $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -2 \cdot 10^{-181}:\\
\;\;\;\;\frac{d \cdot \left(-\sqrt{\frac{h}{\ell}}\right)}{h}\\

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


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

    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. Add Preprocessing
    3. 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}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \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}}}{\color{blue}{h}} \]
    5. Applied rewrites51.4%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}}, \sqrt{\frac{h}{\ell}} \cdot d\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. associate-*l*N/A

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

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

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

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

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

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

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

    if -2.00000000000000009e-181 < (*.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 56.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. Add Preprocessing
    3. Taylor expanded in d around 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}{\left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)} \]
    4. Step-by-step derivation
      1. 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 \frac{\frac{-1}{8} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2} \cdot \ell}} \]
      2. 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 \frac{\frac{-1}{8} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2} \cdot \ell}} \]
      3. 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 \frac{\frac{-1}{8} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{\color{blue}{{d}^{2}} \cdot \ell} \]
      4. associate-*r*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \frac{\frac{-1}{8} \cdot \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot h\right)}{{d}^{\color{blue}{2}} \cdot \ell} \]
      5. 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 \frac{\frac{-1}{8} \cdot \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot h\right)}{{d}^{\color{blue}{2}} \cdot \ell} \]
      6. pow-prod-downN/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \frac{\frac{-1}{8} \cdot \left({\left(M \cdot D\right)}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \]
      8. lower-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 \frac{\frac{-1}{8} \cdot \left({\left(M \cdot D\right)}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \]
      9. *-commutativeN/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \frac{\frac{-1}{8} \cdot \left({\left(D \cdot M\right)}^{2} \cdot h\right)}{\left(d \cdot d\right) \cdot \ell} \]
      13. lower-*.f642.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 \frac{-0.125 \cdot \left({\left(D \cdot M\right)}^{2} \cdot h\right)}{\left(d \cdot d\right) \cdot \ell} \]
    5. Applied rewrites2.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 \color{blue}{\frac{-0.125 \cdot \left({\left(D \cdot M\right)}^{2} \cdot h\right)}{\left(d \cdot d\right) \cdot \ell}} \]
    6. Applied rewrites2.5%

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

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

        \[\leadsto \sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}} \]
      2. lift-/.f6459.0

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

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

Alternative 6: 72.4% accurate, 1.5× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} t_0 := \frac{M}{2} \cdot \frac{D\_m}{d}\\ \mathbf{if}\;d \leq -1.7 \cdot 10^{-81}:\\ \;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\ \mathbf{elif}\;d \leq 1.45 \cdot 10^{-166}:\\ \;\;\;\;\frac{\left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \frac{{\left(M \cdot D\_m\right)}^{2}}{d}\right) \cdot -0.125}{h}\\ \mathbf{else}:\\ \;\;\;\;\left({\left(\ell \cdot h\right)}^{-0.5} \cdot d\right) \cdot \left(1 - \frac{\left({t\_0}^{2} \cdot 0.5\right) \cdot h}{\ell}\right)\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (let* ((t_0 (* (/ M 2.0) (/ D_m d))))
   (if (<= d -1.7e-81)
     (*
      (* (sqrt (/ d l)) (sqrt (/ d h)))
      (- 1.0 (/ (* (* (* t_0 t_0) 0.5) h) l)))
     (if (<= d 1.45e-166)
       (/ (* (* (pow (/ h l) 1.5) (/ (pow (* M D_m) 2.0) d)) -0.125) h)
       (*
        (* (pow (* l h) -0.5) d)
        (- 1.0 (/ (* (* (pow t_0 2.0) 0.5) h) l)))))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double t_0 = (M / 2.0) * (D_m / d);
	double tmp;
	if (d <= -1.7e-81) {
		tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
	} else if (d <= 1.45e-166) {
		tmp = ((pow((h / l), 1.5) * (pow((M * D_m), 2.0) / d)) * -0.125) / h;
	} else {
		tmp = (pow((l * h), -0.5) * d) * (1.0 - (((pow(t_0, 2.0) * 0.5) * h) / l));
	}
	return tmp;
}
D_m =     private
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(d, h, l, m, d_m)
use fmin_fmax_functions
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (m / 2.0d0) * (d_m / d)
    if (d <= (-1.7d-81)) then
        tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - ((((t_0 * t_0) * 0.5d0) * h) / l))
    else if (d <= 1.45d-166) then
        tmp = ((((h / l) ** 1.5d0) * (((m * d_m) ** 2.0d0) / d)) * (-0.125d0)) / h
    else
        tmp = (((l * h) ** (-0.5d0)) * d) * (1.0d0 - ((((t_0 ** 2.0d0) * 0.5d0) * h) / l))
    end if
    code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	double t_0 = (M / 2.0) * (D_m / d);
	double tmp;
	if (d <= -1.7e-81) {
		tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
	} else if (d <= 1.45e-166) {
		tmp = ((Math.pow((h / l), 1.5) * (Math.pow((M * D_m), 2.0) / d)) * -0.125) / h;
	} else {
		tmp = (Math.pow((l * h), -0.5) * d) * (1.0 - (((Math.pow(t_0, 2.0) * 0.5) * h) / l));
	}
	return tmp;
}
D_m = math.fabs(D)
[d, h, l, M, D_m] = sort([d, h, l, M, D_m])
def code(d, h, l, M, D_m):
	t_0 = (M / 2.0) * (D_m / d)
	tmp = 0
	if d <= -1.7e-81:
		tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l))
	elif d <= 1.45e-166:
		tmp = ((math.pow((h / l), 1.5) * (math.pow((M * D_m), 2.0) / d)) * -0.125) / h
	else:
		tmp = (math.pow((l * h), -0.5) * d) * (1.0 - (((math.pow(t_0, 2.0) * 0.5) * h) / l))
	return tmp
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	t_0 = Float64(Float64(M / 2.0) * Float64(D_m / d))
	tmp = 0.0
	if (d <= -1.7e-81)
		tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * t_0) * 0.5) * h) / l)));
	elseif (d <= 1.45e-166)
		tmp = Float64(Float64(Float64((Float64(h / l) ^ 1.5) * Float64((Float64(M * D_m) ^ 2.0) / d)) * -0.125) / h);
	else
		tmp = Float64(Float64((Float64(l * h) ^ -0.5) * d) * Float64(1.0 - Float64(Float64(Float64((t_0 ^ 2.0) * 0.5) * h) / l)));
	end
	return tmp
end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
	t_0 = (M / 2.0) * (D_m / d);
	tmp = 0.0;
	if (d <= -1.7e-81)
		tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
	elseif (d <= 1.45e-166)
		tmp = ((((h / l) ^ 1.5) * (((M * D_m) ^ 2.0) / d)) * -0.125) / h;
	else
		tmp = (((l * h) ^ -0.5) * d) * (1.0 - ((((t_0 ^ 2.0) * 0.5) * h) / l));
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.7e-81], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.45e-166], N[(N[(N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] * N[(N[Power[N[(M * D$95$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] * N[(1.0 - N[(N[(N[(N[Power[t$95$0, 2.0], $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M}{2} \cdot \frac{D\_m}{d}\\
\mathbf{if}\;d \leq -1.7 \cdot 10^{-81}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\

\mathbf{elif}\;d \leq 1.45 \cdot 10^{-166}:\\
\;\;\;\;\frac{\left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \frac{{\left(M \cdot D\_m\right)}^{2}}{d}\right) \cdot -0.125}{h}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.6999999999999999e-81

    1. Initial program 76.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. Add Preprocessing
    3. 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) \]
    4. Applied rewrites79.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) \]
    5. 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 - \frac{\left({\left(\frac{M}{2} \cdot \color{blue}{\frac{D}{d}}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      2. 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 - \frac{\left({\color{blue}{\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)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left({\left(\color{blue}{\frac{M}{2}} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      4. frac-timesN/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left({\left(\frac{\color{blue}{D \cdot M}}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot 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 - \frac{\left({\left(\frac{\color{blue}{D \cdot M}}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      8. lift-*.f6479.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 - \frac{\left({\left(\frac{D \cdot M}{\color{blue}{2 \cdot d}}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right) \]
    6. Applied rewrites79.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 - \frac{\left({\color{blue}{\left(\frac{D \cdot M}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot h}{\ell}\right) \]
    7. 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      13. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.6999999999999999e-81 < d < 1.45e-166

    1. Initial program 45.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. Add Preprocessing
    3. 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}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \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}}}{\color{blue}{h}} \]
    5. Applied rewrites47.9%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}}, \sqrt{\frac{h}{\ell}} \cdot d\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. lower-*.f64N/A

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

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

    if 1.45e-166 < d

    1. Initial program 74.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. Add Preprocessing
    3. 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) \]
    4. Applied rewrites75.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 \left(1 - \color{blue}{\frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}}\right) \]
    5. 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) \]
    6. Step-by-step derivation
      1. *-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) \]
      2. 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) \]
      3. 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) \]
      4. *-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) \]
      5. 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) \]
      6. 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) \]
      7. 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) \]
      8. metadata-eval78.5

        \[\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) \]
    7. Applied rewrites78.5%

      \[\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 7: 75.0% accurate, 1.6× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} t_0 := \frac{M}{2} \cdot \frac{D\_m}{d}\\ t_1 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;d \leq -1.7 \cdot 10^{-81}:\\ \;\;\;\;\left(t\_1 \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\ \mathbf{elif}\;d \leq 7.8 \cdot 10^{-182}:\\ \;\;\;\;\frac{\left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \frac{{\left(M \cdot D\_m\right)}^{2}}{d}\right) \cdot -0.125}{h}\\ \mathbf{else}:\\ \;\;\;\;\left(t\_1 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right) \cdot \left(1 - \frac{\left({\left(\frac{D\_m \cdot M}{2 \cdot d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right)\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (let* ((t_0 (* (/ M 2.0) (/ D_m d))) (t_1 (sqrt (/ d l))))
   (if (<= d -1.7e-81)
     (* (* t_1 (sqrt (/ d h))) (- 1.0 (/ (* (* (* t_0 t_0) 0.5) h) l)))
     (if (<= d 7.8e-182)
       (/ (* (* (pow (/ h l) 1.5) (/ (pow (* M D_m) 2.0) d)) -0.125) h)
       (*
        (* t_1 (/ (sqrt d) (sqrt h)))
        (- 1.0 (/ (* (* (pow (/ (* D_m M) (* 2.0 d)) 2.0) 0.5) h) l)))))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double t_0 = (M / 2.0) * (D_m / d);
	double t_1 = sqrt((d / l));
	double tmp;
	if (d <= -1.7e-81) {
		tmp = (t_1 * sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
	} else if (d <= 7.8e-182) {
		tmp = ((pow((h / l), 1.5) * (pow((M * D_m), 2.0) / d)) * -0.125) / h;
	} else {
		tmp = (t_1 * (sqrt(d) / sqrt(h))) * (1.0 - (((pow(((D_m * M) / (2.0 * d)), 2.0) * 0.5) * h) / l));
	}
	return tmp;
}
D_m =     private
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(d, h, l, m, d_m)
use fmin_fmax_functions
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (m / 2.0d0) * (d_m / d)
    t_1 = sqrt((d / l))
    if (d <= (-1.7d-81)) then
        tmp = (t_1 * sqrt((d / h))) * (1.0d0 - ((((t_0 * t_0) * 0.5d0) * h) / l))
    else if (d <= 7.8d-182) then
        tmp = ((((h / l) ** 1.5d0) * (((m * d_m) ** 2.0d0) / d)) * (-0.125d0)) / h
    else
        tmp = (t_1 * (sqrt(d) / sqrt(h))) * (1.0d0 - ((((((d_m * m) / (2.0d0 * d)) ** 2.0d0) * 0.5d0) * h) / l))
    end if
    code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	double t_0 = (M / 2.0) * (D_m / d);
	double t_1 = Math.sqrt((d / l));
	double tmp;
	if (d <= -1.7e-81) {
		tmp = (t_1 * Math.sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
	} else if (d <= 7.8e-182) {
		tmp = ((Math.pow((h / l), 1.5) * (Math.pow((M * D_m), 2.0) / d)) * -0.125) / h;
	} else {
		tmp = (t_1 * (Math.sqrt(d) / Math.sqrt(h))) * (1.0 - (((Math.pow(((D_m * M) / (2.0 * d)), 2.0) * 0.5) * h) / l));
	}
	return tmp;
}
D_m = math.fabs(D)
[d, h, l, M, D_m] = sort([d, h, l, M, D_m])
def code(d, h, l, M, D_m):
	t_0 = (M / 2.0) * (D_m / d)
	t_1 = math.sqrt((d / l))
	tmp = 0
	if d <= -1.7e-81:
		tmp = (t_1 * math.sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l))
	elif d <= 7.8e-182:
		tmp = ((math.pow((h / l), 1.5) * (math.pow((M * D_m), 2.0) / d)) * -0.125) / h
	else:
		tmp = (t_1 * (math.sqrt(d) / math.sqrt(h))) * (1.0 - (((math.pow(((D_m * M) / (2.0 * d)), 2.0) * 0.5) * h) / l))
	return tmp
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	t_0 = Float64(Float64(M / 2.0) * Float64(D_m / d))
	t_1 = sqrt(Float64(d / l))
	tmp = 0.0
	if (d <= -1.7e-81)
		tmp = Float64(Float64(t_1 * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * t_0) * 0.5) * h) / l)));
	elseif (d <= 7.8e-182)
		tmp = Float64(Float64(Float64((Float64(h / l) ^ 1.5) * Float64((Float64(M * D_m) ^ 2.0) / d)) * -0.125) / h);
	else
		tmp = Float64(Float64(t_1 * Float64(sqrt(d) / sqrt(h))) * Float64(1.0 - Float64(Float64(Float64((Float64(Float64(D_m * M) / Float64(2.0 * d)) ^ 2.0) * 0.5) * h) / l)));
	end
	return tmp
end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
	t_0 = (M / 2.0) * (D_m / d);
	t_1 = sqrt((d / l));
	tmp = 0.0;
	if (d <= -1.7e-81)
		tmp = (t_1 * sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
	elseif (d <= 7.8e-182)
		tmp = ((((h / l) ^ 1.5) * (((M * D_m) ^ 2.0) / d)) * -0.125) / h;
	else
		tmp = (t_1 * (sqrt(d) / sqrt(h))) * (1.0 - ((((((D_m * M) / (2.0 * d)) ^ 2.0) * 0.5) * h) / l));
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.7e-81], N[(N[(t$95$1 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.8e-182], N[(N[(N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] * N[(N[Power[N[(M * D$95$m), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] / h), $MachinePrecision], N[(N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M}{2} \cdot \frac{D\_m}{d}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -1.7 \cdot 10^{-81}:\\
\;\;\;\;\left(t\_1 \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\

\mathbf{elif}\;d \leq 7.8 \cdot 10^{-182}:\\
\;\;\;\;\frac{\left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \frac{{\left(M \cdot D\_m\right)}^{2}}{d}\right) \cdot -0.125}{h}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.6999999999999999e-81

    1. Initial program 76.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. Add Preprocessing
    3. 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) \]
    4. Applied rewrites79.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) \]
    5. 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 - \frac{\left({\left(\frac{M}{2} \cdot \color{blue}{\frac{D}{d}}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      2. 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 - \frac{\left({\color{blue}{\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)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left({\left(\color{blue}{\frac{M}{2}} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      4. frac-timesN/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left({\left(\frac{\color{blue}{D \cdot M}}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot 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 - \frac{\left({\left(\frac{\color{blue}{D \cdot M}}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      8. lift-*.f6479.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 - \frac{\left({\left(\frac{D \cdot M}{\color{blue}{2 \cdot d}}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right) \]
    6. Applied rewrites79.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 - \frac{\left({\color{blue}{\left(\frac{D \cdot M}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot h}{\ell}\right) \]
    7. 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      13. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.6999999999999999e-81 < d < 7.8e-182

    1. Initial program 44.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. Add Preprocessing
    3. 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}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \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}}}{\color{blue}{h}} \]
    5. Applied rewrites47.7%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-0.125 \cdot \frac{{\left(D \cdot M\right)}^{2}}{d}, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}}, \sqrt{\frac{h}{\ell}} \cdot d\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. lower-*.f64N/A

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

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

    if 7.8e-182 < d

    1. Initial program 73.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. Add Preprocessing
    3. 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) \]
    4. Applied rewrites75.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) \]
    5. 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 - \frac{\left({\left(\frac{M}{2} \cdot \color{blue}{\frac{D}{d}}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      2. 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 - \frac{\left({\color{blue}{\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)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left({\left(\color{blue}{\frac{M}{2}} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      4. frac-timesN/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left({\left(\frac{\color{blue}{D \cdot M}}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot 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 - \frac{\left({\left(\frac{\color{blue}{D \cdot M}}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      8. lift-*.f6475.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 - \frac{\left({\left(\frac{D \cdot M}{\color{blue}{2 \cdot d}}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right) \]
    6. Applied rewrites75.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 - \frac{\left({\color{blue}{\left(\frac{D \cdot M}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot h}{\ell}\right) \]
    7. 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      13. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 73.4% accurate, 1.8× speedup?

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

\mathbf{elif}\;d \leq -4.7 \cdot 10^{-197}:\\
\;\;\;\;\left(\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\

\mathbf{elif}\;d \leq 5.2 \cdot 10^{-182}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{\left(M \cdot D\_m\right) \cdot \left(M \cdot D\_m\right)}{d}, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < -2.2000000000000001e-91

    1. Initial program 76.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. Add Preprocessing
    3. 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) \]
    4. Applied rewrites78.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) \]
    5. 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 - \frac{\left({\left(\frac{M}{2} \cdot \color{blue}{\frac{D}{d}}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      2. 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 - \frac{\left({\color{blue}{\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)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left({\left(\color{blue}{\frac{M}{2}} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      4. frac-timesN/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left({\left(\frac{\color{blue}{D \cdot M}}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot 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 - \frac{\left({\left(\frac{\color{blue}{D \cdot M}}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      8. lift-*.f6478.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 - \frac{\left({\left(\frac{D \cdot M}{\color{blue}{2 \cdot d}}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right) \]
    6. Applied rewrites78.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 - \frac{\left({\color{blue}{\left(\frac{D \cdot M}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot h}{\ell}\right) \]
    7. 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      13. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.2000000000000001e-91 < d < -4.7000000000000001e-197

    1. Initial program 57.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. Add Preprocessing
    3. 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) \]
    4. 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-*.f6466.7

        \[\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) \]
    5. Applied rewrites66.7%

      \[\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) \]
    6. Step-by-step derivation
      1. lift-*.f64N/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) \]
      2. lift-pow.f64N/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) \]
      3. unpow-1N/A

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

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\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. lift-*.f6466.7

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\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. Applied rewrites66.7%

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

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

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

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

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

    if -4.7000000000000001e-197 < d < 5.20000000000000011e-182

    1. Initial program 38.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. Add Preprocessing
    3. 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}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \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}}}{\color{blue}{h}} \]
    5. Applied rewrites44.7%

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-1}{8} \cdot \frac{\left(M \cdot D\right) \cdot \left(M \cdot D\right)}{d}, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h} \]
      8. lower-*.f6444.7

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

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

    if 5.20000000000000011e-182 < d

    1. Initial program 73.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. Add Preprocessing
    3. 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) \]
    4. Applied rewrites75.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) \]
    5. 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 - \frac{\left({\left(\frac{M}{2} \cdot \color{blue}{\frac{D}{d}}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      2. 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 - \frac{\left({\color{blue}{\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)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left({\left(\color{blue}{\frac{M}{2}} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      4. frac-timesN/A

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left({\left(\frac{\color{blue}{D \cdot M}}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot 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 - \frac{\left({\left(\frac{\color{blue}{D \cdot M}}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      8. lift-*.f6475.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 - \frac{\left({\left(\frac{D \cdot M}{\color{blue}{2 \cdot d}}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right) \]
    6. Applied rewrites75.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 - \frac{\left({\color{blue}{\left(\frac{D \cdot M}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot h}{\ell}\right) \]
    7. 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      13. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 69.6% accurate, 1.9× speedup?

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

\mathbf{elif}\;d \leq -4.7 \cdot 10^{-197}:\\
\;\;\;\;\left(\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\

\mathbf{elif}\;d \leq 4.6 \cdot 10^{-166}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \frac{\left(M \cdot D\_m\right) \cdot \left(M \cdot D\_m\right)}{d}, \sqrt{{\left(\frac{h}{\ell}\right)}^{3}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -2.2000000000000001e-91 or 4.59999999999999997e-166 < d

    1. Initial program 75.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. Add Preprocessing
    3. 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) \]
    4. Applied rewrites77.2%

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

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left({\left(\frac{\color{blue}{D \cdot M}}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot 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 - \frac{\left({\left(\frac{\color{blue}{D \cdot M}}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      8. lift-*.f6477.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 - \frac{\left({\left(\frac{D \cdot M}{\color{blue}{2 \cdot d}}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right) \]
    6. Applied rewrites77.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 - \frac{\left({\color{blue}{\left(\frac{D \cdot M}{2 \cdot d}\right)}}^{2} \cdot 0.5\right) \cdot h}{\ell}\right) \]
    7. 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot 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{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      13. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.2000000000000001e-91 < d < -4.7000000000000001e-197

    1. Initial program 57.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. Add Preprocessing
    3. 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) \]
    4. 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-*.f6466.7

        \[\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) \]
    5. Applied rewrites66.7%

      \[\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) \]
    6. Step-by-step derivation
      1. lift-*.f64N/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) \]
      2. lift-pow.f64N/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) \]
      3. unpow-1N/A

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

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\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. lift-*.f6466.7

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\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. Applied rewrites66.7%

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

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

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

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

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

    if -4.7000000000000001e-197 < d < 4.59999999999999997e-166

    1. Initial program 39.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. Add Preprocessing
    3. 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}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \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}}}{\color{blue}{h}} \]
    5. Applied rewrites45.2%

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

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

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

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

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

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

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

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

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

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

Alternative 10: 69.5% accurate, 2.0× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} t_0 := \frac{M}{2} \cdot \frac{D\_m}{d}\\ t_1 := \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\ \mathbf{if}\;d \leq -2.2 \cdot 10^{-91}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;d \leq -3.6 \cdot 10^{-284}:\\ \;\;\;\;\left(\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (let* ((t_0 (* (/ M 2.0) (/ D_m d)))
        (t_1
         (*
          (* (sqrt (/ d l)) (sqrt (/ d h)))
          (- 1.0 (/ (* (* (* t_0 t_0) 0.5) h) l)))))
   (if (<= d -2.2e-91)
     t_1
     (if (<= d -3.6e-284)
       (*
        (* (- d) (sqrt (/ 1.0 (* l h))))
        (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D_m) (* 2.0 d)) 2.0)) (/ h l))))
       t_1))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double t_0 = (M / 2.0) * (D_m / d);
	double t_1 = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
	double tmp;
	if (d <= -2.2e-91) {
		tmp = t_1;
	} else if (d <= -3.6e-284) {
		tmp = (-d * sqrt((1.0 / (l * h)))) * (1.0 - (((1.0 / 2.0) * pow(((M * D_m) / (2.0 * d)), 2.0)) * (h / l)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
D_m =     private
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(d, h, l, m, d_m)
use fmin_fmax_functions
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (m / 2.0d0) * (d_m / d)
    t_1 = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - ((((t_0 * t_0) * 0.5d0) * h) / l))
    if (d <= (-2.2d-91)) then
        tmp = t_1
    else if (d <= (-3.6d-284)) then
        tmp = (-d * sqrt((1.0d0 / (l * h)))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_m) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
    else
        tmp = t_1
    end if
    code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	double t_0 = (M / 2.0) * (D_m / d);
	double t_1 = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
	double tmp;
	if (d <= -2.2e-91) {
		tmp = t_1;
	} else if (d <= -3.6e-284) {
		tmp = (-d * Math.sqrt((1.0 / (l * h)))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D_m) / (2.0 * d)), 2.0)) * (h / l)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
D_m = math.fabs(D)
[d, h, l, M, D_m] = sort([d, h, l, M, D_m])
def code(d, h, l, M, D_m):
	t_0 = (M / 2.0) * (D_m / d)
	t_1 = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l))
	tmp = 0
	if d <= -2.2e-91:
		tmp = t_1
	elif d <= -3.6e-284:
		tmp = (-d * math.sqrt((1.0 / (l * h)))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D_m) / (2.0 * d)), 2.0)) * (h / l)))
	else:
		tmp = t_1
	return tmp
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	t_0 = Float64(Float64(M / 2.0) * Float64(D_m / d))
	t_1 = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * t_0) * 0.5) * h) / l)))
	tmp = 0.0
	if (d <= -2.2e-91)
		tmp = t_1;
	elseif (d <= -3.6e-284)
		tmp = Float64(Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(l * h)))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))));
	else
		tmp = t_1;
	end
	return tmp
end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
	t_0 = (M / 2.0) * (D_m / d);
	t_1 = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
	tmp = 0.0;
	if (d <= -2.2e-91)
		tmp = t_1;
	elseif (d <= -3.6e-284)
		tmp = (-d * sqrt((1.0 / (l * h)))) * (1.0 - (((1.0 / 2.0) * (((M * D_m) / (2.0 * d)) ^ 2.0)) * (h / l)));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.2e-91], t$95$1, If[LessEqual[d, -3.6e-284], N[(N[((-d) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M}{2} \cdot \frac{D\_m}{d}\\
t_1 := \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\
\mathbf{if}\;d \leq -2.2 \cdot 10^{-91}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;d \leq -3.6 \cdot 10^{-284}:\\
\;\;\;\;\left(\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -2.2000000000000001e-91 or -3.6000000000000002e-284 < d

    1. Initial program 69.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. Add Preprocessing
    3. 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) \]
    4. Applied rewrites70.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) \]
    5. 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 - \frac{\left({\left(\frac{M}{2} \cdot \color{blue}{\frac{D}{d}}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      2. 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 - \frac{\left({\color{blue}{\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)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left({\left(\color{blue}{\frac{M}{2}} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      4. frac-timesN/A

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

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

        \[\leadsto \left({\left(\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{D \cdot M}{\color{blue}{2 \cdot d}}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right) \]
    6. Applied rewrites71.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.2000000000000001e-91 < d < -3.6000000000000002e-284

    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. Add Preprocessing
    3. 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) \]
    4. 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-*.f6462.1

        \[\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) \]
    5. Applied rewrites62.1%

      \[\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) \]
    6. Step-by-step derivation
      1. lift-*.f64N/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) \]
      2. lift-pow.f64N/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) \]
      3. unpow-1N/A

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

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\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. lift-*.f6462.1

        \[\leadsto \left(\left(-1 \cdot d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\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. Applied rewrites62.1%

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

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

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

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

      \[\leadsto \left(\left(-d\right) \cdot \sqrt{\color{blue}{\frac{1}{\ell \cdot h}}}\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. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 67.3% accurate, 3.0× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} t_0 := \frac{M}{2} \cdot \frac{D\_m}{d}\\ \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\right) \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (let* ((t_0 (* (/ M 2.0) (/ D_m d))))
   (*
    (* (sqrt (/ d l)) (sqrt (/ d h)))
    (- 1.0 (/ (* (* (* t_0 t_0) 0.5) h) l)))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double t_0 = (M / 2.0) * (D_m / d);
	return (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
}
D_m =     private
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(d, h, l, m, d_m)
use fmin_fmax_functions
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_m
    real(8) :: t_0
    t_0 = (m / 2.0d0) * (d_m / d)
    code = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - ((((t_0 * t_0) * 0.5d0) * h) / l))
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	double t_0 = (M / 2.0) * (D_m / d);
	return (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
}
D_m = math.fabs(D)
[d, h, l, M, D_m] = sort([d, h, l, M, D_m])
def code(d, h, l, M, D_m):
	t_0 = (M / 2.0) * (D_m / d)
	return (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l))
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	t_0 = Float64(Float64(M / 2.0) * Float64(D_m / d))
	return Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * t_0) * 0.5) * h) / l)))
end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp = code(d, h, l, M, D_m)
	t_0 = (M / 2.0) * (D_m / d);
	tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(M / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M}{2} \cdot \frac{D\_m}{d}\\
\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\right)
\end{array}
\end{array}
Derivation
  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. Add Preprocessing
  3. 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) \]
  4. Applied rewrites67.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) \]
  5. 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 - \frac{\left({\left(\frac{M}{2} \cdot \color{blue}{\frac{D}{d}}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
    2. 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 - \frac{\left({\color{blue}{\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)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left({\left(\color{blue}{\frac{M}{2}} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
    4. frac-timesN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 39.0% accurate, 9.4× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -2.4 \cdot 10^{-82}:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
 :precision binary64
 (if (<= d -2.4e-82) (/ (* (sqrt (/ h l)) d) h) (* (sqrt (/ (/ 1.0 l) h)) d)))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
	double tmp;
	if (d <= -2.4e-82) {
		tmp = (sqrt((h / l)) * d) / h;
	} else {
		tmp = sqrt(((1.0 / l) / h)) * d;
	}
	return tmp;
}
D_m =     private
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(d, h, l, m, d_m)
use fmin_fmax_functions
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_m
    real(8) :: tmp
    if (d <= (-2.4d-82)) then
        tmp = (sqrt((h / l)) * d) / h
    else
        tmp = sqrt(((1.0d0 / l) / h)) * d
    end if
    code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
	double tmp;
	if (d <= -2.4e-82) {
		tmp = (Math.sqrt((h / l)) * d) / h;
	} else {
		tmp = Math.sqrt(((1.0 / l) / h)) * d;
	}
	return tmp;
}
D_m = math.fabs(D)
[d, h, l, M, D_m] = sort([d, h, l, M, D_m])
def code(d, h, l, M, D_m):
	tmp = 0
	if d <= -2.4e-82:
		tmp = (math.sqrt((h / l)) * d) / h
	else:
		tmp = math.sqrt(((1.0 / l) / h)) * d
	return tmp
D_m = abs(D)
d, h, l, M, D_m = sort([d, h, l, M, D_m])
function code(d, h, l, M, D_m)
	tmp = 0.0
	if (d <= -2.4e-82)
		tmp = Float64(Float64(sqrt(Float64(h / l)) * d) / h);
	else
		tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * d);
	end
	return tmp
end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
	tmp = 0.0;
	if (d <= -2.4e-82)
		tmp = (sqrt((h / l)) * d) / h;
	else
		tmp = sqrt(((1.0 / l) / h)) * d;
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[d, -2.4e-82], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / h), $MachinePrecision], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.4 \cdot 10^{-82}:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -2.40000000000000008e-82

    1. Initial program 76.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. Add Preprocessing
    3. 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}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \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}}}{\color{blue}{h}} \]
    5. Applied rewrites49.7%

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

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

        \[\leadsto \frac{\sqrt{\frac{h}{\ell}} \cdot d}{h} \]
      4. lift-*.f6447.8

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

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

    if -2.40000000000000008e-82 < d

    1. Initial program 61.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. Add Preprocessing
    3. Taylor expanded in d around inf

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    4. 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-*.f6434.7

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

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

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

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      5. lift-*.f6434.7

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

      \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
    8. Step-by-step derivation
      1. Applied rewrites34.7%

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

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

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

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

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

          \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d \]
      3. Applied rewrites35.0%

        \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d \]
    9. Recombined 2 regimes into one program.
    10. Add Preprocessing

    Alternative 13: 26.3% accurate, 10.9× speedup?

    \[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d \end{array} \]
    D_m = (fabs.f64 D)
    NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
    (FPCore (d h l M D_m) :precision binary64 (* (sqrt (/ (/ 1.0 l) h)) d))
    D_m = fabs(D);
    assert(d < h && h < l && l < M && M < D_m);
    double code(double d, double h, double l, double M, double D_m) {
    	return sqrt(((1.0 / l) / h)) * d;
    }
    
    D_m =     private
    NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(d, h, l, m, d_m)
    use fmin_fmax_functions
        real(8), intent (in) :: d
        real(8), intent (in) :: h
        real(8), intent (in) :: l
        real(8), intent (in) :: m
        real(8), intent (in) :: d_m
        code = sqrt(((1.0d0 / l) / h)) * d
    end function
    
    D_m = Math.abs(D);
    assert d < h && h < l && l < M && M < D_m;
    public static double code(double d, double h, double l, double M, double D_m) {
    	return Math.sqrt(((1.0 / l) / h)) * d;
    }
    
    D_m = math.fabs(D)
    [d, h, l, M, D_m] = sort([d, h, l, M, D_m])
    def code(d, h, l, M, D_m):
    	return math.sqrt(((1.0 / l) / h)) * d
    
    D_m = abs(D)
    d, h, l, M, D_m = sort([d, h, l, M, D_m])
    function code(d, h, l, M, D_m)
    	return Float64(sqrt(Float64(Float64(1.0 / l) / h)) * d)
    end
    
    D_m = abs(D);
    d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
    function tmp = code(d, h, l, M, D_m)
    	tmp = sqrt(((1.0 / l) / h)) * d;
    end
    
    D_m = N[Abs[D], $MachinePrecision]
    NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
    code[d_, h_, l_, M_, D$95$m_] := N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]
    
    \begin{array}{l}
    D_m = \left|D\right|
    \\
    [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
    \\
    \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d
    \end{array}
    
    Derivation
    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. Add Preprocessing
    3. Taylor expanded in d around inf

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    4. 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.1

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

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

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

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      5. lift-*.f6426.1

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

      \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
    8. Step-by-step derivation
      1. Applied rewrites26.1%

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

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

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

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

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

          \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d \]
      3. Applied rewrites26.3%

        \[\leadsto \sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d \]
      4. Add Preprocessing

      Alternative 14: 26.1% accurate, 12.9× speedup?

      \[\begin{array}{l} D_m = \left|D\right| \\ [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\ \\ \sqrt{\frac{1}{\ell \cdot h}} \cdot d \end{array} \]
      D_m = (fabs.f64 D)
      NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
      (FPCore (d h l M D_m) :precision binary64 (* (sqrt (/ 1.0 (* l h))) d))
      D_m = fabs(D);
      assert(d < h && h < l && l < M && M < D_m);
      double code(double d, double h, double l, double M, double D_m) {
      	return sqrt((1.0 / (l * h))) * d;
      }
      
      D_m =     private
      NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(d, h, l, m, d_m)
      use fmin_fmax_functions
          real(8), intent (in) :: d
          real(8), intent (in) :: h
          real(8), intent (in) :: l
          real(8), intent (in) :: m
          real(8), intent (in) :: d_m
          code = sqrt((1.0d0 / (l * h))) * d
      end function
      
      D_m = Math.abs(D);
      assert d < h && h < l && l < M && M < D_m;
      public static double code(double d, double h, double l, double M, double D_m) {
      	return Math.sqrt((1.0 / (l * h))) * d;
      }
      
      D_m = math.fabs(D)
      [d, h, l, M, D_m] = sort([d, h, l, M, D_m])
      def code(d, h, l, M, D_m):
      	return math.sqrt((1.0 / (l * h))) * d
      
      D_m = abs(D)
      d, h, l, M, D_m = sort([d, h, l, M, D_m])
      function code(d, h, l, M, D_m)
      	return Float64(sqrt(Float64(1.0 / Float64(l * h))) * d)
      end
      
      D_m = abs(D);
      d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
      function tmp = code(d, h, l, M, D_m)
      	tmp = sqrt((1.0 / (l * h))) * d;
      end
      
      D_m = N[Abs[D], $MachinePrecision]
      NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
      code[d_, h_, l_, M_, D$95$m_] := N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]
      
      \begin{array}{l}
      D_m = \left|D\right|
      \\
      [d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
      \\
      \sqrt{\frac{1}{\ell \cdot h}} \cdot d
      \end{array}
      
      Derivation
      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. Add Preprocessing
      3. Taylor expanded in d around inf

        \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      4. 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.1

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

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

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

          \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
        5. lift-*.f6426.1

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

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      8. Add Preprocessing

      Reproduce

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