Henrywood and Agarwal, Equation (12)

Percentage Accurate: 35.1% → 71.4%
Time: 8.9s
Alternatives: 15
Speedup: 1.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 15 alternatives:

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

Initial Program: 35.1% accurate, 1.0× speedup?

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

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

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

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

Alternative 1: 71.4% accurate, 0.5× speedup?

\[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\\ t_1 := 1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\\ \mathbf{if}\;\left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot t\_0\right) \cdot t\_1 \leq 5 \cdot 10^{+197}:\\ \;\;\;\;\left(\frac{\sqrt{d\_m}}{\sqrt{h}} \cdot t\_0\right) \cdot t\_1\\ \mathbf{else}:\\ \;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(1 - \frac{\left(\left(\left(D \cdot M\right) \cdot \frac{D \cdot M}{\left(d\_m + d\_m\right) \cdot \left(d\_m + d\_m\right)}\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 (pow (/ d_m l) (/ 1.0 2.0)))
        (t_1
         (-
          1.0
          (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l)))))
   (if (<= (* (* (pow (/ d_m h) (/ 1.0 2.0)) t_0) t_1) 5e+197)
     (* (* (/ (sqrt d_m) (sqrt h)) t_0) t_1)
     (*
      (* d_m (sqrt (/ 1.0 (* h l))))
      (-
       1.0
       (/
        (* (* (* (* D M) (/ (* D M) (* (+ d_m d_m) (+ d_m d_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 = pow((d_m / l), (1.0 / 2.0));
	double t_1 = 1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l));
	double tmp;
	if (((pow((d_m / h), (1.0 / 2.0)) * t_0) * t_1) <= 5e+197) {
		tmp = ((sqrt(d_m) / sqrt(h)) * t_0) * t_1;
	} else {
		tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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_m / l) ** (1.0d0 / 2.0d0)
    t_1 = 1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l))
    if (((((d_m / h) ** (1.0d0 / 2.0d0)) * t_0) * t_1) <= 5d+197) then
        tmp = ((sqrt(d_m) / sqrt(h)) * t_0) * t_1
    else
        tmp = (d_m * sqrt((1.0d0 / (h * l)))) * (1.0d0 - (((((d * m) * ((d * m) / ((d_m + d_m) * (d_m + d_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 = Math.pow((d_m / l), (1.0 / 2.0));
	double t_1 = 1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l));
	double tmp;
	if (((Math.pow((d_m / h), (1.0 / 2.0)) * t_0) * t_1) <= 5e+197) {
		tmp = ((Math.sqrt(d_m) / Math.sqrt(h)) * t_0) * t_1;
	} else {
		tmp = (d_m * Math.sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_m)))) * 0.5) * h) / l));
	}
	return tmp;
}
d_m = math.fabs(d)
def code(d_m, h, l, M, D):
	t_0 = math.pow((d_m / l), (1.0 / 2.0))
	t_1 = 1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l))
	tmp = 0
	if ((math.pow((d_m / h), (1.0 / 2.0)) * t_0) * t_1) <= 5e+197:
		tmp = ((math.sqrt(d_m) / math.sqrt(h)) * t_0) * t_1
	else:
		tmp = (d_m * math.sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_m)))) * 0.5) * h) / l))
	return tmp
d_m = abs(d)
function code(d_m, h, l, M, D)
	t_0 = Float64(d_m / l) ^ Float64(1.0 / 2.0)
	t_1 = Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))
	tmp = 0.0
	if (Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * t_0) * t_1) <= 5e+197)
		tmp = Float64(Float64(Float64(sqrt(d_m) / sqrt(h)) * t_0) * t_1);
	else
		tmp = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D * M) * Float64(Float64(D * M) / Float64(Float64(d_m + d_m) * Float64(d_m + d_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_m / l) ^ (1.0 / 2.0);
	t_1 = 1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d_m)) ^ 2.0)) * (h / l));
	tmp = 0.0;
	if (((((d_m / h) ^ (1.0 / 2.0)) * t_0) * t_1) <= 5e+197)
		tmp = ((sqrt(d_m) / sqrt(h)) * t_0) * t_1;
	else
		tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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[Power[N[(d$95$m / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[N[(N[(N[Power[N[(d$95$m / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], 5e+197], N[(N[(N[(N[Sqrt[d$95$m], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $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[(D * M), $MachinePrecision] * N[(N[(D * M), $MachinePrecision] / N[(N[(d$95$m + d$95$m), $MachinePrecision] * N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|

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

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

    1. Initial program 35.1%

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

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

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

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

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

    if 5.00000000000000009e197 < (*.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 35.1%

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

        \[\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 rewrites42.9%

      \[\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.5

        \[\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.5%

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

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

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

Alternative 2: 71.4% accurate, 0.6× 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}\\ \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 t\_0 \leq 5 \cdot 10^{+197}:\\ \;\;\;\;\left(\sqrt{\frac{d\_m}{\ell}} \cdot \sqrt{\frac{d\_m}{h}}\right) \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(1 - \frac{\left(\left(\left(D \cdot M\right) \cdot \frac{D \cdot M}{\left(d\_m + d\_m\right) \cdot \left(d\_m + d\_m\right)}\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)))))
   (if (<=
        (* (* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0))) t_0)
        5e+197)
     (* (* (sqrt (/ d_m l)) (sqrt (/ d_m h))) t_0)
     (*
      (* d_m (sqrt (/ 1.0 (* h l))))
      (-
       1.0
       (/
        (* (* (* (* D M) (/ (* D M) (* (+ d_m d_m) (+ d_m d_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 tmp;
	if (((pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * t_0) <= 5e+197) {
		tmp = (sqrt((d_m / l)) * sqrt((d_m / h))) * t_0;
	} else {
		tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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) :: tmp
    t_0 = 1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l))
    if (((((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * t_0) <= 5d+197) then
        tmp = (sqrt((d_m / l)) * sqrt((d_m / h))) * t_0
    else
        tmp = (d_m * sqrt((1.0d0 / (h * l)))) * (1.0d0 - (((((d * m) * ((d * m) / ((d_m + d_m) * (d_m + d_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 tmp;
	if (((Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * t_0) <= 5e+197) {
		tmp = (Math.sqrt((d_m / l)) * Math.sqrt((d_m / h))) * t_0;
	} else {
		tmp = (d_m * Math.sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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))
	tmp = 0
	if ((math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * t_0) <= 5e+197:
		tmp = (math.sqrt((d_m / l)) * math.sqrt((d_m / h))) * t_0
	else:
		tmp = (d_m * math.sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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)))
	tmp = 0.0
	if (Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * t_0) <= 5e+197)
		tmp = Float64(Float64(sqrt(Float64(d_m / l)) * sqrt(Float64(d_m / h))) * t_0);
	else
		tmp = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D * M) * Float64(Float64(D * M) / Float64(Float64(d_m + d_m) * Float64(d_m + d_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));
	tmp = 0.0;
	if (((((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * t_0) <= 5e+197)
		tmp = (sqrt((d_m / l)) * sqrt((d_m / h))) * t_0;
	else
		tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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]}, 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] * t$95$0), $MachinePrecision], 5e+197], N[(N[(N[Sqrt[N[(d$95$m / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d$95$m / h), $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[(D * M), $MachinePrecision] * N[(N[(D * M), $MachinePrecision] / N[(N[(d$95$m + d$95$m), $MachinePrecision] * N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}\\
\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 t\_0 \leq 5 \cdot 10^{+197}:\\
\;\;\;\;\left(\sqrt{\frac{d\_m}{\ell}} \cdot \sqrt{\frac{d\_m}{h}}\right) \cdot t\_0\\

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

    1. Initial program 35.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.00000000000000009e197 < (*.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 35.1%

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

        \[\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 rewrites42.9%

      \[\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.5

        \[\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.5%

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

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

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

Alternative 3: 71.2% accurate, 0.6× 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}\\ \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 t\_0 \leq 2 \cdot 10^{+144}:\\ \;\;\;\;\frac{d\_m \cdot \sqrt{\frac{h}{\ell}}}{h} \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(1 - \frac{\left(\left(\left(D \cdot M\right) \cdot \frac{D \cdot M}{\left(d\_m + d\_m\right) \cdot \left(d\_m + d\_m\right)}\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)))))
   (if (<=
        (* (* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0))) t_0)
        2e+144)
     (* (/ (* d_m (sqrt (/ h l))) h) t_0)
     (*
      (* d_m (sqrt (/ 1.0 (* h l))))
      (-
       1.0
       (/
        (* (* (* (* D M) (/ (* D M) (* (+ d_m d_m) (+ d_m d_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 tmp;
	if (((pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * t_0) <= 2e+144) {
		tmp = ((d_m * sqrt((h / l))) / h) * t_0;
	} else {
		tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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) :: tmp
    t_0 = 1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l))
    if (((((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * t_0) <= 2d+144) then
        tmp = ((d_m * sqrt((h / l))) / h) * t_0
    else
        tmp = (d_m * sqrt((1.0d0 / (h * l)))) * (1.0d0 - (((((d * m) * ((d * m) / ((d_m + d_m) * (d_m + d_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 tmp;
	if (((Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * t_0) <= 2e+144) {
		tmp = ((d_m * Math.sqrt((h / l))) / h) * t_0;
	} else {
		tmp = (d_m * Math.sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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))
	tmp = 0
	if ((math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * t_0) <= 2e+144:
		tmp = ((d_m * math.sqrt((h / l))) / h) * t_0
	else:
		tmp = (d_m * math.sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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)))
	tmp = 0.0
	if (Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * t_0) <= 2e+144)
		tmp = Float64(Float64(Float64(d_m * sqrt(Float64(h / l))) / h) * t_0);
	else
		tmp = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D * M) * Float64(Float64(D * M) / Float64(Float64(d_m + d_m) * Float64(d_m + d_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));
	tmp = 0.0;
	if (((((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * t_0) <= 2e+144)
		tmp = ((d_m * sqrt((h / l))) / h) * t_0;
	else
		tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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]}, 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] * t$95$0), $MachinePrecision], 2e+144], N[(N[(N[(d$95$m * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $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[(D * M), $MachinePrecision] * N[(N[(D * M), $MachinePrecision] / N[(N[(d$95$m + d$95$m), $MachinePrecision] * N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}\\
\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 t\_0 \leq 2 \cdot 10^{+144}:\\
\;\;\;\;\frac{d\_m \cdot \sqrt{\frac{h}{\ell}}}{h} \cdot t\_0\\

\mathbf{else}:\\
\;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(1 - \frac{\left(\left(\left(D \cdot M\right) \cdot \frac{D \cdot M}{\left(d\_m + d\_m\right) \cdot \left(d\_m + d\_m\right)}\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.00000000000000005e144

    1. Initial program 35.1%

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

        \[\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 rewrites42.9%

      \[\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.5

        \[\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.5%

      \[\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. Taylor expanded in h around 0

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

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

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

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

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

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

    if 2.00000000000000005e144 < (*.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 35.1%

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

        \[\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 rewrites42.9%

      \[\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.5

        \[\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.5%

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

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

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

Alternative 4: 71.0% accurate, 0.6× speedup?

\[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := \frac{D}{d\_m + d\_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 2 \cdot 10^{+144}:\\ \;\;\;\;\sqrt{\frac{d\_m}{h}} \cdot \left(\frac{\sqrt{d\_m}}{\sqrt{\ell}} \cdot \left(1 - \left(\left(\left(\left(t\_0 \cdot M\right) \cdot t\_0\right) \cdot M\right) \cdot 0.5\right) \cdot \frac{h}{\ell}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(1 - \frac{\left(\left(\left(D \cdot M\right) \cdot \frac{D \cdot M}{\left(d\_m + d\_m\right) \cdot \left(d\_m + d\_m\right)}\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))))
   (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))))
        2e+144)
     (*
      (sqrt (/ d_m h))
      (*
       (/ (sqrt d_m) (sqrt l))
       (- 1.0 (* (* (* (* (* t_0 M) t_0) M) 0.5) (/ h l)))))
     (*
      (* d_m (sqrt (/ 1.0 (* h l))))
      (-
       1.0
       (/
        (* (* (* (* D M) (/ (* D M) (* (+ d_m d_m) (+ d_m d_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 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)))) <= 2e+144) {
		tmp = sqrt((d_m / h)) * ((sqrt(d_m) / sqrt(l)) * (1.0 - (((((t_0 * M) * t_0) * M) * 0.5) * (h / l))));
	} else {
		tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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) :: tmp
    t_0 = d / (d_m + d_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)))) <= 2d+144) then
        tmp = sqrt((d_m / h)) * ((sqrt(d_m) / sqrt(l)) * (1.0d0 - (((((t_0 * m) * t_0) * m) * 0.5d0) * (h / l))))
    else
        tmp = (d_m * sqrt((1.0d0 / (h * l)))) * (1.0d0 - (((((d * m) * ((d * m) / ((d_m + d_m) * (d_m + d_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 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)))) <= 2e+144) {
		tmp = Math.sqrt((d_m / h)) * ((Math.sqrt(d_m) / Math.sqrt(l)) * (1.0 - (((((t_0 * M) * t_0) * M) * 0.5) * (h / l))));
	} else {
		tmp = (d_m * Math.sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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)
	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)))) <= 2e+144:
		tmp = math.sqrt((d_m / h)) * ((math.sqrt(d_m) / math.sqrt(l)) * (1.0 - (((((t_0 * M) * t_0) * M) * 0.5) * (h / l))))
	else:
		tmp = (d_m * math.sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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))
	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)))) <= 2e+144)
		tmp = Float64(sqrt(Float64(d_m / h)) * Float64(Float64(sqrt(d_m) / sqrt(l)) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(t_0 * M) * t_0) * M) * 0.5) * Float64(h / l)))));
	else
		tmp = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D * M) * Float64(Float64(D * M) / Float64(Float64(d_m + d_m) * Float64(d_m + d_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);
	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)))) <= 2e+144)
		tmp = sqrt((d_m / h)) * ((sqrt(d_m) / sqrt(l)) * (1.0 - (((((t_0 * M) * t_0) * M) * 0.5) * (h / l))));
	else
		tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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]}, 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], 2e+144], N[(N[Sqrt[N[(d$95$m / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[d$95$m], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(t$95$0 * M), $MachinePrecision] * t$95$0), $MachinePrecision] * M), $MachinePrecision] * 0.5), $MachinePrecision] * N[(h / l), $MachinePrecision]), $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[(D * M), $MachinePrecision] * N[(N[(D * M), $MachinePrecision] / N[(N[(d$95$m + d$95$m), $MachinePrecision] * N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}\\
\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 2 \cdot 10^{+144}:\\
\;\;\;\;\sqrt{\frac{d\_m}{h}} \cdot \left(\frac{\sqrt{d\_m}}{\sqrt{\ell}} \cdot \left(1 - \left(\left(\left(\left(t\_0 \cdot M\right) \cdot t\_0\right) \cdot M\right) \cdot 0.5\right) \cdot \frac{h}{\ell}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(1 - \frac{\left(\left(\left(D \cdot M\right) \cdot \frac{D \cdot M}{\left(d\_m + d\_m\right) \cdot \left(d\_m + d\_m\right)}\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.00000000000000005e144

    1. Initial program 35.1%

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

        \[\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 rewrites42.9%

      \[\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. Applied rewrites32.1%

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

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

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

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

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

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

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

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

    if 2.00000000000000005e144 < (*.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 35.1%

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

        \[\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 rewrites42.9%

      \[\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.5

        \[\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.5%

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

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

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

Alternative 5: 70.6% accurate, 0.6× speedup?

\[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := \frac{D}{d\_m + d\_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 5 \cdot 10^{+197}:\\ \;\;\;\;\sqrt{\frac{d\_m}{h}} \cdot \left(\sqrt{\frac{d\_m}{\ell}} \cdot \left(1 - \left(\left(\left(\left(t\_0 \cdot M\right) \cdot t\_0\right) \cdot M\right) \cdot 0.5\right) \cdot \frac{h}{\ell}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(1 - \frac{\left(\left(\left(D \cdot M\right) \cdot \frac{D \cdot M}{\left(d\_m + d\_m\right) \cdot \left(d\_m + d\_m\right)}\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))))
   (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+197)
     (*
      (sqrt (/ d_m h))
      (* (sqrt (/ d_m l)) (- 1.0 (* (* (* (* (* t_0 M) t_0) M) 0.5) (/ h l)))))
     (*
      (* d_m (sqrt (/ 1.0 (* h l))))
      (-
       1.0
       (/
        (* (* (* (* D M) (/ (* D M) (* (+ d_m d_m) (+ d_m d_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 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+197) {
		tmp = sqrt((d_m / h)) * (sqrt((d_m / l)) * (1.0 - (((((t_0 * M) * t_0) * M) * 0.5) * (h / l))));
	} else {
		tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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) :: tmp
    t_0 = d / (d_m + d_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)))) <= 5d+197) then
        tmp = sqrt((d_m / h)) * (sqrt((d_m / l)) * (1.0d0 - (((((t_0 * m) * t_0) * m) * 0.5d0) * (h / l))))
    else
        tmp = (d_m * sqrt((1.0d0 / (h * l)))) * (1.0d0 - (((((d * m) * ((d * m) / ((d_m + d_m) * (d_m + d_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 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+197) {
		tmp = Math.sqrt((d_m / h)) * (Math.sqrt((d_m / l)) * (1.0 - (((((t_0 * M) * t_0) * M) * 0.5) * (h / l))));
	} else {
		tmp = (d_m * Math.sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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)
	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+197:
		tmp = math.sqrt((d_m / h)) * (math.sqrt((d_m / l)) * (1.0 - (((((t_0 * M) * t_0) * M) * 0.5) * (h / l))))
	else:
		tmp = (d_m * math.sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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))
	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+197)
		tmp = Float64(sqrt(Float64(d_m / h)) * Float64(sqrt(Float64(d_m / l)) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(t_0 * M) * t_0) * M) * 0.5) * Float64(h / l)))));
	else
		tmp = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D * M) * Float64(Float64(D * M) / Float64(Float64(d_m + d_m) * Float64(d_m + d_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);
	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+197)
		tmp = sqrt((d_m / h)) * (sqrt((d_m / l)) * (1.0 - (((((t_0 * M) * t_0) * M) * 0.5) * (h / l))));
	else
		tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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]}, 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+197], N[(N[Sqrt[N[(d$95$m / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d$95$m / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(t$95$0 * M), $MachinePrecision] * t$95$0), $MachinePrecision] * M), $MachinePrecision] * 0.5), $MachinePrecision] * N[(h / l), $MachinePrecision]), $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[(D * M), $MachinePrecision] * N[(N[(D * M), $MachinePrecision] / N[(N[(d$95$m + d$95$m), $MachinePrecision] * N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}\\
\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^{+197}:\\
\;\;\;\;\sqrt{\frac{d\_m}{h}} \cdot \left(\sqrt{\frac{d\_m}{\ell}} \cdot \left(1 - \left(\left(\left(\left(t\_0 \cdot M\right) \cdot t\_0\right) \cdot M\right) \cdot 0.5\right) \cdot \frac{h}{\ell}\right)\right)\\

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

    1. Initial program 35.1%

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

        \[\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 rewrites42.9%

      \[\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. Applied rewrites32.1%

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

    if 5.00000000000000009e197 < (*.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 35.1%

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

        \[\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 rewrites42.9%

      \[\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.5

        \[\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.5%

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

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

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

Alternative 6: 69.8% accurate, 0.4× speedup?

\[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := \frac{D}{d\_m + d\_m}\\ t_1 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_1 \leq 0:\\ \;\;\;\;\left(1 - \left(\left(\left(\left(t\_0 \cdot M\right) \cdot t\_0\right) \cdot M\right) \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \cdot \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right)\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+197}:\\ \;\;\;\;\sqrt{\frac{d\_m}{h}} \cdot \sqrt{\frac{d\_m}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(1 - \frac{\left(\left(\left(D \cdot M\right) \cdot \frac{D \cdot M}{\left(d\_m + d\_m\right) \cdot \left(d\_m + d\_m\right)}\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
         (*
          (* (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))))))
   (if (<= t_1 0.0)
     (*
      (- 1.0 (* (* (* (* (* t_0 M) t_0) M) 0.5) (/ h l)))
      (* (sqrt (/ 1.0 (* l h))) d_m))
     (if (<= t_1 5e+197)
       (* (sqrt (/ d_m h)) (sqrt (/ d_m l)))
       (*
        (* d_m (sqrt (/ 1.0 (* h l))))
        (-
         1.0
         (/
          (* (* (* (* D M) (/ (* D M) (* (+ d_m d_m) (+ d_m d_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 = (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)));
	double tmp;
	if (t_1 <= 0.0) {
		tmp = (1.0 - (((((t_0 * M) * t_0) * M) * 0.5) * (h / l))) * (sqrt((1.0 / (l * h))) * d_m);
	} else if (t_1 <= 5e+197) {
		tmp = sqrt((d_m / h)) * sqrt((d_m / l));
	} else {
		tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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 = (((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)))
    if (t_1 <= 0.0d0) then
        tmp = (1.0d0 - (((((t_0 * m) * t_0) * m) * 0.5d0) * (h / l))) * (sqrt((1.0d0 / (l * h))) * d_m)
    else if (t_1 <= 5d+197) then
        tmp = sqrt((d_m / h)) * sqrt((d_m / l))
    else
        tmp = (d_m * sqrt((1.0d0 / (h * l)))) * (1.0d0 - (((((d * m) * ((d * m) / ((d_m + d_m) * (d_m + d_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 = (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)));
	double tmp;
	if (t_1 <= 0.0) {
		tmp = (1.0 - (((((t_0 * M) * t_0) * M) * 0.5) * (h / l))) * (Math.sqrt((1.0 / (l * h))) * d_m);
	} else if (t_1 <= 5e+197) {
		tmp = Math.sqrt((d_m / h)) * Math.sqrt((d_m / l));
	} else {
		tmp = (d_m * Math.sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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 = (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)))
	tmp = 0
	if t_1 <= 0.0:
		tmp = (1.0 - (((((t_0 * M) * t_0) * M) * 0.5) * (h / l))) * (math.sqrt((1.0 / (l * h))) * d_m)
	elif t_1 <= 5e+197:
		tmp = math.sqrt((d_m / h)) * math.sqrt((d_m / l))
	else:
		tmp = (d_m * math.sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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(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))))
	tmp = 0.0
	if (t_1 <= 0.0)
		tmp = Float64(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(t_0 * M) * t_0) * M) * 0.5) * Float64(h / l))) * Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m));
	elseif (t_1 <= 5e+197)
		tmp = Float64(sqrt(Float64(d_m / h)) * sqrt(Float64(d_m / l)));
	else
		tmp = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D * M) * Float64(Float64(D * M) / Float64(Float64(d_m + d_m) * Float64(d_m + d_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 = (((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)));
	tmp = 0.0;
	if (t_1 <= 0.0)
		tmp = (1.0 - (((((t_0 * M) * t_0) * M) * 0.5) * (h / l))) * (sqrt((1.0 / (l * h))) * d_m);
	elseif (t_1 <= 5e+197)
		tmp = sqrt((d_m / h)) * sqrt((d_m / l));
	else
		tmp = (d_m * sqrt((1.0 / (h * l)))) * (1.0 - (((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_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[(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]}, If[LessEqual[t$95$1, 0.0], N[(N[(1.0 - N[(N[(N[(N[(N[(t$95$0 * M), $MachinePrecision] * t$95$0), $MachinePrecision] * M), $MachinePrecision] * 0.5), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+197], N[(N[Sqrt[N[(d$95$m / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d$95$m / l), $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[(D * M), $MachinePrecision] * N[(N[(D * M), $MachinePrecision] / N[(N[(d$95$m + d$95$m), $MachinePrecision] * N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 := \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)\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\left(1 - \left(\left(\left(\left(t\_0 \cdot M\right) \cdot t\_0\right) \cdot M\right) \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \cdot \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right)\\

\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+197}:\\
\;\;\;\;\sqrt{\frac{d\_m}{h}} \cdot \sqrt{\frac{d\_m}{\ell}}\\

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


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

    1. Initial program 35.1%

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

        \[\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 rewrites42.9%

      \[\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.5

        \[\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.5%

      \[\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 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \color{blue}{\frac{h}{\ell}}\right) \]
      2. div-flipN/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 \color{blue}{\frac{1}{\frac{\ell}{h}}}\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 \color{blue}{\frac{1}{\frac{\ell}{h}}}\right) \]
      4. lower-/.f6469.3

        \[\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{1}{\color{blue}{\frac{\ell}{h}}}\right) \]
    8. Applied rewrites69.3%

      \[\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 \color{blue}{\frac{1}{\frac{\ell}{h}}}\right) \]
    9. Applied rewrites68.2%

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

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

    1. Initial program 35.1%

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

        \[\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 rewrites42.9%

      \[\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.2

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    7. Step-by-step derivation
      1. times-frac10.2

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

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

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

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

        \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      6. metadata-eval10.2

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

        \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
      8. metadata-eval10.2

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
    9. Taylor expanded in l around inf

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

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

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

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

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

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

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

    if 5.00000000000000009e197 < (*.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 35.1%

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

        \[\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 rewrites42.9%

      \[\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.5

        \[\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.5%

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

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

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

Alternative 7: 67.3% accurate, 0.4× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_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)))) < -9.99999999999999965e-106 or 5.00000000000000009e197 < (*.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 35.1%

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

        \[\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 rewrites42.9%

      \[\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.5

        \[\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.5%

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

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

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

    if -9.99999999999999965e-106 < (*.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.00000000000000009e197

    1. Initial program 35.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{d} \cdot \left(\sqrt{\frac{1}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \]
    9. Applied rewrites22.5%

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

Alternative 8: 52.5% accurate, 1.7× speedup?

\[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := \left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot 1\\ \mathbf{if}\;d\_m \leq 3 \cdot 10^{-214}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d\_m \leq 9 \cdot 10^{+104}:\\ \;\;\;\;\mathsf{fma}\left(\left(\left(D \cdot M\right) \cdot \frac{D \cdot M}{\left(d\_m + d\_m\right) \cdot \left(d\_m + d\_m\right)}\right) \cdot -0.5, \frac{h}{\ell}, 1\right) \cdot \sqrt{d\_m \cdot \frac{d\_m}{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \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)))) 1.0)))
   (if (<= d_m 3e-214)
     t_0
     (if (<= d_m 9e+104)
       (*
        (fma
         (* (* (* D M) (/ (* D M) (* (+ d_m d_m) (+ d_m d_m)))) -0.5)
         (/ h l)
         1.0)
        (sqrt (* d_m (/ d_m (* l h)))))
       t_0))))
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)))) * 1.0;
	double tmp;
	if (d_m <= 3e-214) {
		tmp = t_0;
	} else if (d_m <= 9e+104) {
		tmp = fma((((D * M) * ((D * M) / ((d_m + d_m) * (d_m + d_m)))) * -0.5), (h / l), 1.0) * sqrt((d_m * (d_m / (l * h))));
	} else {
		tmp = t_0;
	}
	return tmp;
}
d_m = abs(d)
function code(d_m, h, l, M, D)
	t_0 = Float64(Float64(d_m * sqrt(Float64(1.0 / Float64(h * l)))) * 1.0)
	tmp = 0.0
	if (d_m <= 3e-214)
		tmp = t_0;
	elseif (d_m <= 9e+104)
		tmp = Float64(fma(Float64(Float64(Float64(D * M) * Float64(Float64(D * M) / Float64(Float64(d_m + d_m) * Float64(d_m + d_m)))) * -0.5), Float64(h / l), 1.0) * sqrt(Float64(d_m * Float64(d_m / Float64(l * h)))));
	else
		tmp = t_0;
	end
	return tmp
end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(d$95$m * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[d$95$m, 3e-214], t$95$0, If[LessEqual[d$95$m, 9e+104], N[(N[(N[(N[(N[(D * M), $MachinePrecision] * N[(N[(D * M), $MachinePrecision] / N[(N[(d$95$m + d$95$m), $MachinePrecision] * N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision] * N[(h / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d$95$m * N[(d$95$m / N[(l * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
d_m = \left|d\right|

\\
\begin{array}{l}
t_0 := \left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot 1\\
\mathbf{if}\;d\_m \leq 3 \cdot 10^{-214}:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < 2.99999999999999994e-214 or 8.9999999999999997e104 < d

    1. Initial program 35.1%

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

        \[\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 rewrites42.9%

      \[\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.5

        \[\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.5%

      \[\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. Taylor expanded in d around inf

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

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

      if 2.99999999999999994e-214 < d < 8.9999999999999997e104

      1. Initial program 35.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 9: 49.0% accurate, 0.4× speedup?

    \[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-202}:\\ \;\;\;\;\frac{\left(\sqrt{d\_m} \cdot \sqrt{h}\right) \cdot \left(-1 \cdot \left(d\_m \cdot \sqrt{\frac{1}{d\_m \cdot \ell}}\right)\right)}{h}\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+197}:\\ \;\;\;\;\sqrt{d\_m} \cdot \left(\sqrt{\frac{1}{h}} \cdot \sqrt{\frac{d\_m}{\ell}}\right)\\ \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
     (let* ((t_0
             (*
              (* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
              (-
               1.0
               (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))))
       (if (<= t_0 -2e-202)
         (/
          (* (* (sqrt d_m) (sqrt h)) (* -1.0 (* d_m (sqrt (/ 1.0 (* d_m l))))))
          h)
         (if (<= t_0 5e+197)
           (* (sqrt d_m) (* (sqrt (/ 1.0 h)) (sqrt (/ d_m l))))
           (* (* 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 t_0 = (pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
    	double tmp;
    	if (t_0 <= -2e-202) {
    		tmp = ((sqrt(d_m) * sqrt(h)) * (-1.0 * (d_m * sqrt((1.0 / (d_m * l)))))) / h;
    	} else if (t_0 <= 5e+197) {
    		tmp = sqrt(d_m) * (sqrt((1.0 / h)) * sqrt((d_m / l)));
    	} 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) :: t_0
        real(8) :: tmp
        t_0 = (((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))
        if (t_0 <= (-2d-202)) then
            tmp = ((sqrt(d_m) * sqrt(h)) * ((-1.0d0) * (d_m * sqrt((1.0d0 / (d_m * l)))))) / h
        else if (t_0 <= 5d+197) then
            tmp = sqrt(d_m) * (sqrt((1.0d0 / h)) * sqrt((d_m / l)))
        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 t_0 = (Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
    	double tmp;
    	if (t_0 <= -2e-202) {
    		tmp = ((Math.sqrt(d_m) * Math.sqrt(h)) * (-1.0 * (d_m * Math.sqrt((1.0 / (d_m * l)))))) / h;
    	} else if (t_0 <= 5e+197) {
    		tmp = Math.sqrt(d_m) * (Math.sqrt((1.0 / h)) * Math.sqrt((d_m / l)));
    	} 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):
    	t_0 = (math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)))
    	tmp = 0
    	if t_0 <= -2e-202:
    		tmp = ((math.sqrt(d_m) * math.sqrt(h)) * (-1.0 * (d_m * math.sqrt((1.0 / (d_m * l)))))) / h
    	elif t_0 <= 5e+197:
    		tmp = math.sqrt(d_m) * (math.sqrt((1.0 / h)) * math.sqrt((d_m / l)))
    	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)
    	t_0 = Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l))))
    	tmp = 0.0
    	if (t_0 <= -2e-202)
    		tmp = Float64(Float64(Float64(sqrt(d_m) * sqrt(h)) * Float64(-1.0 * Float64(d_m * sqrt(Float64(1.0 / Float64(d_m * l)))))) / h);
    	elseif (t_0 <= 5e+197)
    		tmp = Float64(sqrt(d_m) * Float64(sqrt(Float64(1.0 / h)) * sqrt(Float64(d_m / l))));
    	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)
    	t_0 = (((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)));
    	tmp = 0.0;
    	if (t_0 <= -2e-202)
    		tmp = ((sqrt(d_m) * sqrt(h)) * (-1.0 * (d_m * sqrt((1.0 / (d_m * l)))))) / h;
    	elseif (t_0 <= 5e+197)
    		tmp = sqrt(d_m) * (sqrt((1.0 / h)) * sqrt((d_m / l)));
    	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_] := Block[{t$95$0 = N[(N[(N[Power[N[(d$95$m / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d$95$m / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-202], N[(N[(N[(N[Sqrt[d$95$m], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(-1.0 * N[(d$95$m * N[Sqrt[N[(1.0 / N[(d$95$m * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$0, 5e+197], N[(N[Sqrt[d$95$m], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d$95$m / l), $MachinePrecision]], $MachinePrecision]), $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}
    t_0 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
    \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-202}:\\
    \;\;\;\;\frac{\left(\sqrt{d\_m} \cdot \sqrt{h}\right) \cdot \left(-1 \cdot \left(d\_m \cdot \sqrt{\frac{1}{d\_m \cdot \ell}}\right)\right)}{h}\\
    
    \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+197}:\\
    \;\;\;\;\sqrt{d\_m} \cdot \left(\sqrt{\frac{1}{h}} \cdot \sqrt{\frac{d\_m}{\ell}}\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot 1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.0000000000000001e-202

      1. Initial program 35.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -2.0000000000000001e-202 < (*.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.00000000000000009e197

      1. Initial program 35.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \sqrt{d} \cdot \left(\sqrt{\frac{1}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \]
      9. Applied rewrites22.5%

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

      if 5.00000000000000009e197 < (*.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 35.1%

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

          \[\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 rewrites42.9%

        \[\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.5

          \[\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.5%

        \[\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. Taylor expanded in d around inf

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

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

      Alternative 10: 48.6% accurate, 0.4× speedup?

      \[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-202}:\\ \;\;\;\;\frac{\sqrt{d\_m \cdot h} \cdot \left(-1 \cdot \left(d\_m \cdot \sqrt{\frac{1}{d\_m \cdot \ell}}\right)\right)}{h}\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+197}:\\ \;\;\;\;\sqrt{d\_m} \cdot \left(\sqrt{\frac{1}{h}} \cdot \sqrt{\frac{d\_m}{\ell}}\right)\\ \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
       (let* ((t_0
               (*
                (* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
                (-
                 1.0
                 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))))
         (if (<= t_0 -2e-202)
           (/ (* (sqrt (* d_m h)) (* -1.0 (* d_m (sqrt (/ 1.0 (* d_m l)))))) h)
           (if (<= t_0 5e+197)
             (* (sqrt d_m) (* (sqrt (/ 1.0 h)) (sqrt (/ d_m l))))
             (* (* 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 t_0 = (pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
      	double tmp;
      	if (t_0 <= -2e-202) {
      		tmp = (sqrt((d_m * h)) * (-1.0 * (d_m * sqrt((1.0 / (d_m * l)))))) / h;
      	} else if (t_0 <= 5e+197) {
      		tmp = sqrt(d_m) * (sqrt((1.0 / h)) * sqrt((d_m / l)));
      	} 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) :: t_0
          real(8) :: tmp
          t_0 = (((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))
          if (t_0 <= (-2d-202)) then
              tmp = (sqrt((d_m * h)) * ((-1.0d0) * (d_m * sqrt((1.0d0 / (d_m * l)))))) / h
          else if (t_0 <= 5d+197) then
              tmp = sqrt(d_m) * (sqrt((1.0d0 / h)) * sqrt((d_m / l)))
          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 t_0 = (Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
      	double tmp;
      	if (t_0 <= -2e-202) {
      		tmp = (Math.sqrt((d_m * h)) * (-1.0 * (d_m * Math.sqrt((1.0 / (d_m * l)))))) / h;
      	} else if (t_0 <= 5e+197) {
      		tmp = Math.sqrt(d_m) * (Math.sqrt((1.0 / h)) * Math.sqrt((d_m / l)));
      	} 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):
      	t_0 = (math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)))
      	tmp = 0
      	if t_0 <= -2e-202:
      		tmp = (math.sqrt((d_m * h)) * (-1.0 * (d_m * math.sqrt((1.0 / (d_m * l)))))) / h
      	elif t_0 <= 5e+197:
      		tmp = math.sqrt(d_m) * (math.sqrt((1.0 / h)) * math.sqrt((d_m / l)))
      	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)
      	t_0 = Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l))))
      	tmp = 0.0
      	if (t_0 <= -2e-202)
      		tmp = Float64(Float64(sqrt(Float64(d_m * h)) * Float64(-1.0 * Float64(d_m * sqrt(Float64(1.0 / Float64(d_m * l)))))) / h);
      	elseif (t_0 <= 5e+197)
      		tmp = Float64(sqrt(d_m) * Float64(sqrt(Float64(1.0 / h)) * sqrt(Float64(d_m / l))));
      	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)
      	t_0 = (((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)));
      	tmp = 0.0;
      	if (t_0 <= -2e-202)
      		tmp = (sqrt((d_m * h)) * (-1.0 * (d_m * sqrt((1.0 / (d_m * l)))))) / h;
      	elseif (t_0 <= 5e+197)
      		tmp = sqrt(d_m) * (sqrt((1.0 / h)) * sqrt((d_m / l)));
      	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_] := Block[{t$95$0 = N[(N[(N[Power[N[(d$95$m / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d$95$m / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-202], N[(N[(N[Sqrt[N[(d$95$m * h), $MachinePrecision]], $MachinePrecision] * N[(-1.0 * N[(d$95$m * N[Sqrt[N[(1.0 / N[(d$95$m * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$0, 5e+197], N[(N[Sqrt[d$95$m], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d$95$m / l), $MachinePrecision]], $MachinePrecision]), $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}
      t_0 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
      \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-202}:\\
      \;\;\;\;\frac{\sqrt{d\_m \cdot h} \cdot \left(-1 \cdot \left(d\_m \cdot \sqrt{\frac{1}{d\_m \cdot \ell}}\right)\right)}{h}\\
      
      \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+197}:\\
      \;\;\;\;\sqrt{d\_m} \cdot \left(\sqrt{\frac{1}{h}} \cdot \sqrt{\frac{d\_m}{\ell}}\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot 1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.0000000000000001e-202

        1. Initial program 35.1%

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

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

          \[\leadsto \color{blue}{\frac{\sqrt{d \cdot h} \cdot \sqrt{\frac{d}{\ell}}}{h}} \]
        5. Taylor expanded in d around -inf

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

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

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

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

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

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

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

        if -2.0000000000000001e-202 < (*.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.00000000000000009e197

        1. Initial program 35.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \sqrt{d} \cdot \left(\sqrt{\frac{1}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \]
        9. Applied rewrites22.5%

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

        if 5.00000000000000009e197 < (*.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 35.1%

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

            \[\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 rewrites42.9%

          \[\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.5

            \[\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.5%

          \[\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. Taylor expanded in d around inf

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

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

        Alternative 11: 48.4% accurate, 0.4× speedup?

        \[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-202}:\\ \;\;\;\;-1 \cdot \frac{d\_m \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+197}:\\ \;\;\;\;\sqrt{d\_m} \cdot \left(\sqrt{\frac{1}{h}} \cdot \sqrt{\frac{d\_m}{\ell}}\right)\\ \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
         (let* ((t_0
                 (*
                  (* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
                  (-
                   1.0
                   (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))))
           (if (<= t_0 -2e-202)
             (* -1.0 (/ (* d_m (sqrt (/ h l))) h))
             (if (<= t_0 5e+197)
               (* (sqrt d_m) (* (sqrt (/ 1.0 h)) (sqrt (/ d_m l))))
               (* (* 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 t_0 = (pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
        	double tmp;
        	if (t_0 <= -2e-202) {
        		tmp = -1.0 * ((d_m * sqrt((h / l))) / h);
        	} else if (t_0 <= 5e+197) {
        		tmp = sqrt(d_m) * (sqrt((1.0 / h)) * sqrt((d_m / l)));
        	} 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) :: t_0
            real(8) :: tmp
            t_0 = (((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))
            if (t_0 <= (-2d-202)) then
                tmp = (-1.0d0) * ((d_m * sqrt((h / l))) / h)
            else if (t_0 <= 5d+197) then
                tmp = sqrt(d_m) * (sqrt((1.0d0 / h)) * sqrt((d_m / l)))
            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 t_0 = (Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
        	double tmp;
        	if (t_0 <= -2e-202) {
        		tmp = -1.0 * ((d_m * Math.sqrt((h / l))) / h);
        	} else if (t_0 <= 5e+197) {
        		tmp = Math.sqrt(d_m) * (Math.sqrt((1.0 / h)) * Math.sqrt((d_m / l)));
        	} 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):
        	t_0 = (math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)))
        	tmp = 0
        	if t_0 <= -2e-202:
        		tmp = -1.0 * ((d_m * math.sqrt((h / l))) / h)
        	elif t_0 <= 5e+197:
        		tmp = math.sqrt(d_m) * (math.sqrt((1.0 / h)) * math.sqrt((d_m / l)))
        	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)
        	t_0 = Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l))))
        	tmp = 0.0
        	if (t_0 <= -2e-202)
        		tmp = Float64(-1.0 * Float64(Float64(d_m * sqrt(Float64(h / l))) / h));
        	elseif (t_0 <= 5e+197)
        		tmp = Float64(sqrt(d_m) * Float64(sqrt(Float64(1.0 / h)) * sqrt(Float64(d_m / l))));
        	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)
        	t_0 = (((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)));
        	tmp = 0.0;
        	if (t_0 <= -2e-202)
        		tmp = -1.0 * ((d_m * sqrt((h / l))) / h);
        	elseif (t_0 <= 5e+197)
        		tmp = sqrt(d_m) * (sqrt((1.0 / h)) * sqrt((d_m / l)));
        	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_] := Block[{t$95$0 = N[(N[(N[Power[N[(d$95$m / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d$95$m / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-202], N[(-1.0 * N[(N[(d$95$m * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+197], N[(N[Sqrt[d$95$m], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d$95$m / l), $MachinePrecision]], $MachinePrecision]), $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}
        t_0 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
        \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-202}:\\
        \;\;\;\;-1 \cdot \frac{d\_m \cdot \sqrt{\frac{h}{\ell}}}{h}\\
        
        \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+197}:\\
        \;\;\;\;\sqrt{d\_m} \cdot \left(\sqrt{\frac{1}{h}} \cdot \sqrt{\frac{d\_m}{\ell}}\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot 1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.0000000000000001e-202

          1. Initial program 35.1%

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

              \[\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 rewrites42.9%

            \[\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.2

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

            \[\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-/.f6426.1

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

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

          if -2.0000000000000001e-202 < (*.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.00000000000000009e197

          1. Initial program 35.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \sqrt{d} \cdot \left(\sqrt{\frac{1}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \]
          9. Applied rewrites22.5%

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

          if 5.00000000000000009e197 < (*.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 35.1%

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

              \[\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 rewrites42.9%

            \[\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.5

              \[\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.5%

            \[\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. Taylor expanded in d around inf

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

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

          Alternative 12: 48.3% accurate, 0.4× speedup?

          \[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-202}:\\ \;\;\;\;-1 \cdot \frac{d\_m \cdot \sqrt{\frac{h}{\ell}}}{h}\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+197}:\\ \;\;\;\;\sqrt{\frac{d\_m}{h}} \cdot \sqrt{\frac{d\_m}{\ell}}\\ \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
           (let* ((t_0
                   (*
                    (* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
                    (-
                     1.0
                     (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))))
             (if (<= t_0 -2e-202)
               (* -1.0 (/ (* d_m (sqrt (/ h l))) h))
               (if (<= t_0 5e+197)
                 (* (sqrt (/ d_m h)) (sqrt (/ d_m l)))
                 (* (* 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 t_0 = (pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
          	double tmp;
          	if (t_0 <= -2e-202) {
          		tmp = -1.0 * ((d_m * sqrt((h / l))) / h);
          	} else if (t_0 <= 5e+197) {
          		tmp = sqrt((d_m / h)) * sqrt((d_m / l));
          	} 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) :: t_0
              real(8) :: tmp
              t_0 = (((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))
              if (t_0 <= (-2d-202)) then
                  tmp = (-1.0d0) * ((d_m * sqrt((h / l))) / h)
              else if (t_0 <= 5d+197) then
                  tmp = sqrt((d_m / h)) * sqrt((d_m / l))
              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 t_0 = (Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
          	double tmp;
          	if (t_0 <= -2e-202) {
          		tmp = -1.0 * ((d_m * Math.sqrt((h / l))) / h);
          	} else if (t_0 <= 5e+197) {
          		tmp = Math.sqrt((d_m / h)) * Math.sqrt((d_m / l));
          	} 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):
          	t_0 = (math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)))
          	tmp = 0
          	if t_0 <= -2e-202:
          		tmp = -1.0 * ((d_m * math.sqrt((h / l))) / h)
          	elif t_0 <= 5e+197:
          		tmp = math.sqrt((d_m / h)) * math.sqrt((d_m / l))
          	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)
          	t_0 = Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l))))
          	tmp = 0.0
          	if (t_0 <= -2e-202)
          		tmp = Float64(-1.0 * Float64(Float64(d_m * sqrt(Float64(h / l))) / h));
          	elseif (t_0 <= 5e+197)
          		tmp = Float64(sqrt(Float64(d_m / h)) * sqrt(Float64(d_m / l)));
          	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)
          	t_0 = (((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)));
          	tmp = 0.0;
          	if (t_0 <= -2e-202)
          		tmp = -1.0 * ((d_m * sqrt((h / l))) / h);
          	elseif (t_0 <= 5e+197)
          		tmp = sqrt((d_m / h)) * sqrt((d_m / l));
          	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_] := Block[{t$95$0 = N[(N[(N[Power[N[(d$95$m / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d$95$m / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-202], N[(-1.0 * N[(N[(d$95$m * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+197], N[(N[Sqrt[N[(d$95$m / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d$95$m / l), $MachinePrecision]], $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}
          t_0 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
          \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-202}:\\
          \;\;\;\;-1 \cdot \frac{d\_m \cdot \sqrt{\frac{h}{\ell}}}{h}\\
          
          \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+197}:\\
          \;\;\;\;\sqrt{\frac{d\_m}{h}} \cdot \sqrt{\frac{d\_m}{\ell}}\\
          
          \mathbf{else}:\\
          \;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot 1\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2.0000000000000001e-202

            1. Initial program 35.1%

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

                \[\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 rewrites42.9%

              \[\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.2

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

              \[\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-/.f6426.1

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

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

            if -2.0000000000000001e-202 < (*.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.00000000000000009e197

            1. Initial program 35.1%

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

                \[\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 rewrites42.9%

              \[\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.2

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

              \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
            7. Step-by-step derivation
              1. times-frac10.2

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

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

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

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

                \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
              6. metadata-eval10.2

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

                \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
              8. metadata-eval10.2

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{-\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
            9. Taylor expanded in l around inf

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

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

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

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

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

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

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

            if 5.00000000000000009e197 < (*.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 35.1%

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

                \[\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 rewrites42.9%

              \[\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.5

                \[\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.5%

              \[\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. Taylor expanded in d around inf

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

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

            Alternative 13: 48.2% accurate, 0.4× speedup?

            \[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_0 \leq 0:\\ \;\;\;\;-\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+197}:\\ \;\;\;\;\sqrt{\frac{d\_m}{h}} \cdot \sqrt{\frac{d\_m}{\ell}}\\ \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
             (let* ((t_0
                     (*
                      (* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
                      (-
                       1.0
                       (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))))
               (if (<= t_0 0.0)
                 (- (* (sqrt (/ 1.0 (* l h))) d_m))
                 (if (<= t_0 5e+197)
                   (* (sqrt (/ d_m h)) (sqrt (/ d_m l)))
                   (* (* 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 t_0 = (pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
            	double tmp;
            	if (t_0 <= 0.0) {
            		tmp = -(sqrt((1.0 / (l * h))) * d_m);
            	} else if (t_0 <= 5e+197) {
            		tmp = sqrt((d_m / h)) * sqrt((d_m / l));
            	} 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) :: t_0
                real(8) :: tmp
                t_0 = (((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))
                if (t_0 <= 0.0d0) then
                    tmp = -(sqrt((1.0d0 / (l * h))) * d_m)
                else if (t_0 <= 5d+197) then
                    tmp = sqrt((d_m / h)) * sqrt((d_m / l))
                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 t_0 = (Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
            	double tmp;
            	if (t_0 <= 0.0) {
            		tmp = -(Math.sqrt((1.0 / (l * h))) * d_m);
            	} else if (t_0 <= 5e+197) {
            		tmp = Math.sqrt((d_m / h)) * Math.sqrt((d_m / l));
            	} 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):
            	t_0 = (math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)))
            	tmp = 0
            	if t_0 <= 0.0:
            		tmp = -(math.sqrt((1.0 / (l * h))) * d_m)
            	elif t_0 <= 5e+197:
            		tmp = math.sqrt((d_m / h)) * math.sqrt((d_m / l))
            	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)
            	t_0 = Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l))))
            	tmp = 0.0
            	if (t_0 <= 0.0)
            		tmp = Float64(-Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m));
            	elseif (t_0 <= 5e+197)
            		tmp = Float64(sqrt(Float64(d_m / h)) * sqrt(Float64(d_m / l)));
            	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)
            	t_0 = (((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)));
            	tmp = 0.0;
            	if (t_0 <= 0.0)
            		tmp = -(sqrt((1.0 / (l * h))) * d_m);
            	elseif (t_0 <= 5e+197)
            		tmp = sqrt((d_m / h)) * sqrt((d_m / l));
            	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_] := Block[{t$95$0 = N[(N[(N[Power[N[(d$95$m / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d$95$m / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], (-N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision]), If[LessEqual[t$95$0, 5e+197], N[(N[Sqrt[N[(d$95$m / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d$95$m / l), $MachinePrecision]], $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}
            t_0 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
            \mathbf{if}\;t\_0 \leq 0:\\
            \;\;\;\;-\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\\
            
            \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+197}:\\
            \;\;\;\;\sqrt{\frac{d\_m}{h}} \cdot \sqrt{\frac{d\_m}{\ell}}\\
            
            \mathbf{else}:\\
            \;\;\;\;\left(d\_m \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot 1\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0

              1. Initial program 35.1%

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

                  \[\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 rewrites42.9%

                \[\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.2

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

                \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
              7. Step-by-step derivation
                1. times-frac10.2

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

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

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

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

                  \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                6. metadata-eval10.2

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

                  \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                8. metadata-eval10.2

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

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

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

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

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

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

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

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

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

              1. Initial program 35.1%

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

                  \[\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 rewrites42.9%

                \[\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.2

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

                \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
              7. Step-by-step derivation
                1. times-frac10.2

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

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

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

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

                  \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                6. metadata-eval10.2

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

                  \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                8. metadata-eval10.2

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{-\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
              9. Taylor expanded in l around inf

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

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

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

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

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

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

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

              if 5.00000000000000009e197 < (*.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 35.1%

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

                  \[\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 rewrites42.9%

                \[\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.5

                  \[\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.5%

                \[\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. Taylor expanded in d around inf

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

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

              Alternative 14: 25.0% accurate, 5.1× speedup?

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

                1. Initial program 35.1%

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

                    \[\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 rewrites42.9%

                  \[\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.2

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

                  \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
                7. Step-by-step derivation
                  1. times-frac10.2

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

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

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

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

                    \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                  6. metadata-eval10.2

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

                    \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                  8. metadata-eval10.2

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

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

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

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

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

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

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

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

                if 1.0500000000000001e-238 < l

                1. Initial program 35.1%

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

                    \[\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 rewrites42.9%

                  \[\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.2

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

                  \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
                7. Step-by-step derivation
                  1. times-frac10.2

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

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

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

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

                    \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                  6. metadata-eval10.2

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

                    \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                  8. metadata-eval10.2

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{-\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                9. Taylor expanded in l around inf

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

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

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

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

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

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

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

              Alternative 15: 10.2% accurate, 7.1× speedup?

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

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

                  \[\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 rewrites42.9%

                \[\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.2

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

                \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
              7. Step-by-step derivation
                1. times-frac10.2

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

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

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

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

                  \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                6. metadata-eval10.2

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

                  \[\leadsto -1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \]
                8. metadata-eval10.2

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

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

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

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

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

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

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

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

              Reproduce

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