Henrywood and Agarwal, Equation (12)

Percentage Accurate: 35.6% → 73.9%
Time: 11.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: 35.6% accurate, 1.0× speedup?

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

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

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

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

Alternative 1: 73.9% accurate, 1.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} t_0 := \sqrt{\ell \cdot h}\\ t_1 := \frac{\left|d\_m\right|}{t\_0}\\ \mathbf{if}\;\ell \leq -5 \cdot 10^{+15}:\\ \;\;\;\;t\_1 \cdot \left(1 - \frac{0.125}{d\_m} \cdot \frac{\left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot D\_m}{\ell \cdot d\_m}\right)\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-147}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{\left(\left(D\_m \cdot M\_m\right) \cdot M\_m\right) \cdot D\_m}{d\_m} \cdot -0.125, t\_0, \sqrt{\left(\ell \cdot \ell\right) \cdot \frac{\ell}{h}} \cdot d\_m\right)}{\ell \cdot \ell}\\ \mathbf{elif}\;\ell \leq 10^{-292}:\\ \;\;\;\;t\_1 \cdot \left(1 - \frac{h \cdot \left(\left(\left(D\_m \cdot M\_m\right) \cdot D\_m\right) \cdot \frac{M\_m}{d\_m \cdot d\_m}\right)}{\ell} \cdot 0.125\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}} \cdot d\_m\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)\\ \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 (/ (fabs d_m) t_0)))
   (if (<= l -5e+15)
     (*
      t_1
      (-
       1.0
       (* (/ 0.125 d_m) (/ (* (* (* (* M_m M_m) h) D_m) D_m) (* l d_m)))))
     (if (<= l -1e-147)
       (/
        (fma
         (* (/ (* (* (* D_m M_m) M_m) D_m) d_m) -0.125)
         t_0
         (* (sqrt (* (* l l) (/ l h))) d_m))
        (* l l))
       (if (<= l 1e-292)
         (*
          t_1
          (-
           1.0
           (* (/ (* h (* (* (* D_m M_m) D_m) (/ M_m (* d_m d_m)))) l) 0.125)))
         (*
          (* (/ (sqrt (/ 1.0 l)) (sqrt h)) d_m)
          (-
           1.0
           (*
            (* (/ 1.0 2.0) (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0))
            (/ h 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 = fabs(d_m) / t_0;
	double tmp;
	if (l <= -5e+15) {
		tmp = t_1 * (1.0 - ((0.125 / d_m) * (((((M_m * M_m) * h) * D_m) * D_m) / (l * d_m))));
	} else if (l <= -1e-147) {
		tmp = fma((((((D_m * M_m) * M_m) * D_m) / d_m) * -0.125), t_0, (sqrt(((l * l) * (l / h))) * d_m)) / (l * l);
	} else if (l <= 1e-292) {
		tmp = t_1 * (1.0 - (((h * (((D_m * M_m) * D_m) * (M_m / (d_m * d_m)))) / l) * 0.125));
	} else {
		tmp = ((sqrt((1.0 / l)) / sqrt(h)) * d_m) * (1.0 - (((1.0 / 2.0) * pow(((M_m * D_m) / (2.0 * d_m)), 2.0)) * (h / 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(abs(d_m) / t_0)
	tmp = 0.0
	if (l <= -5e+15)
		tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(0.125 / d_m) * Float64(Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) * D_m) / Float64(l * d_m)))));
	elseif (l <= -1e-147)
		tmp = Float64(fma(Float64(Float64(Float64(Float64(Float64(D_m * M_m) * M_m) * D_m) / d_m) * -0.125), t_0, Float64(sqrt(Float64(Float64(l * l) * Float64(l / h))) * d_m)) / Float64(l * l));
	elseif (l <= 1e-292)
		tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(h * Float64(Float64(Float64(D_m * M_m) * D_m) * Float64(M_m / Float64(d_m * d_m)))) / l) * 0.125)));
	else
		tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / l)) / sqrt(h)) * d_m) * 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))));
	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[Abs[d$95$m], $MachinePrecision] / t$95$0), $MachinePrecision]}, If[LessEqual[l, -5e+15], N[(t$95$1 * N[(1.0 - N[(N[(0.125 / d$95$m), $MachinePrecision] * N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] / N[(l * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-147], N[(N[(N[(N[(N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] / d$95$m), $MachinePrecision] * -0.125), $MachinePrecision] * t$95$0 + N[(N[Sqrt[N[(N[(l * l), $MachinePrecision] * N[(l / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision]), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1e-292], N[(t$95$1 * N[(1.0 - N[(N[(N[(h * N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(M$95$m / N[(d$95$m * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * d$95$m), $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]]]]]]
\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{\left|d\_m\right|}{t\_0}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{+15}:\\
\;\;\;\;t\_1 \cdot \left(1 - \frac{0.125}{d\_m} \cdot \frac{\left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot D\_m}{\ell \cdot d\_m}\right)\\

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

\mathbf{elif}\;\ell \leq 10^{-292}:\\
\;\;\;\;t\_1 \cdot \left(1 - \frac{h \cdot \left(\left(\left(D\_m \cdot M\_m\right) \cdot D\_m\right) \cdot \frac{M\_m}{d\_m \cdot d\_m}\right)}{\ell} \cdot 0.125\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}} \cdot d\_m\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)\\


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

    1. Initial program 2.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5e15 < l < -9.9999999999999997e-148

    1. Initial program 3.5%

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

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

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

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

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

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

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

    if -9.9999999999999997e-148 < l < 1.0000000000000001e-292

    1. Initial program 17.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.0000000000000001e-292 < l

    1. Initial program 66.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 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 73.4% 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 := \frac{D\_m}{d\_m + d\_m} \cdot M\_m\\ t_1 := \sqrt{\ell \cdot h}\\ t_2 := \frac{\left|d\_m\right|}{t\_1}\\ \mathbf{if}\;\ell \leq -5 \cdot 10^{+15}:\\ \;\;\;\;t\_2 \cdot \left(1 - \frac{0.125}{d\_m} \cdot \frac{\left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot D\_m}{\ell \cdot d\_m}\right)\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-147}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{\left(\left(D\_m \cdot M\_m\right) \cdot M\_m\right) \cdot D\_m}{d\_m} \cdot -0.125, t\_1, \sqrt{\left(\ell \cdot \ell\right) \cdot \frac{\ell}{h}} \cdot d\_m\right)}{\ell \cdot \ell}\\ \mathbf{elif}\;\ell \leq 10^{-292}:\\ \;\;\;\;t\_2 \cdot \left(1 - \frac{h \cdot \left(\left(\left(D\_m \cdot M\_m\right) \cdot D\_m\right) \cdot \frac{M\_m}{d\_m \cdot d\_m}\right)}{\ell} \cdot 0.125\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}} \cdot d\_m\right) \cdot \left(1 - \left(t\_0 \cdot \left(t\_0 \cdot 0.5\right)\right) \cdot \frac{h}{\ell}\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 (+ d_m d_m)) M_m))
        (t_1 (sqrt (* l h)))
        (t_2 (/ (fabs d_m) t_1)))
   (if (<= l -5e+15)
     (*
      t_2
      (-
       1.0
       (* (/ 0.125 d_m) (/ (* (* (* (* M_m M_m) h) D_m) D_m) (* l d_m)))))
     (if (<= l -1e-147)
       (/
        (fma
         (* (/ (* (* (* D_m M_m) M_m) D_m) d_m) -0.125)
         t_1
         (* (sqrt (* (* l l) (/ l h))) d_m))
        (* l l))
       (if (<= l 1e-292)
         (*
          t_2
          (-
           1.0
           (* (/ (* h (* (* (* D_m M_m) D_m) (/ M_m (* d_m d_m)))) l) 0.125)))
         (*
          (* (/ (sqrt (/ 1.0 l)) (sqrt h)) d_m)
          (- 1.0 (* (* t_0 (* t_0 0.5)) (/ h 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 = (D_m / (d_m + d_m)) * M_m;
	double t_1 = sqrt((l * h));
	double t_2 = fabs(d_m) / t_1;
	double tmp;
	if (l <= -5e+15) {
		tmp = t_2 * (1.0 - ((0.125 / d_m) * (((((M_m * M_m) * h) * D_m) * D_m) / (l * d_m))));
	} else if (l <= -1e-147) {
		tmp = fma((((((D_m * M_m) * M_m) * D_m) / d_m) * -0.125), t_1, (sqrt(((l * l) * (l / h))) * d_m)) / (l * l);
	} else if (l <= 1e-292) {
		tmp = t_2 * (1.0 - (((h * (((D_m * M_m) * D_m) * (M_m / (d_m * d_m)))) / l) * 0.125));
	} else {
		tmp = ((sqrt((1.0 / l)) / sqrt(h)) * d_m) * (1.0 - ((t_0 * (t_0 * 0.5)) * (h / 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 = Float64(Float64(D_m / Float64(d_m + d_m)) * M_m)
	t_1 = sqrt(Float64(l * h))
	t_2 = Float64(abs(d_m) / t_1)
	tmp = 0.0
	if (l <= -5e+15)
		tmp = Float64(t_2 * Float64(1.0 - Float64(Float64(0.125 / d_m) * Float64(Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) * D_m) / Float64(l * d_m)))));
	elseif (l <= -1e-147)
		tmp = Float64(fma(Float64(Float64(Float64(Float64(Float64(D_m * M_m) * M_m) * D_m) / d_m) * -0.125), t_1, Float64(sqrt(Float64(Float64(l * l) * Float64(l / h))) * d_m)) / Float64(l * l));
	elseif (l <= 1e-292)
		tmp = Float64(t_2 * Float64(1.0 - Float64(Float64(Float64(h * Float64(Float64(Float64(D_m * M_m) * D_m) * Float64(M_m / Float64(d_m * d_m)))) / l) * 0.125)));
	else
		tmp = Float64(Float64(Float64(sqrt(Float64(1.0 / l)) / sqrt(h)) * d_m) * Float64(1.0 - Float64(Float64(t_0 * Float64(t_0 * 0.5)) * Float64(h / 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[(N[(D$95$m / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Abs[d$95$m], $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[l, -5e+15], N[(t$95$2 * N[(1.0 - N[(N[(0.125 / d$95$m), $MachinePrecision] * N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] / N[(l * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-147], N[(N[(N[(N[(N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] / d$95$m), $MachinePrecision] * -0.125), $MachinePrecision] * t$95$1 + N[(N[Sqrt[N[(N[(l * l), $MachinePrecision] * N[(l / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision]), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1e-292], N[(t$95$2 * N[(1.0 - N[(N[(N[(h * N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(M$95$m / N[(d$95$m * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision] * N[(1.0 - N[(N[(t$95$0 * N[(t$95$0 * 0.5), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $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 := \frac{D\_m}{d\_m + d\_m} \cdot M\_m\\
t_1 := \sqrt{\ell \cdot h}\\
t_2 := \frac{\left|d\_m\right|}{t\_1}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{+15}:\\
\;\;\;\;t\_2 \cdot \left(1 - \frac{0.125}{d\_m} \cdot \frac{\left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot D\_m}{\ell \cdot d\_m}\right)\\

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

\mathbf{elif}\;\ell \leq 10^{-292}:\\
\;\;\;\;t\_2 \cdot \left(1 - \frac{h \cdot \left(\left(\left(D\_m \cdot M\_m\right) \cdot D\_m\right) \cdot \frac{M\_m}{d\_m \cdot d\_m}\right)}{\ell} \cdot 0.125\right)\\

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


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

    1. Initial program 2.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5e15 < l < -9.9999999999999997e-148

    1. Initial program 3.5%

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

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

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

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

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

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

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

    if -9.9999999999999997e-148 < l < 1.0000000000000001e-292

    1. Initial program 17.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.0000000000000001e-292 < l

    1. Initial program 66.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 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}} \cdot d\right) \cdot \left(1 - \left(\left(\frac{D}{d + d} \cdot M\right) \cdot \left(\left(\frac{D}{d + d} \cdot M\right) \cdot \frac{1}{2}\right)\right) \cdot \frac{h}{\ell}\right) \]
      9. lower-sqrt.f6479.7

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

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

Alternative 3: 72.4% accurate, 0.4× 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(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2}\\ t_1 := \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 t\_0\right) \cdot \frac{h}{\ell}\right)\\ t_2 := \frac{d\_m}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(0.5 \cdot t\_0\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_1 \leq 5 \cdot 10^{-169}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+270}:\\ \;\;\;\;\left(\mathsf{fma}\left(\frac{\left(\left(\left(D\_m \cdot M\_m\right) \cdot M\_m\right) \cdot \frac{D\_m}{4 \cdot d\_m}\right) \cdot -0.5}{d\_m}, \frac{h}{\ell}, 1\right) \cdot \sqrt{\frac{d\_m}{\ell}}\right) \cdot \sqrt{\frac{d\_m}{h}}\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \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 (pow (/ (* M_m D_m) (* 2.0 d_m)) 2.0))
        (t_1
         (*
          (* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
          (- 1.0 (* (* (/ 1.0 2.0) t_0) (/ h l)))))
        (t_2 (* (/ d_m (sqrt (* l h))) (- 1.0 (* (* 0.5 t_0) (/ h l))))))
   (if (<= t_1 5e-169)
     t_2
     (if (<= t_1 4e+270)
       (*
        (*
         (fma
          (/ (* (* (* (* D_m M_m) M_m) (/ D_m (* 4.0 d_m))) -0.5) d_m)
          (/ h l)
          1.0)
         (sqrt (/ d_m l)))
        (sqrt (/ d_m h)))
       t_2))))
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 = pow(((M_m * D_m) / (2.0 * d_m)), 2.0);
	double t_1 = (pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * t_0) * (h / l)));
	double t_2 = (d_m / sqrt((l * h))) * (1.0 - ((0.5 * t_0) * (h / l)));
	double tmp;
	if (t_1 <= 5e-169) {
		tmp = t_2;
	} else if (t_1 <= 4e+270) {
		tmp = (fma((((((D_m * M_m) * M_m) * (D_m / (4.0 * d_m))) * -0.5) / d_m), (h / l), 1.0) * sqrt((d_m / l))) * sqrt((d_m / h));
	} else {
		tmp = t_2;
	}
	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(M_m * D_m) / Float64(2.0 * d_m)) ^ 2.0
	t_1 = 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) * t_0) * Float64(h / l))))
	t_2 = Float64(Float64(d_m / sqrt(Float64(l * h))) * Float64(1.0 - Float64(Float64(0.5 * t_0) * Float64(h / l))))
	tmp = 0.0
	if (t_1 <= 5e-169)
		tmp = t_2;
	elseif (t_1 <= 4e+270)
		tmp = Float64(Float64(fma(Float64(Float64(Float64(Float64(Float64(D_m * M_m) * M_m) * Float64(D_m / Float64(4.0 * d_m))) * -0.5) / d_m), Float64(h / l), 1.0) * sqrt(Float64(d_m / l))) * sqrt(Float64(d_m / h)));
	else
		tmp = t_2;
	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[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = 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] * t$95$0), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * t$95$0), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-169], t$95$2, If[LessEqual[t$95$1, 4e+270], N[(N[(N[(N[(N[(N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] * N[(D$95$m / N[(4.0 * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision] / d$95$m), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d$95$m / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d$95$m / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\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(\frac{M\_m \cdot D\_m}{2 \cdot d\_m}\right)}^{2}\\
t_1 := \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 t\_0\right) \cdot \frac{h}{\ell}\right)\\
t_2 := \frac{d\_m}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(0.5 \cdot t\_0\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-169}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+270}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{\left(\left(\left(D\_m \cdot M\_m\right) \cdot M\_m\right) \cdot \frac{D\_m}{4 \cdot d\_m}\right) \cdot -0.5}{d\_m}, \frac{h}{\ell}, 1\right) \cdot \sqrt{\frac{d\_m}{\ell}}\right) \cdot \sqrt{\frac{d\_m}{h}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.0000000000000002e-169 or 4.0000000000000002e270 < (*.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 26.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 \cdot d}{\color{blue}{\sqrt{\ell \cdot 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) \]
      10. *-lft-identityN/A

        \[\leadsto \frac{d}{\sqrt{\color{blue}{\ell \cdot 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) \]
      11. lower-/.f6468.6

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

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

    if 5.0000000000000002e-169 < (*.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)))) < 4.0000000000000002e270

    1. Initial program 99.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. Applied rewrites49.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 70.6% accurate, 0.4× 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({\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)\\ \mathbf{if}\;t\_0 \leq 0:\\ \;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right) \cdot \left(1 - \left(\left(\frac{D\_m}{d\_m + d\_m} \cdot M\_m\right) \cdot \left(\frac{D\_m \cdot M\_m}{d\_m} \cdot 0.25\right)\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+238}:\\ \;\;\;\;\frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M\_m \cdot \left(\left(D\_m \cdot M\_m\right) \cdot \frac{D\_m \cdot h}{\left(d\_m \cdot d\_m\right) \cdot \ell}\right)\right) \cdot 0.125\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
         (*
          (* (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))))))
   (if (<= t_0 0.0)
     (*
      (* (sqrt (/ 1.0 (* l h))) d_m)
      (-
       1.0
       (*
        (* (* (/ D_m (+ d_m d_m)) M_m) (* (/ (* D_m M_m) d_m) 0.25))
        (/ h l))))
     (if (<= t_0 4e+238)
       (/ d_m (* (sqrt l) (sqrt h)))
       (*
        (/ (fabs d_m) (sqrt (* l h)))
        (-
         1.0
         (*
          (* M_m (* (* D_m M_m) (/ (* D_m h) (* (* d_m d_m) 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 = (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)));
	double tmp;
	if (t_0 <= 0.0) {
		tmp = (sqrt((1.0 / (l * h))) * d_m) * (1.0 - ((((D_m / (d_m + d_m)) * M_m) * (((D_m * M_m) / d_m) * 0.25)) * (h / l)));
	} else if (t_0 <= 4e+238) {
		tmp = d_m / (sqrt(l) * sqrt(h));
	} else {
		tmp = (fabs(d_m) / sqrt((l * h))) * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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 = (((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)))
    if (t_0 <= 0.0d0) then
        tmp = (sqrt((1.0d0 / (l * h))) * d_m) * (1.0d0 - ((((d_m_1 / (d_m + d_m)) * m_m) * (((d_m_1 * m_m) / d_m) * 0.25d0)) * (h / l)))
    else if (t_0 <= 4d+238) then
        tmp = d_m / (sqrt(l) * sqrt(h))
    else
        tmp = (abs(d_m) / sqrt((l * h))) * (1.0d0 - ((m_m * ((d_m_1 * m_m) * ((d_m_1 * h) / ((d_m * d_m) * 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.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)));
	double tmp;
	if (t_0 <= 0.0) {
		tmp = (Math.sqrt((1.0 / (l * h))) * d_m) * (1.0 - ((((D_m / (d_m + d_m)) * M_m) * (((D_m * M_m) / d_m) * 0.25)) * (h / l)));
	} else if (t_0 <= 4e+238) {
		tmp = d_m / (Math.sqrt(l) * Math.sqrt(h));
	} else {
		tmp = (Math.abs(d_m) / Math.sqrt((l * h))) * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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.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)))
	tmp = 0
	if t_0 <= 0.0:
		tmp = (math.sqrt((1.0 / (l * h))) * d_m) * (1.0 - ((((D_m / (d_m + d_m)) * M_m) * (((D_m * M_m) / d_m) * 0.25)) * (h / l)))
	elif t_0 <= 4e+238:
		tmp = d_m / (math.sqrt(l) * math.sqrt(h))
	else:
		tmp = (math.fabs(d_m) / math.sqrt((l * h))) * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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 = 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))))
	tmp = 0.0
	if (t_0 <= 0.0)
		tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m) * Float64(1.0 - Float64(Float64(Float64(Float64(D_m / Float64(d_m + d_m)) * M_m) * Float64(Float64(Float64(D_m * M_m) / d_m) * 0.25)) * Float64(h / l))));
	elseif (t_0 <= 4e+238)
		tmp = Float64(d_m / Float64(sqrt(l) * sqrt(h)));
	else
		tmp = Float64(Float64(abs(d_m) / sqrt(Float64(l * h))) * Float64(1.0 - Float64(Float64(M_m * Float64(Float64(D_m * M_m) * Float64(Float64(D_m * h) / Float64(Float64(d_m * d_m) * 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 = (((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)));
	tmp = 0.0;
	if (t_0 <= 0.0)
		tmp = (sqrt((1.0 / (l * h))) * d_m) * (1.0 - ((((D_m / (d_m + d_m)) * M_m) * (((D_m * M_m) / d_m) * 0.25)) * (h / l)));
	elseif (t_0 <= 4e+238)
		tmp = d_m / (sqrt(l) * sqrt(h));
	else
		tmp = (abs(d_m) / sqrt((l * h))) * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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[(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]}, If[LessEqual[t$95$0, 0.0], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(D$95$m / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision] * N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] / d$95$m), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+238], N[(d$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d$95$m], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(M$95$m * N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(N[(D$95$m * h), $MachinePrecision] / N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $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({\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)\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right) \cdot \left(1 - \left(\left(\frac{D\_m}{d\_m + d\_m} \cdot M\_m\right) \cdot \left(\frac{D\_m \cdot M\_m}{d\_m} \cdot 0.25\right)\right) \cdot \frac{h}{\ell}\right)\\

\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+238}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\\

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


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

    1. Initial program 79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\left(\frac{D}{d + d} \cdot M\right) \cdot \left(\frac{D \cdot M}{d} \cdot 0.25\right)\right) \cdot \frac{h}{\ell}\right) \]
    9. Applied rewrites77.6%

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

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

    1. Initial program 98.6%

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

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

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

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites75.7%

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

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

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

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

        \[\leadsto \frac{\sqrt{1}}{\sqrt{\ell \cdot h}} \cdot d \]
      5. metadata-evalN/A

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

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

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

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

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      10. lift-*.f6475.9

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

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

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

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

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

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

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

        \[\leadsto \frac{d}{\sqrt{\ell} \cdot \sqrt{\color{blue}{h}}} \]
      6. lower-sqrt.f6498.7

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

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

    if 4.0000000000000002e238 < (*.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 8.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 70.5% accurate, 0.4× 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}{d\_m + d\_m} \cdot M\_m\\ t_2 := \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)\\ \mathbf{if}\;t\_2 \leq 0:\\ \;\;\;\;\frac{d\_m}{t\_0} \cdot \left(1 - \left(t\_1 \cdot \left(t\_1 \cdot 0.5\right)\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+238}:\\ \;\;\;\;\frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left|d\_m\right|}{t\_0} \cdot \left(1 - \left(M\_m \cdot \left(\left(D\_m \cdot M\_m\right) \cdot \frac{D\_m \cdot h}{\left(d\_m \cdot d\_m\right) \cdot \ell}\right)\right) \cdot 0.125\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 (* (/ D_m (+ d_m d_m)) M_m))
        (t_2
         (*
          (* (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))))))
   (if (<= t_2 0.0)
     (* (/ d_m t_0) (- 1.0 (* (* t_1 (* t_1 0.5)) (/ h l))))
     (if (<= t_2 4e+238)
       (/ d_m (* (sqrt l) (sqrt h)))
       (*
        (/ (fabs d_m) t_0)
        (-
         1.0
         (*
          (* M_m (* (* D_m M_m) (/ (* D_m h) (* (* d_m d_m) 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 t_1 = (D_m / (d_m + d_m)) * M_m;
	double t_2 = (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)));
	double tmp;
	if (t_2 <= 0.0) {
		tmp = (d_m / t_0) * (1.0 - ((t_1 * (t_1 * 0.5)) * (h / l)));
	} else if (t_2 <= 4e+238) {
		tmp = d_m / (sqrt(l) * sqrt(h));
	} else {
		tmp = (fabs(d_m) / t_0) * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = sqrt((l * h))
    t_1 = (d_m_1 / (d_m + d_m)) * m_m
    t_2 = (((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)))
    if (t_2 <= 0.0d0) then
        tmp = (d_m / t_0) * (1.0d0 - ((t_1 * (t_1 * 0.5d0)) * (h / l)))
    else if (t_2 <= 4d+238) then
        tmp = d_m / (sqrt(l) * sqrt(h))
    else
        tmp = (abs(d_m) / t_0) * (1.0d0 - ((m_m * ((d_m_1 * m_m) * ((d_m_1 * h) / ((d_m * d_m) * 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 t_1 = (D_m / (d_m + d_m)) * M_m;
	double t_2 = (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)));
	double tmp;
	if (t_2 <= 0.0) {
		tmp = (d_m / t_0) * (1.0 - ((t_1 * (t_1 * 0.5)) * (h / l)));
	} else if (t_2 <= 4e+238) {
		tmp = d_m / (Math.sqrt(l) * Math.sqrt(h));
	} else {
		tmp = (Math.abs(d_m) / t_0) * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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))
	t_1 = (D_m / (d_m + d_m)) * M_m
	t_2 = (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)))
	tmp = 0
	if t_2 <= 0.0:
		tmp = (d_m / t_0) * (1.0 - ((t_1 * (t_1 * 0.5)) * (h / l)))
	elif t_2 <= 4e+238:
		tmp = d_m / (math.sqrt(l) * math.sqrt(h))
	else:
		tmp = (math.fabs(d_m) / t_0) * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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))
	t_1 = Float64(Float64(D_m / Float64(d_m + d_m)) * M_m)
	t_2 = 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))))
	tmp = 0.0
	if (t_2 <= 0.0)
		tmp = Float64(Float64(d_m / t_0) * Float64(1.0 - Float64(Float64(t_1 * Float64(t_1 * 0.5)) * Float64(h / l))));
	elseif (t_2 <= 4e+238)
		tmp = Float64(d_m / Float64(sqrt(l) * sqrt(h)));
	else
		tmp = Float64(Float64(abs(d_m) / t_0) * Float64(1.0 - Float64(Float64(M_m * Float64(Float64(D_m * M_m) * Float64(Float64(D_m * h) / Float64(Float64(d_m * d_m) * 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));
	t_1 = (D_m / (d_m + d_m)) * M_m;
	t_2 = (((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)));
	tmp = 0.0;
	if (t_2 <= 0.0)
		tmp = (d_m / t_0) * (1.0 - ((t_1 * (t_1 * 0.5)) * (h / l)));
	elseif (t_2 <= 4e+238)
		tmp = d_m / (sqrt(l) * sqrt(h));
	else
		tmp = (abs(d_m) / t_0) * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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]}, Block[{t$95$1 = N[(N[(D$95$m / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision] * M$95$m), $MachinePrecision]}, Block[{t$95$2 = 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]}, If[LessEqual[t$95$2, 0.0], N[(N[(d$95$m / t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(t$95$1 * N[(t$95$1 * 0.5), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e+238], N[(d$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d$95$m], $MachinePrecision] / t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(M$95$m * N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(N[(D$95$m * h), $MachinePrecision] / N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $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 := \sqrt{\ell \cdot h}\\
t_1 := \frac{D\_m}{d\_m + d\_m} \cdot M\_m\\
t_2 := \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)\\
\mathbf{if}\;t\_2 \leq 0:\\
\;\;\;\;\frac{d\_m}{t\_0} \cdot \left(1 - \left(t\_1 \cdot \left(t\_1 \cdot 0.5\right)\right) \cdot \frac{h}{\ell}\right)\\

\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+238}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\\

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


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

    1. Initial program 79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 98.6%

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

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

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

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites75.7%

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

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

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

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

        \[\leadsto \frac{\sqrt{1}}{\sqrt{\ell \cdot h}} \cdot d \]
      5. metadata-evalN/A

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

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

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

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

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      10. lift-*.f6475.9

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

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

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

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

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

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

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

        \[\leadsto \frac{d}{\sqrt{\ell} \cdot \sqrt{\color{blue}{h}}} \]
      6. lower-sqrt.f6498.7

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

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

    if 4.0000000000000002e238 < (*.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 8.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 69.5% accurate, 0.4× 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({\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)\\ t_1 := \frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}}\\ \mathbf{if}\;t\_0 \leq 0:\\ \;\;\;\;t\_1 \cdot \left(1 - \frac{0.125}{d\_m} \cdot \frac{\left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot D\_m}{\ell \cdot d\_m}\right)\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+238}:\\ \;\;\;\;\frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \left(1 - \left(M\_m \cdot \left(\left(D\_m \cdot M\_m\right) \cdot \frac{D\_m \cdot h}{\left(d\_m \cdot d\_m\right) \cdot \ell}\right)\right) \cdot 0.125\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
         (*
          (* (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)))))
        (t_1 (/ (fabs d_m) (sqrt (* l h)))))
   (if (<= t_0 0.0)
     (*
      t_1
      (-
       1.0
       (* (/ 0.125 d_m) (/ (* (* (* (* M_m M_m) h) D_m) D_m) (* l d_m)))))
     (if (<= t_0 4e+238)
       (/ d_m (* (sqrt l) (sqrt h)))
       (*
        t_1
        (-
         1.0
         (*
          (* M_m (* (* D_m M_m) (/ (* D_m h) (* (* d_m d_m) 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 = (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)));
	double t_1 = fabs(d_m) / sqrt((l * h));
	double tmp;
	if (t_0 <= 0.0) {
		tmp = t_1 * (1.0 - ((0.125 / d_m) * (((((M_m * M_m) * h) * D_m) * D_m) / (l * d_m))));
	} else if (t_0 <= 4e+238) {
		tmp = d_m / (sqrt(l) * sqrt(h));
	} else {
		tmp = t_1 * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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) :: t_1
    real(8) :: tmp
    t_0 = (((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)))
    t_1 = abs(d_m) / sqrt((l * h))
    if (t_0 <= 0.0d0) then
        tmp = t_1 * (1.0d0 - ((0.125d0 / d_m) * (((((m_m * m_m) * h) * d_m_1) * d_m_1) / (l * d_m))))
    else if (t_0 <= 4d+238) then
        tmp = d_m / (sqrt(l) * sqrt(h))
    else
        tmp = t_1 * (1.0d0 - ((m_m * ((d_m_1 * m_m) * ((d_m_1 * h) / ((d_m * d_m) * 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.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)));
	double t_1 = Math.abs(d_m) / Math.sqrt((l * h));
	double tmp;
	if (t_0 <= 0.0) {
		tmp = t_1 * (1.0 - ((0.125 / d_m) * (((((M_m * M_m) * h) * D_m) * D_m) / (l * d_m))));
	} else if (t_0 <= 4e+238) {
		tmp = d_m / (Math.sqrt(l) * Math.sqrt(h));
	} else {
		tmp = t_1 * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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.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)))
	t_1 = math.fabs(d_m) / math.sqrt((l * h))
	tmp = 0
	if t_0 <= 0.0:
		tmp = t_1 * (1.0 - ((0.125 / d_m) * (((((M_m * M_m) * h) * D_m) * D_m) / (l * d_m))))
	elif t_0 <= 4e+238:
		tmp = d_m / (math.sqrt(l) * math.sqrt(h))
	else:
		tmp = t_1 * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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 = 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))))
	t_1 = Float64(abs(d_m) / sqrt(Float64(l * h)))
	tmp = 0.0
	if (t_0 <= 0.0)
		tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(0.125 / d_m) * Float64(Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) * D_m) / Float64(l * d_m)))));
	elseif (t_0 <= 4e+238)
		tmp = Float64(d_m / Float64(sqrt(l) * sqrt(h)));
	else
		tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(M_m * Float64(Float64(D_m * M_m) * Float64(Float64(D_m * h) / Float64(Float64(d_m * d_m) * 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 = (((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)));
	t_1 = abs(d_m) / sqrt((l * h));
	tmp = 0.0;
	if (t_0 <= 0.0)
		tmp = t_1 * (1.0 - ((0.125 / d_m) * (((((M_m * M_m) * h) * D_m) * D_m) / (l * d_m))));
	elseif (t_0 <= 4e+238)
		tmp = d_m / (sqrt(l) * sqrt(h));
	else
		tmp = t_1 * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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[(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]}, Block[{t$95$1 = N[(N[Abs[d$95$m], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(t$95$1 * N[(1.0 - N[(N[(0.125 / d$95$m), $MachinePrecision] * N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] / N[(l * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+238], N[(d$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(1.0 - N[(N[(M$95$m * N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(N[(D$95$m * h), $MachinePrecision] / N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $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({\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)\\
t_1 := \frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;t\_1 \cdot \left(1 - \frac{0.125}{d\_m} \cdot \frac{\left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot D\_m}{\ell \cdot d\_m}\right)\\

\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+238}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\\

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


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

    1. Initial program 79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 98.6%

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

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

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

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites75.7%

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

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

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

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

        \[\leadsto \frac{\sqrt{1}}{\sqrt{\ell \cdot h}} \cdot d \]
      5. metadata-evalN/A

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

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

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

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

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      10. lift-*.f6475.9

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

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

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

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

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

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

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

        \[\leadsto \frac{d}{\sqrt{\ell} \cdot \sqrt{\color{blue}{h}}} \]
      6. lower-sqrt.f6498.7

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

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

    if 4.0000000000000002e238 < (*.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 8.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 68.9% accurate, 0.4× 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({\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)\\ t_1 := \frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}}\\ \mathbf{if}\;t\_0 \leq 0:\\ \;\;\;\;t\_1 \cdot \left(1 - \frac{\frac{\left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot D\_m}{d\_m}}{\ell \cdot d\_m} \cdot 0.125\right)\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+238}:\\ \;\;\;\;\frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \left(1 - \left(M\_m \cdot \left(\left(D\_m \cdot M\_m\right) \cdot \frac{D\_m \cdot h}{\left(d\_m \cdot d\_m\right) \cdot \ell}\right)\right) \cdot 0.125\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
         (*
          (* (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)))))
        (t_1 (/ (fabs d_m) (sqrt (* l h)))))
   (if (<= t_0 0.0)
     (*
      t_1
      (-
       1.0
       (* (/ (/ (* (* (* (* M_m M_m) h) D_m) D_m) d_m) (* l d_m)) 0.125)))
     (if (<= t_0 4e+238)
       (/ d_m (* (sqrt l) (sqrt h)))
       (*
        t_1
        (-
         1.0
         (*
          (* M_m (* (* D_m M_m) (/ (* D_m h) (* (* d_m d_m) 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 = (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)));
	double t_1 = fabs(d_m) / sqrt((l * h));
	double tmp;
	if (t_0 <= 0.0) {
		tmp = t_1 * (1.0 - (((((((M_m * M_m) * h) * D_m) * D_m) / d_m) / (l * d_m)) * 0.125));
	} else if (t_0 <= 4e+238) {
		tmp = d_m / (sqrt(l) * sqrt(h));
	} else {
		tmp = t_1 * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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) :: t_1
    real(8) :: tmp
    t_0 = (((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)))
    t_1 = abs(d_m) / sqrt((l * h))
    if (t_0 <= 0.0d0) then
        tmp = t_1 * (1.0d0 - (((((((m_m * m_m) * h) * d_m_1) * d_m_1) / d_m) / (l * d_m)) * 0.125d0))
    else if (t_0 <= 4d+238) then
        tmp = d_m / (sqrt(l) * sqrt(h))
    else
        tmp = t_1 * (1.0d0 - ((m_m * ((d_m_1 * m_m) * ((d_m_1 * h) / ((d_m * d_m) * 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.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)));
	double t_1 = Math.abs(d_m) / Math.sqrt((l * h));
	double tmp;
	if (t_0 <= 0.0) {
		tmp = t_1 * (1.0 - (((((((M_m * M_m) * h) * D_m) * D_m) / d_m) / (l * d_m)) * 0.125));
	} else if (t_0 <= 4e+238) {
		tmp = d_m / (Math.sqrt(l) * Math.sqrt(h));
	} else {
		tmp = t_1 * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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.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)))
	t_1 = math.fabs(d_m) / math.sqrt((l * h))
	tmp = 0
	if t_0 <= 0.0:
		tmp = t_1 * (1.0 - (((((((M_m * M_m) * h) * D_m) * D_m) / d_m) / (l * d_m)) * 0.125))
	elif t_0 <= 4e+238:
		tmp = d_m / (math.sqrt(l) * math.sqrt(h))
	else:
		tmp = t_1 * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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 = 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))))
	t_1 = Float64(abs(d_m) / sqrt(Float64(l * h)))
	tmp = 0.0
	if (t_0 <= 0.0)
		tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) * D_m) / d_m) / Float64(l * d_m)) * 0.125)));
	elseif (t_0 <= 4e+238)
		tmp = Float64(d_m / Float64(sqrt(l) * sqrt(h)));
	else
		tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(M_m * Float64(Float64(D_m * M_m) * Float64(Float64(D_m * h) / Float64(Float64(d_m * d_m) * 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 = (((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)));
	t_1 = abs(d_m) / sqrt((l * h));
	tmp = 0.0;
	if (t_0 <= 0.0)
		tmp = t_1 * (1.0 - (((((((M_m * M_m) * h) * D_m) * D_m) / d_m) / (l * d_m)) * 0.125));
	elseif (t_0 <= 4e+238)
		tmp = d_m / (sqrt(l) * sqrt(h));
	else
		tmp = t_1 * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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[(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]}, Block[{t$95$1 = N[(N[Abs[d$95$m], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(t$95$1 * N[(1.0 - N[(N[(N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] / d$95$m), $MachinePrecision] / N[(l * d$95$m), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+238], N[(d$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(1.0 - N[(N[(M$95$m * N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(N[(D$95$m * h), $MachinePrecision] / N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $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({\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)\\
t_1 := \frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;t\_1 \cdot \left(1 - \frac{\frac{\left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot D\_m}{d\_m}}{\ell \cdot d\_m} \cdot 0.125\right)\\

\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+238}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\\

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


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

    1. Initial program 79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 98.6%

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

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

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

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites75.7%

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

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

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

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

        \[\leadsto \frac{\sqrt{1}}{\sqrt{\ell \cdot h}} \cdot d \]
      5. metadata-evalN/A

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

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

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

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

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      10. lift-*.f6475.9

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

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

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

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

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

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

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

        \[\leadsto \frac{d}{\sqrt{\ell} \cdot \sqrt{\color{blue}{h}}} \]
      6. lower-sqrt.f6498.7

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

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

    if 4.0000000000000002e238 < (*.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 8.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 68.3% accurate, 0.4× 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({\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)\\ t_1 := \frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}}\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-180}:\\ \;\;\;\;t\_1 \cdot \left(1 - \frac{\frac{h}{d\_m} \cdot \left(\left(\left(D\_m \cdot M\_m\right) \cdot M\_m\right) \cdot D\_m\right)}{\ell \cdot d\_m} \cdot 0.125\right)\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+238}:\\ \;\;\;\;\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d\_m\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \left(1 - \left(M\_m \cdot \left(\left(D\_m \cdot M\_m\right) \cdot \frac{D\_m \cdot h}{\left(d\_m \cdot d\_m\right) \cdot \ell}\right)\right) \cdot 0.125\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
         (*
          (* (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)))))
        (t_1 (/ (fabs d_m) (sqrt (* l h)))))
   (if (<= t_0 -2e-180)
     (*
      t_1
      (-
       1.0
       (* (/ (* (/ h d_m) (* (* (* D_m M_m) M_m) D_m)) (* l d_m)) 0.125)))
     (if (<= t_0 4e+238)
       (* (/ (sqrt (/ 1.0 h)) (sqrt l)) d_m)
       (*
        t_1
        (-
         1.0
         (*
          (* M_m (* (* D_m M_m) (/ (* D_m h) (* (* d_m d_m) 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 = (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)));
	double t_1 = fabs(d_m) / sqrt((l * h));
	double tmp;
	if (t_0 <= -2e-180) {
		tmp = t_1 * (1.0 - ((((h / d_m) * (((D_m * M_m) * M_m) * D_m)) / (l * d_m)) * 0.125));
	} else if (t_0 <= 4e+238) {
		tmp = (sqrt((1.0 / h)) / sqrt(l)) * d_m;
	} else {
		tmp = t_1 * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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) :: t_1
    real(8) :: tmp
    t_0 = (((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)))
    t_1 = abs(d_m) / sqrt((l * h))
    if (t_0 <= (-2d-180)) then
        tmp = t_1 * (1.0d0 - ((((h / d_m) * (((d_m_1 * m_m) * m_m) * d_m_1)) / (l * d_m)) * 0.125d0))
    else if (t_0 <= 4d+238) then
        tmp = (sqrt((1.0d0 / h)) / sqrt(l)) * d_m
    else
        tmp = t_1 * (1.0d0 - ((m_m * ((d_m_1 * m_m) * ((d_m_1 * h) / ((d_m * d_m) * 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.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)));
	double t_1 = Math.abs(d_m) / Math.sqrt((l * h));
	double tmp;
	if (t_0 <= -2e-180) {
		tmp = t_1 * (1.0 - ((((h / d_m) * (((D_m * M_m) * M_m) * D_m)) / (l * d_m)) * 0.125));
	} else if (t_0 <= 4e+238) {
		tmp = (Math.sqrt((1.0 / h)) / Math.sqrt(l)) * d_m;
	} else {
		tmp = t_1 * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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.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)))
	t_1 = math.fabs(d_m) / math.sqrt((l * h))
	tmp = 0
	if t_0 <= -2e-180:
		tmp = t_1 * (1.0 - ((((h / d_m) * (((D_m * M_m) * M_m) * D_m)) / (l * d_m)) * 0.125))
	elif t_0 <= 4e+238:
		tmp = (math.sqrt((1.0 / h)) / math.sqrt(l)) * d_m
	else:
		tmp = t_1 * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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 = 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))))
	t_1 = Float64(abs(d_m) / sqrt(Float64(l * h)))
	tmp = 0.0
	if (t_0 <= -2e-180)
		tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(Float64(h / d_m) * Float64(Float64(Float64(D_m * M_m) * M_m) * D_m)) / Float64(l * d_m)) * 0.125)));
	elseif (t_0 <= 4e+238)
		tmp = Float64(Float64(sqrt(Float64(1.0 / h)) / sqrt(l)) * d_m);
	else
		tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(M_m * Float64(Float64(D_m * M_m) * Float64(Float64(D_m * h) / Float64(Float64(d_m * d_m) * 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 = (((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)));
	t_1 = abs(d_m) / sqrt((l * h));
	tmp = 0.0;
	if (t_0 <= -2e-180)
		tmp = t_1 * (1.0 - ((((h / d_m) * (((D_m * M_m) * M_m) * D_m)) / (l * d_m)) * 0.125));
	elseif (t_0 <= 4e+238)
		tmp = (sqrt((1.0 / h)) / sqrt(l)) * d_m;
	else
		tmp = t_1 * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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[(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]}, Block[{t$95$1 = N[(N[Abs[d$95$m], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-180], N[(t$95$1 * N[(1.0 - N[(N[(N[(N[(h / d$95$m), $MachinePrecision] * N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision]), $MachinePrecision] / N[(l * d$95$m), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+238], N[(N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], N[(t$95$1 * N[(1.0 - N[(N[(M$95$m * N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(N[(D$95$m * h), $MachinePrecision] / N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $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({\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)\\
t_1 := \frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-180}:\\
\;\;\;\;t\_1 \cdot \left(1 - \frac{\frac{h}{d\_m} \cdot \left(\left(\left(D\_m \cdot M\_m\right) \cdot M\_m\right) \cdot D\_m\right)}{\ell \cdot d\_m} \cdot 0.125\right)\\

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

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


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

    1. Initial program 86.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2e-180 < (*.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)))) < 4.0000000000000002e238

    1. Initial program 88.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 \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites75.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      10. lower-sqrt.f6491.9

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
    6. Applied rewrites91.9%

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

    if 4.0000000000000002e238 < (*.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 8.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 67.9% 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 := \frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}}\\ t_1 := t\_0 \cdot \left(1 - \left(\frac{\left(M\_m \cdot M\_m\right) \cdot h}{d\_m} \cdot \frac{D\_m \cdot D\_m}{\ell \cdot d\_m}\right) \cdot 0.125\right)\\ \mathbf{if}\;M\_m \cdot D\_m \leq 2 \cdot 10^{-118}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;M\_m \cdot D\_m \leq 5 \cdot 10^{+261}:\\ \;\;\;\;t\_0 \cdot \left(1 - \left(\left(\frac{h}{\left(d\_m \cdot d\_m\right) \cdot \ell} \cdot \left(D\_m \cdot M\_m\right)\right) \cdot \left(D\_m \cdot M\_m\right)\right) \cdot 0.125\right)\\ \mathbf{else}:\\ \;\;\;\;t\_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
 (let* ((t_0 (/ (fabs d_m) (sqrt (* l h))))
        (t_1
         (*
          t_0
          (-
           1.0
           (*
            (* (/ (* (* M_m M_m) h) d_m) (/ (* D_m D_m) (* l d_m)))
            0.125)))))
   (if (<= (* M_m D_m) 2e-118)
     t_1
     (if (<= (* M_m D_m) 5e+261)
       (*
        t_0
        (-
         1.0
         (* (* (* (/ h (* (* d_m d_m) l)) (* D_m M_m)) (* D_m M_m)) 0.125)))
       t_1))))
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 = fabs(d_m) / sqrt((l * h));
	double t_1 = t_0 * (1.0 - (((((M_m * M_m) * h) / d_m) * ((D_m * D_m) / (l * d_m))) * 0.125));
	double tmp;
	if ((M_m * D_m) <= 2e-118) {
		tmp = t_1;
	} else if ((M_m * D_m) <= 5e+261) {
		tmp = t_0 * (1.0 - ((((h / ((d_m * d_m) * l)) * (D_m * M_m)) * (D_m * M_m)) * 0.125));
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_0 = abs(d_m) / sqrt((l * h))
    t_1 = t_0 * (1.0d0 - (((((m_m * m_m) * h) / d_m) * ((d_m_1 * d_m_1) / (l * d_m))) * 0.125d0))
    if ((m_m * d_m_1) <= 2d-118) then
        tmp = t_1
    else if ((m_m * d_m_1) <= 5d+261) then
        tmp = t_0 * (1.0d0 - ((((h / ((d_m * d_m) * l)) * (d_m_1 * m_m)) * (d_m_1 * m_m)) * 0.125d0))
    else
        tmp = t_1
    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.abs(d_m) / Math.sqrt((l * h));
	double t_1 = t_0 * (1.0 - (((((M_m * M_m) * h) / d_m) * ((D_m * D_m) / (l * d_m))) * 0.125));
	double tmp;
	if ((M_m * D_m) <= 2e-118) {
		tmp = t_1;
	} else if ((M_m * D_m) <= 5e+261) {
		tmp = t_0 * (1.0 - ((((h / ((d_m * d_m) * l)) * (D_m * M_m)) * (D_m * M_m)) * 0.125));
	} else {
		tmp = t_1;
	}
	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.fabs(d_m) / math.sqrt((l * h))
	t_1 = t_0 * (1.0 - (((((M_m * M_m) * h) / d_m) * ((D_m * D_m) / (l * d_m))) * 0.125))
	tmp = 0
	if (M_m * D_m) <= 2e-118:
		tmp = t_1
	elif (M_m * D_m) <= 5e+261:
		tmp = t_0 * (1.0 - ((((h / ((d_m * d_m) * l)) * (D_m * M_m)) * (D_m * M_m)) * 0.125))
	else:
		tmp = t_1
	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(abs(d_m) / sqrt(Float64(l * h)))
	t_1 = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(M_m * M_m) * h) / d_m) * Float64(Float64(D_m * D_m) / Float64(l * d_m))) * 0.125)))
	tmp = 0.0
	if (Float64(M_m * D_m) <= 2e-118)
		tmp = t_1;
	elseif (Float64(M_m * D_m) <= 5e+261)
		tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(Float64(h / Float64(Float64(d_m * d_m) * l)) * Float64(D_m * M_m)) * Float64(D_m * M_m)) * 0.125)));
	else
		tmp = t_1;
	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 = abs(d_m) / sqrt((l * h));
	t_1 = t_0 * (1.0 - (((((M_m * M_m) * h) / d_m) * ((D_m * D_m) / (l * d_m))) * 0.125));
	tmp = 0.0;
	if ((M_m * D_m) <= 2e-118)
		tmp = t_1;
	elseif ((M_m * D_m) <= 5e+261)
		tmp = t_0 * (1.0 - ((((h / ((d_m * d_m) * l)) * (D_m * M_m)) * (D_m * M_m)) * 0.125));
	else
		tmp = t_1;
	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[(N[Abs[d$95$m], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(1.0 - N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] / d$95$m), $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] / N[(l * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(M$95$m * D$95$m), $MachinePrecision], 2e-118], t$95$1, If[LessEqual[N[(M$95$m * D$95$m), $MachinePrecision], 5e+261], N[(t$95$0 * N[(1.0 - N[(N[(N[(N[(h / N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * N[(D$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] * N[(D$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\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 := \frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}}\\
t_1 := t\_0 \cdot \left(1 - \left(\frac{\left(M\_m \cdot M\_m\right) \cdot h}{d\_m} \cdot \frac{D\_m \cdot D\_m}{\ell \cdot d\_m}\right) \cdot 0.125\right)\\
\mathbf{if}\;M\_m \cdot D\_m \leq 2 \cdot 10^{-118}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;M\_m \cdot D\_m \leq 5 \cdot 10^{+261}:\\
\;\;\;\;t\_0 \cdot \left(1 - \left(\left(\frac{h}{\left(d\_m \cdot d\_m\right) \cdot \ell} \cdot \left(D\_m \cdot M\_m\right)\right) \cdot \left(D\_m \cdot M\_m\right)\right) \cdot 0.125\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 M D) < 1.99999999999999997e-118 or 5.0000000000000001e261 < (*.f64 M D)

    1. Initial program 36.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      12. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      15. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      16. lower-*.f6425.9

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right) \]
    4. Applied rewrites25.9%

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125}\right) \]
    5. Applied rewrites55.5%

      \[\leadsto \color{blue}{\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right)} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      5. lift-/.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      6. associate-*r/N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot h}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{1}{8}\right) \]
      7. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot h}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{1}{8}\right) \]
      8. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot h}{\left(d \cdot d\right) \cdot \ell} \cdot \frac{1}{8}\right) \]
      9. associate-*l*N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot h}{d \cdot \left(d \cdot \ell\right)} \cdot \frac{1}{8}\right) \]
      10. associate-*l*N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\left(\left(D \cdot M\right) \cdot \left(M \cdot D\right)\right) \cdot h}{d \cdot \left(d \cdot \ell\right)} \cdot \frac{1}{8}\right) \]
      11. *-commutativeN/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\left(\left(D \cdot M\right) \cdot \left(D \cdot M\right)\right) \cdot h}{d \cdot \left(d \cdot \ell\right)} \cdot \frac{1}{8}\right) \]
      12. pow2N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{{\left(D \cdot M\right)}^{2} \cdot h}{d \cdot \left(d \cdot \ell\right)} \cdot \frac{1}{8}\right) \]
      13. pow-prod-downN/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{d \cdot \left(d \cdot \ell\right)} \cdot \frac{1}{8}\right) \]
      14. associate-*r*N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{d \cdot \left(d \cdot \ell\right)} \cdot \frac{1}{8}\right) \]
      15. *-commutativeN/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\left({M}^{2} \cdot h\right) \cdot {D}^{2}}{d \cdot \left(d \cdot \ell\right)} \cdot \frac{1}{8}\right) \]
      16. times-fracN/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{{M}^{2} \cdot h}{d} \cdot \frac{{D}^{2}}{d \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{{M}^{2} \cdot h}{d} \cdot \frac{{D}^{2}}{d \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
    7. Applied rewrites71.3%

      \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{\left(M \cdot M\right) \cdot h}{d} \cdot \frac{D \cdot D}{\ell \cdot d}\right) \cdot 0.125\right) \]

    if 1.99999999999999997e-118 < (*.f64 M D) < 5.0000000000000001e261

    1. Initial program 34.5%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around 0

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\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(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot \color{blue}{\frac{1}{8}}\right) \]
      2. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot \color{blue}{\frac{1}{8}}\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(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{{d}^{2} \cdot \ell} \cdot \frac{1}{8}\right) \]
      4. associate-/l*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      6. *-commutativeN/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({M}^{2} \cdot {D}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      7. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({M}^{2} \cdot \left(D \cdot D\right)\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      8. associate-*r*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      10. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      11. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      12. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      15. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      16. lower-*.f6427.5

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right) \]
    4. Applied rewrites27.5%

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125}\right) \]
    5. Applied rewrites61.8%

      \[\leadsto \color{blue}{\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right)} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      5. *-commutativeN/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot \left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right)\right) \cdot \frac{1}{8}\right) \]
      6. associate-*l*N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot \left(\left(D \cdot M\right) \cdot \left(M \cdot D\right)\right)\right) \cdot \frac{1}{8}\right) \]
      7. *-commutativeN/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot M\right)\right)\right) \cdot \frac{1}{8}\right) \]
      8. associate-*r*N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot \left(D \cdot M\right)\right) \cdot \left(D \cdot M\right)\right) \cdot \frac{1}{8}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot \left(D \cdot M\right)\right) \cdot \left(D \cdot M\right)\right) \cdot \frac{1}{8}\right) \]
      10. lower-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot \left(D \cdot M\right)\right) \cdot \left(D \cdot M\right)\right) \cdot \frac{1}{8}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot \left(D \cdot M\right)\right) \cdot \left(D \cdot M\right)\right) \cdot \frac{1}{8}\right) \]
      12. lift-*.f6467.8

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot \left(D \cdot M\right)\right) \cdot \left(D \cdot M\right)\right) \cdot 0.125\right) \]
    7. Applied rewrites67.8%

      \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot \left(D \cdot M\right)\right) \cdot \left(D \cdot M\right)\right) \cdot 0.125\right) \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 67.9% accurate, 0.4× 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({\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)\\ t_1 := \frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}}\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-180}:\\ \;\;\;\;t\_1 \cdot \left(1 - \left(\left(\left(\left(D\_m \cdot M\_m\right) \cdot M\_m\right) \cdot D\_m\right) \cdot \frac{\frac{h}{d\_m}}{\ell \cdot d\_m}\right) \cdot 0.125\right)\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+238}:\\ \;\;\;\;\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d\_m\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \left(1 - \left(M\_m \cdot \left(\left(D\_m \cdot M\_m\right) \cdot \frac{D\_m \cdot h}{\left(d\_m \cdot d\_m\right) \cdot \ell}\right)\right) \cdot 0.125\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
         (*
          (* (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)))))
        (t_1 (/ (fabs d_m) (sqrt (* l h)))))
   (if (<= t_0 -2e-180)
     (*
      t_1
      (-
       1.0
       (* (* (* (* (* D_m M_m) M_m) D_m) (/ (/ h d_m) (* l d_m))) 0.125)))
     (if (<= t_0 4e+238)
       (* (/ (sqrt (/ 1.0 h)) (sqrt l)) d_m)
       (*
        t_1
        (-
         1.0
         (*
          (* M_m (* (* D_m M_m) (/ (* D_m h) (* (* d_m d_m) 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 = (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)));
	double t_1 = fabs(d_m) / sqrt((l * h));
	double tmp;
	if (t_0 <= -2e-180) {
		tmp = t_1 * (1.0 - (((((D_m * M_m) * M_m) * D_m) * ((h / d_m) / (l * d_m))) * 0.125));
	} else if (t_0 <= 4e+238) {
		tmp = (sqrt((1.0 / h)) / sqrt(l)) * d_m;
	} else {
		tmp = t_1 * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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) :: t_1
    real(8) :: tmp
    t_0 = (((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)))
    t_1 = abs(d_m) / sqrt((l * h))
    if (t_0 <= (-2d-180)) then
        tmp = t_1 * (1.0d0 - (((((d_m_1 * m_m) * m_m) * d_m_1) * ((h / d_m) / (l * d_m))) * 0.125d0))
    else if (t_0 <= 4d+238) then
        tmp = (sqrt((1.0d0 / h)) / sqrt(l)) * d_m
    else
        tmp = t_1 * (1.0d0 - ((m_m * ((d_m_1 * m_m) * ((d_m_1 * h) / ((d_m * d_m) * 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.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)));
	double t_1 = Math.abs(d_m) / Math.sqrt((l * h));
	double tmp;
	if (t_0 <= -2e-180) {
		tmp = t_1 * (1.0 - (((((D_m * M_m) * M_m) * D_m) * ((h / d_m) / (l * d_m))) * 0.125));
	} else if (t_0 <= 4e+238) {
		tmp = (Math.sqrt((1.0 / h)) / Math.sqrt(l)) * d_m;
	} else {
		tmp = t_1 * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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.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)))
	t_1 = math.fabs(d_m) / math.sqrt((l * h))
	tmp = 0
	if t_0 <= -2e-180:
		tmp = t_1 * (1.0 - (((((D_m * M_m) * M_m) * D_m) * ((h / d_m) / (l * d_m))) * 0.125))
	elif t_0 <= 4e+238:
		tmp = (math.sqrt((1.0 / h)) / math.sqrt(l)) * d_m
	else:
		tmp = t_1 * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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 = 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))))
	t_1 = Float64(abs(d_m) / sqrt(Float64(l * h)))
	tmp = 0.0
	if (t_0 <= -2e-180)
		tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D_m * M_m) * M_m) * D_m) * Float64(Float64(h / d_m) / Float64(l * d_m))) * 0.125)));
	elseif (t_0 <= 4e+238)
		tmp = Float64(Float64(sqrt(Float64(1.0 / h)) / sqrt(l)) * d_m);
	else
		tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(M_m * Float64(Float64(D_m * M_m) * Float64(Float64(D_m * h) / Float64(Float64(d_m * d_m) * 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 = (((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)));
	t_1 = abs(d_m) / sqrt((l * h));
	tmp = 0.0;
	if (t_0 <= -2e-180)
		tmp = t_1 * (1.0 - (((((D_m * M_m) * M_m) * D_m) * ((h / d_m) / (l * d_m))) * 0.125));
	elseif (t_0 <= 4e+238)
		tmp = (sqrt((1.0 / h)) / sqrt(l)) * d_m;
	else
		tmp = t_1 * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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[(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]}, Block[{t$95$1 = N[(N[Abs[d$95$m], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-180], N[(t$95$1 * N[(1.0 - N[(N[(N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(N[(h / d$95$m), $MachinePrecision] / N[(l * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+238], N[(N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], N[(t$95$1 * N[(1.0 - N[(N[(M$95$m * N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(N[(D$95$m * h), $MachinePrecision] / N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $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({\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)\\
t_1 := \frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-180}:\\
\;\;\;\;t\_1 \cdot \left(1 - \left(\left(\left(\left(D\_m \cdot M\_m\right) \cdot M\_m\right) \cdot D\_m\right) \cdot \frac{\frac{h}{d\_m}}{\ell \cdot d\_m}\right) \cdot 0.125\right)\\

\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+238}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d\_m\\

\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(1 - \left(M\_m \cdot \left(\left(D\_m \cdot M\_m\right) \cdot \frac{D\_m \cdot h}{\left(d\_m \cdot d\_m\right) \cdot \ell}\right)\right) \cdot 0.125\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-180

    1. Initial program 86.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around 0

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\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(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot \color{blue}{\frac{1}{8}}\right) \]
      2. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot \color{blue}{\frac{1}{8}}\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(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{{d}^{2} \cdot \ell} \cdot \frac{1}{8}\right) \]
      4. associate-/l*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      6. *-commutativeN/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({M}^{2} \cdot {D}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      7. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({M}^{2} \cdot \left(D \cdot D\right)\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      8. associate-*r*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      10. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      11. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      12. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      15. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      16. lower-*.f6455.4

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right) \]
    4. Applied rewrites55.4%

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125}\right) \]
    5. Applied rewrites59.7%

      \[\leadsto \color{blue}{\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right)} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      4. associate-*l*N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{d \cdot \left(d \cdot \ell\right)}\right) \cdot \frac{1}{8}\right) \]
      5. associate-/r*N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{\frac{h}{d}}{d \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      6. lower-/.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{\frac{h}{d}}{d \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      7. lower-/.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{\frac{h}{d}}{d \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      8. *-commutativeN/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{\frac{h}{d}}{\ell \cdot d}\right) \cdot \frac{1}{8}\right) \]
      9. lower-*.f6467.5

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{\frac{h}{d}}{\ell \cdot d}\right) \cdot 0.125\right) \]
    7. Applied rewrites67.5%

      \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{\frac{h}{d}}{\ell \cdot d}\right) \cdot 0.125\right) \]

    if -2e-180 < (*.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)))) < 4.0000000000000002e238

    1. Initial program 88.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 \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites75.5%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      3. lift-/.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
      5. associate-/r*N/A

        \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d \]
      6. sqrt-divN/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      7. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      8. lower-sqrt.f64N/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      9. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      10. lower-sqrt.f6491.9

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
    6. Applied rewrites91.9%

      \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]

    if 4.0000000000000002e238 < (*.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 8.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around 0

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\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(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot \color{blue}{\frac{1}{8}}\right) \]
      2. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot \color{blue}{\frac{1}{8}}\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(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{{d}^{2} \cdot \ell} \cdot \frac{1}{8}\right) \]
      4. associate-/l*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      6. *-commutativeN/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({M}^{2} \cdot {D}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      7. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({M}^{2} \cdot \left(D \cdot D\right)\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      8. associate-*r*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      10. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      11. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      12. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      15. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      16. lower-*.f648.2

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right) \]
    4. Applied rewrites8.2%

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125}\right) \]
    5. Applied rewrites59.2%

      \[\leadsto \color{blue}{\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right)} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      5. associate-*l*N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(D \cdot M\right) \cdot M\right) \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      6. *-commutativeN/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(M \cdot \left(D \cdot M\right)\right) \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      7. associate-*l*N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      8. lower-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      10. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      12. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      13. pow2N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot \frac{h}{{d}^{2} \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      14. lower-/.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot \frac{h}{{d}^{2} \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      15. associate-*r/N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \frac{D \cdot h}{{d}^{2} \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      16. lower-/.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \frac{D \cdot h}{{d}^{2} \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \frac{D \cdot h}{{d}^{2} \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      18. pow2N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \frac{D \cdot h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      19. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \frac{D \cdot h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      20. lift-*.f6462.2

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \frac{D \cdot h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot 0.125\right) \]
    7. Applied rewrites62.2%

      \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \frac{D \cdot h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot 0.125\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 11: 67.9% accurate, 0.4× 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({\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)\\ t_1 := \frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}}\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-180}:\\ \;\;\;\;t\_1 \cdot \left(1 - \left(\left(\left(\left(D\_m \cdot M\_m\right) \cdot M\_m\right) \cdot D\_m\right) \cdot \frac{h}{\left(\ell \cdot d\_m\right) \cdot d\_m}\right) \cdot 0.125\right)\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+238}:\\ \;\;\;\;\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d\_m\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \left(1 - \left(M\_m \cdot \left(\left(D\_m \cdot M\_m\right) \cdot \frac{D\_m \cdot h}{\left(d\_m \cdot d\_m\right) \cdot \ell}\right)\right) \cdot 0.125\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
         (*
          (* (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)))))
        (t_1 (/ (fabs d_m) (sqrt (* l h)))))
   (if (<= t_0 -2e-180)
     (*
      t_1
      (-
       1.0
       (* (* (* (* (* D_m M_m) M_m) D_m) (/ h (* (* l d_m) d_m))) 0.125)))
     (if (<= t_0 4e+238)
       (* (/ (sqrt (/ 1.0 h)) (sqrt l)) d_m)
       (*
        t_1
        (-
         1.0
         (*
          (* M_m (* (* D_m M_m) (/ (* D_m h) (* (* d_m d_m) 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 = (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)));
	double t_1 = fabs(d_m) / sqrt((l * h));
	double tmp;
	if (t_0 <= -2e-180) {
		tmp = t_1 * (1.0 - (((((D_m * M_m) * M_m) * D_m) * (h / ((l * d_m) * d_m))) * 0.125));
	} else if (t_0 <= 4e+238) {
		tmp = (sqrt((1.0 / h)) / sqrt(l)) * d_m;
	} else {
		tmp = t_1 * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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) :: t_1
    real(8) :: tmp
    t_0 = (((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)))
    t_1 = abs(d_m) / sqrt((l * h))
    if (t_0 <= (-2d-180)) then
        tmp = t_1 * (1.0d0 - (((((d_m_1 * m_m) * m_m) * d_m_1) * (h / ((l * d_m) * d_m))) * 0.125d0))
    else if (t_0 <= 4d+238) then
        tmp = (sqrt((1.0d0 / h)) / sqrt(l)) * d_m
    else
        tmp = t_1 * (1.0d0 - ((m_m * ((d_m_1 * m_m) * ((d_m_1 * h) / ((d_m * d_m) * 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.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)));
	double t_1 = Math.abs(d_m) / Math.sqrt((l * h));
	double tmp;
	if (t_0 <= -2e-180) {
		tmp = t_1 * (1.0 - (((((D_m * M_m) * M_m) * D_m) * (h / ((l * d_m) * d_m))) * 0.125));
	} else if (t_0 <= 4e+238) {
		tmp = (Math.sqrt((1.0 / h)) / Math.sqrt(l)) * d_m;
	} else {
		tmp = t_1 * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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.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)))
	t_1 = math.fabs(d_m) / math.sqrt((l * h))
	tmp = 0
	if t_0 <= -2e-180:
		tmp = t_1 * (1.0 - (((((D_m * M_m) * M_m) * D_m) * (h / ((l * d_m) * d_m))) * 0.125))
	elif t_0 <= 4e+238:
		tmp = (math.sqrt((1.0 / h)) / math.sqrt(l)) * d_m
	else:
		tmp = t_1 * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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 = 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))))
	t_1 = Float64(abs(d_m) / sqrt(Float64(l * h)))
	tmp = 0.0
	if (t_0 <= -2e-180)
		tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D_m * M_m) * M_m) * D_m) * Float64(h / Float64(Float64(l * d_m) * d_m))) * 0.125)));
	elseif (t_0 <= 4e+238)
		tmp = Float64(Float64(sqrt(Float64(1.0 / h)) / sqrt(l)) * d_m);
	else
		tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(M_m * Float64(Float64(D_m * M_m) * Float64(Float64(D_m * h) / Float64(Float64(d_m * d_m) * 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 = (((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)));
	t_1 = abs(d_m) / sqrt((l * h));
	tmp = 0.0;
	if (t_0 <= -2e-180)
		tmp = t_1 * (1.0 - (((((D_m * M_m) * M_m) * D_m) * (h / ((l * d_m) * d_m))) * 0.125));
	elseif (t_0 <= 4e+238)
		tmp = (sqrt((1.0 / h)) / sqrt(l)) * d_m;
	else
		tmp = t_1 * (1.0 - ((M_m * ((D_m * M_m) * ((D_m * h) / ((d_m * d_m) * 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[(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]}, Block[{t$95$1 = N[(N[Abs[d$95$m], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-180], N[(t$95$1 * N[(1.0 - N[(N[(N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(h / N[(N[(l * d$95$m), $MachinePrecision] * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+238], N[(N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], N[(t$95$1 * N[(1.0 - N[(N[(M$95$m * N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(N[(D$95$m * h), $MachinePrecision] / N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $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({\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)\\
t_1 := \frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-180}:\\
\;\;\;\;t\_1 \cdot \left(1 - \left(\left(\left(\left(D\_m \cdot M\_m\right) \cdot M\_m\right) \cdot D\_m\right) \cdot \frac{h}{\left(\ell \cdot d\_m\right) \cdot d\_m}\right) \cdot 0.125\right)\\

\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+238}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d\_m\\

\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(1 - \left(M\_m \cdot \left(\left(D\_m \cdot M\_m\right) \cdot \frac{D\_m \cdot h}{\left(d\_m \cdot d\_m\right) \cdot \ell}\right)\right) \cdot 0.125\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-180

    1. Initial program 86.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around 0

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\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(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot \color{blue}{\frac{1}{8}}\right) \]
      2. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot \color{blue}{\frac{1}{8}}\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(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{{d}^{2} \cdot \ell} \cdot \frac{1}{8}\right) \]
      4. associate-/l*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      6. *-commutativeN/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({M}^{2} \cdot {D}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      7. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({M}^{2} \cdot \left(D \cdot D\right)\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      8. associate-*r*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      10. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      11. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      12. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      15. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      16. lower-*.f6455.4

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right) \]
    4. Applied rewrites55.4%

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125}\right) \]
    5. Applied rewrites59.7%

      \[\leadsto \color{blue}{\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right)} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      3. associate-*l*N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{d \cdot \left(d \cdot \ell\right)}\right) \cdot \frac{1}{8}\right) \]
      4. *-commutativeN/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot \ell\right) \cdot d}\right) \cdot \frac{1}{8}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot \ell\right) \cdot d}\right) \cdot \frac{1}{8}\right) \]
      6. *-commutativeN/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(\ell \cdot d\right) \cdot d}\right) \cdot \frac{1}{8}\right) \]
      7. lower-*.f6464.8

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(\ell \cdot d\right) \cdot d}\right) \cdot 0.125\right) \]
    7. Applied rewrites64.8%

      \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(\ell \cdot d\right) \cdot d}\right) \cdot 0.125\right) \]

    if -2e-180 < (*.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)))) < 4.0000000000000002e238

    1. Initial program 88.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 \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites75.5%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      3. lift-/.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
      5. associate-/r*N/A

        \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d \]
      6. sqrt-divN/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      7. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      8. lower-sqrt.f64N/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      9. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      10. lower-sqrt.f6491.9

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
    6. Applied rewrites91.9%

      \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]

    if 4.0000000000000002e238 < (*.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 8.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around 0

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\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(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot \color{blue}{\frac{1}{8}}\right) \]
      2. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot \color{blue}{\frac{1}{8}}\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(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{{d}^{2} \cdot \ell} \cdot \frac{1}{8}\right) \]
      4. associate-/l*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      6. *-commutativeN/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({M}^{2} \cdot {D}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      7. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({M}^{2} \cdot \left(D \cdot D\right)\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      8. associate-*r*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      10. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      11. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      12. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      15. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      16. lower-*.f648.2

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right) \]
    4. Applied rewrites8.2%

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125}\right) \]
    5. Applied rewrites59.2%

      \[\leadsto \color{blue}{\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right)} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      5. associate-*l*N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(D \cdot M\right) \cdot M\right) \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      6. *-commutativeN/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(M \cdot \left(D \cdot M\right)\right) \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      7. associate-*l*N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      8. lower-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      10. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      12. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      13. pow2N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot \frac{h}{{d}^{2} \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      14. lower-/.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot \frac{h}{{d}^{2} \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      15. associate-*r/N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \frac{D \cdot h}{{d}^{2} \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      16. lower-/.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \frac{D \cdot h}{{d}^{2} \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \frac{D \cdot h}{{d}^{2} \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      18. pow2N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \frac{D \cdot h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      19. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \frac{D \cdot h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      20. lift-*.f6462.2

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \frac{D \cdot h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot 0.125\right) \]
    7. Applied rewrites62.2%

      \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(M \cdot \left(\left(D \cdot M\right) \cdot \frac{D \cdot h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot 0.125\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 12: 67.8% accurate, 0.4× 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({\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)\\ t_1 := \frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}}\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-180}:\\ \;\;\;\;t\_1 \cdot \left(1 - \left(\left(\left(\left(D\_m \cdot M\_m\right) \cdot M\_m\right) \cdot D\_m\right) \cdot \frac{h}{\left(\ell \cdot d\_m\right) \cdot d\_m}\right) \cdot 0.125\right)\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+238}:\\ \;\;\;\;\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d\_m\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \left(1 - \left(\left(D\_m \cdot M\_m\right) \cdot \left(M\_m \cdot \frac{D\_m \cdot h}{\left(d\_m \cdot d\_m\right) \cdot \ell}\right)\right) \cdot 0.125\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
         (*
          (* (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)))))
        (t_1 (/ (fabs d_m) (sqrt (* l h)))))
   (if (<= t_0 -2e-180)
     (*
      t_1
      (-
       1.0
       (* (* (* (* (* D_m M_m) M_m) D_m) (/ h (* (* l d_m) d_m))) 0.125)))
     (if (<= t_0 4e+238)
       (* (/ (sqrt (/ 1.0 h)) (sqrt l)) d_m)
       (*
        t_1
        (-
         1.0
         (*
          (* (* D_m M_m) (* M_m (/ (* D_m h) (* (* d_m d_m) 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 = (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)));
	double t_1 = fabs(d_m) / sqrt((l * h));
	double tmp;
	if (t_0 <= -2e-180) {
		tmp = t_1 * (1.0 - (((((D_m * M_m) * M_m) * D_m) * (h / ((l * d_m) * d_m))) * 0.125));
	} else if (t_0 <= 4e+238) {
		tmp = (sqrt((1.0 / h)) / sqrt(l)) * d_m;
	} else {
		tmp = t_1 * (1.0 - (((D_m * M_m) * (M_m * ((D_m * h) / ((d_m * d_m) * 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) :: t_1
    real(8) :: tmp
    t_0 = (((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)))
    t_1 = abs(d_m) / sqrt((l * h))
    if (t_0 <= (-2d-180)) then
        tmp = t_1 * (1.0d0 - (((((d_m_1 * m_m) * m_m) * d_m_1) * (h / ((l * d_m) * d_m))) * 0.125d0))
    else if (t_0 <= 4d+238) then
        tmp = (sqrt((1.0d0 / h)) / sqrt(l)) * d_m
    else
        tmp = t_1 * (1.0d0 - (((d_m_1 * m_m) * (m_m * ((d_m_1 * h) / ((d_m * d_m) * 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.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)));
	double t_1 = Math.abs(d_m) / Math.sqrt((l * h));
	double tmp;
	if (t_0 <= -2e-180) {
		tmp = t_1 * (1.0 - (((((D_m * M_m) * M_m) * D_m) * (h / ((l * d_m) * d_m))) * 0.125));
	} else if (t_0 <= 4e+238) {
		tmp = (Math.sqrt((1.0 / h)) / Math.sqrt(l)) * d_m;
	} else {
		tmp = t_1 * (1.0 - (((D_m * M_m) * (M_m * ((D_m * h) / ((d_m * d_m) * 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.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)))
	t_1 = math.fabs(d_m) / math.sqrt((l * h))
	tmp = 0
	if t_0 <= -2e-180:
		tmp = t_1 * (1.0 - (((((D_m * M_m) * M_m) * D_m) * (h / ((l * d_m) * d_m))) * 0.125))
	elif t_0 <= 4e+238:
		tmp = (math.sqrt((1.0 / h)) / math.sqrt(l)) * d_m
	else:
		tmp = t_1 * (1.0 - (((D_m * M_m) * (M_m * ((D_m * h) / ((d_m * d_m) * 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 = 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))))
	t_1 = Float64(abs(d_m) / sqrt(Float64(l * h)))
	tmp = 0.0
	if (t_0 <= -2e-180)
		tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D_m * M_m) * M_m) * D_m) * Float64(h / Float64(Float64(l * d_m) * d_m))) * 0.125)));
	elseif (t_0 <= 4e+238)
		tmp = Float64(Float64(sqrt(Float64(1.0 / h)) / sqrt(l)) * d_m);
	else
		tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(D_m * M_m) * Float64(M_m * Float64(Float64(D_m * h) / Float64(Float64(d_m * d_m) * 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 = (((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)));
	t_1 = abs(d_m) / sqrt((l * h));
	tmp = 0.0;
	if (t_0 <= -2e-180)
		tmp = t_1 * (1.0 - (((((D_m * M_m) * M_m) * D_m) * (h / ((l * d_m) * d_m))) * 0.125));
	elseif (t_0 <= 4e+238)
		tmp = (sqrt((1.0 / h)) / sqrt(l)) * d_m;
	else
		tmp = t_1 * (1.0 - (((D_m * M_m) * (M_m * ((D_m * h) / ((d_m * d_m) * 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[(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]}, Block[{t$95$1 = N[(N[Abs[d$95$m], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-180], N[(t$95$1 * N[(1.0 - N[(N[(N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(h / N[(N[(l * d$95$m), $MachinePrecision] * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+238], N[(N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], N[(t$95$1 * N[(1.0 - N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(M$95$m * N[(N[(D$95$m * h), $MachinePrecision] / N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $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({\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)\\
t_1 := \frac{\left|d\_m\right|}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-180}:\\
\;\;\;\;t\_1 \cdot \left(1 - \left(\left(\left(\left(D\_m \cdot M\_m\right) \cdot M\_m\right) \cdot D\_m\right) \cdot \frac{h}{\left(\ell \cdot d\_m\right) \cdot d\_m}\right) \cdot 0.125\right)\\

\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+238}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d\_m\\

\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(1 - \left(\left(D\_m \cdot M\_m\right) \cdot \left(M\_m \cdot \frac{D\_m \cdot h}{\left(d\_m \cdot d\_m\right) \cdot \ell}\right)\right) \cdot 0.125\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-180

    1. Initial program 86.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around 0

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\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(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot \color{blue}{\frac{1}{8}}\right) \]
      2. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot \color{blue}{\frac{1}{8}}\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(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{{d}^{2} \cdot \ell} \cdot \frac{1}{8}\right) \]
      4. associate-/l*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      6. *-commutativeN/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({M}^{2} \cdot {D}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      7. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({M}^{2} \cdot \left(D \cdot D\right)\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      8. associate-*r*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      10. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      11. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      12. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      15. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      16. lower-*.f6455.4

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right) \]
    4. Applied rewrites55.4%

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125}\right) \]
    5. Applied rewrites59.7%

      \[\leadsto \color{blue}{\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right)} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      3. associate-*l*N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{d \cdot \left(d \cdot \ell\right)}\right) \cdot \frac{1}{8}\right) \]
      4. *-commutativeN/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot \ell\right) \cdot d}\right) \cdot \frac{1}{8}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot \ell\right) \cdot d}\right) \cdot \frac{1}{8}\right) \]
      6. *-commutativeN/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(\ell \cdot d\right) \cdot d}\right) \cdot \frac{1}{8}\right) \]
      7. lower-*.f6464.8

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(\ell \cdot d\right) \cdot d}\right) \cdot 0.125\right) \]
    7. Applied rewrites64.8%

      \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(\ell \cdot d\right) \cdot d}\right) \cdot 0.125\right) \]

    if -2e-180 < (*.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)))) < 4.0000000000000002e238

    1. Initial program 88.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 \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites75.5%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      3. lift-/.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
      5. associate-/r*N/A

        \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d \]
      6. sqrt-divN/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      7. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      8. lower-sqrt.f64N/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      9. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      10. lower-sqrt.f6491.9

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
    6. Applied rewrites91.9%

      \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]

    if 4.0000000000000002e238 < (*.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 8.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around 0

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\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(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot \color{blue}{\frac{1}{8}}\right) \]
      2. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot \color{blue}{\frac{1}{8}}\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(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{{d}^{2} \cdot \ell} \cdot \frac{1}{8}\right) \]
      4. associate-/l*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      6. *-commutativeN/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({M}^{2} \cdot {D}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      7. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({M}^{2} \cdot \left(D \cdot D\right)\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      8. associate-*r*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      10. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      11. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      12. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      15. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      16. lower-*.f648.2

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right) \]
    4. Applied rewrites8.2%

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125}\right) \]
    5. Applied rewrites59.2%

      \[\leadsto \color{blue}{\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right)} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      5. associate-*l*N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(D \cdot M\right) \cdot M\right) \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      6. associate-*l*N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      7. lower-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      8. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      10. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      12. pow2N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \left(D \cdot \frac{h}{{d}^{2} \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \left(D \cdot \frac{h}{{d}^{2} \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      14. associate-*r/N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \frac{D \cdot h}{{d}^{2} \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      15. lower-/.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \frac{D \cdot h}{{d}^{2} \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      16. lower-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \frac{D \cdot h}{{d}^{2} \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      17. pow2N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \frac{D \cdot h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      18. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \frac{D \cdot h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      19. lift-*.f6462.4

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \frac{D \cdot h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot 0.125\right) \]
    7. Applied rewrites62.4%

      \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \frac{D \cdot h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot 0.125\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 13: 67.0% accurate, 0.4× 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({\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)\\ t_2 := \left(d\_m \cdot d\_m\right) \cdot \ell\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-180}:\\ \;\;\;\;\frac{\left(1 - \left(\left(\left(\left(D\_m \cdot M\_m\right) \cdot M\_m\right) \cdot D\_m\right) \cdot \frac{h}{t\_2}\right) \cdot 0.125\right) \cdot \left|d\_m\right|}{t\_0}\\ \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+238}:\\ \;\;\;\;\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d\_m\\ \mathbf{else}:\\ \;\;\;\;\frac{\left|d\_m\right|}{t\_0} \cdot \left(1 - \left(\left(D\_m \cdot M\_m\right) \cdot \left(M\_m \cdot \frac{D\_m \cdot h}{t\_2}\right)\right) \cdot 0.125\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
         (*
          (* (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)))))
        (t_2 (* (* d_m d_m) l)))
   (if (<= t_1 -2e-180)
     (/
      (*
       (- 1.0 (* (* (* (* (* D_m M_m) M_m) D_m) (/ h t_2)) 0.125))
       (fabs d_m))
      t_0)
     (if (<= t_1 4e+238)
       (* (/ (sqrt (/ 1.0 h)) (sqrt l)) d_m)
       (*
        (/ (fabs d_m) t_0)
        (- 1.0 (* (* (* D_m M_m) (* M_m (/ (* D_m h) t_2))) 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 t_1 = (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)));
	double t_2 = (d_m * d_m) * l;
	double tmp;
	if (t_1 <= -2e-180) {
		tmp = ((1.0 - (((((D_m * M_m) * M_m) * D_m) * (h / t_2)) * 0.125)) * fabs(d_m)) / t_0;
	} else if (t_1 <= 4e+238) {
		tmp = (sqrt((1.0 / h)) / sqrt(l)) * d_m;
	} else {
		tmp = (fabs(d_m) / t_0) * (1.0 - (((D_m * M_m) * (M_m * ((D_m * h) / t_2))) * 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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = sqrt((l * h))
    t_1 = (((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)))
    t_2 = (d_m * d_m) * l
    if (t_1 <= (-2d-180)) then
        tmp = ((1.0d0 - (((((d_m_1 * m_m) * m_m) * d_m_1) * (h / t_2)) * 0.125d0)) * abs(d_m)) / t_0
    else if (t_1 <= 4d+238) then
        tmp = (sqrt((1.0d0 / h)) / sqrt(l)) * d_m
    else
        tmp = (abs(d_m) / t_0) * (1.0d0 - (((d_m_1 * m_m) * (m_m * ((d_m_1 * h) / t_2))) * 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 t_1 = (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)));
	double t_2 = (d_m * d_m) * l;
	double tmp;
	if (t_1 <= -2e-180) {
		tmp = ((1.0 - (((((D_m * M_m) * M_m) * D_m) * (h / t_2)) * 0.125)) * Math.abs(d_m)) / t_0;
	} else if (t_1 <= 4e+238) {
		tmp = (Math.sqrt((1.0 / h)) / Math.sqrt(l)) * d_m;
	} else {
		tmp = (Math.abs(d_m) / t_0) * (1.0 - (((D_m * M_m) * (M_m * ((D_m * h) / t_2))) * 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))
	t_1 = (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)))
	t_2 = (d_m * d_m) * l
	tmp = 0
	if t_1 <= -2e-180:
		tmp = ((1.0 - (((((D_m * M_m) * M_m) * D_m) * (h / t_2)) * 0.125)) * math.fabs(d_m)) / t_0
	elif t_1 <= 4e+238:
		tmp = (math.sqrt((1.0 / h)) / math.sqrt(l)) * d_m
	else:
		tmp = (math.fabs(d_m) / t_0) * (1.0 - (((D_m * M_m) * (M_m * ((D_m * h) / t_2))) * 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))
	t_1 = 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))))
	t_2 = Float64(Float64(d_m * d_m) * l)
	tmp = 0.0
	if (t_1 <= -2e-180)
		tmp = Float64(Float64(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D_m * M_m) * M_m) * D_m) * Float64(h / t_2)) * 0.125)) * abs(d_m)) / t_0);
	elseif (t_1 <= 4e+238)
		tmp = Float64(Float64(sqrt(Float64(1.0 / h)) / sqrt(l)) * d_m);
	else
		tmp = Float64(Float64(abs(d_m) / t_0) * Float64(1.0 - Float64(Float64(Float64(D_m * M_m) * Float64(M_m * Float64(Float64(D_m * h) / t_2))) * 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));
	t_1 = (((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)));
	t_2 = (d_m * d_m) * l;
	tmp = 0.0;
	if (t_1 <= -2e-180)
		tmp = ((1.0 - (((((D_m * M_m) * M_m) * D_m) * (h / t_2)) * 0.125)) * abs(d_m)) / t_0;
	elseif (t_1 <= 4e+238)
		tmp = (sqrt((1.0 / h)) / sqrt(l)) * d_m;
	else
		tmp = (abs(d_m) / t_0) * (1.0 - (((D_m * M_m) * (M_m * ((D_m * h) / t_2))) * 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]}, Block[{t$95$1 = 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]}, Block[{t$95$2 = N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-180], N[(N[(N[(1.0 - N[(N[(N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(h / t$95$2), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision] * N[Abs[d$95$m], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[t$95$1, 4e+238], N[(N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], N[(N[(N[Abs[d$95$m], $MachinePrecision] / t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(M$95$m * N[(N[(D$95$m * h), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $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 := \sqrt{\ell \cdot h}\\
t_1 := \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)\\
t_2 := \left(d\_m \cdot d\_m\right) \cdot \ell\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-180}:\\
\;\;\;\;\frac{\left(1 - \left(\left(\left(\left(D\_m \cdot M\_m\right) \cdot M\_m\right) \cdot D\_m\right) \cdot \frac{h}{t\_2}\right) \cdot 0.125\right) \cdot \left|d\_m\right|}{t\_0}\\

\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+238}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d\_m\\

\mathbf{else}:\\
\;\;\;\;\frac{\left|d\_m\right|}{t\_0} \cdot \left(1 - \left(\left(D\_m \cdot M\_m\right) \cdot \left(M\_m \cdot \frac{D\_m \cdot h}{t\_2}\right)\right) \cdot 0.125\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-180

    1. Initial program 86.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around 0

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\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(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot \color{blue}{\frac{1}{8}}\right) \]
      2. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot \color{blue}{\frac{1}{8}}\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(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{{d}^{2} \cdot \ell} \cdot \frac{1}{8}\right) \]
      4. associate-/l*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      6. *-commutativeN/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({M}^{2} \cdot {D}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      7. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({M}^{2} \cdot \left(D \cdot D\right)\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      8. associate-*r*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      10. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      11. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      12. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      15. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      16. lower-*.f6455.4

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right) \]
    4. Applied rewrites55.4%

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125}\right) \]
    5. Applied rewrites59.7%

      \[\leadsto \color{blue}{\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right)} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      5. associate-*l*N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(D \cdot M\right) \cdot \left(M \cdot D\right)\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      6. *-commutativeN/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(D \cdot M\right) \cdot \left(D \cdot M\right)\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      7. pow2N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left({\left(D \cdot M\right)}^{2} \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      8. pow-prod-downN/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      9. *-commutativeN/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot \left({D}^{2} \cdot {M}^{2}\right)\right) \cdot \frac{1}{8}\right) \]
      10. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot \left({D}^{2} \cdot {M}^{2}\right)\right) \cdot \frac{1}{8}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot \left({D}^{2} \cdot {M}^{2}\right)\right) \cdot \frac{1}{8}\right) \]
      12. pow2N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{h}{{d}^{2} \cdot \ell} \cdot \left({D}^{2} \cdot {M}^{2}\right)\right) \cdot \frac{1}{8}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{h}{{d}^{2} \cdot \ell} \cdot \left({D}^{2} \cdot {M}^{2}\right)\right) \cdot \frac{1}{8}\right) \]
      14. associate-/r*N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{\frac{h}{{d}^{2}}}{\ell} \cdot \left({D}^{2} \cdot {M}^{2}\right)\right) \cdot \frac{1}{8}\right) \]
      15. associate-*l/N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\frac{h}{{d}^{2}} \cdot \left({D}^{2} \cdot {M}^{2}\right)}{\ell} \cdot \frac{1}{8}\right) \]
      16. lower-/.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\frac{h}{{d}^{2}} \cdot \left({D}^{2} \cdot {M}^{2}\right)}{\ell} \cdot \frac{1}{8}\right) \]
    7. Applied rewrites56.5%

      \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\frac{h}{d \cdot d} \cdot \left(\left(\left(D \cdot D\right) \cdot M\right) \cdot M\right)}{\ell} \cdot 0.125\right) \]
    8. Applied rewrites59.5%

      \[\leadsto \color{blue}{\frac{\left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right) \cdot \left|d\right|}{\sqrt{\ell \cdot h}}} \]

    if -2e-180 < (*.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)))) < 4.0000000000000002e238

    1. Initial program 88.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 \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites75.5%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      3. lift-/.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
      5. associate-/r*N/A

        \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d \]
      6. sqrt-divN/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      7. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      8. lower-sqrt.f64N/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      9. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      10. lower-sqrt.f6491.9

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
    6. Applied rewrites91.9%

      \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]

    if 4.0000000000000002e238 < (*.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 8.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around 0

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\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(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot \color{blue}{\frac{1}{8}}\right) \]
      2. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot \color{blue}{\frac{1}{8}}\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(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{{d}^{2} \cdot \ell} \cdot \frac{1}{8}\right) \]
      4. associate-/l*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      6. *-commutativeN/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({M}^{2} \cdot {D}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      7. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({M}^{2} \cdot \left(D \cdot D\right)\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      8. associate-*r*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      10. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      11. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      12. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      15. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      16. lower-*.f648.2

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right) \]
    4. Applied rewrites8.2%

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125}\right) \]
    5. Applied rewrites59.2%

      \[\leadsto \color{blue}{\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right)} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      5. associate-*l*N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(D \cdot M\right) \cdot M\right) \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      6. associate-*l*N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      7. lower-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      8. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      10. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \left(D \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      12. pow2N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \left(D \cdot \frac{h}{{d}^{2} \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \left(D \cdot \frac{h}{{d}^{2} \cdot \ell}\right)\right)\right) \cdot \frac{1}{8}\right) \]
      14. associate-*r/N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \frac{D \cdot h}{{d}^{2} \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      15. lower-/.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \frac{D \cdot h}{{d}^{2} \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      16. lower-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \frac{D \cdot h}{{d}^{2} \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      17. pow2N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \frac{D \cdot h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      18. lift-*.f64N/A

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \frac{D \cdot h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot \frac{1}{8}\right) \]
      19. lift-*.f6462.4

        \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \frac{D \cdot h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot 0.125\right) \]
    7. Applied rewrites62.4%

      \[\leadsto \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(D \cdot M\right) \cdot \left(M \cdot \frac{D \cdot h}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot 0.125\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 14: 64.1% 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 := \frac{d\_m}{t\_0}\\ \mathbf{if}\;M\_m \cdot D\_m \leq 10^{-196}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;M\_m \cdot D\_m \leq 2 \cdot 10^{+25}:\\ \;\;\;\;t\_1 \cdot \left(1 - \left(\left(\left(\left(D\_m \cdot M\_m\right) \cdot D\_m\right) \cdot \frac{M\_m}{d\_m \cdot d\_m}\right) \cdot 0.125\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(1 - \frac{\left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot D\_m}{\left(d\_m \cdot d\_m\right) \cdot \ell} \cdot 0.125\right) \cdot \left|d\_m\right|}{t\_0}\\ \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) 1e-196)
     t_1
     (if (<= (* M_m D_m) 2e+25)
       (*
        t_1
        (-
         1.0
         (* (* (* (* (* D_m M_m) D_m) (/ M_m (* d_m d_m))) 0.125) (/ h l))))
       (/
        (*
         (-
          1.0
          (* (/ (* (* (* (* M_m M_m) h) D_m) D_m) (* (* d_m d_m) l)) 0.125))
         (fabs d_m))
        t_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 = d_m / t_0;
	double tmp;
	if ((M_m * D_m) <= 1e-196) {
		tmp = t_1;
	} else if ((M_m * D_m) <= 2e+25) {
		tmp = t_1 * (1.0 - (((((D_m * M_m) * D_m) * (M_m / (d_m * d_m))) * 0.125) * (h / l)));
	} else {
		tmp = ((1.0 - ((((((M_m * M_m) * h) * D_m) * D_m) / ((d_m * d_m) * l)) * 0.125)) * fabs(d_m)) / t_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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = sqrt((l * h))
    t_1 = d_m / t_0
    if ((m_m * d_m_1) <= 1d-196) then
        tmp = t_1
    else if ((m_m * d_m_1) <= 2d+25) then
        tmp = t_1 * (1.0d0 - (((((d_m_1 * m_m) * d_m_1) * (m_m / (d_m * d_m))) * 0.125d0) * (h / l)))
    else
        tmp = ((1.0d0 - ((((((m_m * m_m) * h) * d_m_1) * d_m_1) / ((d_m * d_m) * l)) * 0.125d0)) * abs(d_m)) / t_0
    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 t_1 = d_m / t_0;
	double tmp;
	if ((M_m * D_m) <= 1e-196) {
		tmp = t_1;
	} else if ((M_m * D_m) <= 2e+25) {
		tmp = t_1 * (1.0 - (((((D_m * M_m) * D_m) * (M_m / (d_m * d_m))) * 0.125) * (h / l)));
	} else {
		tmp = ((1.0 - ((((((M_m * M_m) * h) * D_m) * D_m) / ((d_m * d_m) * l)) * 0.125)) * Math.abs(d_m)) / t_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):
	t_0 = math.sqrt((l * h))
	t_1 = d_m / t_0
	tmp = 0
	if (M_m * D_m) <= 1e-196:
		tmp = t_1
	elif (M_m * D_m) <= 2e+25:
		tmp = t_1 * (1.0 - (((((D_m * M_m) * D_m) * (M_m / (d_m * d_m))) * 0.125) * (h / l)))
	else:
		tmp = ((1.0 - ((((((M_m * M_m) * h) * D_m) * D_m) / ((d_m * d_m) * l)) * 0.125)) * math.fabs(d_m)) / t_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(d_m / t_0)
	tmp = 0.0
	if (Float64(M_m * D_m) <= 1e-196)
		tmp = t_1;
	elseif (Float64(M_m * D_m) <= 2e+25)
		tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D_m * M_m) * D_m) * Float64(M_m / Float64(d_m * d_m))) * 0.125) * Float64(h / l))));
	else
		tmp = Float64(Float64(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) * D_m) / Float64(Float64(d_m * d_m) * l)) * 0.125)) * abs(d_m)) / t_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)
	t_0 = sqrt((l * h));
	t_1 = d_m / t_0;
	tmp = 0.0;
	if ((M_m * D_m) <= 1e-196)
		tmp = t_1;
	elseif ((M_m * D_m) <= 2e+25)
		tmp = t_1 * (1.0 - (((((D_m * M_m) * D_m) * (M_m / (d_m * d_m))) * 0.125) * (h / l)));
	else
		tmp = ((1.0 - ((((((M_m * M_m) * h) * D_m) * D_m) / ((d_m * d_m) * l)) * 0.125)) * abs(d_m)) / t_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_] := 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], 1e-196], t$95$1, If[LessEqual[N[(M$95$m * D$95$m), $MachinePrecision], 2e+25], N[(t$95$1 * N[(1.0 - N[(N[(N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(M$95$m / N[(d$95$m * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.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[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision] * N[Abs[d$95$m], $MachinePrecision]), $MachinePrecision] / t$95$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}
t_0 := \sqrt{\ell \cdot h}\\
t_1 := \frac{d\_m}{t\_0}\\
\mathbf{if}\;M\_m \cdot D\_m \leq 10^{-196}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;M\_m \cdot D\_m \leq 2 \cdot 10^{+25}:\\
\;\;\;\;t\_1 \cdot \left(1 - \left(\left(\left(\left(D\_m \cdot M\_m\right) \cdot D\_m\right) \cdot \frac{M\_m}{d\_m \cdot d\_m}\right) \cdot 0.125\right) \cdot \frac{h}{\ell}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{\left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot D\_m}{\left(d\_m \cdot d\_m\right) \cdot \ell} \cdot 0.125\right) \cdot \left|d\_m\right|}{t\_0}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 M D) < 1e-196

    1. Initial program 37.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites77.6%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      3. lift-/.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      4. sqrt-divN/A

        \[\leadsto \frac{\sqrt{1}}{\sqrt{\ell \cdot h}} \cdot d \]
      5. metadata-evalN/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
      7. lower-/.f64N/A

        \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
      8. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      9. lower-sqrt.f64N/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      10. lift-*.f6477.8

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    6. Applied rewrites77.8%

      \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    7. Applied rewrites77.9%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]

    if 1e-196 < (*.f64 M D) < 2.00000000000000018e25

    1. Initial program 34.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around 0

      \[\leadsto \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d}\right) \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. lower-*.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d}\right) \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 rewrites66.6%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right)} \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. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. metadata-eval66.6

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    6. Applied rewrites66.6%

      \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot \color{blue}{d}\right) \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-sqrt.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \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-*.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \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(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \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. sqrt-divN/A

        \[\leadsto \left(\frac{\sqrt{1}}{\sqrt{\ell \cdot h}} \cdot d\right) \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. metadata-evalN/A

        \[\leadsto \left(\frac{1}{\sqrt{\ell \cdot h}} \cdot d\right) \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-sqrt.f64N/A

        \[\leadsto \left(\frac{1}{\sqrt{\ell \cdot h}} \cdot d\right) \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. lift-*.f64N/A

        \[\leadsto \left(\frac{1}{\sqrt{\ell \cdot h}} \cdot d\right) \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. associate-*l/N/A

        \[\leadsto \frac{1 \cdot d}{\color{blue}{\sqrt{\ell \cdot 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) \]
      10. *-lft-identityN/A

        \[\leadsto \frac{d}{\sqrt{\color{blue}{\ell \cdot 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) \]
      11. lower-/.f6467.0

        \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell \cdot h}}} \cdot \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    8. Applied rewrites67.0%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \cdot \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    9. Taylor expanded in d around 0

      \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \color{blue}{\left(\frac{1}{8} \cdot \frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right) \]
    10. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}} \cdot \color{blue}{\frac{1}{8}}\right) \cdot \frac{h}{\ell}\right) \]
      2. lower-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}} \cdot \color{blue}{\frac{1}{8}}\right) \cdot \frac{h}{\ell}\right) \]
      3. unpow2N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{{D}^{2} \cdot \left(M \cdot M\right)}{{d}^{2}} \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      4. associate-*l*N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{\left({D}^{2} \cdot M\right) \cdot M}{{d}^{2}} \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      5. pow2N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{\left(\left(D \cdot D\right) \cdot M\right) \cdot M}{{d}^{2}} \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      6. lift-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{\left(\left(D \cdot D\right) \cdot M\right) \cdot M}{{d}^{2}} \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      7. lift-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{\left(\left(D \cdot D\right) \cdot M\right) \cdot M}{{d}^{2}} \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      8. associate-/l*N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot D\right) \cdot M\right) \cdot \frac{M}{{d}^{2}}\right) \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot D\right) \cdot M\right) \cdot \frac{M}{{d}^{2}}\right) \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      10. lift-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot D\right) \cdot M\right) \cdot \frac{M}{{d}^{2}}\right) \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot D\right) \cdot M\right) \cdot \frac{M}{{d}^{2}}\right) \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      12. associate-*l*N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(D \cdot \left(D \cdot M\right)\right) \cdot \frac{M}{{d}^{2}}\right) \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      13. *-commutativeN/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot \frac{M}{{d}^{2}}\right) \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot \frac{M}{{d}^{2}}\right) \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      15. lift-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot \frac{M}{{d}^{2}}\right) \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      16. lower-/.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot \frac{M}{{d}^{2}}\right) \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      17. pow2N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot \frac{M}{d \cdot d}\right) \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      18. lift-*.f6460.7

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot \frac{M}{d \cdot d}\right) \cdot 0.125\right) \cdot \frac{h}{\ell}\right) \]
    11. Applied rewrites60.7%

      \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \color{blue}{\left(\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot \frac{M}{d \cdot d}\right) \cdot 0.125\right)} \cdot \frac{h}{\ell}\right) \]

    if 2.00000000000000018e25 < (*.f64 M D)

    1. Initial program 35.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around 0

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\frac{1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}}\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(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot \color{blue}{\frac{1}{8}}\right) \]
      2. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell} \cdot \color{blue}{\frac{1}{8}}\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(1 - \frac{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}{{d}^{2} \cdot \ell} \cdot \frac{1}{8}\right) \]
      4. associate-/l*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({D}^{2} \cdot {M}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      6. *-commutativeN/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({M}^{2} \cdot {D}^{2}\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      7. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left({M}^{2} \cdot \left(D \cdot D\right)\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      8. associate-*r*N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      10. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left({M}^{2} \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      11. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      12. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{{d}^{2} \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      15. unpow2N/A

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot \frac{1}{8}\right) \]
      16. lower-*.f6425.7

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right) \]
    4. Applied rewrites25.7%

      \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \color{blue}{\left(\left(\left(\left(M \cdot M\right) \cdot D\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125}\right) \]
    5. Applied rewrites58.9%

      \[\leadsto \color{blue}{\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot M\right) \cdot D\right) \cdot \frac{h}{\left(d \cdot d\right) \cdot \ell}\right) \cdot 0.125\right)} \]
    6. Applied rewrites59.6%

      \[\leadsto \color{blue}{\frac{\left(1 - \frac{\left(\left(\left(M \cdot M\right) \cdot h\right) \cdot D\right) \cdot D}{\left(d \cdot d\right) \cdot \ell} \cdot 0.125\right) \cdot \left|d\right|}{\sqrt{\ell \cdot h}}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 15: 61.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} \mathbf{if}\;d\_m \leq 1.55 \cdot 10^{-193}:\\ \;\;\;\;\left(\left(\left(\frac{M\_m \cdot M\_m}{d\_m} \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\right) \cdot -0.125\right) \cdot D\_m\right) \cdot D\_m\\ \mathbf{elif}\;d\_m \leq 1.65 \cdot 10^{+133}:\\ \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D\_m \cdot M\_m\right) \cdot D\_m\right) \cdot \frac{M\_m}{d\_m \cdot d\_m}\right) \cdot 0.125\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\\ \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 (<= d_m 1.55e-193)
   (*
    (* (* (* (/ (* M_m M_m) d_m) (sqrt (/ h (* (* l l) l)))) -0.125) D_m)
    D_m)
   (if (<= d_m 1.65e+133)
     (*
      (/ d_m (sqrt (* l h)))
      (-
       1.0
       (* (* (* (* (* D_m M_m) D_m) (/ M_m (* d_m d_m))) 0.125) (/ h l))))
     (* (sqrt (/ 1.0 (* l h))) d_m))))
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 (d_m <= 1.55e-193) {
		tmp = (((((M_m * M_m) / d_m) * sqrt((h / ((l * l) * l)))) * -0.125) * D_m) * D_m;
	} else if (d_m <= 1.65e+133) {
		tmp = (d_m / sqrt((l * h))) * (1.0 - (((((D_m * M_m) * D_m) * (M_m / (d_m * d_m))) * 0.125) * (h / l)));
	} else {
		tmp = sqrt((1.0 / (l * h))) * d_m;
	}
	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 <= 1.55d-193) then
        tmp = (((((m_m * m_m) / d_m) * sqrt((h / ((l * l) * l)))) * (-0.125d0)) * d_m_1) * d_m_1
    else if (d_m <= 1.65d+133) then
        tmp = (d_m / sqrt((l * h))) * (1.0d0 - (((((d_m_1 * m_m) * d_m_1) * (m_m / (d_m * d_m))) * 0.125d0) * (h / l)))
    else
        tmp = sqrt((1.0d0 / (l * h))) * d_m
    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 (d_m <= 1.55e-193) {
		tmp = (((((M_m * M_m) / d_m) * Math.sqrt((h / ((l * l) * l)))) * -0.125) * D_m) * D_m;
	} else if (d_m <= 1.65e+133) {
		tmp = (d_m / Math.sqrt((l * h))) * (1.0 - (((((D_m * M_m) * D_m) * (M_m / (d_m * d_m))) * 0.125) * (h / l)));
	} else {
		tmp = Math.sqrt((1.0 / (l * h))) * d_m;
	}
	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 d_m <= 1.55e-193:
		tmp = (((((M_m * M_m) / d_m) * math.sqrt((h / ((l * l) * l)))) * -0.125) * D_m) * D_m
	elif d_m <= 1.65e+133:
		tmp = (d_m / math.sqrt((l * h))) * (1.0 - (((((D_m * M_m) * D_m) * (M_m / (d_m * d_m))) * 0.125) * (h / l)))
	else:
		tmp = math.sqrt((1.0 / (l * h))) * d_m
	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 (d_m <= 1.55e-193)
		tmp = Float64(Float64(Float64(Float64(Float64(Float64(M_m * M_m) / d_m) * sqrt(Float64(h / Float64(Float64(l * l) * l)))) * -0.125) * D_m) * D_m);
	elseif (d_m <= 1.65e+133)
		tmp = Float64(Float64(d_m / sqrt(Float64(l * h))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D_m * M_m) * D_m) * Float64(M_m / Float64(d_m * d_m))) * 0.125) * Float64(h / l))));
	else
		tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m);
	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 <= 1.55e-193)
		tmp = (((((M_m * M_m) / d_m) * sqrt((h / ((l * l) * l)))) * -0.125) * D_m) * D_m;
	elseif (d_m <= 1.65e+133)
		tmp = (d_m / sqrt((l * h))) * (1.0 - (((((D_m * M_m) * D_m) * (M_m / (d_m * d_m))) * 0.125) * (h / l)));
	else
		tmp = sqrt((1.0 / (l * h))) * d_m;
	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[d$95$m, 1.55e-193], N[(N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] / d$95$m), $MachinePrecision] * N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * D$95$m), $MachinePrecision] * D$95$m), $MachinePrecision], If[LessEqual[d$95$m, 1.65e+133], N[(N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(M$95$m / N[(d$95$m * d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $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}\;d\_m \leq 1.55 \cdot 10^{-193}:\\
\;\;\;\;\left(\left(\left(\frac{M\_m \cdot M\_m}{d\_m} \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\right) \cdot -0.125\right) \cdot D\_m\right) \cdot D\_m\\

\mathbf{elif}\;d\_m \leq 1.65 \cdot 10^{+133}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D\_m \cdot M\_m\right) \cdot D\_m\right) \cdot \frac{M\_m}{d\_m \cdot d\_m}\right) \cdot 0.125\right) \cdot \frac{h}{\ell}\right)\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < 1.5500000000000001e-193

    1. Initial program 23.3%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around 0

      \[\leadsto \color{blue}{\frac{-1}{8} \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \cdot \color{blue}{\frac{-1}{8}} \]
      2. associate-/l*N/A

        \[\leadsto \left(\left({D}^{2} \cdot \frac{{M}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \cdot \frac{-1}{8} \]
      3. associate-*l*N/A

        \[\leadsto \left({D}^{2} \cdot \left(\frac{{M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\right) \cdot \frac{-1}{8} \]
      4. associate-*r*N/A

        \[\leadsto {D}^{2} \cdot \color{blue}{\left(\left(\frac{{M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \cdot \frac{-1}{8}\right)} \]
      5. *-commutativeN/A

        \[\leadsto {D}^{2} \cdot \left(\frac{-1}{8} \cdot \color{blue}{\left(\frac{{M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)}\right) \]
      6. *-commutativeN/A

        \[\leadsto \left(\frac{-1}{8} \cdot \left(\frac{{M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\right) \cdot \color{blue}{{D}^{2}} \]
      7. unpow2N/A

        \[\leadsto \left(\frac{-1}{8} \cdot \left(\frac{{M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\right) \cdot \left(D \cdot \color{blue}{D}\right) \]
      8. associate-*r*N/A

        \[\leadsto \left(\left(\frac{-1}{8} \cdot \left(\frac{{M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\right) \cdot D\right) \cdot \color{blue}{D} \]
      9. lower-*.f64N/A

        \[\leadsto \left(\left(\frac{-1}{8} \cdot \left(\frac{{M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\right) \cdot D\right) \cdot \color{blue}{D} \]
    4. Applied rewrites43.1%

      \[\leadsto \color{blue}{\left(\left(\left(\frac{M \cdot M}{d} \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\right) \cdot -0.125\right) \cdot D\right) \cdot D} \]

    if 1.5500000000000001e-193 < d < 1.65e133

    1. Initial program 36.3%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around 0

      \[\leadsto \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d}\right) \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. lower-*.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d}\right) \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 rewrites70.5%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right)} \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. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. metadata-eval70.5

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    6. Applied rewrites70.5%

      \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot \color{blue}{d}\right) \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-sqrt.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \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-*.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \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(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \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. sqrt-divN/A

        \[\leadsto \left(\frac{\sqrt{1}}{\sqrt{\ell \cdot h}} \cdot d\right) \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. metadata-evalN/A

        \[\leadsto \left(\frac{1}{\sqrt{\ell \cdot h}} \cdot d\right) \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-sqrt.f64N/A

        \[\leadsto \left(\frac{1}{\sqrt{\ell \cdot h}} \cdot d\right) \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. lift-*.f64N/A

        \[\leadsto \left(\frac{1}{\sqrt{\ell \cdot h}} \cdot d\right) \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. associate-*l/N/A

        \[\leadsto \frac{1 \cdot d}{\color{blue}{\sqrt{\ell \cdot 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) \]
      10. *-lft-identityN/A

        \[\leadsto \frac{d}{\sqrt{\color{blue}{\ell \cdot 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) \]
      11. lower-/.f6470.9

        \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell \cdot h}}} \cdot \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    8. Applied rewrites70.9%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \cdot \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    9. Taylor expanded in d around 0

      \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \color{blue}{\left(\frac{1}{8} \cdot \frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}}\right)} \cdot \frac{h}{\ell}\right) \]
    10. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}} \cdot \color{blue}{\frac{1}{8}}\right) \cdot \frac{h}{\ell}\right) \]
      2. lower-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{{D}^{2} \cdot {M}^{2}}{{d}^{2}} \cdot \color{blue}{\frac{1}{8}}\right) \cdot \frac{h}{\ell}\right) \]
      3. unpow2N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{{D}^{2} \cdot \left(M \cdot M\right)}{{d}^{2}} \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      4. associate-*l*N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{\left({D}^{2} \cdot M\right) \cdot M}{{d}^{2}} \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      5. pow2N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{\left(\left(D \cdot D\right) \cdot M\right) \cdot M}{{d}^{2}} \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      6. lift-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{\left(\left(D \cdot D\right) \cdot M\right) \cdot M}{{d}^{2}} \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      7. lift-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\frac{\left(\left(D \cdot D\right) \cdot M\right) \cdot M}{{d}^{2}} \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      8. associate-/l*N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot D\right) \cdot M\right) \cdot \frac{M}{{d}^{2}}\right) \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      9. lower-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot D\right) \cdot M\right) \cdot \frac{M}{{d}^{2}}\right) \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      10. lift-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot D\right) \cdot M\right) \cdot \frac{M}{{d}^{2}}\right) \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot D\right) \cdot M\right) \cdot \frac{M}{{d}^{2}}\right) \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      12. associate-*l*N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(D \cdot \left(D \cdot M\right)\right) \cdot \frac{M}{{d}^{2}}\right) \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      13. *-commutativeN/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot \frac{M}{{d}^{2}}\right) \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot \frac{M}{{d}^{2}}\right) \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      15. lift-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot \frac{M}{{d}^{2}}\right) \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      16. lower-/.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot \frac{M}{{d}^{2}}\right) \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      17. pow2N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot \frac{M}{d \cdot d}\right) \cdot \frac{1}{8}\right) \cdot \frac{h}{\ell}\right) \]
      18. lift-*.f6465.4

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \left(\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot \frac{M}{d \cdot d}\right) \cdot 0.125\right) \cdot \frac{h}{\ell}\right) \]
    11. Applied rewrites65.4%

      \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(1 - \color{blue}{\left(\left(\left(\left(D \cdot M\right) \cdot D\right) \cdot \frac{M}{d \cdot d}\right) \cdot 0.125\right)} \cdot \frac{h}{\ell}\right) \]

    if 1.65e133 < d

    1. Initial program 42.5%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites66.9%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 16: 56.6% accurate, 1.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 := \left(d\_m \cdot d\_m\right) \cdot \ell\\ t_1 := \frac{d\_m}{\sqrt{\ell \cdot h}}\\ \mathbf{if}\;M\_m \cdot D\_m \leq 10^{+45}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;M\_m \cdot D\_m \leq 10^{+161}:\\ \;\;\;\;t\_1 \cdot \left(\left(\left(\left(\frac{h}{t\_0} \cdot \left(M\_m \cdot M\_m\right)\right) \cdot -0.125\right) \cdot D\_m\right) \cdot D\_m\right)\\ \mathbf{elif}\;M\_m \cdot D\_m \leq 5 \cdot 10^{+220}:\\ \;\;\;\;\sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d\_m\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right) \cdot \left(\left(\left(-0.125 \cdot \left(D\_m \cdot D\_m\right)\right) \cdot \left(M\_m \cdot \frac{M\_m}{t\_0}\right)\right) \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 d_m) l)) (t_1 (/ d_m (sqrt (* l h)))))
   (if (<= (* M_m D_m) 1e+45)
     t_1
     (if (<= (* M_m D_m) 1e+161)
       (* t_1 (* (* (* (* (/ h t_0) (* M_m M_m)) -0.125) D_m) D_m))
       (if (<= (* M_m D_m) 5e+220)
         (* (sqrt (/ (/ 1.0 h) l)) d_m)
         (*
          (* (sqrt (/ 1.0 (* l h))) d_m)
          (* (* (* -0.125 (* D_m D_m)) (* M_m (/ M_m t_0))) 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 * d_m) * l;
	double t_1 = d_m / sqrt((l * h));
	double tmp;
	if ((M_m * D_m) <= 1e+45) {
		tmp = t_1;
	} else if ((M_m * D_m) <= 1e+161) {
		tmp = t_1 * (((((h / t_0) * (M_m * M_m)) * -0.125) * D_m) * D_m);
	} else if ((M_m * D_m) <= 5e+220) {
		tmp = sqrt(((1.0 / h) / l)) * d_m;
	} else {
		tmp = (sqrt((1.0 / (l * h))) * d_m) * (((-0.125 * (D_m * D_m)) * (M_m * (M_m / t_0))) * 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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (d_m * d_m) * l
    t_1 = d_m / sqrt((l * h))
    if ((m_m * d_m_1) <= 1d+45) then
        tmp = t_1
    else if ((m_m * d_m_1) <= 1d+161) then
        tmp = t_1 * (((((h / t_0) * (m_m * m_m)) * (-0.125d0)) * d_m_1) * d_m_1)
    else if ((m_m * d_m_1) <= 5d+220) then
        tmp = sqrt(((1.0d0 / h) / l)) * d_m
    else
        tmp = (sqrt((1.0d0 / (l * h))) * d_m) * ((((-0.125d0) * (d_m_1 * d_m_1)) * (m_m * (m_m / t_0))) * 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 t_0 = (d_m * d_m) * l;
	double t_1 = d_m / Math.sqrt((l * h));
	double tmp;
	if ((M_m * D_m) <= 1e+45) {
		tmp = t_1;
	} else if ((M_m * D_m) <= 1e+161) {
		tmp = t_1 * (((((h / t_0) * (M_m * M_m)) * -0.125) * D_m) * D_m);
	} else if ((M_m * D_m) <= 5e+220) {
		tmp = Math.sqrt(((1.0 / h) / l)) * d_m;
	} else {
		tmp = (Math.sqrt((1.0 / (l * h))) * d_m) * (((-0.125 * (D_m * D_m)) * (M_m * (M_m / t_0))) * 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):
	t_0 = (d_m * d_m) * l
	t_1 = d_m / math.sqrt((l * h))
	tmp = 0
	if (M_m * D_m) <= 1e+45:
		tmp = t_1
	elif (M_m * D_m) <= 1e+161:
		tmp = t_1 * (((((h / t_0) * (M_m * M_m)) * -0.125) * D_m) * D_m)
	elif (M_m * D_m) <= 5e+220:
		tmp = math.sqrt(((1.0 / h) / l)) * d_m
	else:
		tmp = (math.sqrt((1.0 / (l * h))) * d_m) * (((-0.125 * (D_m * D_m)) * (M_m * (M_m / t_0))) * 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 * d_m) * l)
	t_1 = Float64(d_m / sqrt(Float64(l * h)))
	tmp = 0.0
	if (Float64(M_m * D_m) <= 1e+45)
		tmp = t_1;
	elseif (Float64(M_m * D_m) <= 1e+161)
		tmp = Float64(t_1 * Float64(Float64(Float64(Float64(Float64(h / t_0) * Float64(M_m * M_m)) * -0.125) * D_m) * D_m));
	elseif (Float64(M_m * D_m) <= 5e+220)
		tmp = Float64(sqrt(Float64(Float64(1.0 / h) / l)) * d_m);
	else
		tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m) * Float64(Float64(Float64(-0.125 * Float64(D_m * D_m)) * Float64(M_m * Float64(M_m / t_0))) * 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)
	t_0 = (d_m * d_m) * l;
	t_1 = d_m / sqrt((l * h));
	tmp = 0.0;
	if ((M_m * D_m) <= 1e+45)
		tmp = t_1;
	elseif ((M_m * D_m) <= 1e+161)
		tmp = t_1 * (((((h / t_0) * (M_m * M_m)) * -0.125) * D_m) * D_m);
	elseif ((M_m * D_m) <= 5e+220)
		tmp = sqrt(((1.0 / h) / l)) * d_m;
	else
		tmp = (sqrt((1.0 / (l * h))) * d_m) * (((-0.125 * (D_m * D_m)) * (M_m * (M_m / t_0))) * 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_] := Block[{t$95$0 = N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]}, Block[{t$95$1 = N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(M$95$m * D$95$m), $MachinePrecision], 1e+45], t$95$1, If[LessEqual[N[(M$95$m * D$95$m), $MachinePrecision], 1e+161], N[(t$95$1 * N[(N[(N[(N[(N[(h / t$95$0), $MachinePrecision] * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * D$95$m), $MachinePrecision] * D$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(M$95$m * D$95$m), $MachinePrecision], 5e+220], N[(N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision] * N[(N[(N[(-0.125 * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(M$95$m * N[(M$95$m / t$95$0), $MachinePrecision]), $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}
t_0 := \left(d\_m \cdot d\_m\right) \cdot \ell\\
t_1 := \frac{d\_m}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;M\_m \cdot D\_m \leq 10^{+45}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;M\_m \cdot D\_m \leq 10^{+161}:\\
\;\;\;\;t\_1 \cdot \left(\left(\left(\left(\frac{h}{t\_0} \cdot \left(M\_m \cdot M\_m\right)\right) \cdot -0.125\right) \cdot D\_m\right) \cdot D\_m\right)\\

\mathbf{elif}\;M\_m \cdot D\_m \leq 5 \cdot 10^{+220}:\\
\;\;\;\;\sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d\_m\\

\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right) \cdot \left(\left(\left(-0.125 \cdot \left(D\_m \cdot D\_m\right)\right) \cdot \left(M\_m \cdot \frac{M\_m}{t\_0}\right)\right) \cdot h\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 M D) < 9.9999999999999993e44

    1. Initial program 35.9%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites62.2%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      3. lift-/.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      4. sqrt-divN/A

        \[\leadsto \frac{\sqrt{1}}{\sqrt{\ell \cdot h}} \cdot d \]
      5. metadata-evalN/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
      7. lower-/.f64N/A

        \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
      8. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      9. lower-sqrt.f64N/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      10. lift-*.f6462.4

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    6. Applied rewrites62.4%

      \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    7. Applied rewrites62.5%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]

    if 9.9999999999999993e44 < (*.f64 M D) < 1e161

    1. Initial program 34.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around 0

      \[\leadsto \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d}\right) \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. lower-*.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d}\right) \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 rewrites70.5%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right)} \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. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. metadata-eval70.5

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    6. Applied rewrites70.5%

      \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot \color{blue}{d}\right) \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-sqrt.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \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-*.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \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(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \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. sqrt-divN/A

        \[\leadsto \left(\frac{\sqrt{1}}{\sqrt{\ell \cdot h}} \cdot d\right) \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. metadata-evalN/A

        \[\leadsto \left(\frac{1}{\sqrt{\ell \cdot h}} \cdot d\right) \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-sqrt.f64N/A

        \[\leadsto \left(\frac{1}{\sqrt{\ell \cdot h}} \cdot d\right) \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. lift-*.f64N/A

        \[\leadsto \left(\frac{1}{\sqrt{\ell \cdot h}} \cdot d\right) \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. associate-*l/N/A

        \[\leadsto \frac{1 \cdot d}{\color{blue}{\sqrt{\ell \cdot 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) \]
      10. *-lft-identityN/A

        \[\leadsto \frac{d}{\sqrt{\color{blue}{\ell \cdot 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) \]
      11. lower-/.f6470.7

        \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell \cdot h}}} \cdot \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    8. Applied rewrites70.7%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \cdot \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    9. Taylor expanded in d around 0

      \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \color{blue}{\left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)} \]
    10. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(\frac{-1}{8} \cdot \left({D}^{2} \cdot \color{blue}{\frac{{M}^{2} \cdot h}{{d}^{2} \cdot \ell}}\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(\frac{-1}{8} \cdot \left(\frac{{M}^{2} \cdot h}{{d}^{2} \cdot \ell} \cdot \color{blue}{{D}^{2}}\right)\right) \]
      3. associate-*l*N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(\left(\frac{-1}{8} \cdot \frac{{M}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot \color{blue}{{D}^{2}}\right) \]
      4. pow2N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(\left(\frac{-1}{8} \cdot \frac{{M}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot \left(D \cdot \color{blue}{D}\right)\right) \]
      5. associate-*r*N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(\left(\left(\frac{-1}{8} \cdot \frac{{M}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot D\right) \cdot \color{blue}{D}\right) \]
      6. lower-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(\left(\left(\frac{-1}{8} \cdot \frac{{M}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot D\right) \cdot \color{blue}{D}\right) \]
    11. Applied rewrites34.7%

      \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \color{blue}{\left(\left(\left(\left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot \left(M \cdot M\right)\right) \cdot -0.125\right) \cdot D\right) \cdot D\right)} \]

    if 1e161 < (*.f64 M D) < 5.0000000000000002e220

    1. Initial program 35.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 \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites19.9%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      2. lift-/.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      3. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
      4. associate-/r*N/A

        \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d \]
      5. lower-/.f64N/A

        \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d \]
      6. lower-/.f6420.2

        \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d \]
    6. Applied rewrites20.2%

      \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d \]

    if 5.0000000000000002e220 < (*.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 d around 0

      \[\leadsto \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d}\right) \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. lower-*.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d}\right) \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 rewrites71.7%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right)} \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. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. metadata-eval71.7

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    6. Applied rewrites71.7%

      \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    7. Taylor expanded in d around 0

      \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \color{blue}{\left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)} \]
    8. Applied rewrites56.0%

      \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \color{blue}{\left(\left(\left(-0.125 \cdot \left(D \cdot D\right)\right) \cdot \left(M \cdot \frac{M}{\left(d \cdot d\right) \cdot \ell}\right)\right) \cdot h\right)} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 17: 55.6% accurate, 0.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 := \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)\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-180}:\\ \;\;\;\;\left(\left(\left(\frac{M\_m \cdot M\_m}{d\_m} \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\right) \cdot -0.125\right) \cdot D\_m\right) \cdot D\_m\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+238}:\\ \;\;\;\;\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d\_m\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\ell \cdot h}} \cdot d\_m\\ \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
         (*
          (* (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))))))
   (if (<= t_0 -2e-180)
     (*
      (* (* (* (/ (* M_m M_m) d_m) (sqrt (/ h (* (* l l) l)))) -0.125) D_m)
      D_m)
     (if (<= t_0 4e+238)
       (* (/ (sqrt (/ 1.0 h)) (sqrt l)) d_m)
       (* (/ 1.0 (sqrt (* l h))) d_m)))))
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 = (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)));
	double tmp;
	if (t_0 <= -2e-180) {
		tmp = (((((M_m * M_m) / d_m) * sqrt((h / ((l * l) * l)))) * -0.125) * D_m) * D_m;
	} else if (t_0 <= 4e+238) {
		tmp = (sqrt((1.0 / h)) / sqrt(l)) * d_m;
	} else {
		tmp = (1.0 / sqrt((l * h))) * d_m;
	}
	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 = (((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)))
    if (t_0 <= (-2d-180)) then
        tmp = (((((m_m * m_m) / d_m) * sqrt((h / ((l * l) * l)))) * (-0.125d0)) * d_m_1) * d_m_1
    else if (t_0 <= 4d+238) then
        tmp = (sqrt((1.0d0 / h)) / sqrt(l)) * d_m
    else
        tmp = (1.0d0 / sqrt((l * h))) * d_m
    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.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)));
	double tmp;
	if (t_0 <= -2e-180) {
		tmp = (((((M_m * M_m) / d_m) * Math.sqrt((h / ((l * l) * l)))) * -0.125) * D_m) * D_m;
	} else if (t_0 <= 4e+238) {
		tmp = (Math.sqrt((1.0 / h)) / Math.sqrt(l)) * d_m;
	} else {
		tmp = (1.0 / Math.sqrt((l * h))) * d_m;
	}
	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.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)))
	tmp = 0
	if t_0 <= -2e-180:
		tmp = (((((M_m * M_m) / d_m) * math.sqrt((h / ((l * l) * l)))) * -0.125) * D_m) * D_m
	elif t_0 <= 4e+238:
		tmp = (math.sqrt((1.0 / h)) / math.sqrt(l)) * d_m
	else:
		tmp = (1.0 / math.sqrt((l * h))) * d_m
	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((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))))
	tmp = 0.0
	if (t_0 <= -2e-180)
		tmp = Float64(Float64(Float64(Float64(Float64(Float64(M_m * M_m) / d_m) * sqrt(Float64(h / Float64(Float64(l * l) * l)))) * -0.125) * D_m) * D_m);
	elseif (t_0 <= 4e+238)
		tmp = Float64(Float64(sqrt(Float64(1.0 / h)) / sqrt(l)) * d_m);
	else
		tmp = Float64(Float64(1.0 / sqrt(Float64(l * h))) * d_m);
	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 = (((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)));
	tmp = 0.0;
	if (t_0 <= -2e-180)
		tmp = (((((M_m * M_m) / d_m) * sqrt((h / ((l * l) * l)))) * -0.125) * D_m) * D_m;
	elseif (t_0 <= 4e+238)
		tmp = (sqrt((1.0 / h)) / sqrt(l)) * d_m;
	else
		tmp = (1.0 / sqrt((l * h))) * d_m;
	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[(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]}, If[LessEqual[t$95$0, -2e-180], N[(N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] / d$95$m), $MachinePrecision] * N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision] * D$95$m), $MachinePrecision] * D$95$m), $MachinePrecision], If[LessEqual[t$95$0, 4e+238], N[(N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], N[(N[(1.0 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * d$95$m), $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({\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)\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-180}:\\
\;\;\;\;\left(\left(\left(\frac{M\_m \cdot M\_m}{d\_m} \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\right) \cdot -0.125\right) \cdot D\_m\right) \cdot D\_m\\

\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+238}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d\_m\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\ell \cdot h}} \cdot d\_m\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-180

    1. Initial program 86.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around 0

      \[\leadsto \color{blue}{\frac{-1}{8} \cdot \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(\frac{{D}^{2} \cdot {M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \cdot \color{blue}{\frac{-1}{8}} \]
      2. associate-/l*N/A

        \[\leadsto \left(\left({D}^{2} \cdot \frac{{M}^{2}}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \cdot \frac{-1}{8} \]
      3. associate-*l*N/A

        \[\leadsto \left({D}^{2} \cdot \left(\frac{{M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\right) \cdot \frac{-1}{8} \]
      4. associate-*r*N/A

        \[\leadsto {D}^{2} \cdot \color{blue}{\left(\left(\frac{{M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right) \cdot \frac{-1}{8}\right)} \]
      5. *-commutativeN/A

        \[\leadsto {D}^{2} \cdot \left(\frac{-1}{8} \cdot \color{blue}{\left(\frac{{M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)}\right) \]
      6. *-commutativeN/A

        \[\leadsto \left(\frac{-1}{8} \cdot \left(\frac{{M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\right) \cdot \color{blue}{{D}^{2}} \]
      7. unpow2N/A

        \[\leadsto \left(\frac{-1}{8} \cdot \left(\frac{{M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\right) \cdot \left(D \cdot \color{blue}{D}\right) \]
      8. associate-*r*N/A

        \[\leadsto \left(\left(\frac{-1}{8} \cdot \left(\frac{{M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\right) \cdot D\right) \cdot \color{blue}{D} \]
      9. lower-*.f64N/A

        \[\leadsto \left(\left(\frac{-1}{8} \cdot \left(\frac{{M}^{2}}{d} \cdot \sqrt{\frac{h}{{\ell}^{3}}}\right)\right) \cdot D\right) \cdot \color{blue}{D} \]
    4. Applied rewrites63.6%

      \[\leadsto \color{blue}{\left(\left(\left(\frac{M \cdot M}{d} \cdot \sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\right) \cdot -0.125\right) \cdot D\right) \cdot D} \]

    if -2e-180 < (*.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)))) < 4.0000000000000002e238

    1. Initial program 88.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 \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites75.5%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      3. lift-/.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
      5. associate-/r*N/A

        \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d \]
      6. sqrt-divN/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      7. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      8. lower-sqrt.f64N/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      9. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      10. lower-sqrt.f6491.9

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
    6. Applied rewrites91.9%

      \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]

    if 4.0000000000000002e238 < (*.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 8.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites45.3%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      3. lift-/.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      4. sqrt-divN/A

        \[\leadsto \frac{\sqrt{1}}{\sqrt{\ell \cdot h}} \cdot d \]
      5. metadata-evalN/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
      7. lower-/.f64N/A

        \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
      8. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      9. lower-sqrt.f64N/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      10. lift-*.f6445.4

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    6. Applied rewrites45.4%

      \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 18: 54.1% accurate, 2.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} t_0 := \frac{d\_m}{\sqrt{\ell \cdot h}}\\ \mathbf{if}\;M\_m \cdot D\_m \leq 10^{+45}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \left(\left(\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\right) \cdot D\_m\right) \cdot D\_m\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 (sqrt (* l h)))))
   (if (<= (* M_m D_m) 1e+45)
     t_0
     (*
      t_0
      (* (* (* (* (/ h (* (* d_m d_m) l)) (* M_m M_m)) -0.125) D_m) D_m)))))
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 / sqrt((l * h));
	double tmp;
	if ((M_m * D_m) <= 1e+45) {
		tmp = t_0;
	} else {
		tmp = t_0 * (((((h / ((d_m * d_m) * l)) * (M_m * M_m)) * -0.125) * D_m) * D_m);
	}
	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 = d_m / sqrt((l * h))
    if ((m_m * d_m_1) <= 1d+45) then
        tmp = t_0
    else
        tmp = t_0 * (((((h / ((d_m * d_m) * l)) * (m_m * m_m)) * (-0.125d0)) * d_m_1) * d_m_1)
    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 = d_m / Math.sqrt((l * h));
	double tmp;
	if ((M_m * D_m) <= 1e+45) {
		tmp = t_0;
	} else {
		tmp = t_0 * (((((h / ((d_m * d_m) * l)) * (M_m * M_m)) * -0.125) * D_m) * D_m);
	}
	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 = d_m / math.sqrt((l * h))
	tmp = 0
	if (M_m * D_m) <= 1e+45:
		tmp = t_0
	else:
		tmp = t_0 * (((((h / ((d_m * d_m) * l)) * (M_m * M_m)) * -0.125) * D_m) * D_m)
	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(d_m / sqrt(Float64(l * h)))
	tmp = 0.0
	if (Float64(M_m * D_m) <= 1e+45)
		tmp = t_0;
	else
		tmp = Float64(t_0 * Float64(Float64(Float64(Float64(Float64(h / Float64(Float64(d_m * d_m) * l)) * Float64(M_m * M_m)) * -0.125) * D_m) * D_m));
	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 = d_m / sqrt((l * h));
	tmp = 0.0;
	if ((M_m * D_m) <= 1e+45)
		tmp = t_0;
	else
		tmp = t_0 * (((((h / ((d_m * d_m) * l)) * (M_m * M_m)) * -0.125) * D_m) * D_m);
	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[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(M$95$m * D$95$m), $MachinePrecision], 1e+45], t$95$0, N[(t$95$0 * N[(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] * D$95$m), $MachinePrecision] * D$95$m), $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 := \frac{d\_m}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;M\_m \cdot D\_m \leq 10^{+45}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(\left(\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\right) \cdot D\_m\right) \cdot D\_m\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 M D) < 9.9999999999999993e44

    1. Initial program 35.9%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites62.2%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      3. lift-/.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      4. sqrt-divN/A

        \[\leadsto \frac{\sqrt{1}}{\sqrt{\ell \cdot h}} \cdot d \]
      5. metadata-evalN/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
      7. lower-/.f64N/A

        \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
      8. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      9. lower-sqrt.f64N/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      10. lift-*.f6462.4

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    6. Applied rewrites62.4%

      \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    7. Applied rewrites62.5%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]

    if 9.9999999999999993e44 < (*.f64 M D)

    1. Initial program 35.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around 0

      \[\leadsto \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d}\right) \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. lower-*.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d}\right) \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 rewrites71.1%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right)} \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. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. metadata-eval71.1

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    6. Applied rewrites71.1%

      \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot \color{blue}{d}\right) \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-sqrt.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \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-*.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \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(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \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. sqrt-divN/A

        \[\leadsto \left(\frac{\sqrt{1}}{\sqrt{\ell \cdot h}} \cdot d\right) \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. metadata-evalN/A

        \[\leadsto \left(\frac{1}{\sqrt{\ell \cdot h}} \cdot d\right) \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-sqrt.f64N/A

        \[\leadsto \left(\frac{1}{\sqrt{\ell \cdot h}} \cdot d\right) \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. lift-*.f64N/A

        \[\leadsto \left(\frac{1}{\sqrt{\ell \cdot h}} \cdot d\right) \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. associate-*l/N/A

        \[\leadsto \frac{1 \cdot d}{\color{blue}{\sqrt{\ell \cdot 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) \]
      10. *-lft-identityN/A

        \[\leadsto \frac{d}{\sqrt{\color{blue}{\ell \cdot 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) \]
      11. lower-/.f6471.2

        \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell \cdot h}}} \cdot \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    8. Applied rewrites71.2%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \cdot \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    9. Taylor expanded in d around 0

      \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \color{blue}{\left(\frac{-1}{8} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2} \cdot \ell}\right)} \]
    10. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(\frac{-1}{8} \cdot \left({D}^{2} \cdot \color{blue}{\frac{{M}^{2} \cdot h}{{d}^{2} \cdot \ell}}\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(\frac{-1}{8} \cdot \left(\frac{{M}^{2} \cdot h}{{d}^{2} \cdot \ell} \cdot \color{blue}{{D}^{2}}\right)\right) \]
      3. associate-*l*N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(\left(\frac{-1}{8} \cdot \frac{{M}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot \color{blue}{{D}^{2}}\right) \]
      4. pow2N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(\left(\frac{-1}{8} \cdot \frac{{M}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot \left(D \cdot \color{blue}{D}\right)\right) \]
      5. associate-*r*N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(\left(\left(\frac{-1}{8} \cdot \frac{{M}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot D\right) \cdot \color{blue}{D}\right) \]
      6. lower-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \left(\left(\left(\frac{-1}{8} \cdot \frac{{M}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot D\right) \cdot \color{blue}{D}\right) \]
    11. Applied rewrites46.5%

      \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \cdot \color{blue}{\left(\left(\left(\left(\frac{h}{\left(d \cdot d\right) \cdot \ell} \cdot \left(M \cdot M\right)\right) \cdot -0.125\right) \cdot D\right) \cdot D\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 19: 49.6% accurate, 0.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 := \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)\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-180}:\\ \;\;\;\;\left(-d\_m\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+238}:\\ \;\;\;\;\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d\_m\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\ell \cdot h}} \cdot d\_m\\ \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
         (*
          (* (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))))))
   (if (<= t_0 -2e-180)
     (* (- d_m) (sqrt (/ 1.0 (* l h))))
     (if (<= t_0 4e+238)
       (* (/ (sqrt (/ 1.0 h)) (sqrt l)) d_m)
       (* (/ 1.0 (sqrt (* l h))) d_m)))))
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 = (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)));
	double tmp;
	if (t_0 <= -2e-180) {
		tmp = -d_m * sqrt((1.0 / (l * h)));
	} else if (t_0 <= 4e+238) {
		tmp = (sqrt((1.0 / h)) / sqrt(l)) * d_m;
	} else {
		tmp = (1.0 / sqrt((l * h))) * d_m;
	}
	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 = (((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)))
    if (t_0 <= (-2d-180)) then
        tmp = -d_m * sqrt((1.0d0 / (l * h)))
    else if (t_0 <= 4d+238) then
        tmp = (sqrt((1.0d0 / h)) / sqrt(l)) * d_m
    else
        tmp = (1.0d0 / sqrt((l * h))) * d_m
    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.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)));
	double tmp;
	if (t_0 <= -2e-180) {
		tmp = -d_m * Math.sqrt((1.0 / (l * h)));
	} else if (t_0 <= 4e+238) {
		tmp = (Math.sqrt((1.0 / h)) / Math.sqrt(l)) * d_m;
	} else {
		tmp = (1.0 / Math.sqrt((l * h))) * d_m;
	}
	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.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)))
	tmp = 0
	if t_0 <= -2e-180:
		tmp = -d_m * math.sqrt((1.0 / (l * h)))
	elif t_0 <= 4e+238:
		tmp = (math.sqrt((1.0 / h)) / math.sqrt(l)) * d_m
	else:
		tmp = (1.0 / math.sqrt((l * h))) * d_m
	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((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))))
	tmp = 0.0
	if (t_0 <= -2e-180)
		tmp = Float64(Float64(-d_m) * sqrt(Float64(1.0 / Float64(l * h))));
	elseif (t_0 <= 4e+238)
		tmp = Float64(Float64(sqrt(Float64(1.0 / h)) / sqrt(l)) * d_m);
	else
		tmp = Float64(Float64(1.0 / sqrt(Float64(l * h))) * d_m);
	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 = (((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)));
	tmp = 0.0;
	if (t_0 <= -2e-180)
		tmp = -d_m * sqrt((1.0 / (l * h)));
	elseif (t_0 <= 4e+238)
		tmp = (sqrt((1.0 / h)) / sqrt(l)) * d_m;
	else
		tmp = (1.0 / sqrt((l * h))) * d_m;
	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[(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]}, If[LessEqual[t$95$0, -2e-180], N[((-d$95$m) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+238], N[(N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], N[(N[(1.0 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * d$95$m), $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({\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)\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-180}:\\
\;\;\;\;\left(-d\_m\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\

\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+238}:\\
\;\;\;\;\frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d\_m\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\ell \cdot h}} \cdot d\_m\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-180

    1. Initial program 86.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in l around -inf

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. sqrt-pow2N/A

        \[\leadsto \left(d \cdot {-1}^{\left(\frac{2}{2}\right)}\right) \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      2. metadata-evalN/A

        \[\leadsto \left(d \cdot {-1}^{1}\right) \cdot \sqrt{\frac{1}{h \cdot \color{blue}{\ell}}} \]
      3. metadata-evalN/A

        \[\leadsto \left(d \cdot -1\right) \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      4. *-commutativeN/A

        \[\leadsto \left(-1 \cdot d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
      5. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
      6. lower-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(d\right)\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
      7. lower-neg.f64N/A

        \[\leadsto \left(-d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
      8. inv-powN/A

        \[\leadsto \left(-d\right) \cdot \sqrt{{\left(h \cdot \ell\right)}^{-1}} \]
      9. sqr-powN/A

        \[\leadsto \left(-d\right) \cdot \sqrt{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}} \]
      10. sqrt-pow1N/A

        \[\leadsto \left(-d\right) \cdot \sqrt{\sqrt{{\left(h \cdot \ell\right)}^{-1}} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}} \]
      11. inv-powN/A

        \[\leadsto \left(-d\right) \cdot \sqrt{\sqrt{\frac{1}{h \cdot \ell}} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}} \]
      12. sqrt-pow1N/A

        \[\leadsto \left(-d\right) \cdot \sqrt{\sqrt{\frac{1}{h \cdot \ell}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-1}}} \]
      13. inv-powN/A

        \[\leadsto \left(-d\right) \cdot \sqrt{\sqrt{\frac{1}{h \cdot \ell}} \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      14. lower-sqrt.f64N/A

        \[\leadsto \left(-d\right) \cdot \sqrt{\sqrt{\frac{1}{h \cdot \ell}} \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    4. Applied rewrites23.8%

      \[\leadsto \color{blue}{\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]

    if -2e-180 < (*.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)))) < 4.0000000000000002e238

    1. Initial program 88.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 \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites75.5%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      3. lift-/.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      4. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot d \]
      5. associate-/r*N/A

        \[\leadsto \sqrt{\frac{\frac{1}{h}}{\ell}} \cdot d \]
      6. sqrt-divN/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      7. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      8. lower-sqrt.f64N/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      9. lower-/.f64N/A

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
      10. lower-sqrt.f6491.9

        \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]
    6. Applied rewrites91.9%

      \[\leadsto \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}} \cdot d \]

    if 4.0000000000000002e238 < (*.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 8.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites45.3%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      3. lift-/.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      4. sqrt-divN/A

        \[\leadsto \frac{\sqrt{1}}{\sqrt{\ell \cdot h}} \cdot d \]
      5. metadata-evalN/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
      7. lower-/.f64N/A

        \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
      8. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      9. lower-sqrt.f64N/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      10. lift-*.f6445.4

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    6. Applied rewrites45.4%

      \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 20: 49.6% accurate, 0.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 := \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)\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-180}:\\ \;\;\;\;\left(-d\_m\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+238}:\\ \;\;\;\;\frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\ell \cdot h}} \cdot d\_m\\ \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
         (*
          (* (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))))))
   (if (<= t_0 -2e-180)
     (* (- d_m) (sqrt (/ 1.0 (* l h))))
     (if (<= t_0 4e+238)
       (/ d_m (* (sqrt l) (sqrt h)))
       (* (/ 1.0 (sqrt (* l h))) d_m)))))
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 = (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)));
	double tmp;
	if (t_0 <= -2e-180) {
		tmp = -d_m * sqrt((1.0 / (l * h)));
	} else if (t_0 <= 4e+238) {
		tmp = d_m / (sqrt(l) * sqrt(h));
	} else {
		tmp = (1.0 / sqrt((l * h))) * d_m;
	}
	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 = (((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)))
    if (t_0 <= (-2d-180)) then
        tmp = -d_m * sqrt((1.0d0 / (l * h)))
    else if (t_0 <= 4d+238) then
        tmp = d_m / (sqrt(l) * sqrt(h))
    else
        tmp = (1.0d0 / sqrt((l * h))) * d_m
    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.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)));
	double tmp;
	if (t_0 <= -2e-180) {
		tmp = -d_m * Math.sqrt((1.0 / (l * h)));
	} else if (t_0 <= 4e+238) {
		tmp = d_m / (Math.sqrt(l) * Math.sqrt(h));
	} else {
		tmp = (1.0 / Math.sqrt((l * h))) * d_m;
	}
	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.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)))
	tmp = 0
	if t_0 <= -2e-180:
		tmp = -d_m * math.sqrt((1.0 / (l * h)))
	elif t_0 <= 4e+238:
		tmp = d_m / (math.sqrt(l) * math.sqrt(h))
	else:
		tmp = (1.0 / math.sqrt((l * h))) * d_m
	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((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))))
	tmp = 0.0
	if (t_0 <= -2e-180)
		tmp = Float64(Float64(-d_m) * sqrt(Float64(1.0 / Float64(l * h))));
	elseif (t_0 <= 4e+238)
		tmp = Float64(d_m / Float64(sqrt(l) * sqrt(h)));
	else
		tmp = Float64(Float64(1.0 / sqrt(Float64(l * h))) * d_m);
	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 = (((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)));
	tmp = 0.0;
	if (t_0 <= -2e-180)
		tmp = -d_m * sqrt((1.0 / (l * h)));
	elseif (t_0 <= 4e+238)
		tmp = d_m / (sqrt(l) * sqrt(h));
	else
		tmp = (1.0 / sqrt((l * h))) * d_m;
	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[(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]}, If[LessEqual[t$95$0, -2e-180], N[((-d$95$m) * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+238], N[(d$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * d$95$m), $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({\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)\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-180}:\\
\;\;\;\;\left(-d\_m\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\\

\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+238}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\ell \cdot h}} \cdot d\_m\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-180

    1. Initial program 86.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in l around -inf

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. sqrt-pow2N/A

        \[\leadsto \left(d \cdot {-1}^{\left(\frac{2}{2}\right)}\right) \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      2. metadata-evalN/A

        \[\leadsto \left(d \cdot {-1}^{1}\right) \cdot \sqrt{\frac{1}{h \cdot \color{blue}{\ell}}} \]
      3. metadata-evalN/A

        \[\leadsto \left(d \cdot -1\right) \cdot \sqrt{\frac{1}{\color{blue}{h \cdot \ell}}} \]
      4. *-commutativeN/A

        \[\leadsto \left(-1 \cdot d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
      5. mul-1-negN/A

        \[\leadsto \left(\mathsf{neg}\left(d\right)\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
      6. lower-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(d\right)\right) \cdot \color{blue}{\sqrt{\frac{1}{h \cdot \ell}}} \]
      7. lower-neg.f64N/A

        \[\leadsto \left(-d\right) \cdot \sqrt{\color{blue}{\frac{1}{h \cdot \ell}}} \]
      8. inv-powN/A

        \[\leadsto \left(-d\right) \cdot \sqrt{{\left(h \cdot \ell\right)}^{-1}} \]
      9. sqr-powN/A

        \[\leadsto \left(-d\right) \cdot \sqrt{{\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}} \]
      10. sqrt-pow1N/A

        \[\leadsto \left(-d\right) \cdot \sqrt{\sqrt{{\left(h \cdot \ell\right)}^{-1}} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}} \]
      11. inv-powN/A

        \[\leadsto \left(-d\right) \cdot \sqrt{\sqrt{\frac{1}{h \cdot \ell}} \cdot {\left(h \cdot \ell\right)}^{\left(\frac{-1}{2}\right)}} \]
      12. sqrt-pow1N/A

        \[\leadsto \left(-d\right) \cdot \sqrt{\sqrt{\frac{1}{h \cdot \ell}} \cdot \sqrt{{\left(h \cdot \ell\right)}^{-1}}} \]
      13. inv-powN/A

        \[\leadsto \left(-d\right) \cdot \sqrt{\sqrt{\frac{1}{h \cdot \ell}} \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      14. lower-sqrt.f64N/A

        \[\leadsto \left(-d\right) \cdot \sqrt{\sqrt{\frac{1}{h \cdot \ell}} \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    4. Applied rewrites23.8%

      \[\leadsto \color{blue}{\left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}} \]

    if -2e-180 < (*.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)))) < 4.0000000000000002e238

    1. Initial program 88.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 \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites75.5%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      3. lift-/.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      4. sqrt-divN/A

        \[\leadsto \frac{\sqrt{1}}{\sqrt{\ell \cdot h}} \cdot d \]
      5. metadata-evalN/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
      7. lower-/.f64N/A

        \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
      8. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      9. lower-sqrt.f64N/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      10. lift-*.f6475.7

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    6. Applied rewrites75.7%

      \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    7. Applied rewrites75.8%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
      2. lift-sqrt.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
      3. sqrt-prodN/A

        \[\leadsto \frac{d}{\sqrt{\ell} \cdot \color{blue}{\sqrt{h}}} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell} \cdot \color{blue}{\sqrt{h}}} \]
      5. lower-sqrt.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell} \cdot \sqrt{\color{blue}{h}}} \]
      6. lower-sqrt.f6492.0

        \[\leadsto \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \]
    9. Applied rewrites92.0%

      \[\leadsto \frac{d}{\sqrt{\ell} \cdot \color{blue}{\sqrt{h}}} \]

    if 4.0000000000000002e238 < (*.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 8.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites45.3%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      3. lift-/.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      4. sqrt-divN/A

        \[\leadsto \frac{\sqrt{1}}{\sqrt{\ell \cdot h}} \cdot d \]
      5. metadata-evalN/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
      7. lower-/.f64N/A

        \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
      8. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      9. lower-sqrt.f64N/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      10. lift-*.f6445.4

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    6. Applied rewrites45.4%

      \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 21: 46.7% accurate, 6.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 -1 \cdot 10^{-307}:\\ \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d\_m}{\sqrt{\ell} \cdot \sqrt{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 -1e-307) (/ d_m (sqrt (* l h))) (/ d_m (* (sqrt l) (sqrt 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 <= -1e-307) {
		tmp = d_m / sqrt((l * h));
	} else {
		tmp = d_m / (sqrt(l) * sqrt(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 <= (-1d-307)) then
        tmp = d_m / sqrt((l * h))
    else
        tmp = d_m / (sqrt(l) * sqrt(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 <= -1e-307) {
		tmp = d_m / Math.sqrt((l * h));
	} else {
		tmp = d_m / (Math.sqrt(l) * Math.sqrt(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 <= -1e-307:
		tmp = d_m / math.sqrt((l * h))
	else:
		tmp = d_m / (math.sqrt(l) * math.sqrt(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 <= -1e-307)
		tmp = Float64(d_m / sqrt(Float64(l * h)));
	else
		tmp = Float64(d_m / Float64(sqrt(l) * sqrt(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 <= -1e-307)
		tmp = d_m / sqrt((l * h));
	else
		tmp = d_m / (sqrt(l) * sqrt(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, -1e-307], N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d$95$m / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[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}\;h \leq -1 \cdot 10^{-307}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}}\\

\mathbf{else}:\\
\;\;\;\;\frac{d\_m}{\sqrt{\ell} \cdot \sqrt{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if h < -9.99999999999999909e-308

    1. Initial program 4.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites42.4%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      3. lift-/.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      4. sqrt-divN/A

        \[\leadsto \frac{\sqrt{1}}{\sqrt{\ell \cdot h}} \cdot d \]
      5. metadata-evalN/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
      7. lower-/.f64N/A

        \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
      8. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      9. lower-sqrt.f64N/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      10. lift-*.f6442.6

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    6. Applied rewrites42.6%

      \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    7. Applied rewrites42.6%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]

    if -9.99999999999999909e-308 < h

    1. Initial program 66.3%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites43.2%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      3. lift-/.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      4. sqrt-divN/A

        \[\leadsto \frac{\sqrt{1}}{\sqrt{\ell \cdot h}} \cdot d \]
      5. metadata-evalN/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
      7. lower-/.f64N/A

        \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
      8. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      9. lower-sqrt.f64N/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      10. lift-*.f6443.3

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    6. Applied rewrites43.3%

      \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    7. Applied rewrites43.3%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
      2. lift-sqrt.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell \cdot h}} \]
      3. sqrt-prodN/A

        \[\leadsto \frac{d}{\sqrt{\ell} \cdot \color{blue}{\sqrt{h}}} \]
      4. lower-*.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell} \cdot \color{blue}{\sqrt{h}}} \]
      5. lower-sqrt.f64N/A

        \[\leadsto \frac{d}{\sqrt{\ell} \cdot \sqrt{\color{blue}{h}}} \]
      6. lower-sqrt.f6450.6

        \[\leadsto \frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \]
    9. Applied rewrites50.6%

      \[\leadsto \frac{d}{\sqrt{\ell} \cdot \color{blue}{\sqrt{h}}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 22: 46.6% 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} t_0 := \frac{d\_m}{\sqrt{\ell \cdot h}}\\ \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^{-180}:\\ \;\;\;\;-t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \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 (sqrt (* l h)))))
   (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-180)
     (- t_0)
     t_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 / sqrt((l * h));
	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-180) {
		tmp = -t_0;
	} else {
		tmp = t_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) :: t_0
    real(8) :: tmp
    t_0 = d_m / sqrt((l * h))
    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-180)) then
        tmp = -t_0
    else
        tmp = t_0
    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 = d_m / Math.sqrt((l * h));
	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-180) {
		tmp = -t_0;
	} else {
		tmp = t_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):
	t_0 = d_m / math.sqrt((l * h))
	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-180:
		tmp = -t_0
	else:
		tmp = t_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(d_m / sqrt(Float64(l * h)))
	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-180)
		tmp = Float64(-t_0);
	else
		tmp = t_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)
	t_0 = d_m / sqrt((l * h));
	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-180)
		tmp = -t_0;
	else
		tmp = t_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_] := Block[{t$95$0 = N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, 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-180], (-t$95$0), t$95$0]]
\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 := \frac{d\_m}{\sqrt{\ell \cdot h}}\\
\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^{-180}:\\
\;\;\;\;-t\_0\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-180

    1. Initial program 86.6%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around 0

      \[\leadsto \color{blue}{\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d}\right) \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. lower-*.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d}\right) \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 rewrites79.7%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right)} \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. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\color{blue}{\frac{1}{2}} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
      2. metadata-eval79.7

        \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    6. Applied rewrites79.7%

      \[\leadsto \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right) \cdot \left(1 - \left(\color{blue}{0.5} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    7. Taylor expanded in l around -inf

      \[\leadsto \color{blue}{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    8. Applied rewrites22.6%

      \[\leadsto \color{blue}{-\frac{d}{\sqrt{\ell \cdot h}}} \]

    if -2e-180 < (*.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 24.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    4. Applied rewrites51.6%

      \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    5. Step-by-step derivation
      1. lift-sqrt.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      2. lift-*.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      3. lift-/.f64N/A

        \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
      4. sqrt-divN/A

        \[\leadsto \frac{\sqrt{1}}{\sqrt{\ell \cdot h}} \cdot d \]
      5. metadata-evalN/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      6. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
      7. lower-/.f64N/A

        \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
      8. *-commutativeN/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      9. lower-sqrt.f64N/A

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
      10. lift-*.f6451.7

        \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    6. Applied rewrites51.7%

      \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    7. Applied rewrites51.8%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 23: 43.0% 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 35.6%

    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
  2. Taylor expanded in d around inf

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
  3. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
    2. lower-*.f64N/A

      \[\leadsto \sqrt{\frac{1}{h \cdot \ell}} \cdot \color{blue}{d} \]
  4. Applied rewrites42.8%

    \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
  5. Step-by-step derivation
    1. lift-sqrt.f64N/A

      \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
    2. lift-*.f64N/A

      \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
    3. lift-/.f64N/A

      \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
    4. sqrt-divN/A

      \[\leadsto \frac{\sqrt{1}}{\sqrt{\ell \cdot h}} \cdot d \]
    5. metadata-evalN/A

      \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    6. *-commutativeN/A

      \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
    7. lower-/.f64N/A

      \[\leadsto \frac{1}{\sqrt{h \cdot \ell}} \cdot d \]
    8. *-commutativeN/A

      \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    9. lower-sqrt.f64N/A

      \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    10. lift-*.f6442.9

      \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
  6. Applied rewrites42.9%

    \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
  7. Applied rewrites43.0%

    \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
  8. Add Preprocessing

Reproduce

?
herbie shell --seed 2025130 
(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)))))