Henrywood and Agarwal, Equation (12)

Percentage Accurate: 36.2% → 77.2%
Time: 8.4s
Alternatives: 9
Speedup: 2.7×

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 9 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 36.2% accurate, 1.0× speedup?

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

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

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

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

Alternative 1: 77.2% accurate, 0.5× speedup?

\[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := 1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\\ t_1 := {\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)}\\ t_2 := \frac{D}{d\_m + d\_m}\\ \mathbf{if}\;\left(t\_1 \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot t\_0 \leq 2 \cdot 10^{+221}:\\ \;\;\;\;\left(t\_1 \cdot \frac{\sqrt{d\_m}}{\sqrt{\ell}}\right) \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(1 - \frac{\left(\left(\left(\left(M \cdot t\_2\right) \cdot t\_2\right) \cdot M\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\ \end{array} \end{array} \]
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
 :precision binary64
 (let* ((t_0
         (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))
        (t_1 (pow (/ d_m h) (/ 1.0 2.0)))
        (t_2 (/ D (+ d_m d_m))))
   (if (<= (* (* t_1 (pow (/ d_m l) (/ 1.0 2.0))) t_0) 2e+221)
     (* (* t_1 (/ (sqrt d_m) (sqrt l))) t_0)
     (*
      (* d_m (sqrt (/ 1.0 (* h l))))
      (- 1.0 (/ (* (* (* (* (* M t_2) t_2) M) 0.5) h) l))))))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
	double t_0 = 1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l));
	double t_1 = pow((d_m / h), (1.0 / 2.0));
	double t_2 = D / (d_m + d_m);
	double tmp;
	if (((t_1 * pow((d_m / l), (1.0 / 2.0))) * t_0) <= 2e+221) {
		tmp = (t_1 * (sqrt(d_m) / sqrt(l))) * t_0;
	} else {
		tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - ((((((M * t_2) * t_2) * M) * 0.5) * h) / l));
	}
	return tmp;
}
d_m =     private
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, d)
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
    real(8), intent (in) :: d
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = 1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l))
    t_1 = (d_m / h) ** (1.0d0 / 2.0d0)
    t_2 = d / (d_m + d_m)
    if (((t_1 * ((d_m / l) ** (1.0d0 / 2.0d0))) * t_0) <= 2d+221) then
        tmp = (t_1 * (sqrt(d_m) / sqrt(l))) * t_0
    else
        tmp = (d_m * sqrt((1.0d0 / (h * l)))) * (1.0d0 - ((((((m * t_2) * t_2) * m) * 0.5d0) * h) / l))
    end if
    code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
	double t_0 = 1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l));
	double t_1 = Math.pow((d_m / h), (1.0 / 2.0));
	double t_2 = D / (d_m + d_m);
	double tmp;
	if (((t_1 * Math.pow((d_m / l), (1.0 / 2.0))) * t_0) <= 2e+221) {
		tmp = (t_1 * (Math.sqrt(d_m) / Math.sqrt(l))) * t_0;
	} else {
		tmp = (d_m * Math.sqrt((1.0 / (h * l)))) * (1.0 - ((((((M * t_2) * t_2) * M) * 0.5) * h) / l));
	}
	return tmp;
}
d_m = math.fabs(d)
def code(d_m, h, l, M, D):
	t_0 = 1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l))
	t_1 = math.pow((d_m / h), (1.0 / 2.0))
	t_2 = D / (d_m + d_m)
	tmp = 0
	if ((t_1 * math.pow((d_m / l), (1.0 / 2.0))) * t_0) <= 2e+221:
		tmp = (t_1 * (math.sqrt(d_m) / math.sqrt(l))) * t_0
	else:
		tmp = (d_m * math.sqrt((1.0 / (h * l)))) * (1.0 - ((((((M * t_2) * t_2) * M) * 0.5) * h) / l))
	return tmp
d_m = abs(d)
function code(d_m, h, l, M, D)
	t_0 = Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))
	t_1 = Float64(d_m / h) ^ Float64(1.0 / 2.0)
	t_2 = Float64(D / Float64(d_m + d_m))
	tmp = 0.0
	if (Float64(Float64(t_1 * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * t_0) <= 2e+221)
		tmp = Float64(Float64(t_1 * Float64(sqrt(d_m) / sqrt(l))) * t_0);
	else
		tmp = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(M * t_2) * t_2) * M) * 0.5) * h) / l)));
	end
	return tmp
end
d_m = abs(d);
function tmp_2 = code(d_m, h, l, M, D)
	t_0 = 1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d_m)) ^ 2.0)) * (h / l));
	t_1 = (d_m / h) ^ (1.0 / 2.0);
	t_2 = D / (d_m + d_m);
	tmp = 0.0;
	if (((t_1 * ((d_m / l) ^ (1.0 / 2.0))) * t_0) <= 2e+221)
		tmp = (t_1 * (sqrt(d_m) / sqrt(l))) * t_0;
	else
		tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - ((((((M * t_2) * t_2) * M) * 0.5) * h) / l));
	end
	tmp_2 = tmp;
end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(d$95$m / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 * N[Power[N[(d$95$m / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], 2e+221], N[(N[(t$95$1 * N[(N[Sqrt[d$95$m], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(N[(M * t$95$2), $MachinePrecision] * t$95$2), $MachinePrecision] * M), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
d_m = \left|d\right|

\\
\begin{array}{l}
t_0 := 1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\\
t_1 := {\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)}\\
t_2 := \frac{D}{d\_m + d\_m}\\
\mathbf{if}\;\left(t\_1 \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot t\_0 \leq 2 \cdot 10^{+221}:\\
\;\;\;\;\left(t\_1 \cdot \frac{\sqrt{d\_m}}{\sqrt{\ell}}\right) \cdot t\_0\\

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


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

    1. Initial program 36.2%

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

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

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

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

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

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

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

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

        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \frac{\color{blue}{\sqrt{d}}}{\sqrt{\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) \]
      9. lower-sqrt.f6436.0

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

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

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

    1. Initial program 36.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \color{blue}{\frac{d}{\ell}}} \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. frac-timesN/A

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

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

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

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

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

      \[\leadsto \color{blue}{\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) \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

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

        \[\leadsto \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. lower-/.f64N/A

        \[\leadsto \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) \]
      4. lower-*.f6469.6

        \[\leadsto \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) \]
    6. Applied rewrites69.6%

      \[\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) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

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

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

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\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) \]
      6. count-2-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 74.7% accurate, 0.6× speedup?

\[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := \frac{D}{d\_m + d\_m}\\ t_1 := t\_0 \cdot M\\ \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 \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 10^{+27}:\\ \;\;\;\;\left(d\_m \cdot \frac{\sqrt{\frac{h}{\ell}}}{h}\right) \cdot \left(1 - \left(\left(0.5 \cdot t\_1\right) \cdot t\_1\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(1 - \frac{\left(\left(\left(\left(M \cdot t\_0\right) \cdot t\_0\right) \cdot M\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\ \end{array} \end{array} \]
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
 :precision binary64
 (let* ((t_0 (/ D (+ d_m d_m))) (t_1 (* t_0 M)))
   (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 D) (* 2.0 d_m)) 2.0)) (/ h l))))
        1e+27)
     (* (* d_m (/ (sqrt (/ h l)) h)) (- 1.0 (* (* (* 0.5 t_1) t_1) (/ h l))))
     (*
      (* d_m (sqrt (/ 1.0 (* h l))))
      (- 1.0 (/ (* (* (* (* (* M t_0) t_0) M) 0.5) h) l))))))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
	double t_0 = D / (d_m + d_m);
	double t_1 = t_0 * M;
	double tmp;
	if (((pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= 1e+27) {
		tmp = (d_m * (sqrt((h / l)) / h)) * (1.0 - (((0.5 * t_1) * t_1) * (h / l)));
	} else {
		tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - ((((((M * t_0) * t_0) * M) * 0.5) * h) / l));
	}
	return tmp;
}
d_m =     private
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, d)
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
    real(8), intent (in) :: d
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = d / (d_m + d_m)
    t_1 = t_0 * m
    if (((((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))) <= 1d+27) then
        tmp = (d_m * (sqrt((h / l)) / h)) * (1.0d0 - (((0.5d0 * t_1) * t_1) * (h / l)))
    else
        tmp = (d_m * sqrt((1.0d0 / (h * l)))) * (1.0d0 - ((((((m * t_0) * t_0) * m) * 0.5d0) * h) / l))
    end if
    code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
	double t_0 = D / (d_m + d_m);
	double t_1 = t_0 * M;
	double tmp;
	if (((Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= 1e+27) {
		tmp = (d_m * (Math.sqrt((h / l)) / h)) * (1.0 - (((0.5 * t_1) * t_1) * (h / l)));
	} else {
		tmp = (d_m * Math.sqrt((1.0 / (h * l)))) * (1.0 - ((((((M * t_0) * t_0) * M) * 0.5) * h) / l));
	}
	return tmp;
}
d_m = math.fabs(d)
def code(d_m, h, l, M, D):
	t_0 = D / (d_m + d_m)
	t_1 = t_0 * M
	tmp = 0
	if ((math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= 1e+27:
		tmp = (d_m * (math.sqrt((h / l)) / h)) * (1.0 - (((0.5 * t_1) * t_1) * (h / l)))
	else:
		tmp = (d_m * math.sqrt((1.0 / (h * l)))) * (1.0 - ((((((M * t_0) * t_0) * M) * 0.5) * h) / l))
	return tmp
d_m = abs(d)
function code(d_m, h, l, M, D)
	t_0 = Float64(D / Float64(d_m + d_m))
	t_1 = Float64(t_0 * M)
	tmp = 0.0
	if (Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))) <= 1e+27)
		tmp = Float64(Float64(d_m * Float64(sqrt(Float64(h / l)) / h)) * Float64(1.0 - Float64(Float64(Float64(0.5 * t_1) * t_1) * Float64(h / l))));
	else
		tmp = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(M * t_0) * t_0) * M) * 0.5) * h) / l)));
	end
	return tmp
end
d_m = abs(d);
function tmp_2 = code(d_m, h, l, M, D)
	t_0 = D / (d_m + d_m);
	t_1 = t_0 * M;
	tmp = 0.0;
	if (((((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d_m)) ^ 2.0)) * (h / l)))) <= 1e+27)
		tmp = (d_m * (sqrt((h / l)) / h)) * (1.0 - (((0.5 * t_1) * t_1) * (h / l)));
	else
		tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - ((((((M * t_0) * t_0) * M) * 0.5) * h) / l));
	end
	tmp_2 = tmp;
end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * M), $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 * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+27], N[(N[(d$95$m * N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(0.5 * t$95$1), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(N[(M * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] * M), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|

\\
\begin{array}{l}
t_0 := \frac{D}{d\_m + d\_m}\\
t_1 := t\_0 \cdot M\\
\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 \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 10^{+27}:\\
\;\;\;\;\left(d\_m \cdot \frac{\sqrt{\frac{h}{\ell}}}{h}\right) \cdot \left(1 - \left(\left(0.5 \cdot t\_1\right) \cdot t\_1\right) \cdot \frac{h}{\ell}\right)\\

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


\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)))) < 1e27

    1. Initial program 36.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \color{blue}{\frac{d}{\ell}}} \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. frac-timesN/A

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

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

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

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

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

      \[\leadsto \color{blue}{\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) \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

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

        \[\leadsto \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. lower-/.f64N/A

        \[\leadsto \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) \]
      4. lower-*.f6469.6

        \[\leadsto \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) \]
    6. Applied rewrites69.6%

      \[\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) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

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

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

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\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) \]
      6. count-2-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 36.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \color{blue}{\frac{d}{\ell}}} \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. frac-timesN/A

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

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

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

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

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

      \[\leadsto \color{blue}{\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) \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

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

        \[\leadsto \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. lower-/.f64N/A

        \[\leadsto \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) \]
      4. lower-*.f6469.6

        \[\leadsto \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) \]
    6. Applied rewrites69.6%

      \[\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) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

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

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

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\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) \]
      6. count-2-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 72.9% accurate, 1.9× speedup?

\[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := \frac{D}{d\_m + d\_m}\\ \left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(1 - \frac{\left(\left(\left(\left(M \cdot t\_0\right) \cdot t\_0\right) \cdot M\right) \cdot 0.5\right) \cdot h}{\ell}\right) \end{array} \end{array} \]
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
 :precision binary64
 (let* ((t_0 (/ D (+ d_m d_m))))
   (*
    (* d_m (sqrt (/ 1.0 (* h l))))
    (- 1.0 (/ (* (* (* (* (* M t_0) t_0) M) 0.5) h) l)))))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
	double t_0 = D / (d_m + d_m);
	return (d_m * sqrt((1.0 / (h * l)))) * (1.0 - ((((((M * t_0) * t_0) * M) * 0.5) * h) / l));
}
d_m =     private
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, d)
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
    real(8), intent (in) :: d
    real(8) :: t_0
    t_0 = d / (d_m + d_m)
    code = (d_m * sqrt((1.0d0 / (h * l)))) * (1.0d0 - ((((((m * t_0) * t_0) * m) * 0.5d0) * h) / l))
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
	double t_0 = D / (d_m + d_m);
	return (d_m * Math.sqrt((1.0 / (h * l)))) * (1.0 - ((((((M * t_0) * t_0) * M) * 0.5) * h) / l));
}
d_m = math.fabs(d)
def code(d_m, h, l, M, D):
	t_0 = D / (d_m + d_m)
	return (d_m * math.sqrt((1.0 / (h * l)))) * (1.0 - ((((((M * t_0) * t_0) * M) * 0.5) * h) / l))
d_m = abs(d)
function code(d_m, h, l, M, D)
	t_0 = Float64(D / Float64(d_m + d_m))
	return Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(Float64(M * t_0) * t_0) * M) * 0.5) * h) / l)))
end
d_m = abs(d);
function tmp = code(d_m, h, l, M, D)
	t_0 = D / (d_m + d_m);
	tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - ((((((M * t_0) * t_0) * M) * 0.5) * h) / l));
end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]}, N[(N[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(N[(M * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] * M), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
d_m = \left|d\right|

\\
\begin{array}{l}
t_0 := \frac{D}{d\_m + d\_m}\\
\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(1 - \frac{\left(\left(\left(\left(M \cdot t\_0\right) \cdot t\_0\right) \cdot M\right) \cdot 0.5\right) \cdot h}{\ell}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 36.2%

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h} \cdot \color{blue}{\frac{d}{\ell}}} \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. frac-timesN/A

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

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

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

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

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

    \[\leadsto \color{blue}{\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) \]
  5. Step-by-step derivation
    1. lower-*.f64N/A

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

      \[\leadsto \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. lower-/.f64N/A

      \[\leadsto \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) \]
    4. lower-*.f6469.6

      \[\leadsto \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) \]
  6. Applied rewrites69.6%

    \[\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) \]
  7. Step-by-step derivation
    1. lift-*.f64N/A

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

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

      \[\leadsto \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\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) \]
    6. count-2-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 56.6% accurate, 1.8× speedup?

\[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\\ \mathbf{if}\;M \cdot D \leq 2 \cdot 10^{-158}:\\ \;\;\;\;t\_0 \cdot 1\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \left(1 - \left(\left(0.25 \cdot \frac{D \cdot M}{d\_m}\right) \cdot \left(\frac{D}{d\_m + d\_m} \cdot M\right)\right) \cdot \frac{h}{\ell}\right)\\ \end{array} \end{array} \]
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
 :precision binary64
 (let* ((t_0 (* d_m (sqrt (/ 1.0 (* h l))))))
   (if (<= (* M D) 2e-158)
     (* t_0 1.0)
     (*
      t_0
      (-
       1.0
       (* (* (* 0.25 (/ (* D M) d_m)) (* (/ D (+ d_m d_m)) M)) (/ h l)))))))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
	double t_0 = d_m * sqrt((1.0 / (h * l)));
	double tmp;
	if ((M * D) <= 2e-158) {
		tmp = t_0 * 1.0;
	} else {
		tmp = t_0 * (1.0 - (((0.25 * ((D * M) / d_m)) * ((D / (d_m + d_m)) * M)) * (h / l)));
	}
	return tmp;
}
d_m =     private
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, d)
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
    real(8), intent (in) :: d
    real(8) :: t_0
    real(8) :: tmp
    t_0 = d_m * sqrt((1.0d0 / (h * l)))
    if ((m * d) <= 2d-158) then
        tmp = t_0 * 1.0d0
    else
        tmp = t_0 * (1.0d0 - (((0.25d0 * ((d * m) / d_m)) * ((d / (d_m + d_m)) * m)) * (h / l)))
    end if
    code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
	double t_0 = d_m * Math.sqrt((1.0 / (h * l)));
	double tmp;
	if ((M * D) <= 2e-158) {
		tmp = t_0 * 1.0;
	} else {
		tmp = t_0 * (1.0 - (((0.25 * ((D * M) / d_m)) * ((D / (d_m + d_m)) * M)) * (h / l)));
	}
	return tmp;
}
d_m = math.fabs(d)
def code(d_m, h, l, M, D):
	t_0 = d_m * math.sqrt((1.0 / (h * l)))
	tmp = 0
	if (M * D) <= 2e-158:
		tmp = t_0 * 1.0
	else:
		tmp = t_0 * (1.0 - (((0.25 * ((D * M) / d_m)) * ((D / (d_m + d_m)) * M)) * (h / l)))
	return tmp
d_m = abs(d)
function code(d_m, h, l, M, D)
	t_0 = Float64(d_m * sqrt(Float64(1.0 / Float64(h * l))))
	tmp = 0.0
	if (Float64(M * D) <= 2e-158)
		tmp = Float64(t_0 * 1.0);
	else
		tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(0.25 * Float64(Float64(D * M) / d_m)) * Float64(Float64(D / Float64(d_m + d_m)) * M)) * Float64(h / l))));
	end
	return tmp
end
d_m = abs(d);
function tmp_2 = code(d_m, h, l, M, D)
	t_0 = d_m * sqrt((1.0 / (h * l)));
	tmp = 0.0;
	if ((M * D) <= 2e-158)
		tmp = t_0 * 1.0;
	else
		tmp = t_0 * (1.0 - (((0.25 * ((D * M) / d_m)) * ((D / (d_m + d_m)) * M)) * (h / l)));
	end
	tmp_2 = tmp;
end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(M * D), $MachinePrecision], 2e-158], N[(t$95$0 * 1.0), $MachinePrecision], N[(t$95$0 * N[(1.0 - N[(N[(N[(0.25 * N[(N[(D * M), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
d_m = \left|d\right|

\\
\begin{array}{l}
t_0 := d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;M \cdot D \leq 2 \cdot 10^{-158}:\\
\;\;\;\;t\_0 \cdot 1\\

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


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

    1. Initial program 36.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \color{blue}{\frac{d}{\ell}}} \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. frac-timesN/A

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

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

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

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

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

      \[\leadsto \color{blue}{\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) \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

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

        \[\leadsto \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. lower-/.f64N/A

        \[\leadsto \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) \]
      4. lower-*.f6469.6

        \[\leadsto \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) \]
    6. Applied rewrites69.6%

      \[\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) \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

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

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

        \[\leadsto \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\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) \]
      6. count-2-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 2.00000000000000013e-158 < (*.f64 M D)

      1. Initial program 36.2%

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

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

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

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

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

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

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

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

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

          \[\leadsto \sqrt{\frac{d}{h} \cdot \color{blue}{\frac{d}{\ell}}} \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. frac-timesN/A

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

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

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

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

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

        \[\leadsto \color{blue}{\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) \]
      5. Step-by-step derivation
        1. lower-*.f64N/A

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

          \[\leadsto \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. lower-/.f64N/A

          \[\leadsto \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) \]
        4. lower-*.f6469.6

          \[\leadsto \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) \]
      6. Applied rewrites69.6%

        \[\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) \]
      7. Step-by-step derivation
        1. lift-*.f64N/A

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

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

          \[\leadsto \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\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) \]
        6. count-2-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 5: 46.4% accurate, 2.7× speedup?

    \[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} \mathbf{if}\;M \cdot D \leq 1.95 \cdot 10^{+177}:\\ \;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot 1\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \sqrt{\frac{{d\_m}^{2}}{h \cdot \ell}}\\ \end{array} \end{array} \]
    d_m = (fabs.f64 d)
    (FPCore (d_m h l M D)
     :precision binary64
     (if (<= (* M D) 1.95e+177)
       (* (* d_m (sqrt (/ 1.0 (* h l)))) 1.0)
       (* -1.0 (sqrt (/ (pow d_m 2.0) (* h l))))))
    d_m = fabs(d);
    double code(double d_m, double h, double l, double M, double D) {
    	double tmp;
    	if ((M * D) <= 1.95e+177) {
    		tmp = (d_m * sqrt((1.0 / (h * l)))) * 1.0;
    	} else {
    		tmp = -1.0 * sqrt((pow(d_m, 2.0) / (h * l)));
    	}
    	return tmp;
    }
    
    d_m =     private
    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, d)
    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
        real(8), intent (in) :: d
        real(8) :: tmp
        if ((m * d) <= 1.95d+177) then
            tmp = (d_m * sqrt((1.0d0 / (h * l)))) * 1.0d0
        else
            tmp = (-1.0d0) * sqrt(((d_m ** 2.0d0) / (h * l)))
        end if
        code = tmp
    end function
    
    d_m = Math.abs(d);
    public static double code(double d_m, double h, double l, double M, double D) {
    	double tmp;
    	if ((M * D) <= 1.95e+177) {
    		tmp = (d_m * Math.sqrt((1.0 / (h * l)))) * 1.0;
    	} else {
    		tmp = -1.0 * Math.sqrt((Math.pow(d_m, 2.0) / (h * l)));
    	}
    	return tmp;
    }
    
    d_m = math.fabs(d)
    def code(d_m, h, l, M, D):
    	tmp = 0
    	if (M * D) <= 1.95e+177:
    		tmp = (d_m * math.sqrt((1.0 / (h * l)))) * 1.0
    	else:
    		tmp = -1.0 * math.sqrt((math.pow(d_m, 2.0) / (h * l)))
    	return tmp
    
    d_m = abs(d)
    function code(d_m, h, l, M, D)
    	tmp = 0.0
    	if (Float64(M * D) <= 1.95e+177)
    		tmp = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * 1.0);
    	else
    		tmp = Float64(-1.0 * sqrt(Float64((d_m ^ 2.0) / Float64(h * l))));
    	end
    	return tmp
    end
    
    d_m = abs(d);
    function tmp_2 = code(d_m, h, l, M, D)
    	tmp = 0.0;
    	if ((M * D) <= 1.95e+177)
    		tmp = (d_m * sqrt((1.0 / (h * l)))) * 1.0;
    	else
    		tmp = -1.0 * sqrt(((d_m ^ 2.0) / (h * l)));
    	end
    	tmp_2 = tmp;
    end
    
    d_m = N[Abs[d], $MachinePrecision]
    code[d$95$m_, h_, l_, M_, D_] := If[LessEqual[N[(M * D), $MachinePrecision], 1.95e+177], N[(N[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(-1.0 * N[Sqrt[N[(N[Power[d$95$m, 2.0], $MachinePrecision] / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    d_m = \left|d\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;M \cdot D \leq 1.95 \cdot 10^{+177}:\\
    \;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot 1\\
    
    \mathbf{else}:\\
    \;\;\;\;-1 \cdot \sqrt{\frac{{d\_m}^{2}}{h \cdot \ell}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f64 M D) < 1.95e177

      1. Initial program 36.2%

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

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

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

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

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

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

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

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

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

          \[\leadsto \sqrt{\frac{d}{h} \cdot \color{blue}{\frac{d}{\ell}}} \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. frac-timesN/A

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

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

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

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

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

        \[\leadsto \color{blue}{\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) \]
      5. Step-by-step derivation
        1. lower-*.f64N/A

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

          \[\leadsto \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. lower-/.f64N/A

          \[\leadsto \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) \]
        4. lower-*.f6469.6

          \[\leadsto \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) \]
      6. Applied rewrites69.6%

        \[\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) \]
      7. Step-by-step derivation
        1. lift-*.f64N/A

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

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

          \[\leadsto \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\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) \]
        6. count-2-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 1.95e177 < (*.f64 M D)

        1. Initial program 36.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \sqrt{\left(h \cdot d\right) \cdot \frac{d}{\ell}} \cdot \frac{1}{h} \]
          13. lower-/.f6421.7

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

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

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

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

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

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

            \[\leadsto -1 \cdot \sqrt{\frac{{d}^{2}}{h \cdot \ell}} \]
          5. lower-*.f6412.2

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

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

      Alternative 6: 46.0% accurate, 0.8× speedup?

      \[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{+77}:\\ \;\;\;\;-1 \cdot \frac{d\_m \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{else}:\\ \;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot 1\\ \end{array} \end{array} \]
      d_m = (fabs.f64 d)
      (FPCore (d_m h l M D)
       :precision binary64
       (if (<=
            (*
             (* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
             (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))
            -5e+77)
         (* -1.0 (/ (* d_m (sqrt (/ h l))) h))
         (* (* d_m (sqrt (/ 1.0 (* h l)))) 1.0)))
      d_m = fabs(d);
      double code(double d_m, double h, double l, double M, double D) {
      	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 * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -5e+77) {
      		tmp = -1.0 * ((d_m * sqrt((h / l))) / h);
      	} else {
      		tmp = (d_m * sqrt((1.0 / (h * l)))) * 1.0;
      	}
      	return tmp;
      }
      
      d_m =     private
      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, d)
      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
          real(8), intent (in) :: d
          real(8) :: tmp
          if (((((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))) <= (-5d+77)) then
              tmp = (-1.0d0) * ((d_m * sqrt((h / l))) / h)
          else
              tmp = (d_m * sqrt((1.0d0 / (h * l)))) * 1.0d0
          end if
          code = tmp
      end function
      
      d_m = Math.abs(d);
      public static double code(double d_m, double h, double l, double M, double D) {
      	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 * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -5e+77) {
      		tmp = -1.0 * ((d_m * Math.sqrt((h / l))) / h);
      	} else {
      		tmp = (d_m * Math.sqrt((1.0 / (h * l)))) * 1.0;
      	}
      	return tmp;
      }
      
      d_m = math.fabs(d)
      def code(d_m, h, l, M, D):
      	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 * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -5e+77:
      		tmp = -1.0 * ((d_m * math.sqrt((h / l))) / h)
      	else:
      		tmp = (d_m * math.sqrt((1.0 / (h * l)))) * 1.0
      	return tmp
      
      d_m = abs(d)
      function code(d_m, h, l, M, D)
      	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 * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))) <= -5e+77)
      		tmp = Float64(-1.0 * Float64(Float64(d_m * sqrt(Float64(h / l))) / h));
      	else
      		tmp = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * 1.0);
      	end
      	return tmp
      end
      
      d_m = abs(d);
      function tmp_2 = code(d_m, h, l, M, D)
      	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 * D) / (2.0 * d_m)) ^ 2.0)) * (h / l)))) <= -5e+77)
      		tmp = -1.0 * ((d_m * sqrt((h / l))) / h);
      	else
      		tmp = (d_m * sqrt((1.0 / (h * l)))) * 1.0;
      	end
      	tmp_2 = tmp;
      end
      
      d_m = N[Abs[d], $MachinePrecision]
      code[d$95$m_, h_, l_, M_, D_] := 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 * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e+77], N[(-1.0 * N[(N[(d$95$m * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], N[(N[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]]
      
      \begin{array}{l}
      d_m = \left|d\right|
      
      \\
      \begin{array}{l}
      \mathbf{if}\;\left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{+77}:\\
      \;\;\;\;-1 \cdot \frac{d\_m \cdot \sqrt{\frac{h}{\ell}}}{h}\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot 1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.00000000000000004e77

        1. Initial program 36.2%

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

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

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

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

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

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

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

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

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

            \[\leadsto \sqrt{\frac{d}{h} \cdot \color{blue}{\frac{d}{\ell}}} \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. frac-timesN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        1. Initial program 36.2%

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

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

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

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

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

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

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

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

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

            \[\leadsto \sqrt{\frac{d}{h} \cdot \color{blue}{\frac{d}{\ell}}} \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. frac-timesN/A

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

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

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

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

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

          \[\leadsto \color{blue}{\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) \]
        5. Step-by-step derivation
          1. lower-*.f64N/A

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

            \[\leadsto \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. lower-/.f64N/A

            \[\leadsto \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) \]
          4. lower-*.f6469.6

            \[\leadsto \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) \]
        6. Applied rewrites69.6%

          \[\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) \]
        7. Step-by-step derivation
          1. lift-*.f64N/A

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

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

            \[\leadsto \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\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) \]
          6. count-2-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 7: 44.6% accurate, 0.8× speedup?

        \[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{+77}:\\ \;\;\;\;-\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\\ \mathbf{else}:\\ \;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot 1\\ \end{array} \end{array} \]
        d_m = (fabs.f64 d)
        (FPCore (d_m h l M D)
         :precision binary64
         (if (<=
              (*
               (* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
               (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))
              -5e+77)
           (- (* (sqrt (/ 1.0 (* l h))) d_m))
           (* (* d_m (sqrt (/ 1.0 (* h l)))) 1.0)))
        d_m = fabs(d);
        double code(double d_m, double h, double l, double M, double D) {
        	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 * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -5e+77) {
        		tmp = -(sqrt((1.0 / (l * h))) * d_m);
        	} else {
        		tmp = (d_m * sqrt((1.0 / (h * l)))) * 1.0;
        	}
        	return tmp;
        }
        
        d_m =     private
        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, d)
        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
            real(8), intent (in) :: d
            real(8) :: tmp
            if (((((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))) <= (-5d+77)) then
                tmp = -(sqrt((1.0d0 / (l * h))) * d_m)
            else
                tmp = (d_m * sqrt((1.0d0 / (h * l)))) * 1.0d0
            end if
            code = tmp
        end function
        
        d_m = Math.abs(d);
        public static double code(double d_m, double h, double l, double M, double D) {
        	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 * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -5e+77) {
        		tmp = -(Math.sqrt((1.0 / (l * h))) * d_m);
        	} else {
        		tmp = (d_m * Math.sqrt((1.0 / (h * l)))) * 1.0;
        	}
        	return tmp;
        }
        
        d_m = math.fabs(d)
        def code(d_m, h, l, M, D):
        	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 * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -5e+77:
        		tmp = -(math.sqrt((1.0 / (l * h))) * d_m)
        	else:
        		tmp = (d_m * math.sqrt((1.0 / (h * l)))) * 1.0
        	return tmp
        
        d_m = abs(d)
        function code(d_m, h, l, M, D)
        	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 * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))) <= -5e+77)
        		tmp = Float64(-Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m));
        	else
        		tmp = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * 1.0);
        	end
        	return tmp
        end
        
        d_m = abs(d);
        function tmp_2 = code(d_m, h, l, M, D)
        	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 * D) / (2.0 * d_m)) ^ 2.0)) * (h / l)))) <= -5e+77)
        		tmp = -(sqrt((1.0 / (l * h))) * d_m);
        	else
        		tmp = (d_m * sqrt((1.0 / (h * l)))) * 1.0;
        	end
        	tmp_2 = tmp;
        end
        
        d_m = N[Abs[d], $MachinePrecision]
        code[d$95$m_, h_, l_, M_, D_] := 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 * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e+77], (-N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision]), N[(N[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]]
        
        \begin{array}{l}
        d_m = \left|d\right|
        
        \\
        \begin{array}{l}
        \mathbf{if}\;\left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{+77}:\\
        \;\;\;\;-\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\\
        
        \mathbf{else}:\\
        \;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot 1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.00000000000000004e77

          1. Initial program 36.2%

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

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

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

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

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

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

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

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

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

              \[\leadsto \sqrt{\frac{d}{h} \cdot \color{blue}{\frac{d}{\ell}}} \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. frac-timesN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
            3. lower-neg.f6410.1

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

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

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

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

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

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

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

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

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

          1. Initial program 36.2%

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

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

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

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

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

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

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

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

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

              \[\leadsto \sqrt{\frac{d}{h} \cdot \color{blue}{\frac{d}{\ell}}} \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. frac-timesN/A

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

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

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

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

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

            \[\leadsto \color{blue}{\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) \]
          5. Step-by-step derivation
            1. lower-*.f64N/A

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

              \[\leadsto \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. lower-/.f64N/A

              \[\leadsto \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) \]
            4. lower-*.f6469.6

              \[\leadsto \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) \]
          6. Applied rewrites69.6%

            \[\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) \]
          7. Step-by-step derivation
            1. lift-*.f64N/A

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

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

              \[\leadsto \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\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) \]
            6. count-2-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 8: 27.8% accurate, 0.9× speedup?

          \[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{+77}:\\ \;\;\;\;-\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\\ \mathbf{else}:\\ \;\;\;\;\frac{d\_m \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \end{array} \end{array} \]
          d_m = (fabs.f64 d)
          (FPCore (d_m h l M D)
           :precision binary64
           (if (<=
                (*
                 (* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
                 (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))
                -5e+77)
             (- (* (sqrt (/ 1.0 (* l h))) d_m))
             (/ (* d_m (sqrt (/ h l))) h)))
          d_m = fabs(d);
          double code(double d_m, double h, double l, double M, double D) {
          	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 * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -5e+77) {
          		tmp = -(sqrt((1.0 / (l * h))) * d_m);
          	} else {
          		tmp = (d_m * sqrt((h / l))) / h;
          	}
          	return tmp;
          }
          
          d_m =     private
          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, d)
          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
              real(8), intent (in) :: d
              real(8) :: tmp
              if (((((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))) <= (-5d+77)) then
                  tmp = -(sqrt((1.0d0 / (l * h))) * d_m)
              else
                  tmp = (d_m * sqrt((h / l))) / h
              end if
              code = tmp
          end function
          
          d_m = Math.abs(d);
          public static double code(double d_m, double h, double l, double M, double D) {
          	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 * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -5e+77) {
          		tmp = -(Math.sqrt((1.0 / (l * h))) * d_m);
          	} else {
          		tmp = (d_m * Math.sqrt((h / l))) / h;
          	}
          	return tmp;
          }
          
          d_m = math.fabs(d)
          def code(d_m, h, l, M, D):
          	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 * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -5e+77:
          		tmp = -(math.sqrt((1.0 / (l * h))) * d_m)
          	else:
          		tmp = (d_m * math.sqrt((h / l))) / h
          	return tmp
          
          d_m = abs(d)
          function code(d_m, h, l, M, D)
          	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 * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))) <= -5e+77)
          		tmp = Float64(-Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m));
          	else
          		tmp = Float64(Float64(d_m * sqrt(Float64(h / l))) / h);
          	end
          	return tmp
          end
          
          d_m = abs(d);
          function tmp_2 = code(d_m, h, l, M, D)
          	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 * D) / (2.0 * d_m)) ^ 2.0)) * (h / l)))) <= -5e+77)
          		tmp = -(sqrt((1.0 / (l * h))) * d_m);
          	else
          		tmp = (d_m * sqrt((h / l))) / h;
          	end
          	tmp_2 = tmp;
          end
          
          d_m = N[Abs[d], $MachinePrecision]
          code[d$95$m_, h_, l_, M_, D_] := 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 * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e+77], (-N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision]), N[(N[(d$95$m * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]
          
          \begin{array}{l}
          d_m = \left|d\right|
          
          \\
          \begin{array}{l}
          \mathbf{if}\;\left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{+77}:\\
          \;\;\;\;-\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{d\_m \cdot \sqrt{\frac{h}{\ell}}}{h}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.00000000000000004e77

            1. Initial program 36.2%

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

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

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

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

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

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

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

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

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

                \[\leadsto \sqrt{\frac{d}{h} \cdot \color{blue}{\frac{d}{\ell}}} \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. frac-timesN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{neg}\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
              3. lower-neg.f6410.1

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

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

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

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

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

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

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

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

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

            1. Initial program 36.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \sqrt{\left(h \cdot d\right) \cdot \frac{d}{\ell}} \cdot \frac{1}{h} \]
              13. lower-/.f6421.7

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

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

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

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

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

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

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

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

          Alternative 9: 24.7% accurate, 7.4× speedup?

          \[\begin{array}{l} d_m = \left|d\right| \\ \frac{d\_m \cdot \sqrt{\frac{h}{\ell}}}{h} \end{array} \]
          d_m = (fabs.f64 d)
          (FPCore (d_m h l M D) :precision binary64 (/ (* d_m (sqrt (/ h l))) h))
          d_m = fabs(d);
          double code(double d_m, double h, double l, double M, double D) {
          	return (d_m * sqrt((h / l))) / h;
          }
          
          d_m =     private
          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, d)
          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
              real(8), intent (in) :: d
              code = (d_m * sqrt((h / l))) / h
          end function
          
          d_m = Math.abs(d);
          public static double code(double d_m, double h, double l, double M, double D) {
          	return (d_m * Math.sqrt((h / l))) / h;
          }
          
          d_m = math.fabs(d)
          def code(d_m, h, l, M, D):
          	return (d_m * math.sqrt((h / l))) / h
          
          d_m = abs(d)
          function code(d_m, h, l, M, D)
          	return Float64(Float64(d_m * sqrt(Float64(h / l))) / h)
          end
          
          d_m = abs(d);
          function tmp = code(d_m, h, l, M, D)
          	tmp = (d_m * sqrt((h / l))) / h;
          end
          
          d_m = N[Abs[d], $MachinePrecision]
          code[d$95$m_, h_, l_, M_, D_] := N[(N[(d$95$m * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]
          
          \begin{array}{l}
          d_m = \left|d\right|
          
          \\
          \frac{d\_m \cdot \sqrt{\frac{h}{\ell}}}{h}
          \end{array}
          
          Derivation
          1. Initial program 36.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \sqrt{\left(h \cdot d\right) \cdot \frac{d}{\ell}} \cdot \frac{1}{h} \]
            13. lower-/.f6421.7

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

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

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

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

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

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

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

            \[\leadsto \frac{d \cdot \sqrt{\frac{h}{\ell}}}{\color{blue}{h}} \]
          10. Add Preprocessing

          Reproduce

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