Henrywood and Agarwal, Equation (12)

Percentage Accurate: 36.1% → 73.4%
Time: 12.6s
Alternatives: 23
Speedup: 10.2×

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

\[\begin{array}{l} \\ \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (*
  (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
  (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
	return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(d, h, l, m, d_1)
use fmin_fmax_functions
    real(8), intent (in) :: d
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d_1
    code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
	return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D):
	return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D)
	return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
end
function tmp = code(d, h, l, M, D)
	tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)));
end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 73.4% accurate, 1.7× speedup?

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

\mathbf{elif}\;\ell \leq 6 \cdot 10^{+67}:\\
\;\;\;\;\frac{\left|d\_m\right|}{\sqrt{h \cdot \ell}} \cdot \left(1 - \left(\left(t\_2 \cdot t\_2\right) \cdot 0.5\right) \cdot \frac{h}{\ell}\right)\\

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


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

    1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2 < l < 6.0000000000000002e67

    1. Initial program 36.1%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{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) \]
      13. sqrt-unprodN/A

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \color{blue}{\frac{d}{h}}} \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. Applied rewrites55.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.0000000000000002e67 < l

    1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 73.0% accurate, 1.7× speedup?

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

\mathbf{elif}\;\ell \leq 6 \cdot 10^{+67}:\\
\;\;\;\;\frac{\left|d\_m\right|}{\sqrt{h \cdot \ell}} \cdot \left(1 - \left(\left(t\_2 \cdot t\_2\right) \cdot 0.5\right) \cdot \frac{h}{\ell}\right)\\

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


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

    1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2 < l < 6.0000000000000002e67

    1. Initial program 36.1%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{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) \]
      13. sqrt-unprodN/A

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \color{blue}{\frac{d}{h}}} \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. Applied rewrites55.9%

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

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

    if 6.0000000000000002e67 < l

    1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 71.7% accurate, 1.7× speedup?

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

\mathbf{elif}\;\ell \leq 9.5 \cdot 10^{-166}:\\
\;\;\;\;\frac{\left|d\_m\right|}{\sqrt{h \cdot \ell}} \cdot \left(1 - \frac{\left(\frac{t\_2}{\left(d\_m + d\_m\right) \cdot \left(d\_m + d\_m\right)} \cdot 0.5\right) \cdot h}{\ell}\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t\_2}{t\_1} \cdot -0.125, h, \frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right)\\


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

    1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2 < l < 9.50000000000000046e-166

    1. Initial program 36.1%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{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) \]
      13. sqrt-unprodN/A

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \color{blue}{\frac{d}{h}}} \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. Applied rewrites55.9%

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

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

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

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

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

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

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

    if 9.50000000000000046e-166 < l

    1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 70.9% accurate, 1.8× speedup?

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

\mathbf{elif}\;\ell \leq 1.15 \cdot 10^{-170}:\\
\;\;\;\;\frac{\left|d\_m\right|}{\sqrt{h \cdot \ell}} \cdot \mathsf{fma}\left(\frac{t\_0}{\left(d\_m \cdot d\_m\right) \cdot \ell} \cdot -0.125, h, 1\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t\_0}{t\_2} \cdot -0.125, h, \frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right)\\


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

    1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2 < l < 1.14999999999999993e-170

    1. Initial program 36.1%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{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) \]
      13. sqrt-unprodN/A

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \color{blue}{\frac{d}{h}}} \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. Applied rewrites55.9%

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

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

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

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

    if 1.14999999999999993e-170 < l

    1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 68.5% accurate, 1.5× speedup?

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

\mathbf{elif}\;M\_m \cdot D\_m \leq 1.5 \cdot 10^{+106}:\\
\;\;\;\;\frac{\left|d\_m\right|}{\sqrt{h \cdot \ell}} \cdot \mathsf{fma}\left(\frac{\left(D\_m \cdot M\_m\right) \cdot \left(D\_m \cdot M\_m\right)}{\left(d\_m \cdot d\_m\right) \cdot \ell} \cdot -0.125, h, 1\right)\\

\mathbf{elif}\;M\_m \cdot D\_m \leq 10^{+202}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot D\_m}{\left(\ell \cdot d\_m\right) \cdot t\_0}, -0.125, t\_1\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(D\_m \cdot D\_m\right) \cdot \frac{M\_m \cdot M\_m}{\frac{\ell \cdot d\_m}{t\_0}}\right) \cdot -0.125}{\ell}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 M D) < 4.99999999999999976e-178

    1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.99999999999999976e-178 < (*.f64 M D) < 1.5e106

    1. Initial program 36.1%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{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) \]
      13. sqrt-unprodN/A

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \color{blue}{\frac{d}{h}}} \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. Applied rewrites55.9%

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

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

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

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

    if 1.5e106 < (*.f64 M D) < 9.999999999999999e201

    1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.999999999999999e201 < (*.f64 M D)

    1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 68.4% accurate, 1.9× speedup?

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

\mathbf{elif}\;\ell \leq 6.2 \cdot 10^{-208}:\\
\;\;\;\;\frac{\left|d\_m\right|}{\sqrt{h \cdot \ell}} \cdot \mathsf{fma}\left(\frac{t\_0}{\left(d\_m \cdot d\_m\right) \cdot \ell} \cdot -0.125, h, 1\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t\_0}{\left(t\_2 \cdot \ell\right) \cdot d\_m}, -0.125, \frac{d\_m}{t\_2 \cdot h}\right)\\


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

    1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2 < l < 6.1999999999999996e-208

    1. Initial program 36.1%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{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) \]
      13. sqrt-unprodN/A

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \color{blue}{\frac{d}{h}}} \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. Applied rewrites55.9%

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

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

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

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

    if 6.1999999999999996e-208 < l

    1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 67.8% accurate, 1.7× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(D\_m \cdot D\_m\right) \cdot \frac{M\_m \cdot M\_m}{\frac{\ell \cdot d\_m}{t\_0}}\right) \cdot -0.125}{\ell}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 M D) < 4.99999999999999976e-178

    1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.99999999999999976e-178 < (*.f64 M D) < 1e143

    1. Initial program 36.1%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{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) \]
      13. sqrt-unprodN/A

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \color{blue}{\frac{d}{h}}} \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. Applied rewrites55.9%

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

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

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

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

    if 1e143 < (*.f64 M D)

    1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 60.6% accurate, 2.0× speedup?

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

\mathbf{elif}\;M\_m \leq 3.6 \cdot 10^{+75}:\\
\;\;\;\;\frac{\left|d\_m\right|}{\sqrt{h \cdot \ell}} \cdot \mathsf{fma}\left(\left(\frac{h}{\left(d\_m \cdot d\_m\right) \cdot \ell} \cdot \left(M\_m \cdot M\_m\right)\right) \cdot -0.125, D\_m \cdot D\_m, 1\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(D\_m \cdot D\_m\right) \cdot \frac{M\_m \cdot M\_m}{\frac{\ell \cdot d\_m}{t\_0}}\right) \cdot -0.125}{\ell}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if M < 1.55000000000000001e-84

    1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.55000000000000001e-84 < M < 3.6e75

    1. Initial program 36.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. Taylor expanded in D around inf

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

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

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

    if 3.6e75 < M

    1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 58.8% accurate, 2.5× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 2.5000000000000001e-34

    1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.5000000000000001e-34 < M

    1. Initial program 36.1%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{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) \]
      13. sqrt-unprodN/A

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \color{blue}{\frac{d}{h}}} \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. Applied rewrites55.9%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \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. Taylor expanded in d around inf

      \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \color{blue}{1} \]
    5. Step-by-step derivation
      1. Applied rewrites32.9%

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

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

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

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

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

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

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

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

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

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

    Alternative 10: 58.7% accurate, 2.5× speedup?

    \[\begin{array}{l} d_m = \left|d\right| \\ M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;M\_m \leq 2.5 \cdot 10^{-34}:\\ \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(D\_m \cdot D\_m\right)}{\ell \cdot d\_m} \cdot -0.125\\ \end{array} \end{array} \]
    d_m = (fabs.f64 d)
    M_m = (fabs.f64 M)
    D_m = (fabs.f64 D)
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    (FPCore (d_m h l M_m D_m)
     :precision binary64
     (if (<= M_m 2.5e-34)
       (/ d_m (sqrt (* l h)))
       (*
        (/ (* (* (* (* M_m M_m) h) (sqrt (/ 1.0 (* h l)))) (* D_m D_m)) (* l d_m))
        -0.125)))
    d_m = fabs(d);
    M_m = fabs(M);
    D_m = fabs(D);
    assert(d_m < h && h < l && l < M_m && M_m < D_m);
    double code(double d_m, double h, double l, double M_m, double D_m) {
    	double tmp;
    	if (M_m <= 2.5e-34) {
    		tmp = d_m / sqrt((l * h));
    	} else {
    		tmp = (((((M_m * M_m) * h) * sqrt((1.0 / (h * l)))) * (D_m * D_m)) / (l * d_m)) * -0.125;
    	}
    	return tmp;
    }
    
    d_m =     private
    M_m =     private
    D_m =     private
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(d_m, h, l, m_m, d_m_1)
    use fmin_fmax_functions
        real(8), intent (in) :: d_m
        real(8), intent (in) :: h
        real(8), intent (in) :: l
        real(8), intent (in) :: m_m
        real(8), intent (in) :: d_m_1
        real(8) :: tmp
        if (m_m <= 2.5d-34) then
            tmp = d_m / sqrt((l * h))
        else
            tmp = (((((m_m * m_m) * h) * sqrt((1.0d0 / (h * l)))) * (d_m_1 * d_m_1)) / (l * d_m)) * (-0.125d0)
        end if
        code = tmp
    end function
    
    d_m = Math.abs(d);
    M_m = Math.abs(M);
    D_m = Math.abs(D);
    assert d_m < h && h < l && l < M_m && M_m < D_m;
    public static double code(double d_m, double h, double l, double M_m, double D_m) {
    	double tmp;
    	if (M_m <= 2.5e-34) {
    		tmp = d_m / Math.sqrt((l * h));
    	} else {
    		tmp = (((((M_m * M_m) * h) * Math.sqrt((1.0 / (h * l)))) * (D_m * D_m)) / (l * d_m)) * -0.125;
    	}
    	return tmp;
    }
    
    d_m = math.fabs(d)
    M_m = math.fabs(M)
    D_m = math.fabs(D)
    [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m])
    def code(d_m, h, l, M_m, D_m):
    	tmp = 0
    	if M_m <= 2.5e-34:
    		tmp = d_m / math.sqrt((l * h))
    	else:
    		tmp = (((((M_m * M_m) * h) * math.sqrt((1.0 / (h * l)))) * (D_m * D_m)) / (l * d_m)) * -0.125
    	return tmp
    
    d_m = abs(d)
    M_m = abs(M)
    D_m = abs(D)
    d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m])
    function code(d_m, h, l, M_m, D_m)
    	tmp = 0.0
    	if (M_m <= 2.5e-34)
    		tmp = Float64(d_m / sqrt(Float64(l * h)));
    	else
    		tmp = Float64(Float64(Float64(Float64(Float64(Float64(M_m * M_m) * h) * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(D_m * D_m)) / Float64(l * d_m)) * -0.125);
    	end
    	return tmp
    end
    
    d_m = abs(d);
    M_m = abs(M);
    D_m = abs(D);
    d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
    function tmp_2 = code(d_m, h, l, M_m, D_m)
    	tmp = 0.0;
    	if (M_m <= 2.5e-34)
    		tmp = d_m / sqrt((l * h));
    	else
    		tmp = (((((M_m * M_m) * h) * sqrt((1.0 / (h * l)))) * (D_m * D_m)) / (l * d_m)) * -0.125;
    	end
    	tmp_2 = tmp;
    end
    
    d_m = N[Abs[d], $MachinePrecision]
    M_m = N[Abs[M], $MachinePrecision]
    D_m = N[Abs[D], $MachinePrecision]
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[M$95$m, 2.5e-34], N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / N[(l * d$95$m), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]]
    
    \begin{array}{l}
    d_m = \left|d\right|
    \\
    M_m = \left|M\right|
    \\
    D_m = \left|D\right|
    \\
    [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
    \\
    \begin{array}{l}
    \mathbf{if}\;M\_m \leq 2.5 \cdot 10^{-34}:\\
    \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(D\_m \cdot D\_m\right)}{\ell \cdot d\_m} \cdot -0.125\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if M < 2.5000000000000001e-34

      1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 2.5000000000000001e-34 < M

      1. Initial program 36.1%

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

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

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

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

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

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

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

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

          \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{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) \]
        13. sqrt-unprodN/A

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

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

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

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

          \[\leadsto \sqrt{\frac{d}{\ell} \cdot \color{blue}{\frac{d}{h}}} \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. Applied rewrites55.9%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \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. Taylor expanded in d around 0

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

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

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

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

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

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

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

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

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

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

    Alternative 11: 58.5% accurate, 2.7× speedup?

    \[\begin{array}{l} d_m = \left|d\right| \\ M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\ell \cdot h}\\ \mathbf{if}\;M\_m \leq 2.6 \cdot 10^{-34}:\\ \;\;\;\;\frac{d\_m}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(D\_m \cdot D\_m\right) \cdot \frac{\left(M\_m \cdot M\_m\right) \cdot h}{\left(\left|d\_m\right| \cdot t\_0\right) \cdot \ell}\right) \cdot -0.125\\ \end{array} \end{array} \]
    d_m = (fabs.f64 d)
    M_m = (fabs.f64 M)
    D_m = (fabs.f64 D)
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    (FPCore (d_m h l M_m D_m)
     :precision binary64
     (let* ((t_0 (sqrt (* l h))))
       (if (<= M_m 2.6e-34)
         (/ d_m t_0)
         (*
          (* (* D_m D_m) (/ (* (* M_m M_m) h) (* (* (fabs d_m) t_0) l)))
          -0.125))))
    d_m = fabs(d);
    M_m = fabs(M);
    D_m = fabs(D);
    assert(d_m < h && h < l && l < M_m && M_m < D_m);
    double code(double d_m, double h, double l, double M_m, double D_m) {
    	double t_0 = sqrt((l * h));
    	double tmp;
    	if (M_m <= 2.6e-34) {
    		tmp = d_m / t_0;
    	} else {
    		tmp = ((D_m * D_m) * (((M_m * M_m) * h) / ((fabs(d_m) * t_0) * l))) * -0.125;
    	}
    	return tmp;
    }
    
    d_m =     private
    M_m =     private
    D_m =     private
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(d_m, h, l, m_m, d_m_1)
    use fmin_fmax_functions
        real(8), intent (in) :: d_m
        real(8), intent (in) :: h
        real(8), intent (in) :: l
        real(8), intent (in) :: m_m
        real(8), intent (in) :: d_m_1
        real(8) :: t_0
        real(8) :: tmp
        t_0 = sqrt((l * h))
        if (m_m <= 2.6d-34) then
            tmp = d_m / t_0
        else
            tmp = ((d_m_1 * d_m_1) * (((m_m * m_m) * h) / ((abs(d_m) * t_0) * l))) * (-0.125d0)
        end if
        code = tmp
    end function
    
    d_m = Math.abs(d);
    M_m = Math.abs(M);
    D_m = Math.abs(D);
    assert d_m < h && h < l && l < M_m && M_m < D_m;
    public static double code(double d_m, double h, double l, double M_m, double D_m) {
    	double t_0 = Math.sqrt((l * h));
    	double tmp;
    	if (M_m <= 2.6e-34) {
    		tmp = d_m / t_0;
    	} else {
    		tmp = ((D_m * D_m) * (((M_m * M_m) * h) / ((Math.abs(d_m) * t_0) * l))) * -0.125;
    	}
    	return tmp;
    }
    
    d_m = math.fabs(d)
    M_m = math.fabs(M)
    D_m = math.fabs(D)
    [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m])
    def code(d_m, h, l, M_m, D_m):
    	t_0 = math.sqrt((l * h))
    	tmp = 0
    	if M_m <= 2.6e-34:
    		tmp = d_m / t_0
    	else:
    		tmp = ((D_m * D_m) * (((M_m * M_m) * h) / ((math.fabs(d_m) * t_0) * l))) * -0.125
    	return tmp
    
    d_m = abs(d)
    M_m = abs(M)
    D_m = abs(D)
    d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m])
    function code(d_m, h, l, M_m, D_m)
    	t_0 = sqrt(Float64(l * h))
    	tmp = 0.0
    	if (M_m <= 2.6e-34)
    		tmp = Float64(d_m / t_0);
    	else
    		tmp = Float64(Float64(Float64(D_m * D_m) * Float64(Float64(Float64(M_m * M_m) * h) / Float64(Float64(abs(d_m) * t_0) * l))) * -0.125);
    	end
    	return tmp
    end
    
    d_m = abs(d);
    M_m = abs(M);
    D_m = abs(D);
    d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
    function tmp_2 = code(d_m, h, l, M_m, D_m)
    	t_0 = sqrt((l * h));
    	tmp = 0.0;
    	if (M_m <= 2.6e-34)
    		tmp = d_m / t_0;
    	else
    		tmp = ((D_m * D_m) * (((M_m * M_m) * h) / ((abs(d_m) * t_0) * l))) * -0.125;
    	end
    	tmp_2 = tmp;
    end
    
    d_m = N[Abs[d], $MachinePrecision]
    M_m = N[Abs[M], $MachinePrecision]
    D_m = N[Abs[D], $MachinePrecision]
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M$95$m, 2.6e-34], N[(d$95$m / t$95$0), $MachinePrecision], N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] / N[(N[(N[Abs[d$95$m], $MachinePrecision] * t$95$0), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]]]
    
    \begin{array}{l}
    d_m = \left|d\right|
    \\
    M_m = \left|M\right|
    \\
    D_m = \left|D\right|
    \\
    [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
    \\
    \begin{array}{l}
    t_0 := \sqrt{\ell \cdot h}\\
    \mathbf{if}\;M\_m \leq 2.6 \cdot 10^{-34}:\\
    \;\;\;\;\frac{d\_m}{t\_0}\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(\left(D\_m \cdot D\_m\right) \cdot \frac{\left(M\_m \cdot M\_m\right) \cdot h}{\left(\left|d\_m\right| \cdot t\_0\right) \cdot \ell}\right) \cdot -0.125\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if M < 2.5999999999999999e-34

      1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 2.5999999999999999e-34 < M

      1. Initial program 36.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. Taylor expanded in d around inf

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

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

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

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

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

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

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

    Alternative 12: 58.4% accurate, 2.7× speedup?

    \[\begin{array}{l} d_m = \left|d\right| \\ M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\ell \cdot h}\\ \mathbf{if}\;M\_m \leq 3.8 \cdot 10^{-33}:\\ \;\;\;\;\frac{d\_m}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left(D\_m \cdot D\_m\right) \cdot \frac{M\_m \cdot M\_m}{\frac{\ell \cdot d\_m}{t\_0}}\right) \cdot -0.125}{\ell}\\ \end{array} \end{array} \]
    d_m = (fabs.f64 d)
    M_m = (fabs.f64 M)
    D_m = (fabs.f64 D)
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    (FPCore (d_m h l M_m D_m)
     :precision binary64
     (let* ((t_0 (sqrt (* l h))))
       (if (<= M_m 3.8e-33)
         (/ d_m t_0)
         (/ (* (* (* D_m D_m) (/ (* M_m M_m) (/ (* l d_m) t_0))) -0.125) l))))
    d_m = fabs(d);
    M_m = fabs(M);
    D_m = fabs(D);
    assert(d_m < h && h < l && l < M_m && M_m < D_m);
    double code(double d_m, double h, double l, double M_m, double D_m) {
    	double t_0 = sqrt((l * h));
    	double tmp;
    	if (M_m <= 3.8e-33) {
    		tmp = d_m / t_0;
    	} else {
    		tmp = (((D_m * D_m) * ((M_m * M_m) / ((l * d_m) / t_0))) * -0.125) / l;
    	}
    	return tmp;
    }
    
    d_m =     private
    M_m =     private
    D_m =     private
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(d_m, h, l, m_m, d_m_1)
    use fmin_fmax_functions
        real(8), intent (in) :: d_m
        real(8), intent (in) :: h
        real(8), intent (in) :: l
        real(8), intent (in) :: m_m
        real(8), intent (in) :: d_m_1
        real(8) :: t_0
        real(8) :: tmp
        t_0 = sqrt((l * h))
        if (m_m <= 3.8d-33) then
            tmp = d_m / t_0
        else
            tmp = (((d_m_1 * d_m_1) * ((m_m * m_m) / ((l * d_m) / t_0))) * (-0.125d0)) / l
        end if
        code = tmp
    end function
    
    d_m = Math.abs(d);
    M_m = Math.abs(M);
    D_m = Math.abs(D);
    assert d_m < h && h < l && l < M_m && M_m < D_m;
    public static double code(double d_m, double h, double l, double M_m, double D_m) {
    	double t_0 = Math.sqrt((l * h));
    	double tmp;
    	if (M_m <= 3.8e-33) {
    		tmp = d_m / t_0;
    	} else {
    		tmp = (((D_m * D_m) * ((M_m * M_m) / ((l * d_m) / t_0))) * -0.125) / l;
    	}
    	return tmp;
    }
    
    d_m = math.fabs(d)
    M_m = math.fabs(M)
    D_m = math.fabs(D)
    [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m])
    def code(d_m, h, l, M_m, D_m):
    	t_0 = math.sqrt((l * h))
    	tmp = 0
    	if M_m <= 3.8e-33:
    		tmp = d_m / t_0
    	else:
    		tmp = (((D_m * D_m) * ((M_m * M_m) / ((l * d_m) / t_0))) * -0.125) / l
    	return tmp
    
    d_m = abs(d)
    M_m = abs(M)
    D_m = abs(D)
    d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m])
    function code(d_m, h, l, M_m, D_m)
    	t_0 = sqrt(Float64(l * h))
    	tmp = 0.0
    	if (M_m <= 3.8e-33)
    		tmp = Float64(d_m / t_0);
    	else
    		tmp = Float64(Float64(Float64(Float64(D_m * D_m) * Float64(Float64(M_m * M_m) / Float64(Float64(l * d_m) / t_0))) * -0.125) / l);
    	end
    	return tmp
    end
    
    d_m = abs(d);
    M_m = abs(M);
    D_m = abs(D);
    d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
    function tmp_2 = code(d_m, h, l, M_m, D_m)
    	t_0 = sqrt((l * h));
    	tmp = 0.0;
    	if (M_m <= 3.8e-33)
    		tmp = d_m / t_0;
    	else
    		tmp = (((D_m * D_m) * ((M_m * M_m) / ((l * d_m) / t_0))) * -0.125) / l;
    	end
    	tmp_2 = tmp;
    end
    
    d_m = N[Abs[d], $MachinePrecision]
    M_m = N[Abs[M], $MachinePrecision]
    D_m = N[Abs[D], $MachinePrecision]
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M$95$m, 3.8e-33], N[(d$95$m / t$95$0), $MachinePrecision], N[(N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(N[(M$95$m * M$95$m), $MachinePrecision] / N[(N[(l * d$95$m), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] / l), $MachinePrecision]]]
    
    \begin{array}{l}
    d_m = \left|d\right|
    \\
    M_m = \left|M\right|
    \\
    D_m = \left|D\right|
    \\
    [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
    \\
    \begin{array}{l}
    t_0 := \sqrt{\ell \cdot h}\\
    \mathbf{if}\;M\_m \leq 3.8 \cdot 10^{-33}:\\
    \;\;\;\;\frac{d\_m}{t\_0}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\left(\left(D\_m \cdot D\_m\right) \cdot \frac{M\_m \cdot M\_m}{\frac{\ell \cdot d\_m}{t\_0}}\right) \cdot -0.125}{\ell}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if M < 3.79999999999999994e-33

      1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 3.79999999999999994e-33 < M

      1. Initial program 36.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. Taylor expanded in h around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{\frac{\left(\left(M \cdot M\right) \cdot d\right) \cdot D}{\sqrt{h \cdot \ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
      6. Taylor expanded in l around inf

        \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\color{blue}{\ell}} \]
      7. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\ell} \]
      8. Applied rewrites26.7%

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(\left(M \cdot M\right) \cdot h\right) \cdot \left(D \cdot D\right)}{\left(\sqrt{\frac{h}{\ell}} \cdot \ell\right) \cdot d}, -0.125, \frac{d}{\sqrt{\frac{h}{\ell}}}\right)}{\color{blue}{\ell}} \]
      9. Taylor expanded in h around inf

        \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot {M}^{2}}{d \cdot \left(\ell \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)}}{\ell} \]
      10. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \frac{\frac{{D}^{2} \cdot {M}^{2}}{d \cdot \left(\ell \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot \frac{-1}{8}}{\ell} \]
        2. lower-*.f64N/A

          \[\leadsto \frac{\frac{{D}^{2} \cdot {M}^{2}}{d \cdot \left(\ell \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot \frac{-1}{8}}{\ell} \]
      11. Applied rewrites29.3%

        \[\leadsto \frac{\left(\left(D \cdot D\right) \cdot \frac{M \cdot M}{\frac{\ell \cdot d}{\sqrt{\ell \cdot h}}}\right) \cdot -0.125}{\ell} \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 13: 58.1% accurate, 2.7× speedup?

    \[\begin{array}{l} d_m = \left|d\right| \\ M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\ell \cdot h}\\ \mathbf{if}\;M\_m \leq 2.5 \cdot 10^{-34}:\\ \;\;\;\;\frac{d\_m}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot D\_m}{t\_0 \cdot d\_m} \cdot -0.125}{\ell}\\ \end{array} \end{array} \]
    d_m = (fabs.f64 d)
    M_m = (fabs.f64 M)
    D_m = (fabs.f64 D)
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    (FPCore (d_m h l M_m D_m)
     :precision binary64
     (let* ((t_0 (sqrt (* l h))))
       (if (<= M_m 2.5e-34)
         (/ d_m t_0)
         (/ (* (/ (* (* (* (* M_m M_m) h) D_m) D_m) (* t_0 d_m)) -0.125) l))))
    d_m = fabs(d);
    M_m = fabs(M);
    D_m = fabs(D);
    assert(d_m < h && h < l && l < M_m && M_m < D_m);
    double code(double d_m, double h, double l, double M_m, double D_m) {
    	double t_0 = sqrt((l * h));
    	double tmp;
    	if (M_m <= 2.5e-34) {
    		tmp = d_m / t_0;
    	} else {
    		tmp = ((((((M_m * M_m) * h) * D_m) * D_m) / (t_0 * d_m)) * -0.125) / l;
    	}
    	return tmp;
    }
    
    d_m =     private
    M_m =     private
    D_m =     private
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(d_m, h, l, m_m, d_m_1)
    use fmin_fmax_functions
        real(8), intent (in) :: d_m
        real(8), intent (in) :: h
        real(8), intent (in) :: l
        real(8), intent (in) :: m_m
        real(8), intent (in) :: d_m_1
        real(8) :: t_0
        real(8) :: tmp
        t_0 = sqrt((l * h))
        if (m_m <= 2.5d-34) then
            tmp = d_m / t_0
        else
            tmp = ((((((m_m * m_m) * h) * d_m_1) * d_m_1) / (t_0 * d_m)) * (-0.125d0)) / l
        end if
        code = tmp
    end function
    
    d_m = Math.abs(d);
    M_m = Math.abs(M);
    D_m = Math.abs(D);
    assert d_m < h && h < l && l < M_m && M_m < D_m;
    public static double code(double d_m, double h, double l, double M_m, double D_m) {
    	double t_0 = Math.sqrt((l * h));
    	double tmp;
    	if (M_m <= 2.5e-34) {
    		tmp = d_m / t_0;
    	} else {
    		tmp = ((((((M_m * M_m) * h) * D_m) * D_m) / (t_0 * d_m)) * -0.125) / l;
    	}
    	return tmp;
    }
    
    d_m = math.fabs(d)
    M_m = math.fabs(M)
    D_m = math.fabs(D)
    [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m])
    def code(d_m, h, l, M_m, D_m):
    	t_0 = math.sqrt((l * h))
    	tmp = 0
    	if M_m <= 2.5e-34:
    		tmp = d_m / t_0
    	else:
    		tmp = ((((((M_m * M_m) * h) * D_m) * D_m) / (t_0 * d_m)) * -0.125) / l
    	return tmp
    
    d_m = abs(d)
    M_m = abs(M)
    D_m = abs(D)
    d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m])
    function code(d_m, h, l, M_m, D_m)
    	t_0 = sqrt(Float64(l * h))
    	tmp = 0.0
    	if (M_m <= 2.5e-34)
    		tmp = Float64(d_m / t_0);
    	else
    		tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) * D_m) / Float64(t_0 * d_m)) * -0.125) / l);
    	end
    	return tmp
    end
    
    d_m = abs(d);
    M_m = abs(M);
    D_m = abs(D);
    d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
    function tmp_2 = code(d_m, h, l, M_m, D_m)
    	t_0 = sqrt((l * h));
    	tmp = 0.0;
    	if (M_m <= 2.5e-34)
    		tmp = d_m / t_0;
    	else
    		tmp = ((((((M_m * M_m) * h) * D_m) * D_m) / (t_0 * d_m)) * -0.125) / l;
    	end
    	tmp_2 = tmp;
    end
    
    d_m = N[Abs[d], $MachinePrecision]
    M_m = N[Abs[M], $MachinePrecision]
    D_m = N[Abs[D], $MachinePrecision]
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M$95$m, 2.5e-34], N[(d$95$m / t$95$0), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] / N[(t$95$0 * d$95$m), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] / l), $MachinePrecision]]]
    
    \begin{array}{l}
    d_m = \left|d\right|
    \\
    M_m = \left|M\right|
    \\
    D_m = \left|D\right|
    \\
    [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
    \\
    \begin{array}{l}
    t_0 := \sqrt{\ell \cdot h}\\
    \mathbf{if}\;M\_m \leq 2.5 \cdot 10^{-34}:\\
    \;\;\;\;\frac{d\_m}{t\_0}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\frac{\left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot D\_m}{t\_0 \cdot d\_m} \cdot -0.125}{\ell}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if M < 2.5000000000000001e-34

      1. Initial program 36.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. Taylor expanded in h around inf

        \[\leadsto \color{blue}{h \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)}{{d}^{2} \cdot \ell} + \frac{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}{h}\right)} \]
      3. Applied rewrites27.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right)} \]
      4. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        2. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        3. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        4. lift-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        5. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        6. lift-sqrt.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        7. lift-sqrt.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        9. pow2N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot {M}^{2}\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        10. associate-*l/N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{d \cdot {M}^{2}}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        11. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        12. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        13. associate-/l*N/A

          \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        14. lower-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
      5. Applied rewrites27.2%

        \[\leadsto \mathsf{fma}\left(\frac{\frac{\left(\left(M \cdot M\right) \cdot d\right) \cdot D}{\sqrt{h \cdot \ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
      6. Taylor expanded in l around inf

        \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\color{blue}{\ell}} \]
      7. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\ell} \]
      8. Applied rewrites26.7%

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(\left(M \cdot M\right) \cdot h\right) \cdot \left(D \cdot D\right)}{\left(\sqrt{\frac{h}{\ell}} \cdot \ell\right) \cdot d}, -0.125, \frac{d}{\sqrt{\frac{h}{\ell}}}\right)}{\color{blue}{\ell}} \]
      9. Taylor expanded in d around inf

        \[\leadsto \frac{d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      10. Step-by-step derivation
        1. sqrt-prodN/A

          \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
        2. lower-/.f64N/A

          \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
        3. lift-sqrt.f64N/A

          \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
        4. *-commutativeN/A

          \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
        5. lift-*.f6442.7

          \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
      11. Applied rewrites42.7%

        \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell \cdot h}}} \]

      if 2.5000000000000001e-34 < M

      1. Initial program 36.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. Taylor expanded in h around inf

        \[\leadsto \color{blue}{h \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)}{{d}^{2} \cdot \ell} + \frac{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}{h}\right)} \]
      3. Applied rewrites27.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right)} \]
      4. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        2. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        3. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        4. lift-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        5. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        6. lift-sqrt.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        7. lift-sqrt.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        9. pow2N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot {M}^{2}\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        10. associate-*l/N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{d \cdot {M}^{2}}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        11. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        12. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        13. associate-/l*N/A

          \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        14. lower-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
      5. Applied rewrites27.2%

        \[\leadsto \mathsf{fma}\left(\frac{\frac{\left(\left(M \cdot M\right) \cdot d\right) \cdot D}{\sqrt{h \cdot \ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
      6. Taylor expanded in l around inf

        \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\color{blue}{\ell}} \]
      7. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\ell} \]
      8. Applied rewrites26.7%

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(\left(M \cdot M\right) \cdot h\right) \cdot \left(D \cdot D\right)}{\left(\sqrt{\frac{h}{\ell}} \cdot \ell\right) \cdot d}, -0.125, \frac{d}{\sqrt{\frac{h}{\ell}}}\right)}{\color{blue}{\ell}} \]
      9. Taylor expanded in l around 0

        \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \sqrt{h \cdot \ell}}}{\ell} \]
      10. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \frac{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \sqrt{h \cdot \ell}} \cdot \frac{-1}{8}}{\ell} \]
        2. lower-*.f64N/A

          \[\leadsto \frac{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \sqrt{h \cdot \ell}} \cdot \frac{-1}{8}}{\ell} \]
      11. Applied rewrites32.0%

        \[\leadsto \frac{\frac{\left(\left(\left(M \cdot M\right) \cdot h\right) \cdot D\right) \cdot D}{\sqrt{\ell \cdot h} \cdot d} \cdot -0.125}{\ell} \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 14: 57.4% accurate, 2.8× speedup?

    \[\begin{array}{l} d_m = \left|d\right| \\ M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\ell \cdot h}\\ \mathbf{if}\;M\_m \leq 2.1 \cdot 10^{-34}:\\ \;\;\;\;\frac{d\_m}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot D\_m}{\left(\ell \cdot d\_m\right) \cdot t\_0} \cdot -0.125\\ \end{array} \end{array} \]
    d_m = (fabs.f64 d)
    M_m = (fabs.f64 M)
    D_m = (fabs.f64 D)
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    (FPCore (d_m h l M_m D_m)
     :precision binary64
     (let* ((t_0 (sqrt (* l h))))
       (if (<= M_m 2.1e-34)
         (/ d_m t_0)
         (* (/ (* (* (* (* M_m M_m) h) D_m) D_m) (* (* l d_m) t_0)) -0.125))))
    d_m = fabs(d);
    M_m = fabs(M);
    D_m = fabs(D);
    assert(d_m < h && h < l && l < M_m && M_m < D_m);
    double code(double d_m, double h, double l, double M_m, double D_m) {
    	double t_0 = sqrt((l * h));
    	double tmp;
    	if (M_m <= 2.1e-34) {
    		tmp = d_m / t_0;
    	} else {
    		tmp = (((((M_m * M_m) * h) * D_m) * D_m) / ((l * d_m) * t_0)) * -0.125;
    	}
    	return tmp;
    }
    
    d_m =     private
    M_m =     private
    D_m =     private
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(d_m, h, l, m_m, d_m_1)
    use fmin_fmax_functions
        real(8), intent (in) :: d_m
        real(8), intent (in) :: h
        real(8), intent (in) :: l
        real(8), intent (in) :: m_m
        real(8), intent (in) :: d_m_1
        real(8) :: t_0
        real(8) :: tmp
        t_0 = sqrt((l * h))
        if (m_m <= 2.1d-34) then
            tmp = d_m / t_0
        else
            tmp = (((((m_m * m_m) * h) * d_m_1) * d_m_1) / ((l * d_m) * t_0)) * (-0.125d0)
        end if
        code = tmp
    end function
    
    d_m = Math.abs(d);
    M_m = Math.abs(M);
    D_m = Math.abs(D);
    assert d_m < h && h < l && l < M_m && M_m < D_m;
    public static double code(double d_m, double h, double l, double M_m, double D_m) {
    	double t_0 = Math.sqrt((l * h));
    	double tmp;
    	if (M_m <= 2.1e-34) {
    		tmp = d_m / t_0;
    	} else {
    		tmp = (((((M_m * M_m) * h) * D_m) * D_m) / ((l * d_m) * t_0)) * -0.125;
    	}
    	return tmp;
    }
    
    d_m = math.fabs(d)
    M_m = math.fabs(M)
    D_m = math.fabs(D)
    [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m])
    def code(d_m, h, l, M_m, D_m):
    	t_0 = math.sqrt((l * h))
    	tmp = 0
    	if M_m <= 2.1e-34:
    		tmp = d_m / t_0
    	else:
    		tmp = (((((M_m * M_m) * h) * D_m) * D_m) / ((l * d_m) * t_0)) * -0.125
    	return tmp
    
    d_m = abs(d)
    M_m = abs(M)
    D_m = abs(D)
    d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m])
    function code(d_m, h, l, M_m, D_m)
    	t_0 = sqrt(Float64(l * h))
    	tmp = 0.0
    	if (M_m <= 2.1e-34)
    		tmp = Float64(d_m / t_0);
    	else
    		tmp = Float64(Float64(Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) * D_m) / Float64(Float64(l * d_m) * t_0)) * -0.125);
    	end
    	return tmp
    end
    
    d_m = abs(d);
    M_m = abs(M);
    D_m = abs(D);
    d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
    function tmp_2 = code(d_m, h, l, M_m, D_m)
    	t_0 = sqrt((l * h));
    	tmp = 0.0;
    	if (M_m <= 2.1e-34)
    		tmp = d_m / t_0;
    	else
    		tmp = (((((M_m * M_m) * h) * D_m) * D_m) / ((l * d_m) * t_0)) * -0.125;
    	end
    	tmp_2 = tmp;
    end
    
    d_m = N[Abs[d], $MachinePrecision]
    M_m = N[Abs[M], $MachinePrecision]
    D_m = N[Abs[D], $MachinePrecision]
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M$95$m, 2.1e-34], N[(d$95$m / t$95$0), $MachinePrecision], N[(N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] / N[(N[(l * d$95$m), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]]]
    
    \begin{array}{l}
    d_m = \left|d\right|
    \\
    M_m = \left|M\right|
    \\
    D_m = \left|D\right|
    \\
    [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
    \\
    \begin{array}{l}
    t_0 := \sqrt{\ell \cdot h}\\
    \mathbf{if}\;M\_m \leq 2.1 \cdot 10^{-34}:\\
    \;\;\;\;\frac{d\_m}{t\_0}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot D\_m}{\left(\ell \cdot d\_m\right) \cdot t\_0} \cdot -0.125\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if M < 2.1000000000000001e-34

      1. Initial program 36.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. Taylor expanded in h around inf

        \[\leadsto \color{blue}{h \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)}{{d}^{2} \cdot \ell} + \frac{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}{h}\right)} \]
      3. Applied rewrites27.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right)} \]
      4. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        2. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        3. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        4. lift-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        5. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        6. lift-sqrt.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        7. lift-sqrt.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        9. pow2N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot {M}^{2}\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        10. associate-*l/N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{d \cdot {M}^{2}}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        11. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        12. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        13. associate-/l*N/A

          \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        14. lower-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
      5. Applied rewrites27.2%

        \[\leadsto \mathsf{fma}\left(\frac{\frac{\left(\left(M \cdot M\right) \cdot d\right) \cdot D}{\sqrt{h \cdot \ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
      6. Taylor expanded in l around inf

        \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\color{blue}{\ell}} \]
      7. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\ell} \]
      8. Applied rewrites26.7%

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(\left(M \cdot M\right) \cdot h\right) \cdot \left(D \cdot D\right)}{\left(\sqrt{\frac{h}{\ell}} \cdot \ell\right) \cdot d}, -0.125, \frac{d}{\sqrt{\frac{h}{\ell}}}\right)}{\color{blue}{\ell}} \]
      9. Taylor expanded in d around inf

        \[\leadsto \frac{d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      10. Step-by-step derivation
        1. sqrt-prodN/A

          \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
        2. lower-/.f64N/A

          \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
        3. lift-sqrt.f64N/A

          \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
        4. *-commutativeN/A

          \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
        5. lift-*.f6442.7

          \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
      11. Applied rewrites42.7%

        \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell \cdot h}}} \]

      if 2.1000000000000001e-34 < M

      1. Initial program 36.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. Taylor expanded in d around inf

        \[\leadsto \color{blue}{{d}^{2} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot \left(\sqrt{\frac{1}{d \cdot h}} \cdot \sqrt{\frac{1}{d \cdot \ell}}\right)\right)\right)}{{d}^{2} \cdot \ell} + \sqrt{\frac{1}{d \cdot h}} \cdot \sqrt{\frac{1}{d \cdot \ell}}\right)} \]
      3. Applied rewrites18.9%

        \[\leadsto \color{blue}{\left(\mathsf{fma}\left(\frac{\left(\left(\left(\frac{\frac{h}{\sqrt{h \cdot d}}}{\sqrt{\ell \cdot d}} \cdot M\right) \cdot M\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell}, -0.125, \sqrt{\frac{1}{\left(h \cdot d\right) \cdot \left(\ell \cdot d\right)}}\right) \cdot d\right) \cdot d} \]
      4. Taylor expanded in d around 0

        \[\leadsto \frac{-1}{8} \cdot \color{blue}{\frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot \left(\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}\right)}} \]
      5. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot \left(\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}\right)} \cdot \frac{-1}{8} \]
        2. lower-*.f64N/A

          \[\leadsto \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\ell \cdot \left(\sqrt{d \cdot h} \cdot \sqrt{d \cdot \ell}\right)} \cdot \frac{-1}{8} \]
      6. Applied rewrites24.1%

        \[\leadsto \frac{\left(\left(M \cdot M\right) \cdot h\right) \cdot \left(D \cdot D\right)}{\sqrt{h \cdot \left(\left(d \cdot d\right) \cdot \ell\right)} \cdot \ell} \cdot \color{blue}{-0.125} \]
      7. Taylor expanded in d around 0

        \[\leadsto \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{h \cdot \ell}\right)} \cdot \frac{-1}{8} \]
      8. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{h \cdot \ell}\right)} \cdot \frac{-1}{8} \]
        2. *-commutativeN/A

          \[\leadsto \frac{\left({M}^{2} \cdot h\right) \cdot {D}^{2}}{d \cdot \left(\ell \cdot \sqrt{h \cdot \ell}\right)} \cdot \frac{-1}{8} \]
        3. pow2N/A

          \[\leadsto \frac{\left(\left(M \cdot M\right) \cdot h\right) \cdot {D}^{2}}{d \cdot \left(\ell \cdot \sqrt{h \cdot \ell}\right)} \cdot \frac{-1}{8} \]
        4. pow2N/A

          \[\leadsto \frac{\left(\left(M \cdot M\right) \cdot h\right) \cdot \left(D \cdot D\right)}{d \cdot \left(\ell \cdot \sqrt{h \cdot \ell}\right)} \cdot \frac{-1}{8} \]
        5. lift-*.f64N/A

          \[\leadsto \frac{\left(\left(M \cdot M\right) \cdot h\right) \cdot \left(D \cdot D\right)}{d \cdot \left(\ell \cdot \sqrt{h \cdot \ell}\right)} \cdot \frac{-1}{8} \]
        6. lift-*.f64N/A

          \[\leadsto \frac{\left(\left(M \cdot M\right) \cdot h\right) \cdot \left(D \cdot D\right)}{d \cdot \left(\ell \cdot \sqrt{h \cdot \ell}\right)} \cdot \frac{-1}{8} \]
        7. associate-*r*N/A

          \[\leadsto \frac{\left(\left(\left(M \cdot M\right) \cdot h\right) \cdot D\right) \cdot D}{d \cdot \left(\ell \cdot \sqrt{h \cdot \ell}\right)} \cdot \frac{-1}{8} \]
        8. lower-*.f64N/A

          \[\leadsto \frac{\left(\left(\left(M \cdot M\right) \cdot h\right) \cdot D\right) \cdot D}{d \cdot \left(\ell \cdot \sqrt{h \cdot \ell}\right)} \cdot \frac{-1}{8} \]
        9. lift-*.f64N/A

          \[\leadsto \frac{\left(\left(\left(M \cdot M\right) \cdot h\right) \cdot D\right) \cdot D}{d \cdot \left(\ell \cdot \sqrt{h \cdot \ell}\right)} \cdot \frac{-1}{8} \]
        10. lift-*.f64N/A

          \[\leadsto \frac{\left(\left(\left(M \cdot M\right) \cdot h\right) \cdot D\right) \cdot D}{d \cdot \left(\ell \cdot \sqrt{h \cdot \ell}\right)} \cdot \frac{-1}{8} \]
        11. pow2N/A

          \[\leadsto \frac{\left(\left({M}^{2} \cdot h\right) \cdot D\right) \cdot D}{d \cdot \left(\ell \cdot \sqrt{h \cdot \ell}\right)} \cdot \frac{-1}{8} \]
        12. lower-*.f64N/A

          \[\leadsto \frac{\left(\left({M}^{2} \cdot h\right) \cdot D\right) \cdot D}{d \cdot \left(\ell \cdot \sqrt{h \cdot \ell}\right)} \cdot \frac{-1}{8} \]
        13. pow2N/A

          \[\leadsto \frac{\left(\left(\left(M \cdot M\right) \cdot h\right) \cdot D\right) \cdot D}{d \cdot \left(\ell \cdot \sqrt{h \cdot \ell}\right)} \cdot \frac{-1}{8} \]
        14. lift-*.f64N/A

          \[\leadsto \frac{\left(\left(\left(M \cdot M\right) \cdot h\right) \cdot D\right) \cdot D}{d \cdot \left(\ell \cdot \sqrt{h \cdot \ell}\right)} \cdot \frac{-1}{8} \]
        15. lift-*.f64N/A

          \[\leadsto \frac{\left(\left(\left(M \cdot M\right) \cdot h\right) \cdot D\right) \cdot D}{d \cdot \left(\ell \cdot \sqrt{h \cdot \ell}\right)} \cdot \frac{-1}{8} \]
        16. associate-*r*N/A

          \[\leadsto \frac{\left(\left(\left(M \cdot M\right) \cdot h\right) \cdot D\right) \cdot D}{\left(d \cdot \ell\right) \cdot \sqrt{h \cdot \ell}} \cdot \frac{-1}{8} \]
        17. lower-*.f64N/A

          \[\leadsto \frac{\left(\left(\left(M \cdot M\right) \cdot h\right) \cdot D\right) \cdot D}{\left(d \cdot \ell\right) \cdot \sqrt{h \cdot \ell}} \cdot \frac{-1}{8} \]
      9. Applied rewrites31.6%

        \[\leadsto \frac{\left(\left(\left(M \cdot M\right) \cdot h\right) \cdot D\right) \cdot D}{\left(\ell \cdot d\right) \cdot \sqrt{\ell \cdot h}} \cdot -0.125 \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 15: 56.7% accurate, 0.8× speedup?

    \[\begin{array}{l} d_m = \left|d\right| \\ M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -2 \cdot 10^{-214}:\\ \;\;\;\;\frac{\left(D\_m \cdot M\_m\right) \cdot \left(D\_m \cdot M\_m\right)}{\left(\sqrt{\frac{\ell}{h}} \cdot \ell\right) \cdot d\_m} \cdot -0.125\\ \mathbf{else}:\\ \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
    d_m = (fabs.f64 d)
    M_m = (fabs.f64 M)
    D_m = (fabs.f64 D)
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    (FPCore (d_m h l M_m D_m)
     :precision binary64
     (if (<=
          (*
           (* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
           (-
            1.0
            (* (* (/ 1.0 2.0) (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0)) (/ h l))))
          -2e-214)
       (* (/ (* (* D_m M_m) (* D_m M_m)) (* (* (sqrt (/ l h)) l) d_m)) -0.125)
       (/ d_m (sqrt (* l h)))))
    d_m = fabs(d);
    M_m = fabs(M);
    D_m = fabs(D);
    assert(d_m < h && h < l && l < M_m && M_m < D_m);
    double code(double d_m, double h, double l, double M_m, double D_m) {
    	double tmp;
    	if (((pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -2e-214) {
    		tmp = (((D_m * M_m) * (D_m * M_m)) / ((sqrt((l / h)) * l) * d_m)) * -0.125;
    	} else {
    		tmp = d_m / sqrt((l * h));
    	}
    	return tmp;
    }
    
    d_m =     private
    M_m =     private
    D_m =     private
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(d_m, h, l, m_m, d_m_1)
    use fmin_fmax_functions
        real(8), intent (in) :: d_m
        real(8), intent (in) :: h
        real(8), intent (in) :: l
        real(8), intent (in) :: m_m
        real(8), intent (in) :: d_m_1
        real(8) :: tmp
        if (((((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m_m * d_m_1) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))) <= (-2d-214)) then
            tmp = (((d_m_1 * m_m) * (d_m_1 * m_m)) / ((sqrt((l / h)) * l) * d_m)) * (-0.125d0)
        else
            tmp = d_m / sqrt((l * h))
        end if
        code = tmp
    end function
    
    d_m = Math.abs(d);
    M_m = Math.abs(M);
    D_m = Math.abs(D);
    assert d_m < h && h < l && l < M_m && M_m < D_m;
    public static double code(double d_m, double h, double l, double M_m, double D_m) {
    	double tmp;
    	if (((Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -2e-214) {
    		tmp = (((D_m * M_m) * (D_m * M_m)) / ((Math.sqrt((l / h)) * l) * d_m)) * -0.125;
    	} else {
    		tmp = d_m / Math.sqrt((l * h));
    	}
    	return tmp;
    }
    
    d_m = math.fabs(d)
    M_m = math.fabs(M)
    D_m = math.fabs(D)
    [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m])
    def code(d_m, h, l, M_m, D_m):
    	tmp = 0
    	if ((math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -2e-214:
    		tmp = (((D_m * M_m) * (D_m * M_m)) / ((math.sqrt((l / h)) * l) * d_m)) * -0.125
    	else:
    		tmp = d_m / math.sqrt((l * h))
    	return tmp
    
    d_m = abs(d)
    M_m = abs(M)
    D_m = abs(D)
    d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m])
    function code(d_m, h, l, M_m, D_m)
    	tmp = 0.0
    	if (Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))) <= -2e-214)
    		tmp = Float64(Float64(Float64(Float64(D_m * M_m) * Float64(D_m * M_m)) / Float64(Float64(sqrt(Float64(l / h)) * l) * d_m)) * -0.125);
    	else
    		tmp = Float64(d_m / sqrt(Float64(l * h)));
    	end
    	return tmp
    end
    
    d_m = abs(d);
    M_m = abs(M);
    D_m = abs(D);
    d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
    function tmp_2 = code(d_m, h, l, M_m, D_m)
    	tmp = 0.0;
    	if (((((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M_m * D_m) / (2.0 * d_m)) ^ 2.0)) * (h / l)))) <= -2e-214)
    		tmp = (((D_m * M_m) * (D_m * M_m)) / ((sqrt((l / h)) * l) * d_m)) * -0.125;
    	else
    		tmp = d_m / sqrt((l * h));
    	end
    	tmp_2 = tmp;
    end
    
    d_m = N[Abs[d], $MachinePrecision]
    M_m = N[Abs[M], $MachinePrecision]
    D_m = N[Abs[D], $MachinePrecision]
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[N[(N[(N[Power[N[(d$95$m / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d$95$m / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-214], N[(N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(D$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision] * l), $MachinePrecision] * d$95$m), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision], N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    d_m = \left|d\right|
    \\
    M_m = \left|M\right|
    \\
    D_m = \left|D\right|
    \\
    [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
    \\
    \begin{array}{l}
    \mathbf{if}\;\left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -2 \cdot 10^{-214}:\\
    \;\;\;\;\frac{\left(D\_m \cdot M\_m\right) \cdot \left(D\_m \cdot M\_m\right)}{\left(\sqrt{\frac{\ell}{h}} \cdot \ell\right) \cdot d\_m} \cdot -0.125\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\
    
    
    \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)))) < -1.99999999999999983e-214

      1. Initial program 36.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. Taylor expanded in h around inf

        \[\leadsto \color{blue}{h \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)}{{d}^{2} \cdot \ell} + \frac{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}{h}\right)} \]
      3. Applied rewrites27.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right)} \]
      4. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        2. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        3. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        4. lift-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        5. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        6. lift-sqrt.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        7. lift-sqrt.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        9. pow2N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot {M}^{2}\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        10. associate-*l/N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{d \cdot {M}^{2}}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        11. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        12. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        13. associate-/l*N/A

          \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        14. lower-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
      5. Applied rewrites27.2%

        \[\leadsto \mathsf{fma}\left(\frac{\frac{\left(\left(M \cdot M\right) \cdot d\right) \cdot D}{\sqrt{h \cdot \ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
      6. Taylor expanded in h around inf

        \[\leadsto \frac{-1}{8} \cdot \color{blue}{\frac{{D}^{2} \cdot {M}^{2}}{d \cdot \left(\ell \cdot \sqrt{\frac{\ell}{h}}\right)}} \]
      7. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \frac{{D}^{2} \cdot {M}^{2}}{d \cdot \left(\ell \cdot \sqrt{\frac{\ell}{h}}\right)} \cdot \frac{-1}{8} \]
        2. lower-*.f64N/A

          \[\leadsto \frac{{D}^{2} \cdot {M}^{2}}{d \cdot \left(\ell \cdot \sqrt{\frac{\ell}{h}}\right)} \cdot \frac{-1}{8} \]
        3. lower-/.f64N/A

          \[\leadsto \frac{{D}^{2} \cdot {M}^{2}}{d \cdot \left(\ell \cdot \sqrt{\frac{\ell}{h}}\right)} \cdot \frac{-1}{8} \]
        4. pow-prod-downN/A

          \[\leadsto \frac{{\left(D \cdot M\right)}^{2}}{d \cdot \left(\ell \cdot \sqrt{\frac{\ell}{h}}\right)} \cdot \frac{-1}{8} \]
        5. unpow2N/A

          \[\leadsto \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{\ell}{h}}\right)} \cdot \frac{-1}{8} \]
        6. lower-*.f64N/A

          \[\leadsto \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{\ell}{h}}\right)} \cdot \frac{-1}{8} \]
        7. lower-*.f64N/A

          \[\leadsto \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{\ell}{h}}\right)} \cdot \frac{-1}{8} \]
        8. lower-*.f64N/A

          \[\leadsto \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{\ell}{h}}\right)} \cdot \frac{-1}{8} \]
        9. *-commutativeN/A

          \[\leadsto \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{\left(\ell \cdot \sqrt{\frac{\ell}{h}}\right) \cdot d} \cdot \frac{-1}{8} \]
        10. lower-*.f64N/A

          \[\leadsto \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{\left(\ell \cdot \sqrt{\frac{\ell}{h}}\right) \cdot d} \cdot \frac{-1}{8} \]
        11. *-commutativeN/A

          \[\leadsto \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{\left(\sqrt{\frac{\ell}{h}} \cdot \ell\right) \cdot d} \cdot \frac{-1}{8} \]
        12. lower-*.f64N/A

          \[\leadsto \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{\left(\sqrt{\frac{\ell}{h}} \cdot \ell\right) \cdot d} \cdot \frac{-1}{8} \]
        13. lower-sqrt.f64N/A

          \[\leadsto \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{\left(\sqrt{\frac{\ell}{h}} \cdot \ell\right) \cdot d} \cdot \frac{-1}{8} \]
        14. lower-/.f6422.6

          \[\leadsto \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{\left(\sqrt{\frac{\ell}{h}} \cdot \ell\right) \cdot d} \cdot -0.125 \]
      8. Applied rewrites22.6%

        \[\leadsto \frac{\left(D \cdot M\right) \cdot \left(D \cdot M\right)}{\left(\sqrt{\frac{\ell}{h}} \cdot \ell\right) \cdot d} \cdot \color{blue}{-0.125} \]

      if -1.99999999999999983e-214 < (*.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 36.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. Taylor expanded in h around inf

        \[\leadsto \color{blue}{h \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)}{{d}^{2} \cdot \ell} + \frac{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}{h}\right)} \]
      3. Applied rewrites27.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right)} \]
      4. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        2. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        3. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        4. lift-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        5. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        6. lift-sqrt.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        7. lift-sqrt.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        9. pow2N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot {M}^{2}\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        10. associate-*l/N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{d \cdot {M}^{2}}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        11. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        12. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        13. associate-/l*N/A

          \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        14. lower-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
      5. Applied rewrites27.2%

        \[\leadsto \mathsf{fma}\left(\frac{\frac{\left(\left(M \cdot M\right) \cdot d\right) \cdot D}{\sqrt{h \cdot \ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
      6. Taylor expanded in l around inf

        \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\color{blue}{\ell}} \]
      7. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\ell} \]
      8. Applied rewrites26.7%

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(\left(M \cdot M\right) \cdot h\right) \cdot \left(D \cdot D\right)}{\left(\sqrt{\frac{h}{\ell}} \cdot \ell\right) \cdot d}, -0.125, \frac{d}{\sqrt{\frac{h}{\ell}}}\right)}{\color{blue}{\ell}} \]
      9. Taylor expanded in d around inf

        \[\leadsto \frac{d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      10. Step-by-step derivation
        1. sqrt-prodN/A

          \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
        2. lower-/.f64N/A

          \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
        3. lift-sqrt.f64N/A

          \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
        4. *-commutativeN/A

          \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
        5. lift-*.f6442.7

          \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
      11. Applied rewrites42.7%

        \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell \cdot h}}} \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 16: 46.4% accurate, 3.3× speedup?

    \[\begin{array}{l} d_m = \left|d\right| \\ M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq -9 \cdot 10^{+222}:\\ \;\;\;\;\left(\frac{\sqrt{\frac{h}{\left(d\_m \cdot d\_m\right) \cdot \ell}}}{h} \cdot d\_m\right) \cdot d\_m\\ \mathbf{elif}\;h \leq -5 \cdot 10^{-292}:\\ \;\;\;\;\frac{-\frac{\sqrt{-h}}{\sqrt{-\ell}} \cdot d\_m}{h}\\ \mathbf{elif}\;h \leq 1.08 \cdot 10^{+46}:\\ \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left|d\_m\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1\\ \end{array} \end{array} \]
    d_m = (fabs.f64 d)
    M_m = (fabs.f64 M)
    D_m = (fabs.f64 D)
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    (FPCore (d_m h l M_m D_m)
     :precision binary64
     (if (<= h -9e+222)
       (* (* (/ (sqrt (/ h (* (* d_m d_m) l))) h) d_m) d_m)
       (if (<= h -5e-292)
         (/ (- (* (/ (sqrt (- h)) (sqrt (- l))) d_m)) h)
         (if (<= h 1.08e+46)
           (/ d_m (sqrt (* l h)))
           (* (/ (* (fabs d_m) (sqrt (/ l h))) l) 1.0)))))
    d_m = fabs(d);
    M_m = fabs(M);
    D_m = fabs(D);
    assert(d_m < h && h < l && l < M_m && M_m < D_m);
    double code(double d_m, double h, double l, double M_m, double D_m) {
    	double tmp;
    	if (h <= -9e+222) {
    		tmp = ((sqrt((h / ((d_m * d_m) * l))) / h) * d_m) * d_m;
    	} else if (h <= -5e-292) {
    		tmp = -((sqrt(-h) / sqrt(-l)) * d_m) / h;
    	} else if (h <= 1.08e+46) {
    		tmp = d_m / sqrt((l * h));
    	} else {
    		tmp = ((fabs(d_m) * sqrt((l / h))) / l) * 1.0;
    	}
    	return tmp;
    }
    
    d_m =     private
    M_m =     private
    D_m =     private
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(d_m, h, l, m_m, d_m_1)
    use fmin_fmax_functions
        real(8), intent (in) :: d_m
        real(8), intent (in) :: h
        real(8), intent (in) :: l
        real(8), intent (in) :: m_m
        real(8), intent (in) :: d_m_1
        real(8) :: tmp
        if (h <= (-9d+222)) then
            tmp = ((sqrt((h / ((d_m * d_m) * l))) / h) * d_m) * d_m
        else if (h <= (-5d-292)) then
            tmp = -((sqrt(-h) / sqrt(-l)) * d_m) / h
        else if (h <= 1.08d+46) then
            tmp = d_m / sqrt((l * h))
        else
            tmp = ((abs(d_m) * sqrt((l / h))) / l) * 1.0d0
        end if
        code = tmp
    end function
    
    d_m = Math.abs(d);
    M_m = Math.abs(M);
    D_m = Math.abs(D);
    assert d_m < h && h < l && l < M_m && M_m < D_m;
    public static double code(double d_m, double h, double l, double M_m, double D_m) {
    	double tmp;
    	if (h <= -9e+222) {
    		tmp = ((Math.sqrt((h / ((d_m * d_m) * l))) / h) * d_m) * d_m;
    	} else if (h <= -5e-292) {
    		tmp = -((Math.sqrt(-h) / Math.sqrt(-l)) * d_m) / h;
    	} else if (h <= 1.08e+46) {
    		tmp = d_m / Math.sqrt((l * h));
    	} else {
    		tmp = ((Math.abs(d_m) * Math.sqrt((l / h))) / l) * 1.0;
    	}
    	return tmp;
    }
    
    d_m = math.fabs(d)
    M_m = math.fabs(M)
    D_m = math.fabs(D)
    [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m])
    def code(d_m, h, l, M_m, D_m):
    	tmp = 0
    	if h <= -9e+222:
    		tmp = ((math.sqrt((h / ((d_m * d_m) * l))) / h) * d_m) * d_m
    	elif h <= -5e-292:
    		tmp = -((math.sqrt(-h) / math.sqrt(-l)) * d_m) / h
    	elif h <= 1.08e+46:
    		tmp = d_m / math.sqrt((l * h))
    	else:
    		tmp = ((math.fabs(d_m) * math.sqrt((l / h))) / l) * 1.0
    	return tmp
    
    d_m = abs(d)
    M_m = abs(M)
    D_m = abs(D)
    d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m])
    function code(d_m, h, l, M_m, D_m)
    	tmp = 0.0
    	if (h <= -9e+222)
    		tmp = Float64(Float64(Float64(sqrt(Float64(h / Float64(Float64(d_m * d_m) * l))) / h) * d_m) * d_m);
    	elseif (h <= -5e-292)
    		tmp = Float64(Float64(-Float64(Float64(sqrt(Float64(-h)) / sqrt(Float64(-l))) * d_m)) / h);
    	elseif (h <= 1.08e+46)
    		tmp = Float64(d_m / sqrt(Float64(l * h)));
    	else
    		tmp = Float64(Float64(Float64(abs(d_m) * sqrt(Float64(l / h))) / l) * 1.0);
    	end
    	return tmp
    end
    
    d_m = abs(d);
    M_m = abs(M);
    D_m = abs(D);
    d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
    function tmp_2 = code(d_m, h, l, M_m, D_m)
    	tmp = 0.0;
    	if (h <= -9e+222)
    		tmp = ((sqrt((h / ((d_m * d_m) * l))) / h) * d_m) * d_m;
    	elseif (h <= -5e-292)
    		tmp = -((sqrt(-h) / sqrt(-l)) * d_m) / h;
    	elseif (h <= 1.08e+46)
    		tmp = d_m / sqrt((l * h));
    	else
    		tmp = ((abs(d_m) * sqrt((l / h))) / l) * 1.0;
    	end
    	tmp_2 = tmp;
    end
    
    d_m = N[Abs[d], $MachinePrecision]
    M_m = N[Abs[M], $MachinePrecision]
    D_m = N[Abs[D], $MachinePrecision]
    NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
    code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[h, -9e+222], N[(N[(N[(N[Sqrt[N[(h / N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / h), $MachinePrecision] * d$95$m), $MachinePrecision] * d$95$m), $MachinePrecision], If[LessEqual[h, -5e-292], N[((-N[(N[(N[Sqrt[(-h)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision]) / h), $MachinePrecision], If[LessEqual[h, 1.08e+46], N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Abs[d$95$m], $MachinePrecision] * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * 1.0), $MachinePrecision]]]]
    
    \begin{array}{l}
    d_m = \left|d\right|
    \\
    M_m = \left|M\right|
    \\
    D_m = \left|D\right|
    \\
    [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
    \\
    \begin{array}{l}
    \mathbf{if}\;h \leq -9 \cdot 10^{+222}:\\
    \;\;\;\;\left(\frac{\sqrt{\frac{h}{\left(d\_m \cdot d\_m\right) \cdot \ell}}}{h} \cdot d\_m\right) \cdot d\_m\\
    
    \mathbf{elif}\;h \leq -5 \cdot 10^{-292}:\\
    \;\;\;\;\frac{-\frac{\sqrt{-h}}{\sqrt{-\ell}} \cdot d\_m}{h}\\
    
    \mathbf{elif}\;h \leq 1.08 \cdot 10^{+46}:\\
    \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\left|d\_m\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if h < -8.99999999999999978e222

      1. Initial program 36.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. Taylor expanded in d around inf

        \[\leadsto \color{blue}{{d}^{2} \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(h \cdot \left(\sqrt{\frac{1}{d \cdot h}} \cdot \sqrt{\frac{1}{d \cdot \ell}}\right)\right)\right)}{{d}^{2} \cdot \ell} + \sqrt{\frac{1}{d \cdot h}} \cdot \sqrt{\frac{1}{d \cdot \ell}}\right)} \]
      3. Applied rewrites18.9%

        \[\leadsto \color{blue}{\left(\mathsf{fma}\left(\frac{\left(\left(\left(\frac{\frac{h}{\sqrt{h \cdot d}}}{\sqrt{\ell \cdot d}} \cdot M\right) \cdot M\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell}, -0.125, \sqrt{\frac{1}{\left(h \cdot d\right) \cdot \left(\ell \cdot d\right)}}\right) \cdot d\right) \cdot d} \]
      4. Taylor expanded in h around 0

        \[\leadsto \left(\frac{\sqrt{\frac{h}{{d}^{2} \cdot \ell}}}{h} \cdot d\right) \cdot d \]
      5. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \left(\frac{\sqrt{\frac{h}{{d}^{2} \cdot \ell}}}{h} \cdot d\right) \cdot d \]
        2. lower-sqrt.f64N/A

          \[\leadsto \left(\frac{\sqrt{\frac{h}{{d}^{2} \cdot \ell}}}{h} \cdot d\right) \cdot d \]
        3. lower-/.f64N/A

          \[\leadsto \left(\frac{\sqrt{\frac{h}{{d}^{2} \cdot \ell}}}{h} \cdot d\right) \cdot d \]
        4. pow2N/A

          \[\leadsto \left(\frac{\sqrt{\frac{h}{\left(d \cdot d\right) \cdot \ell}}}{h} \cdot d\right) \cdot d \]
        5. lift-*.f64N/A

          \[\leadsto \left(\frac{\sqrt{\frac{h}{\left(d \cdot d\right) \cdot \ell}}}{h} \cdot d\right) \cdot d \]
        6. lift-*.f6417.9

          \[\leadsto \left(\frac{\sqrt{\frac{h}{\left(d \cdot d\right) \cdot \ell}}}{h} \cdot d\right) \cdot d \]
      6. Applied rewrites17.9%

        \[\leadsto \left(\frac{\sqrt{\frac{h}{\left(d \cdot d\right) \cdot \ell}}}{h} \cdot d\right) \cdot d \]

      if -8.99999999999999978e222 < h < -4.99999999999999981e-292

      1. Initial program 36.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. Taylor expanded in h around 0

        \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
      3. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
      4. Applied rewrites21.1%

        \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{\ell} \cdot \left(h \cdot d\right)}}{h}} \]
      5. Taylor expanded in d around -inf

        \[\leadsto \frac{-1 \cdot \left(d \cdot \sqrt{\frac{h}{\ell}}\right)}{h} \]
      6. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \frac{\mathsf{neg}\left(d \cdot \sqrt{\frac{h}{\ell}}\right)}{h} \]
        2. lower-neg.f64N/A

          \[\leadsto \frac{-d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
        3. *-commutativeN/A

          \[\leadsto \frac{-\sqrt{\frac{h}{\ell}} \cdot d}{h} \]
        4. mult-flipN/A

          \[\leadsto \frac{-\sqrt{h \cdot \frac{1}{\ell}} \cdot d}{h} \]
        5. sqrt-unprodN/A

          \[\leadsto \frac{-\left(\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}\right) \cdot d}{h} \]
        6. lower-*.f64N/A

          \[\leadsto \frac{-\left(\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}\right) \cdot d}{h} \]
        7. sqrt-unprodN/A

          \[\leadsto \frac{-\sqrt{h \cdot \frac{1}{\ell}} \cdot d}{h} \]
        8. mult-flipN/A

          \[\leadsto \frac{-\sqrt{\frac{h}{\ell}} \cdot d}{h} \]
        9. lower-sqrt.f64N/A

          \[\leadsto \frac{-\sqrt{\frac{h}{\ell}} \cdot d}{h} \]
        10. lift-/.f6425.6

          \[\leadsto \frac{-\sqrt{\frac{h}{\ell}} \cdot d}{h} \]
      7. Applied rewrites25.6%

        \[\leadsto \frac{-\sqrt{\frac{h}{\ell}} \cdot d}{h} \]
      8. Step-by-step derivation
        1. lift-/.f64N/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. frac-2negN/A

          \[\leadsto \frac{-\sqrt{\frac{\mathsf{neg}\left(h\right)}{\mathsf{neg}\left(\ell\right)}} \cdot d}{h} \]
        4. sqrt-divN/A

          \[\leadsto \frac{-\frac{\sqrt{\mathsf{neg}\left(h\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \cdot d}{h} \]
        5. lower-/.f64N/A

          \[\leadsto \frac{-\frac{\sqrt{\mathsf{neg}\left(h\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \cdot d}{h} \]
        6. lower-sqrt.f64N/A

          \[\leadsto \frac{-\frac{\sqrt{\mathsf{neg}\left(h\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \cdot d}{h} \]
        7. lower-neg.f64N/A

          \[\leadsto \frac{-\frac{\sqrt{-h}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \cdot d}{h} \]
        8. lower-sqrt.f64N/A

          \[\leadsto \frac{-\frac{\sqrt{-h}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \cdot d}{h} \]
        9. lower-neg.f6422.7

          \[\leadsto \frac{-\frac{\sqrt{-h}}{\sqrt{-\ell}} \cdot d}{h} \]
      9. Applied rewrites22.7%

        \[\leadsto \frac{-\frac{\sqrt{-h}}{\sqrt{-\ell}} \cdot d}{h} \]

      if -4.99999999999999981e-292 < h < 1.07999999999999994e46

      1. Initial program 36.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. Taylor expanded in h around inf

        \[\leadsto \color{blue}{h \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)}{{d}^{2} \cdot \ell} + \frac{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}{h}\right)} \]
      3. Applied rewrites27.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right)} \]
      4. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        2. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        3. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        4. lift-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        5. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        6. lift-sqrt.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        7. lift-sqrt.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        9. pow2N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot {M}^{2}\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        10. associate-*l/N/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{d \cdot {M}^{2}}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        11. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        12. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        13. associate-/l*N/A

          \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        14. lower-/.f64N/A

          \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
      5. Applied rewrites27.2%

        \[\leadsto \mathsf{fma}\left(\frac{\frac{\left(\left(M \cdot M\right) \cdot d\right) \cdot D}{\sqrt{h \cdot \ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
      6. Taylor expanded in l around inf

        \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\color{blue}{\ell}} \]
      7. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\ell} \]
      8. Applied rewrites26.7%

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(\left(M \cdot M\right) \cdot h\right) \cdot \left(D \cdot D\right)}{\left(\sqrt{\frac{h}{\ell}} \cdot \ell\right) \cdot d}, -0.125, \frac{d}{\sqrt{\frac{h}{\ell}}}\right)}{\color{blue}{\ell}} \]
      9. Taylor expanded in d around inf

        \[\leadsto \frac{d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      10. Step-by-step derivation
        1. sqrt-prodN/A

          \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
        2. lower-/.f64N/A

          \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
        3. lift-sqrt.f64N/A

          \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
        4. *-commutativeN/A

          \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
        5. lift-*.f6442.7

          \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
      11. Applied rewrites42.7%

        \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell \cdot h}}} \]

      if 1.07999999999999994e46 < h

      1. Initial program 36.1%

        \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\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({\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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        3. lift-pow.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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        4. 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 - \left(\frac{1}{2} \cdot {\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 {\color{blue}{\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) \]
        6. lift-pow.f64N/A

          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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) \]
        7. lift-/.f64N/A

          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\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) \]
        8. *-commutativeN/A

          \[\leadsto \color{blue}{\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        9. metadata-evalN/A

          \[\leadsto \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}} \cdot {\left(\frac{d}{h}\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) \]
        10. pow1/2N/A

          \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        11. metadata-evalN/A

          \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot {\left(\frac{d}{h}\right)}^{\color{blue}{\frac{1}{2}}}\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) \]
        12. pow1/2N/A

          \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{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) \]
        13. sqrt-unprodN/A

          \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        14. lower-sqrt.f64N/A

          \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        15. lower-*.f64N/A

          \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        16. lift-/.f64N/A

          \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell}} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        17. lift-/.f6455.9

          \[\leadsto \sqrt{\frac{d}{\ell} \cdot \color{blue}{\frac{d}{h}}} \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. Applied rewrites55.9%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \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. Taylor expanded in d around inf

        \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \color{blue}{1} \]
      5. Step-by-step derivation
        1. Applied rewrites32.9%

          \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \color{blue}{1} \]
        2. Taylor expanded in l around 0

          \[\leadsto \color{blue}{\frac{\sqrt{\frac{{d}^{2} \cdot \ell}{h}}}{\ell}} \cdot 1 \]
        3. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{\sqrt{\frac{{d}^{2} \cdot \ell}{h}}}{\color{blue}{\ell}} \cdot 1 \]
          2. associate-/l*N/A

            \[\leadsto \frac{\sqrt{{d}^{2} \cdot \frac{\ell}{h}}}{\ell} \cdot 1 \]
          3. sqrt-prodN/A

            \[\leadsto \frac{\sqrt{{d}^{2}} \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
          4. pow2N/A

            \[\leadsto \frac{\sqrt{d \cdot d} \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
          5. rem-sqrt-square-revN/A

            \[\leadsto \frac{\left|d\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
          6. lower-*.f64N/A

            \[\leadsto \frac{\left|d\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
          7. lift-fabs.f64N/A

            \[\leadsto \frac{\left|d\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
          8. lower-sqrt.f64N/A

            \[\leadsto \frac{\left|d\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
          9. lower-/.f6421.9

            \[\leadsto \frac{\left|d\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
        4. Applied rewrites21.9%

          \[\leadsto \color{blue}{\frac{\left|d\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell}} \cdot 1 \]
      6. Recombined 4 regimes into one program.
      7. Add Preprocessing

      Alternative 17: 44.5% accurate, 3.3× speedup?

      \[\begin{array}{l} d_m = \left|d\right| \\ M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq -2 \cdot 10^{+196}:\\ \;\;\;\;d\_m \cdot \frac{\sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{elif}\;h \leq -5 \cdot 10^{-292}:\\ \;\;\;\;\frac{-\frac{\sqrt{-h}}{\sqrt{-\ell}} \cdot d\_m}{h}\\ \mathbf{elif}\;h \leq 5 \cdot 10^{+34}:\\ \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left|d\_m\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1\\ \end{array} \end{array} \]
      d_m = (fabs.f64 d)
      M_m = (fabs.f64 M)
      D_m = (fabs.f64 D)
      NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
      (FPCore (d_m h l M_m D_m)
       :precision binary64
       (if (<= h -2e+196)
         (* d_m (/ (sqrt (/ h l)) h))
         (if (<= h -5e-292)
           (/ (- (* (/ (sqrt (- h)) (sqrt (- l))) d_m)) h)
           (if (<= h 5e+34)
             (/ d_m (sqrt (* l h)))
             (* (/ (* (fabs d_m) (sqrt (/ l h))) l) 1.0)))))
      d_m = fabs(d);
      M_m = fabs(M);
      D_m = fabs(D);
      assert(d_m < h && h < l && l < M_m && M_m < D_m);
      double code(double d_m, double h, double l, double M_m, double D_m) {
      	double tmp;
      	if (h <= -2e+196) {
      		tmp = d_m * (sqrt((h / l)) / h);
      	} else if (h <= -5e-292) {
      		tmp = -((sqrt(-h) / sqrt(-l)) * d_m) / h;
      	} else if (h <= 5e+34) {
      		tmp = d_m / sqrt((l * h));
      	} else {
      		tmp = ((fabs(d_m) * sqrt((l / h))) / l) * 1.0;
      	}
      	return tmp;
      }
      
      d_m =     private
      M_m =     private
      D_m =     private
      NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(d_m, h, l, m_m, d_m_1)
      use fmin_fmax_functions
          real(8), intent (in) :: d_m
          real(8), intent (in) :: h
          real(8), intent (in) :: l
          real(8), intent (in) :: m_m
          real(8), intent (in) :: d_m_1
          real(8) :: tmp
          if (h <= (-2d+196)) then
              tmp = d_m * (sqrt((h / l)) / h)
          else if (h <= (-5d-292)) then
              tmp = -((sqrt(-h) / sqrt(-l)) * d_m) / h
          else if (h <= 5d+34) then
              tmp = d_m / sqrt((l * h))
          else
              tmp = ((abs(d_m) * sqrt((l / h))) / l) * 1.0d0
          end if
          code = tmp
      end function
      
      d_m = Math.abs(d);
      M_m = Math.abs(M);
      D_m = Math.abs(D);
      assert d_m < h && h < l && l < M_m && M_m < D_m;
      public static double code(double d_m, double h, double l, double M_m, double D_m) {
      	double tmp;
      	if (h <= -2e+196) {
      		tmp = d_m * (Math.sqrt((h / l)) / h);
      	} else if (h <= -5e-292) {
      		tmp = -((Math.sqrt(-h) / Math.sqrt(-l)) * d_m) / h;
      	} else if (h <= 5e+34) {
      		tmp = d_m / Math.sqrt((l * h));
      	} else {
      		tmp = ((Math.abs(d_m) * Math.sqrt((l / h))) / l) * 1.0;
      	}
      	return tmp;
      }
      
      d_m = math.fabs(d)
      M_m = math.fabs(M)
      D_m = math.fabs(D)
      [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m])
      def code(d_m, h, l, M_m, D_m):
      	tmp = 0
      	if h <= -2e+196:
      		tmp = d_m * (math.sqrt((h / l)) / h)
      	elif h <= -5e-292:
      		tmp = -((math.sqrt(-h) / math.sqrt(-l)) * d_m) / h
      	elif h <= 5e+34:
      		tmp = d_m / math.sqrt((l * h))
      	else:
      		tmp = ((math.fabs(d_m) * math.sqrt((l / h))) / l) * 1.0
      	return tmp
      
      d_m = abs(d)
      M_m = abs(M)
      D_m = abs(D)
      d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m])
      function code(d_m, h, l, M_m, D_m)
      	tmp = 0.0
      	if (h <= -2e+196)
      		tmp = Float64(d_m * Float64(sqrt(Float64(h / l)) / h));
      	elseif (h <= -5e-292)
      		tmp = Float64(Float64(-Float64(Float64(sqrt(Float64(-h)) / sqrt(Float64(-l))) * d_m)) / h);
      	elseif (h <= 5e+34)
      		tmp = Float64(d_m / sqrt(Float64(l * h)));
      	else
      		tmp = Float64(Float64(Float64(abs(d_m) * sqrt(Float64(l / h))) / l) * 1.0);
      	end
      	return tmp
      end
      
      d_m = abs(d);
      M_m = abs(M);
      D_m = abs(D);
      d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
      function tmp_2 = code(d_m, h, l, M_m, D_m)
      	tmp = 0.0;
      	if (h <= -2e+196)
      		tmp = d_m * (sqrt((h / l)) / h);
      	elseif (h <= -5e-292)
      		tmp = -((sqrt(-h) / sqrt(-l)) * d_m) / h;
      	elseif (h <= 5e+34)
      		tmp = d_m / sqrt((l * h));
      	else
      		tmp = ((abs(d_m) * sqrt((l / h))) / l) * 1.0;
      	end
      	tmp_2 = tmp;
      end
      
      d_m = N[Abs[d], $MachinePrecision]
      M_m = N[Abs[M], $MachinePrecision]
      D_m = N[Abs[D], $MachinePrecision]
      NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
      code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[h, -2e+196], N[(d$95$m * N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-292], N[((-N[(N[(N[Sqrt[(-h)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision]) / h), $MachinePrecision], If[LessEqual[h, 5e+34], N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Abs[d$95$m], $MachinePrecision] * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * 1.0), $MachinePrecision]]]]
      
      \begin{array}{l}
      d_m = \left|d\right|
      \\
      M_m = \left|M\right|
      \\
      D_m = \left|D\right|
      \\
      [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
      \\
      \begin{array}{l}
      \mathbf{if}\;h \leq -2 \cdot 10^{+196}:\\
      \;\;\;\;d\_m \cdot \frac{\sqrt{\frac{h}{\ell}}}{h}\\
      
      \mathbf{elif}\;h \leq -5 \cdot 10^{-292}:\\
      \;\;\;\;\frac{-\frac{\sqrt{-h}}{\sqrt{-\ell}} \cdot d\_m}{h}\\
      
      \mathbf{elif}\;h \leq 5 \cdot 10^{+34}:\\
      \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\left|d\_m\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if h < -1.9999999999999999e196

        1. Initial program 36.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. Taylor expanded in h around 0

          \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
        3. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
        4. Applied rewrites21.1%

          \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{\ell} \cdot \left(h \cdot d\right)}}{h}} \]
        5. Taylor expanded in d around 0

          \[\leadsto \frac{d \cdot \sqrt{\frac{h}{\ell}}}{\color{blue}{h}} \]
        6. Step-by-step derivation
          1. associate-/l*N/A

            \[\leadsto d \cdot \frac{\sqrt{\frac{h}{\ell}}}{\color{blue}{h}} \]
          2. lower-*.f64N/A

            \[\leadsto d \cdot \frac{\sqrt{\frac{h}{\ell}}}{\color{blue}{h}} \]
          3. mult-flipN/A

            \[\leadsto d \cdot \frac{\sqrt{h \cdot \frac{1}{\ell}}}{h} \]
          4. sqrt-unprodN/A

            \[\leadsto d \cdot \frac{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}{h} \]
          5. lower-/.f64N/A

            \[\leadsto d \cdot \frac{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}{h} \]
          6. sqrt-unprodN/A

            \[\leadsto d \cdot \frac{\sqrt{h \cdot \frac{1}{\ell}}}{h} \]
          7. mult-flipN/A

            \[\leadsto d \cdot \frac{\sqrt{\frac{h}{\ell}}}{h} \]
          8. lower-sqrt.f64N/A

            \[\leadsto d \cdot \frac{\sqrt{\frac{h}{\ell}}}{h} \]
          9. lift-/.f6426.0

            \[\leadsto d \cdot \frac{\sqrt{\frac{h}{\ell}}}{h} \]
        7. Applied rewrites26.0%

          \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{h}{\ell}}}{h}} \]

        if -1.9999999999999999e196 < h < -4.99999999999999981e-292

        1. Initial program 36.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. Taylor expanded in h around 0

          \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
        3. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
        4. Applied rewrites21.1%

          \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{\ell} \cdot \left(h \cdot d\right)}}{h}} \]
        5. Taylor expanded in d around -inf

          \[\leadsto \frac{-1 \cdot \left(d \cdot \sqrt{\frac{h}{\ell}}\right)}{h} \]
        6. Step-by-step derivation
          1. mul-1-negN/A

            \[\leadsto \frac{\mathsf{neg}\left(d \cdot \sqrt{\frac{h}{\ell}}\right)}{h} \]
          2. lower-neg.f64N/A

            \[\leadsto \frac{-d \cdot \sqrt{\frac{h}{\ell}}}{h} \]
          3. *-commutativeN/A

            \[\leadsto \frac{-\sqrt{\frac{h}{\ell}} \cdot d}{h} \]
          4. mult-flipN/A

            \[\leadsto \frac{-\sqrt{h \cdot \frac{1}{\ell}} \cdot d}{h} \]
          5. sqrt-unprodN/A

            \[\leadsto \frac{-\left(\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}\right) \cdot d}{h} \]
          6. lower-*.f64N/A

            \[\leadsto \frac{-\left(\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}\right) \cdot d}{h} \]
          7. sqrt-unprodN/A

            \[\leadsto \frac{-\sqrt{h \cdot \frac{1}{\ell}} \cdot d}{h} \]
          8. mult-flipN/A

            \[\leadsto \frac{-\sqrt{\frac{h}{\ell}} \cdot d}{h} \]
          9. lower-sqrt.f64N/A

            \[\leadsto \frac{-\sqrt{\frac{h}{\ell}} \cdot d}{h} \]
          10. lift-/.f6425.6

            \[\leadsto \frac{-\sqrt{\frac{h}{\ell}} \cdot d}{h} \]
        7. Applied rewrites25.6%

          \[\leadsto \frac{-\sqrt{\frac{h}{\ell}} \cdot d}{h} \]
        8. Step-by-step derivation
          1. lift-/.f64N/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. frac-2negN/A

            \[\leadsto \frac{-\sqrt{\frac{\mathsf{neg}\left(h\right)}{\mathsf{neg}\left(\ell\right)}} \cdot d}{h} \]
          4. sqrt-divN/A

            \[\leadsto \frac{-\frac{\sqrt{\mathsf{neg}\left(h\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \cdot d}{h} \]
          5. lower-/.f64N/A

            \[\leadsto \frac{-\frac{\sqrt{\mathsf{neg}\left(h\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \cdot d}{h} \]
          6. lower-sqrt.f64N/A

            \[\leadsto \frac{-\frac{\sqrt{\mathsf{neg}\left(h\right)}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \cdot d}{h} \]
          7. lower-neg.f64N/A

            \[\leadsto \frac{-\frac{\sqrt{-h}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \cdot d}{h} \]
          8. lower-sqrt.f64N/A

            \[\leadsto \frac{-\frac{\sqrt{-h}}{\sqrt{\mathsf{neg}\left(\ell\right)}} \cdot d}{h} \]
          9. lower-neg.f6422.7

            \[\leadsto \frac{-\frac{\sqrt{-h}}{\sqrt{-\ell}} \cdot d}{h} \]
        9. Applied rewrites22.7%

          \[\leadsto \frac{-\frac{\sqrt{-h}}{\sqrt{-\ell}} \cdot d}{h} \]

        if -4.99999999999999981e-292 < h < 4.9999999999999998e34

        1. Initial program 36.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. Taylor expanded in h around inf

          \[\leadsto \color{blue}{h \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)}{{d}^{2} \cdot \ell} + \frac{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}{h}\right)} \]
        3. Applied rewrites27.0%

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right)} \]
        4. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
          2. lift-*.f64N/A

            \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
          3. lift-*.f64N/A

            \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
          4. lift-/.f64N/A

            \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
          5. lift-*.f64N/A

            \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
          6. lift-sqrt.f64N/A

            \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
          7. lift-sqrt.f64N/A

            \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
          8. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
          9. pow2N/A

            \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot {M}^{2}\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
          10. associate-*l/N/A

            \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{d \cdot {M}^{2}}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
          12. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
          13. associate-/l*N/A

            \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
          14. lower-/.f64N/A

            \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        5. Applied rewrites27.2%

          \[\leadsto \mathsf{fma}\left(\frac{\frac{\left(\left(M \cdot M\right) \cdot d\right) \cdot D}{\sqrt{h \cdot \ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
        6. Taylor expanded in l around inf

          \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\color{blue}{\ell}} \]
        7. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\ell} \]
        8. Applied rewrites26.7%

          \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(\left(M \cdot M\right) \cdot h\right) \cdot \left(D \cdot D\right)}{\left(\sqrt{\frac{h}{\ell}} \cdot \ell\right) \cdot d}, -0.125, \frac{d}{\sqrt{\frac{h}{\ell}}}\right)}{\color{blue}{\ell}} \]
        9. Taylor expanded in d around inf

          \[\leadsto \frac{d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
        10. Step-by-step derivation
          1. sqrt-prodN/A

            \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
          2. lower-/.f64N/A

            \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
          3. lift-sqrt.f64N/A

            \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
          4. *-commutativeN/A

            \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
          5. lift-*.f6442.7

            \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
        11. Applied rewrites42.7%

          \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell \cdot h}}} \]

        if 4.9999999999999998e34 < h

        1. Initial program 36.1%

          \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
        2. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\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({\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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
          3. lift-pow.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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
          4. 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 - \left(\frac{1}{2} \cdot {\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 {\color{blue}{\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) \]
          6. lift-pow.f64N/A

            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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) \]
          7. lift-/.f64N/A

            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\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) \]
          8. *-commutativeN/A

            \[\leadsto \color{blue}{\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
          9. metadata-evalN/A

            \[\leadsto \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}} \cdot {\left(\frac{d}{h}\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) \]
          10. pow1/2N/A

            \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
          11. metadata-evalN/A

            \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot {\left(\frac{d}{h}\right)}^{\color{blue}{\frac{1}{2}}}\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) \]
          12. pow1/2N/A

            \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{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) \]
          13. sqrt-unprodN/A

            \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
          14. lower-sqrt.f64N/A

            \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
          15. lower-*.f64N/A

            \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
          16. lift-/.f64N/A

            \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell}} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
          17. lift-/.f6455.9

            \[\leadsto \sqrt{\frac{d}{\ell} \cdot \color{blue}{\frac{d}{h}}} \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. Applied rewrites55.9%

          \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \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. Taylor expanded in d around inf

          \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \color{blue}{1} \]
        5. Step-by-step derivation
          1. Applied rewrites32.9%

            \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \color{blue}{1} \]
          2. Taylor expanded in l around 0

            \[\leadsto \color{blue}{\frac{\sqrt{\frac{{d}^{2} \cdot \ell}{h}}}{\ell}} \cdot 1 \]
          3. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \frac{\sqrt{\frac{{d}^{2} \cdot \ell}{h}}}{\color{blue}{\ell}} \cdot 1 \]
            2. associate-/l*N/A

              \[\leadsto \frac{\sqrt{{d}^{2} \cdot \frac{\ell}{h}}}{\ell} \cdot 1 \]
            3. sqrt-prodN/A

              \[\leadsto \frac{\sqrt{{d}^{2}} \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
            4. pow2N/A

              \[\leadsto \frac{\sqrt{d \cdot d} \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
            5. rem-sqrt-square-revN/A

              \[\leadsto \frac{\left|d\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
            6. lower-*.f64N/A

              \[\leadsto \frac{\left|d\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
            7. lift-fabs.f64N/A

              \[\leadsto \frac{\left|d\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
            8. lower-sqrt.f64N/A

              \[\leadsto \frac{\left|d\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
            9. lower-/.f6421.9

              \[\leadsto \frac{\left|d\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
          4. Applied rewrites21.9%

            \[\leadsto \color{blue}{\frac{\left|d\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell}} \cdot 1 \]
        6. Recombined 4 regimes into one program.
        7. Add Preprocessing

        Alternative 18: 44.4% accurate, 3.8× speedup?

        \[\begin{array}{l} d_m = \left|d\right| \\ M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq -2 \cdot 10^{+196}:\\ \;\;\;\;d\_m \cdot \frac{\sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{elif}\;h \leq 1.08 \cdot 10^{+46}:\\ \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left|d\_m\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1\\ \end{array} \end{array} \]
        d_m = (fabs.f64 d)
        M_m = (fabs.f64 M)
        D_m = (fabs.f64 D)
        NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
        (FPCore (d_m h l M_m D_m)
         :precision binary64
         (if (<= h -2e+196)
           (* d_m (/ (sqrt (/ h l)) h))
           (if (<= h 1.08e+46)
             (/ d_m (sqrt (* l h)))
             (* (/ (* (fabs d_m) (sqrt (/ l h))) l) 1.0))))
        d_m = fabs(d);
        M_m = fabs(M);
        D_m = fabs(D);
        assert(d_m < h && h < l && l < M_m && M_m < D_m);
        double code(double d_m, double h, double l, double M_m, double D_m) {
        	double tmp;
        	if (h <= -2e+196) {
        		tmp = d_m * (sqrt((h / l)) / h);
        	} else if (h <= 1.08e+46) {
        		tmp = d_m / sqrt((l * h));
        	} else {
        		tmp = ((fabs(d_m) * sqrt((l / h))) / l) * 1.0;
        	}
        	return tmp;
        }
        
        d_m =     private
        M_m =     private
        D_m =     private
        NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(d_m, h, l, m_m, d_m_1)
        use fmin_fmax_functions
            real(8), intent (in) :: d_m
            real(8), intent (in) :: h
            real(8), intent (in) :: l
            real(8), intent (in) :: m_m
            real(8), intent (in) :: d_m_1
            real(8) :: tmp
            if (h <= (-2d+196)) then
                tmp = d_m * (sqrt((h / l)) / h)
            else if (h <= 1.08d+46) then
                tmp = d_m / sqrt((l * h))
            else
                tmp = ((abs(d_m) * sqrt((l / h))) / l) * 1.0d0
            end if
            code = tmp
        end function
        
        d_m = Math.abs(d);
        M_m = Math.abs(M);
        D_m = Math.abs(D);
        assert d_m < h && h < l && l < M_m && M_m < D_m;
        public static double code(double d_m, double h, double l, double M_m, double D_m) {
        	double tmp;
        	if (h <= -2e+196) {
        		tmp = d_m * (Math.sqrt((h / l)) / h);
        	} else if (h <= 1.08e+46) {
        		tmp = d_m / Math.sqrt((l * h));
        	} else {
        		tmp = ((Math.abs(d_m) * Math.sqrt((l / h))) / l) * 1.0;
        	}
        	return tmp;
        }
        
        d_m = math.fabs(d)
        M_m = math.fabs(M)
        D_m = math.fabs(D)
        [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m])
        def code(d_m, h, l, M_m, D_m):
        	tmp = 0
        	if h <= -2e+196:
        		tmp = d_m * (math.sqrt((h / l)) / h)
        	elif h <= 1.08e+46:
        		tmp = d_m / math.sqrt((l * h))
        	else:
        		tmp = ((math.fabs(d_m) * math.sqrt((l / h))) / l) * 1.0
        	return tmp
        
        d_m = abs(d)
        M_m = abs(M)
        D_m = abs(D)
        d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m])
        function code(d_m, h, l, M_m, D_m)
        	tmp = 0.0
        	if (h <= -2e+196)
        		tmp = Float64(d_m * Float64(sqrt(Float64(h / l)) / h));
        	elseif (h <= 1.08e+46)
        		tmp = Float64(d_m / sqrt(Float64(l * h)));
        	else
        		tmp = Float64(Float64(Float64(abs(d_m) * sqrt(Float64(l / h))) / l) * 1.0);
        	end
        	return tmp
        end
        
        d_m = abs(d);
        M_m = abs(M);
        D_m = abs(D);
        d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
        function tmp_2 = code(d_m, h, l, M_m, D_m)
        	tmp = 0.0;
        	if (h <= -2e+196)
        		tmp = d_m * (sqrt((h / l)) / h);
        	elseif (h <= 1.08e+46)
        		tmp = d_m / sqrt((l * h));
        	else
        		tmp = ((abs(d_m) * sqrt((l / h))) / l) * 1.0;
        	end
        	tmp_2 = tmp;
        end
        
        d_m = N[Abs[d], $MachinePrecision]
        M_m = N[Abs[M], $MachinePrecision]
        D_m = N[Abs[D], $MachinePrecision]
        NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
        code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[h, -2e+196], N[(d$95$m * N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 1.08e+46], N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Abs[d$95$m], $MachinePrecision] * N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * 1.0), $MachinePrecision]]]
        
        \begin{array}{l}
        d_m = \left|d\right|
        \\
        M_m = \left|M\right|
        \\
        D_m = \left|D\right|
        \\
        [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
        \\
        \begin{array}{l}
        \mathbf{if}\;h \leq -2 \cdot 10^{+196}:\\
        \;\;\;\;d\_m \cdot \frac{\sqrt{\frac{h}{\ell}}}{h}\\
        
        \mathbf{elif}\;h \leq 1.08 \cdot 10^{+46}:\\
        \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\left|d\_m\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if h < -1.9999999999999999e196

          1. Initial program 36.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. Taylor expanded in h around 0

            \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
          3. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
          4. Applied rewrites21.1%

            \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{\ell} \cdot \left(h \cdot d\right)}}{h}} \]
          5. Taylor expanded in d around 0

            \[\leadsto \frac{d \cdot \sqrt{\frac{h}{\ell}}}{\color{blue}{h}} \]
          6. Step-by-step derivation
            1. associate-/l*N/A

              \[\leadsto d \cdot \frac{\sqrt{\frac{h}{\ell}}}{\color{blue}{h}} \]
            2. lower-*.f64N/A

              \[\leadsto d \cdot \frac{\sqrt{\frac{h}{\ell}}}{\color{blue}{h}} \]
            3. mult-flipN/A

              \[\leadsto d \cdot \frac{\sqrt{h \cdot \frac{1}{\ell}}}{h} \]
            4. sqrt-unprodN/A

              \[\leadsto d \cdot \frac{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}{h} \]
            5. lower-/.f64N/A

              \[\leadsto d \cdot \frac{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}{h} \]
            6. sqrt-unprodN/A

              \[\leadsto d \cdot \frac{\sqrt{h \cdot \frac{1}{\ell}}}{h} \]
            7. mult-flipN/A

              \[\leadsto d \cdot \frac{\sqrt{\frac{h}{\ell}}}{h} \]
            8. lower-sqrt.f64N/A

              \[\leadsto d \cdot \frac{\sqrt{\frac{h}{\ell}}}{h} \]
            9. lift-/.f6426.0

              \[\leadsto d \cdot \frac{\sqrt{\frac{h}{\ell}}}{h} \]
          7. Applied rewrites26.0%

            \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{h}{\ell}}}{h}} \]

          if -1.9999999999999999e196 < h < 1.07999999999999994e46

          1. Initial program 36.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. Taylor expanded in h around inf

            \[\leadsto \color{blue}{h \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)}{{d}^{2} \cdot \ell} + \frac{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}{h}\right)} \]
          3. Applied rewrites27.0%

            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right)} \]
          4. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            2. lift-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            3. lift-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            4. lift-/.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            5. lift-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            6. lift-sqrt.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            7. lift-sqrt.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            9. pow2N/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot {M}^{2}\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            10. associate-*l/N/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{d \cdot {M}^{2}}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            12. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            13. associate-/l*N/A

              \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            14. lower-/.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
          5. Applied rewrites27.2%

            \[\leadsto \mathsf{fma}\left(\frac{\frac{\left(\left(M \cdot M\right) \cdot d\right) \cdot D}{\sqrt{h \cdot \ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
          6. Taylor expanded in l around inf

            \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\color{blue}{\ell}} \]
          7. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\ell} \]
          8. Applied rewrites26.7%

            \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(\left(M \cdot M\right) \cdot h\right) \cdot \left(D \cdot D\right)}{\left(\sqrt{\frac{h}{\ell}} \cdot \ell\right) \cdot d}, -0.125, \frac{d}{\sqrt{\frac{h}{\ell}}}\right)}{\color{blue}{\ell}} \]
          9. Taylor expanded in d around inf

            \[\leadsto \frac{d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
          10. Step-by-step derivation
            1. sqrt-prodN/A

              \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
            2. lower-/.f64N/A

              \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
            3. lift-sqrt.f64N/A

              \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
            4. *-commutativeN/A

              \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
            5. lift-*.f6442.7

              \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
          11. Applied rewrites42.7%

            \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell \cdot h}}} \]

          if 1.07999999999999994e46 < h

          1. Initial program 36.1%

            \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
          2. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\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({\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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
            3. lift-pow.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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
            4. 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 - \left(\frac{1}{2} \cdot {\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 {\color{blue}{\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) \]
            6. lift-pow.f64N/A

              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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) \]
            7. lift-/.f64N/A

              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\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) \]
            8. *-commutativeN/A

              \[\leadsto \color{blue}{\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
            9. metadata-evalN/A

              \[\leadsto \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}} \cdot {\left(\frac{d}{h}\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) \]
            10. pow1/2N/A

              \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
            11. metadata-evalN/A

              \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot {\left(\frac{d}{h}\right)}^{\color{blue}{\frac{1}{2}}}\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) \]
            12. pow1/2N/A

              \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{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) \]
            13. sqrt-unprodN/A

              \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
            14. lower-sqrt.f64N/A

              \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
            15. lower-*.f64N/A

              \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
            16. lift-/.f64N/A

              \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell}} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
            17. lift-/.f6455.9

              \[\leadsto \sqrt{\frac{d}{\ell} \cdot \color{blue}{\frac{d}{h}}} \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. Applied rewrites55.9%

            \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \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. Taylor expanded in d around inf

            \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \color{blue}{1} \]
          5. Step-by-step derivation
            1. Applied rewrites32.9%

              \[\leadsto \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \color{blue}{1} \]
            2. Taylor expanded in l around 0

              \[\leadsto \color{blue}{\frac{\sqrt{\frac{{d}^{2} \cdot \ell}{h}}}{\ell}} \cdot 1 \]
            3. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{\sqrt{\frac{{d}^{2} \cdot \ell}{h}}}{\color{blue}{\ell}} \cdot 1 \]
              2. associate-/l*N/A

                \[\leadsto \frac{\sqrt{{d}^{2} \cdot \frac{\ell}{h}}}{\ell} \cdot 1 \]
              3. sqrt-prodN/A

                \[\leadsto \frac{\sqrt{{d}^{2}} \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
              4. pow2N/A

                \[\leadsto \frac{\sqrt{d \cdot d} \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
              5. rem-sqrt-square-revN/A

                \[\leadsto \frac{\left|d\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
              6. lower-*.f64N/A

                \[\leadsto \frac{\left|d\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
              7. lift-fabs.f64N/A

                \[\leadsto \frac{\left|d\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
              8. lower-sqrt.f64N/A

                \[\leadsto \frac{\left|d\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
              9. lower-/.f6421.9

                \[\leadsto \frac{\left|d\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell} \cdot 1 \]
            4. Applied rewrites21.9%

              \[\leadsto \color{blue}{\frac{\left|d\right| \cdot \sqrt{\frac{\ell}{h}}}{\ell}} \cdot 1 \]
          6. Recombined 3 regimes into one program.
          7. Add Preprocessing

          Alternative 19: 44.4% accurate, 4.2× speedup?

          \[\begin{array}{l} d_m = \left|d\right| \\ M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq -2 \cdot 10^{+196}:\\ \;\;\;\;d\_m \cdot \frac{\sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{elif}\;h \leq 7 \cdot 10^{-9}:\\ \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;-\frac{d\_m}{-\sqrt{\frac{\ell}{h}} \cdot h}\\ \end{array} \end{array} \]
          d_m = (fabs.f64 d)
          M_m = (fabs.f64 M)
          D_m = (fabs.f64 D)
          NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
          (FPCore (d_m h l M_m D_m)
           :precision binary64
           (if (<= h -2e+196)
             (* d_m (/ (sqrt (/ h l)) h))
             (if (<= h 7e-9)
               (/ d_m (sqrt (* l h)))
               (- (/ d_m (- (* (sqrt (/ l h)) h)))))))
          d_m = fabs(d);
          M_m = fabs(M);
          D_m = fabs(D);
          assert(d_m < h && h < l && l < M_m && M_m < D_m);
          double code(double d_m, double h, double l, double M_m, double D_m) {
          	double tmp;
          	if (h <= -2e+196) {
          		tmp = d_m * (sqrt((h / l)) / h);
          	} else if (h <= 7e-9) {
          		tmp = d_m / sqrt((l * h));
          	} else {
          		tmp = -(d_m / -(sqrt((l / h)) * h));
          	}
          	return tmp;
          }
          
          d_m =     private
          M_m =     private
          D_m =     private
          NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(d_m, h, l, m_m, d_m_1)
          use fmin_fmax_functions
              real(8), intent (in) :: d_m
              real(8), intent (in) :: h
              real(8), intent (in) :: l
              real(8), intent (in) :: m_m
              real(8), intent (in) :: d_m_1
              real(8) :: tmp
              if (h <= (-2d+196)) then
                  tmp = d_m * (sqrt((h / l)) / h)
              else if (h <= 7d-9) then
                  tmp = d_m / sqrt((l * h))
              else
                  tmp = -(d_m / -(sqrt((l / h)) * h))
              end if
              code = tmp
          end function
          
          d_m = Math.abs(d);
          M_m = Math.abs(M);
          D_m = Math.abs(D);
          assert d_m < h && h < l && l < M_m && M_m < D_m;
          public static double code(double d_m, double h, double l, double M_m, double D_m) {
          	double tmp;
          	if (h <= -2e+196) {
          		tmp = d_m * (Math.sqrt((h / l)) / h);
          	} else if (h <= 7e-9) {
          		tmp = d_m / Math.sqrt((l * h));
          	} else {
          		tmp = -(d_m / -(Math.sqrt((l / h)) * h));
          	}
          	return tmp;
          }
          
          d_m = math.fabs(d)
          M_m = math.fabs(M)
          D_m = math.fabs(D)
          [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m])
          def code(d_m, h, l, M_m, D_m):
          	tmp = 0
          	if h <= -2e+196:
          		tmp = d_m * (math.sqrt((h / l)) / h)
          	elif h <= 7e-9:
          		tmp = d_m / math.sqrt((l * h))
          	else:
          		tmp = -(d_m / -(math.sqrt((l / h)) * h))
          	return tmp
          
          d_m = abs(d)
          M_m = abs(M)
          D_m = abs(D)
          d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m])
          function code(d_m, h, l, M_m, D_m)
          	tmp = 0.0
          	if (h <= -2e+196)
          		tmp = Float64(d_m * Float64(sqrt(Float64(h / l)) / h));
          	elseif (h <= 7e-9)
          		tmp = Float64(d_m / sqrt(Float64(l * h)));
          	else
          		tmp = Float64(-Float64(d_m / Float64(-Float64(sqrt(Float64(l / h)) * h))));
          	end
          	return tmp
          end
          
          d_m = abs(d);
          M_m = abs(M);
          D_m = abs(D);
          d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
          function tmp_2 = code(d_m, h, l, M_m, D_m)
          	tmp = 0.0;
          	if (h <= -2e+196)
          		tmp = d_m * (sqrt((h / l)) / h);
          	elseif (h <= 7e-9)
          		tmp = d_m / sqrt((l * h));
          	else
          		tmp = -(d_m / -(sqrt((l / h)) * h));
          	end
          	tmp_2 = tmp;
          end
          
          d_m = N[Abs[d], $MachinePrecision]
          M_m = N[Abs[M], $MachinePrecision]
          D_m = N[Abs[D], $MachinePrecision]
          NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
          code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[h, -2e+196], N[(d$95$m * N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 7e-9], N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], (-N[(d$95$m / (-N[(N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision] * h), $MachinePrecision])), $MachinePrecision])]]
          
          \begin{array}{l}
          d_m = \left|d\right|
          \\
          M_m = \left|M\right|
          \\
          D_m = \left|D\right|
          \\
          [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
          \\
          \begin{array}{l}
          \mathbf{if}\;h \leq -2 \cdot 10^{+196}:\\
          \;\;\;\;d\_m \cdot \frac{\sqrt{\frac{h}{\ell}}}{h}\\
          
          \mathbf{elif}\;h \leq 7 \cdot 10^{-9}:\\
          \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\
          
          \mathbf{else}:\\
          \;\;\;\;-\frac{d\_m}{-\sqrt{\frac{\ell}{h}} \cdot h}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if h < -1.9999999999999999e196

            1. Initial program 36.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. Taylor expanded in h around 0

              \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
            3. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
            4. Applied rewrites21.1%

              \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{\ell} \cdot \left(h \cdot d\right)}}{h}} \]
            5. Taylor expanded in d around 0

              \[\leadsto \frac{d \cdot \sqrt{\frac{h}{\ell}}}{\color{blue}{h}} \]
            6. Step-by-step derivation
              1. associate-/l*N/A

                \[\leadsto d \cdot \frac{\sqrt{\frac{h}{\ell}}}{\color{blue}{h}} \]
              2. lower-*.f64N/A

                \[\leadsto d \cdot \frac{\sqrt{\frac{h}{\ell}}}{\color{blue}{h}} \]
              3. mult-flipN/A

                \[\leadsto d \cdot \frac{\sqrt{h \cdot \frac{1}{\ell}}}{h} \]
              4. sqrt-unprodN/A

                \[\leadsto d \cdot \frac{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}{h} \]
              5. lower-/.f64N/A

                \[\leadsto d \cdot \frac{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}{h} \]
              6. sqrt-unprodN/A

                \[\leadsto d \cdot \frac{\sqrt{h \cdot \frac{1}{\ell}}}{h} \]
              7. mult-flipN/A

                \[\leadsto d \cdot \frac{\sqrt{\frac{h}{\ell}}}{h} \]
              8. lower-sqrt.f64N/A

                \[\leadsto d \cdot \frac{\sqrt{\frac{h}{\ell}}}{h} \]
              9. lift-/.f6426.0

                \[\leadsto d \cdot \frac{\sqrt{\frac{h}{\ell}}}{h} \]
            7. Applied rewrites26.0%

              \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{h}{\ell}}}{h}} \]

            if -1.9999999999999999e196 < h < 6.9999999999999998e-9

            1. Initial program 36.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. Taylor expanded in h around inf

              \[\leadsto \color{blue}{h \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)}{{d}^{2} \cdot \ell} + \frac{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}{h}\right)} \]
            3. Applied rewrites27.0%

              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right)} \]
            4. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              2. lift-*.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              3. lift-*.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              4. lift-/.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              5. lift-*.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              6. lift-sqrt.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              7. lift-sqrt.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              8. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              9. pow2N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot {M}^{2}\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              10. associate-*l/N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{d \cdot {M}^{2}}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              11. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              12. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              13. associate-/l*N/A

                \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              14. lower-/.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            5. Applied rewrites27.2%

              \[\leadsto \mathsf{fma}\left(\frac{\frac{\left(\left(M \cdot M\right) \cdot d\right) \cdot D}{\sqrt{h \cdot \ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            6. Taylor expanded in l around inf

              \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\color{blue}{\ell}} \]
            7. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\ell} \]
            8. Applied rewrites26.7%

              \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(\left(M \cdot M\right) \cdot h\right) \cdot \left(D \cdot D\right)}{\left(\sqrt{\frac{h}{\ell}} \cdot \ell\right) \cdot d}, -0.125, \frac{d}{\sqrt{\frac{h}{\ell}}}\right)}{\color{blue}{\ell}} \]
            9. Taylor expanded in d around inf

              \[\leadsto \frac{d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
            10. Step-by-step derivation
              1. sqrt-prodN/A

                \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
              2. lower-/.f64N/A

                \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
              3. lift-sqrt.f64N/A

                \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
              4. *-commutativeN/A

                \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
              5. lift-*.f6442.7

                \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
            11. Applied rewrites42.7%

              \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell \cdot h}}} \]

            if 6.9999999999999998e-9 < h

            1. Initial program 36.1%

              \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
            2. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\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({\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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              3. lift-pow.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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              4. 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 - \left(\frac{1}{2} \cdot {\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 {\color{blue}{\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) \]
              6. lift-pow.f64N/A

                \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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) \]
              7. lift-/.f64N/A

                \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\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) \]
              8. *-commutativeN/A

                \[\leadsto \color{blue}{\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              9. metadata-evalN/A

                \[\leadsto \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}} \cdot {\left(\frac{d}{h}\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) \]
              10. pow1/2N/A

                \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              11. metadata-evalN/A

                \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot {\left(\frac{d}{h}\right)}^{\color{blue}{\frac{1}{2}}}\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) \]
              12. pow1/2N/A

                \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{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) \]
              13. sqrt-unprodN/A

                \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              14. lower-sqrt.f64N/A

                \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              15. lower-*.f64N/A

                \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              16. lift-/.f64N/A

                \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell}} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              17. lift-/.f6455.9

                \[\leadsto \sqrt{\frac{d}{\ell} \cdot \color{blue}{\frac{d}{h}}} \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. Applied rewrites55.9%

              \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \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. Taylor expanded in d around -inf

              \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
            5. Step-by-step derivation
              1. sqrt-prodN/A

                \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
              2. pow1/2N/A

                \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
              3. metadata-evalN/A

                \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
              4. pow1/2N/A

                \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
              5. metadata-evalN/A

                \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
              6. *-commutativeN/A

                \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
              7. mul-1-negN/A

                \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
              8. sqrt-divN/A

                \[\leadsto \mathsf{neg}\left(d \cdot \frac{\sqrt{1}}{\sqrt{h \cdot \ell}}\right) \]
              9. metadata-evalN/A

                \[\leadsto \mathsf{neg}\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right) \]
              10. sqrt-unprodN/A

                \[\leadsto \mathsf{neg}\left(d \cdot \frac{1}{\sqrt{h} \cdot \sqrt{\ell}}\right) \]
              11. *-commutativeN/A

                \[\leadsto \mathsf{neg}\left(d \cdot \frac{1}{\sqrt{\ell} \cdot \sqrt{h}}\right) \]
              12. mult-flipN/A

                \[\leadsto \mathsf{neg}\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\right) \]
              13. lower-neg.f64N/A

                \[\leadsto -\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \]
              14. *-commutativeN/A

                \[\leadsto -\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
              15. lower-/.f64N/A

                \[\leadsto -\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
            6. Applied rewrites10.1%

              \[\leadsto \color{blue}{-\frac{d}{\sqrt{h \cdot \ell}}} \]
            7. Taylor expanded in h around -inf

              \[\leadsto -\frac{d}{-1 \cdot \left(h \cdot \sqrt{\frac{\ell}{h}}\right)} \]
            8. Step-by-step derivation
              1. mul-1-negN/A

                \[\leadsto -\frac{d}{\mathsf{neg}\left(h \cdot \sqrt{\frac{\ell}{h}}\right)} \]
              2. sqrt-prodN/A

                \[\leadsto -\frac{d}{\mathsf{neg}\left(h \cdot \sqrt{\frac{\ell}{h}}\right)} \]
              3. *-commutativeN/A

                \[\leadsto -\frac{d}{\mathsf{neg}\left(h \cdot \sqrt{\frac{\ell}{h}}\right)} \]
              4. lower-neg.f64N/A

                \[\leadsto -\frac{d}{-h \cdot \sqrt{\frac{\ell}{h}}} \]
              5. *-commutativeN/A

                \[\leadsto -\frac{d}{-\sqrt{\frac{\ell}{h}} \cdot h} \]
              6. lower-*.f64N/A

                \[\leadsto -\frac{d}{-\sqrt{\frac{\ell}{h}} \cdot h} \]
              7. lower-sqrt.f64N/A

                \[\leadsto -\frac{d}{-\sqrt{\frac{\ell}{h}} \cdot h} \]
              8. lower-/.f6425.6

                \[\leadsto -\frac{d}{-\sqrt{\frac{\ell}{h}} \cdot h} \]
            9. Applied rewrites25.6%

              \[\leadsto -\frac{d}{-\sqrt{\frac{\ell}{h}} \cdot h} \]
          3. Recombined 3 regimes into one program.
          4. Add Preprocessing

          Alternative 20: 44.2% accurate, 4.6× speedup?

          \[\begin{array}{l} d_m = \left|d\right| \\ M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{h}{\ell}}\\ \mathbf{if}\;h \leq -2 \cdot 10^{+196}:\\ \;\;\;\;d\_m \cdot \frac{t\_0}{h}\\ \mathbf{elif}\;h \leq 2.5 \cdot 10^{+62}:\\ \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d\_m}{t\_0 \cdot \ell}\\ \end{array} \end{array} \]
          d_m = (fabs.f64 d)
          M_m = (fabs.f64 M)
          D_m = (fabs.f64 D)
          NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
          (FPCore (d_m h l M_m D_m)
           :precision binary64
           (let* ((t_0 (sqrt (/ h l))))
             (if (<= h -2e+196)
               (* d_m (/ t_0 h))
               (if (<= h 2.5e+62) (/ d_m (sqrt (* l h))) (/ d_m (* t_0 l))))))
          d_m = fabs(d);
          M_m = fabs(M);
          D_m = fabs(D);
          assert(d_m < h && h < l && l < M_m && M_m < D_m);
          double code(double d_m, double h, double l, double M_m, double D_m) {
          	double t_0 = sqrt((h / l));
          	double tmp;
          	if (h <= -2e+196) {
          		tmp = d_m * (t_0 / h);
          	} else if (h <= 2.5e+62) {
          		tmp = d_m / sqrt((l * h));
          	} else {
          		tmp = d_m / (t_0 * l);
          	}
          	return tmp;
          }
          
          d_m =     private
          M_m =     private
          D_m =     private
          NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(d_m, h, l, m_m, d_m_1)
          use fmin_fmax_functions
              real(8), intent (in) :: d_m
              real(8), intent (in) :: h
              real(8), intent (in) :: l
              real(8), intent (in) :: m_m
              real(8), intent (in) :: d_m_1
              real(8) :: t_0
              real(8) :: tmp
              t_0 = sqrt((h / l))
              if (h <= (-2d+196)) then
                  tmp = d_m * (t_0 / h)
              else if (h <= 2.5d+62) then
                  tmp = d_m / sqrt((l * h))
              else
                  tmp = d_m / (t_0 * l)
              end if
              code = tmp
          end function
          
          d_m = Math.abs(d);
          M_m = Math.abs(M);
          D_m = Math.abs(D);
          assert d_m < h && h < l && l < M_m && M_m < D_m;
          public static double code(double d_m, double h, double l, double M_m, double D_m) {
          	double t_0 = Math.sqrt((h / l));
          	double tmp;
          	if (h <= -2e+196) {
          		tmp = d_m * (t_0 / h);
          	} else if (h <= 2.5e+62) {
          		tmp = d_m / Math.sqrt((l * h));
          	} else {
          		tmp = d_m / (t_0 * l);
          	}
          	return tmp;
          }
          
          d_m = math.fabs(d)
          M_m = math.fabs(M)
          D_m = math.fabs(D)
          [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m])
          def code(d_m, h, l, M_m, D_m):
          	t_0 = math.sqrt((h / l))
          	tmp = 0
          	if h <= -2e+196:
          		tmp = d_m * (t_0 / h)
          	elif h <= 2.5e+62:
          		tmp = d_m / math.sqrt((l * h))
          	else:
          		tmp = d_m / (t_0 * l)
          	return tmp
          
          d_m = abs(d)
          M_m = abs(M)
          D_m = abs(D)
          d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m])
          function code(d_m, h, l, M_m, D_m)
          	t_0 = sqrt(Float64(h / l))
          	tmp = 0.0
          	if (h <= -2e+196)
          		tmp = Float64(d_m * Float64(t_0 / h));
          	elseif (h <= 2.5e+62)
          		tmp = Float64(d_m / sqrt(Float64(l * h)));
          	else
          		tmp = Float64(d_m / Float64(t_0 * l));
          	end
          	return tmp
          end
          
          d_m = abs(d);
          M_m = abs(M);
          D_m = abs(D);
          d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
          function tmp_2 = code(d_m, h, l, M_m, D_m)
          	t_0 = sqrt((h / l));
          	tmp = 0.0;
          	if (h <= -2e+196)
          		tmp = d_m * (t_0 / h);
          	elseif (h <= 2.5e+62)
          		tmp = d_m / sqrt((l * h));
          	else
          		tmp = d_m / (t_0 * l);
          	end
          	tmp_2 = tmp;
          end
          
          d_m = N[Abs[d], $MachinePrecision]
          M_m = N[Abs[M], $MachinePrecision]
          D_m = N[Abs[D], $MachinePrecision]
          NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
          code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -2e+196], N[(d$95$m * N[(t$95$0 / h), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.5e+62], N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d$95$m / N[(t$95$0 * l), $MachinePrecision]), $MachinePrecision]]]]
          
          \begin{array}{l}
          d_m = \left|d\right|
          \\
          M_m = \left|M\right|
          \\
          D_m = \left|D\right|
          \\
          [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
          \\
          \begin{array}{l}
          t_0 := \sqrt{\frac{h}{\ell}}\\
          \mathbf{if}\;h \leq -2 \cdot 10^{+196}:\\
          \;\;\;\;d\_m \cdot \frac{t\_0}{h}\\
          
          \mathbf{elif}\;h \leq 2.5 \cdot 10^{+62}:\\
          \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{d\_m}{t\_0 \cdot \ell}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if h < -1.9999999999999999e196

            1. Initial program 36.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. Taylor expanded in h around 0

              \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
            3. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{\color{blue}{h}} \]
            4. Applied rewrites21.1%

              \[\leadsto \color{blue}{\frac{\sqrt{\frac{d}{\ell} \cdot \left(h \cdot d\right)}}{h}} \]
            5. Taylor expanded in d around 0

              \[\leadsto \frac{d \cdot \sqrt{\frac{h}{\ell}}}{\color{blue}{h}} \]
            6. Step-by-step derivation
              1. associate-/l*N/A

                \[\leadsto d \cdot \frac{\sqrt{\frac{h}{\ell}}}{\color{blue}{h}} \]
              2. lower-*.f64N/A

                \[\leadsto d \cdot \frac{\sqrt{\frac{h}{\ell}}}{\color{blue}{h}} \]
              3. mult-flipN/A

                \[\leadsto d \cdot \frac{\sqrt{h \cdot \frac{1}{\ell}}}{h} \]
              4. sqrt-unprodN/A

                \[\leadsto d \cdot \frac{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}{h} \]
              5. lower-/.f64N/A

                \[\leadsto d \cdot \frac{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}{h} \]
              6. sqrt-unprodN/A

                \[\leadsto d \cdot \frac{\sqrt{h \cdot \frac{1}{\ell}}}{h} \]
              7. mult-flipN/A

                \[\leadsto d \cdot \frac{\sqrt{\frac{h}{\ell}}}{h} \]
              8. lower-sqrt.f64N/A

                \[\leadsto d \cdot \frac{\sqrt{\frac{h}{\ell}}}{h} \]
              9. lift-/.f6426.0

                \[\leadsto d \cdot \frac{\sqrt{\frac{h}{\ell}}}{h} \]
            7. Applied rewrites26.0%

              \[\leadsto d \cdot \color{blue}{\frac{\sqrt{\frac{h}{\ell}}}{h}} \]

            if -1.9999999999999999e196 < h < 2.50000000000000014e62

            1. Initial program 36.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. Taylor expanded in h around inf

              \[\leadsto \color{blue}{h \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)}{{d}^{2} \cdot \ell} + \frac{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}{h}\right)} \]
            3. Applied rewrites27.0%

              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right)} \]
            4. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              2. lift-*.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              3. lift-*.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              4. lift-/.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              5. lift-*.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              6. lift-sqrt.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              7. lift-sqrt.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              8. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              9. pow2N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot {M}^{2}\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              10. associate-*l/N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{d \cdot {M}^{2}}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              11. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              12. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              13. associate-/l*N/A

                \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              14. lower-/.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            5. Applied rewrites27.2%

              \[\leadsto \mathsf{fma}\left(\frac{\frac{\left(\left(M \cdot M\right) \cdot d\right) \cdot D}{\sqrt{h \cdot \ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            6. Taylor expanded in l around inf

              \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\color{blue}{\ell}} \]
            7. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\ell} \]
            8. Applied rewrites26.7%

              \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(\left(M \cdot M\right) \cdot h\right) \cdot \left(D \cdot D\right)}{\left(\sqrt{\frac{h}{\ell}} \cdot \ell\right) \cdot d}, -0.125, \frac{d}{\sqrt{\frac{h}{\ell}}}\right)}{\color{blue}{\ell}} \]
            9. Taylor expanded in d around inf

              \[\leadsto \frac{d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
            10. Step-by-step derivation
              1. sqrt-prodN/A

                \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
              2. lower-/.f64N/A

                \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
              3. lift-sqrt.f64N/A

                \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
              4. *-commutativeN/A

                \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
              5. lift-*.f6442.7

                \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
            11. Applied rewrites42.7%

              \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell \cdot h}}} \]

            if 2.50000000000000014e62 < h

            1. Initial program 36.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. Taylor expanded in h around inf

              \[\leadsto \color{blue}{h \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)}{{d}^{2} \cdot \ell} + \frac{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}{h}\right)} \]
            3. Applied rewrites27.0%

              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right)} \]
            4. Taylor expanded in l around inf

              \[\leadsto \frac{d}{\color{blue}{\ell \cdot \left(\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}\right)}} \]
            5. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{d}{\ell \cdot \color{blue}{\left(\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}\right)}} \]
              2. *-commutativeN/A

                \[\leadsto \frac{d}{\left(\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}\right) \cdot \ell} \]
              3. lower-*.f64N/A

                \[\leadsto \frac{d}{\left(\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}\right) \cdot \ell} \]
              4. sqrt-unprodN/A

                \[\leadsto \frac{d}{\sqrt{h \cdot \frac{1}{\ell}} \cdot \ell} \]
              5. mult-flipN/A

                \[\leadsto \frac{d}{\sqrt{\frac{h}{\ell}} \cdot \ell} \]
              6. lower-sqrt.f64N/A

                \[\leadsto \frac{d}{\sqrt{\frac{h}{\ell}} \cdot \ell} \]
              7. lift-/.f6423.0

                \[\leadsto \frac{d}{\sqrt{\frac{h}{\ell}} \cdot \ell} \]
            6. Applied rewrites23.0%

              \[\leadsto \frac{d}{\color{blue}{\sqrt{\frac{h}{\ell}} \cdot \ell}} \]
          3. Recombined 3 regimes into one program.
          4. Add Preprocessing

          Alternative 21: 44.1% accurate, 5.7× speedup?

          \[\begin{array}{l} d_m = \left|d\right| \\ M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq 2.5 \cdot 10^{+62}:\\ \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d\_m}{\sqrt{\frac{h}{\ell}} \cdot \ell}\\ \end{array} \end{array} \]
          d_m = (fabs.f64 d)
          M_m = (fabs.f64 M)
          D_m = (fabs.f64 D)
          NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
          (FPCore (d_m h l M_m D_m)
           :precision binary64
           (if (<= h 2.5e+62) (/ d_m (sqrt (* l h))) (/ d_m (* (sqrt (/ h l)) l))))
          d_m = fabs(d);
          M_m = fabs(M);
          D_m = fabs(D);
          assert(d_m < h && h < l && l < M_m && M_m < D_m);
          double code(double d_m, double h, double l, double M_m, double D_m) {
          	double tmp;
          	if (h <= 2.5e+62) {
          		tmp = d_m / sqrt((l * h));
          	} else {
          		tmp = d_m / (sqrt((h / l)) * l);
          	}
          	return tmp;
          }
          
          d_m =     private
          M_m =     private
          D_m =     private
          NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(d_m, h, l, m_m, d_m_1)
          use fmin_fmax_functions
              real(8), intent (in) :: d_m
              real(8), intent (in) :: h
              real(8), intent (in) :: l
              real(8), intent (in) :: m_m
              real(8), intent (in) :: d_m_1
              real(8) :: tmp
              if (h <= 2.5d+62) then
                  tmp = d_m / sqrt((l * h))
              else
                  tmp = d_m / (sqrt((h / l)) * l)
              end if
              code = tmp
          end function
          
          d_m = Math.abs(d);
          M_m = Math.abs(M);
          D_m = Math.abs(D);
          assert d_m < h && h < l && l < M_m && M_m < D_m;
          public static double code(double d_m, double h, double l, double M_m, double D_m) {
          	double tmp;
          	if (h <= 2.5e+62) {
          		tmp = d_m / Math.sqrt((l * h));
          	} else {
          		tmp = d_m / (Math.sqrt((h / l)) * l);
          	}
          	return tmp;
          }
          
          d_m = math.fabs(d)
          M_m = math.fabs(M)
          D_m = math.fabs(D)
          [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m])
          def code(d_m, h, l, M_m, D_m):
          	tmp = 0
          	if h <= 2.5e+62:
          		tmp = d_m / math.sqrt((l * h))
          	else:
          		tmp = d_m / (math.sqrt((h / l)) * l)
          	return tmp
          
          d_m = abs(d)
          M_m = abs(M)
          D_m = abs(D)
          d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m])
          function code(d_m, h, l, M_m, D_m)
          	tmp = 0.0
          	if (h <= 2.5e+62)
          		tmp = Float64(d_m / sqrt(Float64(l * h)));
          	else
          		tmp = Float64(d_m / Float64(sqrt(Float64(h / l)) * l));
          	end
          	return tmp
          end
          
          d_m = abs(d);
          M_m = abs(M);
          D_m = abs(D);
          d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
          function tmp_2 = code(d_m, h, l, M_m, D_m)
          	tmp = 0.0;
          	if (h <= 2.5e+62)
          		tmp = d_m / sqrt((l * h));
          	else
          		tmp = d_m / (sqrt((h / l)) * l);
          	end
          	tmp_2 = tmp;
          end
          
          d_m = N[Abs[d], $MachinePrecision]
          M_m = N[Abs[M], $MachinePrecision]
          D_m = N[Abs[D], $MachinePrecision]
          NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
          code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[h, 2.5e+62], N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d$95$m / N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          d_m = \left|d\right|
          \\
          M_m = \left|M\right|
          \\
          D_m = \left|D\right|
          \\
          [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
          \\
          \begin{array}{l}
          \mathbf{if}\;h \leq 2.5 \cdot 10^{+62}:\\
          \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{d\_m}{\sqrt{\frac{h}{\ell}} \cdot \ell}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if h < 2.50000000000000014e62

            1. Initial program 36.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. Taylor expanded in h around inf

              \[\leadsto \color{blue}{h \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)}{{d}^{2} \cdot \ell} + \frac{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}{h}\right)} \]
            3. Applied rewrites27.0%

              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right)} \]
            4. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              2. lift-*.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              3. lift-*.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              4. lift-/.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              5. lift-*.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              6. lift-sqrt.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              7. lift-sqrt.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              8. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              9. pow2N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot {M}^{2}\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              10. associate-*l/N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{d \cdot {M}^{2}}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              11. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              12. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              13. associate-/l*N/A

                \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              14. lower-/.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            5. Applied rewrites27.2%

              \[\leadsto \mathsf{fma}\left(\frac{\frac{\left(\left(M \cdot M\right) \cdot d\right) \cdot D}{\sqrt{h \cdot \ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            6. Taylor expanded in l around inf

              \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\color{blue}{\ell}} \]
            7. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\ell} \]
            8. Applied rewrites26.7%

              \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(\left(M \cdot M\right) \cdot h\right) \cdot \left(D \cdot D\right)}{\left(\sqrt{\frac{h}{\ell}} \cdot \ell\right) \cdot d}, -0.125, \frac{d}{\sqrt{\frac{h}{\ell}}}\right)}{\color{blue}{\ell}} \]
            9. Taylor expanded in d around inf

              \[\leadsto \frac{d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
            10. Step-by-step derivation
              1. sqrt-prodN/A

                \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
              2. lower-/.f64N/A

                \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
              3. lift-sqrt.f64N/A

                \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
              4. *-commutativeN/A

                \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
              5. lift-*.f6442.7

                \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
            11. Applied rewrites42.7%

              \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell \cdot h}}} \]

            if 2.50000000000000014e62 < h

            1. Initial program 36.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. Taylor expanded in h around inf

              \[\leadsto \color{blue}{h \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)}{{d}^{2} \cdot \ell} + \frac{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}{h}\right)} \]
            3. Applied rewrites27.0%

              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right)} \]
            4. Taylor expanded in l around inf

              \[\leadsto \frac{d}{\color{blue}{\ell \cdot \left(\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}\right)}} \]
            5. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{d}{\ell \cdot \color{blue}{\left(\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}\right)}} \]
              2. *-commutativeN/A

                \[\leadsto \frac{d}{\left(\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}\right) \cdot \ell} \]
              3. lower-*.f64N/A

                \[\leadsto \frac{d}{\left(\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}\right) \cdot \ell} \]
              4. sqrt-unprodN/A

                \[\leadsto \frac{d}{\sqrt{h \cdot \frac{1}{\ell}} \cdot \ell} \]
              5. mult-flipN/A

                \[\leadsto \frac{d}{\sqrt{\frac{h}{\ell}} \cdot \ell} \]
              6. lower-sqrt.f64N/A

                \[\leadsto \frac{d}{\sqrt{\frac{h}{\ell}} \cdot \ell} \]
              7. lift-/.f6423.0

                \[\leadsto \frac{d}{\sqrt{\frac{h}{\ell}} \cdot \ell} \]
            6. Applied rewrites23.0%

              \[\leadsto \frac{d}{\color{blue}{\sqrt{\frac{h}{\ell}} \cdot \ell}} \]
          3. Recombined 2 regimes into one program.
          4. Add Preprocessing

          Alternative 22: 43.8% accurate, 0.9× speedup?

          \[\begin{array}{l} d_m = \left|d\right| \\ M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -2 \cdot 10^{-214}:\\ \;\;\;\;-\frac{d\_m}{\sqrt{h \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
          d_m = (fabs.f64 d)
          M_m = (fabs.f64 M)
          D_m = (fabs.f64 D)
          NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
          (FPCore (d_m h l M_m D_m)
           :precision binary64
           (if (<=
                (*
                 (* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
                 (-
                  1.0
                  (* (* (/ 1.0 2.0) (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0)) (/ h l))))
                -2e-214)
             (- (/ d_m (sqrt (* h l))))
             (/ d_m (sqrt (* l h)))))
          d_m = fabs(d);
          M_m = fabs(M);
          D_m = fabs(D);
          assert(d_m < h && h < l && l < M_m && M_m < D_m);
          double code(double d_m, double h, double l, double M_m, double D_m) {
          	double tmp;
          	if (((pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -2e-214) {
          		tmp = -(d_m / sqrt((h * l)));
          	} else {
          		tmp = d_m / sqrt((l * h));
          	}
          	return tmp;
          }
          
          d_m =     private
          M_m =     private
          D_m =     private
          NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(d_m, h, l, m_m, d_m_1)
          use fmin_fmax_functions
              real(8), intent (in) :: d_m
              real(8), intent (in) :: h
              real(8), intent (in) :: l
              real(8), intent (in) :: m_m
              real(8), intent (in) :: d_m_1
              real(8) :: tmp
              if (((((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m_m * d_m_1) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))) <= (-2d-214)) then
                  tmp = -(d_m / sqrt((h * l)))
              else
                  tmp = d_m / sqrt((l * h))
              end if
              code = tmp
          end function
          
          d_m = Math.abs(d);
          M_m = Math.abs(M);
          D_m = Math.abs(D);
          assert d_m < h && h < l && l < M_m && M_m < D_m;
          public static double code(double d_m, double h, double l, double M_m, double D_m) {
          	double tmp;
          	if (((Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -2e-214) {
          		tmp = -(d_m / Math.sqrt((h * l)));
          	} else {
          		tmp = d_m / Math.sqrt((l * h));
          	}
          	return tmp;
          }
          
          d_m = math.fabs(d)
          M_m = math.fabs(M)
          D_m = math.fabs(D)
          [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m])
          def code(d_m, h, l, M_m, D_m):
          	tmp = 0
          	if ((math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M_m * D_m) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -2e-214:
          		tmp = -(d_m / math.sqrt((h * l)))
          	else:
          		tmp = d_m / math.sqrt((l * h))
          	return tmp
          
          d_m = abs(d)
          M_m = abs(M)
          D_m = abs(D)
          d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m])
          function code(d_m, h, l, M_m, D_m)
          	tmp = 0.0
          	if (Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))) <= -2e-214)
          		tmp = Float64(-Float64(d_m / sqrt(Float64(h * l))));
          	else
          		tmp = Float64(d_m / sqrt(Float64(l * h)));
          	end
          	return tmp
          end
          
          d_m = abs(d);
          M_m = abs(M);
          D_m = abs(D);
          d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
          function tmp_2 = code(d_m, h, l, M_m, D_m)
          	tmp = 0.0;
          	if (((((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M_m * D_m) / (2.0 * d_m)) ^ 2.0)) * (h / l)))) <= -2e-214)
          		tmp = -(d_m / sqrt((h * l)));
          	else
          		tmp = d_m / sqrt((l * h));
          	end
          	tmp_2 = tmp;
          end
          
          d_m = N[Abs[d], $MachinePrecision]
          M_m = N[Abs[M], $MachinePrecision]
          D_m = N[Abs[D], $MachinePrecision]
          NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
          code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[N[(N[(N[Power[N[(d$95$m / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d$95$m / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-214], (-N[(d$95$m / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          d_m = \left|d\right|
          \\
          M_m = \left|M\right|
          \\
          D_m = \left|D\right|
          \\
          [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
          \\
          \begin{array}{l}
          \mathbf{if}\;\left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -2 \cdot 10^{-214}:\\
          \;\;\;\;-\frac{d\_m}{\sqrt{h \cdot \ell}}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\
          
          
          \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)))) < -1.99999999999999983e-214

            1. Initial program 36.1%

              \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
            2. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\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({\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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              3. lift-pow.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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              4. 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 - \left(\frac{1}{2} \cdot {\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 {\color{blue}{\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) \]
              6. lift-pow.f64N/A

                \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \color{blue}{{\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) \]
              7. lift-/.f64N/A

                \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\color{blue}{\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) \]
              8. *-commutativeN/A

                \[\leadsto \color{blue}{\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              9. metadata-evalN/A

                \[\leadsto \left({\left(\frac{d}{\ell}\right)}^{\color{blue}{\frac{1}{2}}} \cdot {\left(\frac{d}{h}\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) \]
              10. pow1/2N/A

                \[\leadsto \left(\color{blue}{\sqrt{\frac{d}{\ell}}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              11. metadata-evalN/A

                \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot {\left(\frac{d}{h}\right)}^{\color{blue}{\frac{1}{2}}}\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) \]
              12. pow1/2N/A

                \[\leadsto \left(\sqrt{\frac{d}{\ell}} \cdot \color{blue}{\sqrt{\frac{d}{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) \]
              13. sqrt-unprodN/A

                \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              14. lower-sqrt.f64N/A

                \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              15. lower-*.f64N/A

                \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell} \cdot \frac{d}{h}}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              16. lift-/.f64N/A

                \[\leadsto \sqrt{\color{blue}{\frac{d}{\ell}} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
              17. lift-/.f6455.9

                \[\leadsto \sqrt{\frac{d}{\ell} \cdot \color{blue}{\frac{d}{h}}} \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. Applied rewrites55.9%

              \[\leadsto \color{blue}{\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}} \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. Taylor expanded in d around -inf

              \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
            5. Step-by-step derivation
              1. sqrt-prodN/A

                \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
              2. pow1/2N/A

                \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
              3. metadata-evalN/A

                \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
              4. pow1/2N/A

                \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
              5. metadata-evalN/A

                \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
              6. *-commutativeN/A

                \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
              7. mul-1-negN/A

                \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
              8. sqrt-divN/A

                \[\leadsto \mathsf{neg}\left(d \cdot \frac{\sqrt{1}}{\sqrt{h \cdot \ell}}\right) \]
              9. metadata-evalN/A

                \[\leadsto \mathsf{neg}\left(d \cdot \frac{1}{\sqrt{h \cdot \ell}}\right) \]
              10. sqrt-unprodN/A

                \[\leadsto \mathsf{neg}\left(d \cdot \frac{1}{\sqrt{h} \cdot \sqrt{\ell}}\right) \]
              11. *-commutativeN/A

                \[\leadsto \mathsf{neg}\left(d \cdot \frac{1}{\sqrt{\ell} \cdot \sqrt{h}}\right) \]
              12. mult-flipN/A

                \[\leadsto \mathsf{neg}\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\right) \]
              13. lower-neg.f64N/A

                \[\leadsto -\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \]
              14. *-commutativeN/A

                \[\leadsto -\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
              15. lower-/.f64N/A

                \[\leadsto -\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
            6. Applied rewrites10.1%

              \[\leadsto \color{blue}{-\frac{d}{\sqrt{h \cdot \ell}}} \]

            if -1.99999999999999983e-214 < (*.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 36.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. Taylor expanded in h around inf

              \[\leadsto \color{blue}{h \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)}{{d}^{2} \cdot \ell} + \frac{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}{h}\right)} \]
            3. Applied rewrites27.0%

              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right)} \]
            4. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              2. lift-*.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              3. lift-*.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              4. lift-/.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              5. lift-*.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              6. lift-sqrt.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              7. lift-sqrt.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              8. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              9. pow2N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot {M}^{2}\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              10. associate-*l/N/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{d \cdot {M}^{2}}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              11. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              12. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              13. associate-/l*N/A

                \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
              14. lower-/.f64N/A

                \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            5. Applied rewrites27.2%

              \[\leadsto \mathsf{fma}\left(\frac{\frac{\left(\left(M \cdot M\right) \cdot d\right) \cdot D}{\sqrt{h \cdot \ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            6. Taylor expanded in l around inf

              \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\color{blue}{\ell}} \]
            7. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\ell} \]
            8. Applied rewrites26.7%

              \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(\left(M \cdot M\right) \cdot h\right) \cdot \left(D \cdot D\right)}{\left(\sqrt{\frac{h}{\ell}} \cdot \ell\right) \cdot d}, -0.125, \frac{d}{\sqrt{\frac{h}{\ell}}}\right)}{\color{blue}{\ell}} \]
            9. Taylor expanded in d around inf

              \[\leadsto \frac{d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
            10. Step-by-step derivation
              1. sqrt-prodN/A

                \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
              2. lower-/.f64N/A

                \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
              3. lift-sqrt.f64N/A

                \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
              4. *-commutativeN/A

                \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
              5. lift-*.f6442.7

                \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
            11. Applied rewrites42.7%

              \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell \cdot h}}} \]
          3. Recombined 2 regimes into one program.
          4. Add Preprocessing

          Alternative 23: 42.7% accurate, 10.2× speedup?

          \[\begin{array}{l} d_m = \left|d\right| \\ M_m = \left|M\right| \\ D_m = \left|D\right| \\ [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\ \\ \frac{d\_m}{\sqrt{\ell \cdot h}} \end{array} \]
          d_m = (fabs.f64 d)
          M_m = (fabs.f64 M)
          D_m = (fabs.f64 D)
          NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
          (FPCore (d_m h l M_m D_m) :precision binary64 (/ d_m (sqrt (* l h))))
          d_m = fabs(d);
          M_m = fabs(M);
          D_m = fabs(D);
          assert(d_m < h && h < l && l < M_m && M_m < D_m);
          double code(double d_m, double h, double l, double M_m, double D_m) {
          	return d_m / sqrt((l * h));
          }
          
          d_m =     private
          M_m =     private
          D_m =     private
          NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(d_m, h, l, m_m, d_m_1)
          use fmin_fmax_functions
              real(8), intent (in) :: d_m
              real(8), intent (in) :: h
              real(8), intent (in) :: l
              real(8), intent (in) :: m_m
              real(8), intent (in) :: d_m_1
              code = d_m / sqrt((l * h))
          end function
          
          d_m = Math.abs(d);
          M_m = Math.abs(M);
          D_m = Math.abs(D);
          assert d_m < h && h < l && l < M_m && M_m < D_m;
          public static double code(double d_m, double h, double l, double M_m, double D_m) {
          	return d_m / Math.sqrt((l * h));
          }
          
          d_m = math.fabs(d)
          M_m = math.fabs(M)
          D_m = math.fabs(D)
          [d_m, h, l, M_m, D_m] = sort([d_m, h, l, M_m, D_m])
          def code(d_m, h, l, M_m, D_m):
          	return d_m / math.sqrt((l * h))
          
          d_m = abs(d)
          M_m = abs(M)
          D_m = abs(D)
          d_m, h, l, M_m, D_m = sort([d_m, h, l, M_m, D_m])
          function code(d_m, h, l, M_m, D_m)
          	return Float64(d_m / sqrt(Float64(l * h)))
          end
          
          d_m = abs(d);
          M_m = abs(M);
          D_m = abs(D);
          d_m, h, l, M_m, D_m = num2cell(sort([d_m, h, l, M_m, D_m])){:}
          function tmp = code(d_m, h, l, M_m, D_m)
          	tmp = d_m / sqrt((l * h));
          end
          
          d_m = N[Abs[d], $MachinePrecision]
          M_m = N[Abs[M], $MachinePrecision]
          D_m = N[Abs[D], $MachinePrecision]
          NOTE: d_m, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
          code[d$95$m_, h_, l_, M$95$m_, D$95$m_] := N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
          
          \begin{array}{l}
          d_m = \left|d\right|
          \\
          M_m = \left|M\right|
          \\
          D_m = \left|D\right|
          \\
          [d_m, h, l, M_m, D_m] = \mathsf{sort}([d_m, h, l, M_m, D_m])\\
          \\
          \frac{d\_m}{\sqrt{\ell \cdot h}}
          \end{array}
          
          Derivation
          1. Initial program 36.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. Taylor expanded in h around inf

            \[\leadsto \color{blue}{h \cdot \left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\right)}{{d}^{2} \cdot \ell} + \frac{\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}}{h}\right)} \]
          3. Applied rewrites27.0%

            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right)} \]
          4. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            2. lift-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            3. lift-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            4. lift-/.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            5. lift-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            6. lift-sqrt.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            7. lift-sqrt.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(\left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(M \cdot M\right)\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            9. pow2N/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \left(\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot {M}^{2}\right)\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            10. associate-*l/N/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{d \cdot {M}^{2}}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{\ell} \cdot \sqrt{h}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            12. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(\frac{\left(D \cdot \frac{{M}^{2} \cdot d}{\sqrt{h} \cdot \sqrt{\ell}}\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            13. associate-/l*N/A

              \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
            14. lower-/.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{\frac{D \cdot \left({M}^{2} \cdot d\right)}{\sqrt{h} \cdot \sqrt{\ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{-1}{8}, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
          5. Applied rewrites27.2%

            \[\leadsto \mathsf{fma}\left(\frac{\frac{\left(\left(M \cdot M\right) \cdot d\right) \cdot D}{\sqrt{h \cdot \ell}} \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot -0.125, h, \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot 1\right) \]
          6. Taylor expanded in l around inf

            \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\color{blue}{\ell}} \]
          7. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \frac{\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(\ell \cdot \sqrt{\frac{h}{\ell}}\right)} + \frac{d}{\sqrt{h} \cdot \sqrt{\frac{1}{\ell}}}}{\ell} \]
          8. Applied rewrites26.7%

            \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(\left(M \cdot M\right) \cdot h\right) \cdot \left(D \cdot D\right)}{\left(\sqrt{\frac{h}{\ell}} \cdot \ell\right) \cdot d}, -0.125, \frac{d}{\sqrt{\frac{h}{\ell}}}\right)}{\color{blue}{\ell}} \]
          9. Taylor expanded in d around inf

            \[\leadsto \frac{d}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
          10. Step-by-step derivation
            1. sqrt-prodN/A

              \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
            2. lower-/.f64N/A

              \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
            3. lift-sqrt.f64N/A

              \[\leadsto \frac{d}{\sqrt{h \cdot \ell}} \]
            4. *-commutativeN/A

              \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
            5. lift-*.f6442.7

              \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
          11. Applied rewrites42.7%

            \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell \cdot h}}} \]
          12. Add Preprocessing

          Reproduce

          ?
          herbie shell --seed 2025135 
          (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)))))