Henrywood and Agarwal, Equation (12)

Percentage Accurate: 65.8% → 74.8%
Time: 9.3s
Alternatives: 14
Speedup: 2.8×

Specification

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

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

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

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

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 14 alternatives:

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

Initial Program: 65.8% accurate, 1.0× speedup?

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

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

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

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

Alternative 1: 74.8% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(1 - \frac{\left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot 0.5\right) \cdot h}{\ell}\right) \cdot \left(\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\

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


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

    1. Initial program 56.2%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Applied rewrites56.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(\left(\left(\frac{D}{d} \cdot \frac{M}{2}\right) \cdot \left(\frac{D}{d} \cdot \color{blue}{\left(\frac{1}{2} \cdot M\right)}\right)\right) \cdot \frac{1}{2}\right)\right)\right) \]
    7. Step-by-step derivation
      1. lower-*.f6456.1

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.3e83 < l < -4.999999999999985e-310

    1. Initial program 72.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \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) \cdot \left(\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{\frac{-1}{2}}\right) \]
    8. Applied rewrites84.7%

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

    if -4.999999999999985e-310 < l

    1. Initial program 64.7%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Applied rewrites64.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(\left(\left(\frac{D}{d} \cdot \frac{M}{2}\right) \cdot \left(\frac{D}{d} \cdot \color{blue}{\left(\frac{1}{2} \cdot M\right)}\right)\right) \cdot \frac{1}{2}\right)\right)\right) \]
    7. Step-by-step derivation
      1. lower-*.f6464.1

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

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

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

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

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

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

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

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

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

Alternative 2: 66.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{h}{\ell}}\\ t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_1 \leq -1 \cdot 10^{-96}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 - \left(\frac{h}{\ell} \cdot \left(\left(\left(\frac{M}{2} \cdot \frac{D}{d}\right) \cdot \frac{D}{d}\right) \cdot \left(0.5 \cdot M\right)\right)\right) \cdot 0.5\right)\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+261}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;\frac{t\_0 \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{d \cdot \left(-t\_0\right)}{h}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ h l)))
        (t_1
         (*
          (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
          (-
           1.0
           (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))))
   (if (<= t_1 -1e-96)
     (*
      (sqrt (* (/ d l) (/ d h)))
      (-
       1.0
       (* (* (/ h l) (* (* (* (/ M 2.0) (/ D d)) (/ D d)) (* 0.5 M))) 0.5)))
     (if (<= t_1 5e+261)
       (* (sqrt (/ d h)) (sqrt (/ d l)))
       (if (<= t_1 INFINITY) (/ (* t_0 d) h) (/ (* d (- t_0)) h))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((h / l));
	double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
	double tmp;
	if (t_1 <= -1e-96) {
		tmp = sqrt(((d / l) * (d / h))) * (1.0 - (((h / l) * ((((M / 2.0) * (D / d)) * (D / d)) * (0.5 * M))) * 0.5));
	} else if (t_1 <= 5e+261) {
		tmp = sqrt((d / h)) * sqrt((d / l));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = (t_0 * d) / h;
	} else {
		tmp = (d * -t_0) / h;
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((h / l));
	double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
	double tmp;
	if (t_1 <= -1e-96) {
		tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 - (((h / l) * ((((M / 2.0) * (D / d)) * (D / d)) * (0.5 * M))) * 0.5));
	} else if (t_1 <= 5e+261) {
		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = (t_0 * d) / h;
	} else {
		tmp = (d * -t_0) / h;
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt((h / l))
	t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
	tmp = 0
	if t_1 <= -1e-96:
		tmp = math.sqrt(((d / l) * (d / h))) * (1.0 - (((h / l) * ((((M / 2.0) * (D / d)) * (D / d)) * (0.5 * M))) * 0.5))
	elif t_1 <= 5e+261:
		tmp = math.sqrt((d / h)) * math.sqrt((d / l))
	elif t_1 <= math.inf:
		tmp = (t_0 * d) / h
	else:
		tmp = (d * -t_0) / h
	return tmp
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(h / l))
	t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
	tmp = 0.0
	if (t_1 <= -1e-96)
		tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 - Float64(Float64(Float64(h / l) * Float64(Float64(Float64(Float64(M / 2.0) * Float64(D / d)) * Float64(D / d)) * Float64(0.5 * M))) * 0.5)));
	elseif (t_1 <= 5e+261)
		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
	elseif (t_1 <= Inf)
		tmp = Float64(Float64(t_0 * d) / h);
	else
		tmp = Float64(Float64(d * Float64(-t_0)) / h);
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((h / l));
	t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)));
	tmp = 0.0;
	if (t_1 <= -1e-96)
		tmp = sqrt(((d / l) * (d / h))) * (1.0 - (((h / l) * ((((M / 2.0) * (D / d)) * (D / d)) * (0.5 * M))) * 0.5));
	elseif (t_1 <= 5e+261)
		tmp = sqrt((d / h)) * sqrt((d / l));
	elseif (t_1 <= Inf)
		tmp = (t_0 * d) / h;
	else
		tmp = (d * -t_0) / h;
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-96], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(N[(h / l), $MachinePrecision] * N[(N[(N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+261], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(t$95$0 * d), $MachinePrecision] / h), $MachinePrecision], N[(N[(d * (-t$95$0)), $MachinePrecision] / h), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \left(-t\_0\right)}{h}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 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.9999999999999991e-97

    1. Initial program 86.5%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Applied rewrites85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(\left(\left(\frac{D}{d} \cdot \frac{M}{2}\right) \cdot \left(\frac{D}{d} \cdot \color{blue}{\left(\frac{1}{2} \cdot M\right)}\right)\right) \cdot \frac{1}{2}\right)\right)\right) \]
    7. Step-by-step derivation
      1. lower-*.f6485.5

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

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

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

    if -9.9999999999999991e-97 < (*.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.0000000000000001e261

    1. Initial program 87.9%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Applied rewrites87.3%

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

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

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

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

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

    if 5.0000000000000001e261 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

    1. Initial program 53.3%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

      \[\leadsto \frac{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
    7. Step-by-step derivation
      1. sqrt-pow2N/A

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

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

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

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

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

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

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

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

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

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

Alternative 3: 63.2% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ t_1 := \sqrt{\frac{h}{\ell}}\\ t_2 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_3 := \sqrt{\frac{d}{h}}\\ \mathbf{if}\;t\_2 \leq -2 \cdot 10^{-115}:\\ \;\;\;\;t\_3 \cdot \left(t\_0 \cdot \frac{-0.125 \cdot \left(\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot h\right)}{\left(d \cdot d\right) \cdot \ell}\right)\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+261}:\\ \;\;\;\;t\_3 \cdot t\_0\\ \mathbf{elif}\;t\_2 \leq \infty:\\ \;\;\;\;\frac{t\_1 \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{d \cdot \left(-t\_1\right)}{h}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d l)))
        (t_1 (sqrt (/ h l)))
        (t_2
         (*
          (* (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)))))
        (t_3 (sqrt (/ d h))))
   (if (<= t_2 -2e-115)
     (* t_3 (* t_0 (/ (* -0.125 (* (* (* M D) (* M D)) h)) (* (* d d) l))))
     (if (<= t_2 5e+261)
       (* t_3 t_0)
       (if (<= t_2 INFINITY) (/ (* t_1 d) h) (/ (* d (- t_1)) h))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / l));
	double t_1 = sqrt((h / l));
	double t_2 = (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 t_3 = sqrt((d / h));
	double tmp;
	if (t_2 <= -2e-115) {
		tmp = t_3 * (t_0 * ((-0.125 * (((M * D) * (M * D)) * h)) / ((d * d) * l)));
	} else if (t_2 <= 5e+261) {
		tmp = t_3 * t_0;
	} else if (t_2 <= ((double) INFINITY)) {
		tmp = (t_1 * d) / h;
	} else {
		tmp = (d * -t_1) / h;
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / l));
	double t_1 = Math.sqrt((h / l));
	double t_2 = (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)));
	double t_3 = Math.sqrt((d / h));
	double tmp;
	if (t_2 <= -2e-115) {
		tmp = t_3 * (t_0 * ((-0.125 * (((M * D) * (M * D)) * h)) / ((d * d) * l)));
	} else if (t_2 <= 5e+261) {
		tmp = t_3 * t_0;
	} else if (t_2 <= Double.POSITIVE_INFINITY) {
		tmp = (t_1 * d) / h;
	} else {
		tmp = (d * -t_1) / h;
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / l))
	t_1 = math.sqrt((h / l))
	t_2 = (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)))
	t_3 = math.sqrt((d / h))
	tmp = 0
	if t_2 <= -2e-115:
		tmp = t_3 * (t_0 * ((-0.125 * (((M * D) * (M * D)) * h)) / ((d * d) * l)))
	elif t_2 <= 5e+261:
		tmp = t_3 * t_0
	elif t_2 <= math.inf:
		tmp = (t_1 * d) / h
	else:
		tmp = (d * -t_1) / h
	return tmp
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / l))
	t_1 = sqrt(Float64(h / l))
	t_2 = 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))))
	t_3 = sqrt(Float64(d / h))
	tmp = 0.0
	if (t_2 <= -2e-115)
		tmp = Float64(t_3 * Float64(t_0 * Float64(Float64(-0.125 * Float64(Float64(Float64(M * D) * Float64(M * D)) * h)) / Float64(Float64(d * d) * l))));
	elseif (t_2 <= 5e+261)
		tmp = Float64(t_3 * t_0);
	elseif (t_2 <= Inf)
		tmp = Float64(Float64(t_1 * d) / h);
	else
		tmp = Float64(Float64(d * Float64(-t_1)) / h);
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / l));
	t_1 = sqrt((h / l));
	t_2 = (((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)));
	t_3 = sqrt((d / h));
	tmp = 0.0;
	if (t_2 <= -2e-115)
		tmp = t_3 * (t_0 * ((-0.125 * (((M * D) * (M * D)) * h)) / ((d * d) * l)));
	elseif (t_2 <= 5e+261)
		tmp = t_3 * t_0;
	elseif (t_2 <= Inf)
		tmp = (t_1 * d) / h;
	else
		tmp = (d * -t_1) / h;
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = 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]}, Block[{t$95$3 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, -2e-115], N[(t$95$3 * N[(t$95$0 * N[(N[(-0.125 * N[(N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+261], N[(t$95$3 * t$95$0), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(t$95$1 * d), $MachinePrecision] / h), $MachinePrecision], N[(N[(d * (-t$95$1)), $MachinePrecision] / h), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{h}{\ell}}\\
t_2 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_3 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-115}:\\
\;\;\;\;t\_3 \cdot \left(t\_0 \cdot \frac{-0.125 \cdot \left(\left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right) \cdot h\right)}{\left(d \cdot d\right) \cdot \ell}\right)\\

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+261}:\\
\;\;\;\;t\_3 \cdot t\_0\\

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

\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \left(-t\_1\right)}{h}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 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-115

    1. Initial program 86.5%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Applied rewrites85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.0000000000000001e-115 < (*.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.0000000000000001e261

    1. Initial program 87.9%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Applied rewrites87.3%

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

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

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

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

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

    if 5.0000000000000001e261 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

    1. Initial program 53.3%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

      \[\leadsto \frac{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
    7. Step-by-step derivation
      1. sqrt-pow2N/A

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

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

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

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

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

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

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

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

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

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

Alternative 4: 51.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{h}{\ell}}\\ t_1 := -t\_0\\ t_2 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_2 \leq -2 \cdot 10^{-249}:\\ \;\;\;\;\frac{\frac{\left(d \cdot d\right) \cdot t\_1}{d}}{h}\\ \mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+261}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;t\_2 \leq \infty:\\ \;\;\;\;\frac{t\_0 \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{d \cdot t\_1}{h}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ h l)))
        (t_1 (- t_0))
        (t_2
         (*
          (* (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))))))
   (if (<= t_2 -2e-249)
     (/ (/ (* (* d d) t_1) d) h)
     (if (<= t_2 5e+261)
       (* (sqrt (/ d h)) (sqrt (/ d l)))
       (if (<= t_2 INFINITY) (/ (* t_0 d) h) (/ (* d t_1) h))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((h / l));
	double t_1 = -t_0;
	double t_2 = (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 tmp;
	if (t_2 <= -2e-249) {
		tmp = (((d * d) * t_1) / d) / h;
	} else if (t_2 <= 5e+261) {
		tmp = sqrt((d / h)) * sqrt((d / l));
	} else if (t_2 <= ((double) INFINITY)) {
		tmp = (t_0 * d) / h;
	} else {
		tmp = (d * t_1) / h;
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((h / l));
	double t_1 = -t_0;
	double t_2 = (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)));
	double tmp;
	if (t_2 <= -2e-249) {
		tmp = (((d * d) * t_1) / d) / h;
	} else if (t_2 <= 5e+261) {
		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
	} else if (t_2 <= Double.POSITIVE_INFINITY) {
		tmp = (t_0 * d) / h;
	} else {
		tmp = (d * t_1) / h;
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt((h / l))
	t_1 = -t_0
	t_2 = (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)))
	tmp = 0
	if t_2 <= -2e-249:
		tmp = (((d * d) * t_1) / d) / h
	elif t_2 <= 5e+261:
		tmp = math.sqrt((d / h)) * math.sqrt((d / l))
	elif t_2 <= math.inf:
		tmp = (t_0 * d) / h
	else:
		tmp = (d * t_1) / h
	return tmp
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(h / l))
	t_1 = Float64(-t_0)
	t_2 = 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))))
	tmp = 0.0
	if (t_2 <= -2e-249)
		tmp = Float64(Float64(Float64(Float64(d * d) * t_1) / d) / h);
	elseif (t_2 <= 5e+261)
		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
	elseif (t_2 <= Inf)
		tmp = Float64(Float64(t_0 * d) / h);
	else
		tmp = Float64(Float64(d * t_1) / h);
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((h / l));
	t_1 = -t_0;
	t_2 = (((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)));
	tmp = 0.0;
	if (t_2 <= -2e-249)
		tmp = (((d * d) * t_1) / d) / h;
	elseif (t_2 <= 5e+261)
		tmp = sqrt((d / h)) * sqrt((d / l));
	elseif (t_2 <= Inf)
		tmp = (t_0 * d) / h;
	else
		tmp = (d * t_1) / h;
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = (-t$95$0)}, Block[{t$95$2 = 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]}, If[LessEqual[t$95$2, -2e-249], N[(N[(N[(N[(d * d), $MachinePrecision] * t$95$1), $MachinePrecision] / d), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$2, 5e+261], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(t$95$0 * d), $MachinePrecision] / h), $MachinePrecision], N[(N[(d * t$95$1), $MachinePrecision] / h), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+261}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{d \cdot t\_1}{h}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 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.00000000000000011e-249

    1. Initial program 86.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.00000000000000011e-249 < (*.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.0000000000000001e261

    1. Initial program 87.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Applied rewrites87.3%

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

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

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

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

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

    if 5.0000000000000001e261 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

    1. Initial program 53.3%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

      \[\leadsto \frac{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
    7. Step-by-step derivation
      1. sqrt-pow2N/A

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

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

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

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

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

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

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

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

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

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

Alternative 5: 49.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{h}{\ell}}\\ t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_2 := \frac{d \cdot \left(-t\_0\right)}{h}\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-249}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+261}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;\frac{t\_0 \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ h l)))
        (t_1
         (*
          (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
          (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
        (t_2 (/ (* d (- t_0)) h)))
   (if (<= t_1 -2e-249)
     t_2
     (if (<= t_1 5e+261)
       (* (sqrt (/ d h)) (sqrt (/ d l)))
       (if (<= t_1 INFINITY) (/ (* t_0 d) h) t_2)))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((h / l));
	double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
	double t_2 = (d * -t_0) / h;
	double tmp;
	if (t_1 <= -2e-249) {
		tmp = t_2;
	} else if (t_1 <= 5e+261) {
		tmp = sqrt((d / h)) * sqrt((d / l));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = (t_0 * d) / h;
	} else {
		tmp = t_2;
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((h / l));
	double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
	double t_2 = (d * -t_0) / h;
	double tmp;
	if (t_1 <= -2e-249) {
		tmp = t_2;
	} else if (t_1 <= 5e+261) {
		tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = (t_0 * d) / h;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt((h / l))
	t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
	t_2 = (d * -t_0) / h
	tmp = 0
	if t_1 <= -2e-249:
		tmp = t_2
	elif t_1 <= 5e+261:
		tmp = math.sqrt((d / h)) * math.sqrt((d / l))
	elif t_1 <= math.inf:
		tmp = (t_0 * d) / h
	else:
		tmp = t_2
	return tmp
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(h / l))
	t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
	t_2 = Float64(Float64(d * Float64(-t_0)) / h)
	tmp = 0.0
	if (t_1 <= -2e-249)
		tmp = t_2;
	elseif (t_1 <= 5e+261)
		tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)));
	elseif (t_1 <= Inf)
		tmp = Float64(Float64(t_0 * d) / h);
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((h / l));
	t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)));
	t_2 = (d * -t_0) / h;
	tmp = 0.0;
	if (t_1 <= -2e-249)
		tmp = t_2;
	elseif (t_1 <= 5e+261)
		tmp = sqrt((d / h)) * sqrt((d / l));
	elseif (t_1 <= Inf)
		tmp = (t_0 * d) / h;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(d * (-t$95$0)), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-249], t$95$2, If[LessEqual[t$95$1, 5e+261], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(t$95$0 * d), $MachinePrecision] / h), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 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.00000000000000011e-249 or +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

    1. Initial program 55.2%

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

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

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

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

      \[\leadsto \frac{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
    7. Step-by-step derivation
      1. sqrt-pow2N/A

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

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

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

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

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

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

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

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

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

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

    if -2.00000000000000011e-249 < (*.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.0000000000000001e261

    1. Initial program 87.8%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Applied rewrites87.3%

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

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

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

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

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

    if 5.0000000000000001e261 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

    1. Initial program 53.3%

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

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

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

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

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

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

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

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

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

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

Alternative 6: 71.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{h}{\ell}}\\ t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_1 \leq 5 \cdot 10^{+261}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(\left(\left(M \cdot \frac{D}{2 \cdot d}\right) \cdot \left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)\right) \cdot 0.5\right)\right)\right)\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;\frac{t\_0 \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{d \cdot \left(-t\_0\right)}{h}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ h l)))
        (t_1
         (*
          (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
          (-
           1.0
           (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l))))))
   (if (<= t_1 5e+261)
     (*
      (sqrt (/ d h))
      (*
       (sqrt (/ d l))
       (-
        1.0
        (* (/ h l) (* (* (* M (/ D (* 2.0 d))) (* (/ D d) (* 0.5 M))) 0.5)))))
     (if (<= t_1 INFINITY) (/ (* t_0 d) h) (/ (* d (- t_0)) h)))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((h / l));
	double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
	double tmp;
	if (t_1 <= 5e+261) {
		tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - ((h / l) * (((M * (D / (2.0 * d))) * ((D / d) * (0.5 * M))) * 0.5))));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = (t_0 * d) / h;
	} else {
		tmp = (d * -t_0) / h;
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((h / l));
	double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
	double tmp;
	if (t_1 <= 5e+261) {
		tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - ((h / l) * (((M * (D / (2.0 * d))) * ((D / d) * (0.5 * M))) * 0.5))));
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = (t_0 * d) / h;
	} else {
		tmp = (d * -t_0) / h;
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt((h / l))
	t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
	tmp = 0
	if t_1 <= 5e+261:
		tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - ((h / l) * (((M * (D / (2.0 * d))) * ((D / d) * (0.5 * M))) * 0.5))))
	elif t_1 <= math.inf:
		tmp = (t_0 * d) / h
	else:
		tmp = (d * -t_0) / h
	return tmp
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(h / l))
	t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
	tmp = 0.0
	if (t_1 <= 5e+261)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(Float64(h / l) * Float64(Float64(Float64(M * Float64(D / Float64(2.0 * d))) * Float64(Float64(D / d) * Float64(0.5 * M))) * 0.5)))));
	elseif (t_1 <= Inf)
		tmp = Float64(Float64(t_0 * d) / h);
	else
		tmp = Float64(Float64(d * Float64(-t_0)) / h);
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((h / l));
	t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)));
	tmp = 0.0;
	if (t_1 <= 5e+261)
		tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - ((h / l) * (((M * (D / (2.0 * d))) * ((D / d) * (0.5 * M))) * 0.5))));
	elseif (t_1 <= Inf)
		tmp = (t_0 * d) / h;
	else
		tmp = (d * -t_0) / h;
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+261], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[(N[(M * N[(D / N[(2.0 * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(t$95$0 * d), $MachinePrecision] / h), $MachinePrecision], N[(N[(d * (-t$95$0)), $MachinePrecision] / h), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \left(-t\_0\right)}{h}\\


\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)))) < 5.0000000000000001e261

    1. Initial program 87.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(\left(\left(\frac{D}{d} \cdot \frac{M}{2}\right) \cdot \left(\frac{D}{d} \cdot \color{blue}{\left(\frac{1}{2} \cdot M\right)}\right)\right) \cdot \frac{1}{2}\right)\right)\right) \]
    7. Step-by-step derivation
      1. lower-*.f6486.4

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000001e261 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

    1. Initial program 53.3%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

      \[\leadsto \frac{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
    7. Step-by-step derivation
      1. sqrt-pow2N/A

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

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

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

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

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

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

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

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

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

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

Alternative 7: 46.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{h}{\ell}}\\ t_1 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_2 := \frac{d \cdot \left(-t\_0\right)}{h}\\ \mathbf{if}\;t\_1 \leq -2 \cdot 10^{-249}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;\frac{t\_0 \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ h l)))
        (t_1
         (*
          (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
          (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
        (t_2 (/ (* d (- t_0)) h)))
   (if (<= t_1 -2e-249) t_2 (if (<= t_1 INFINITY) (/ (* t_0 d) h) t_2))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((h / l));
	double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
	double t_2 = (d * -t_0) / h;
	double tmp;
	if (t_1 <= -2e-249) {
		tmp = t_2;
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = (t_0 * d) / h;
	} else {
		tmp = t_2;
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((h / l));
	double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
	double t_2 = (d * -t_0) / h;
	double tmp;
	if (t_1 <= -2e-249) {
		tmp = t_2;
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = (t_0 * d) / h;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt((h / l))
	t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
	t_2 = (d * -t_0) / h
	tmp = 0
	if t_1 <= -2e-249:
		tmp = t_2
	elif t_1 <= math.inf:
		tmp = (t_0 * d) / h
	else:
		tmp = t_2
	return tmp
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(h / l))
	t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
	t_2 = Float64(Float64(d * Float64(-t_0)) / h)
	tmp = 0.0
	if (t_1 <= -2e-249)
		tmp = t_2;
	elseif (t_1 <= Inf)
		tmp = Float64(Float64(t_0 * d) / h);
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((h / l));
	t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)));
	t_2 = (d * -t_0) / h;
	tmp = 0.0;
	if (t_1 <= -2e-249)
		tmp = t_2;
	elseif (t_1 <= Inf)
		tmp = (t_0 * d) / h;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(d * (-t$95$0)), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-249], t$95$2, If[LessEqual[t$95$1, Infinity], N[(N[(t$95$0 * d), $MachinePrecision] / h), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 55.2%

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

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

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

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

      \[\leadsto \frac{\left(d \cdot {\left(\sqrt{-1}\right)}^{2}\right) \cdot \sqrt{\frac{h}{\ell}}}{h} \]
    7. Step-by-step derivation
      1. sqrt-pow2N/A

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

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

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

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

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

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

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

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

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

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

    if -2.00000000000000011e-249 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

    1. Initial program 78.0%

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

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

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

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

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

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

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

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

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

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

Alternative 8: 73.5% accurate, 1.9× speedup?

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

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

\mathbf{elif}\;h \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\left(1 - \frac{h}{\ell} \cdot \left(t\_0 \cdot \left(t\_0 \cdot 0.5\right)\right)\right) \cdot \left(\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\

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


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

    1. Initial program 58.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(\left(\left(\frac{D}{d} \cdot \frac{M}{2}\right) \cdot \left(\frac{D}{d} \cdot \color{blue}{\left(\frac{1}{2} \cdot M\right)}\right)\right) \cdot \frac{1}{2}\right)\right)\right) \]
    7. Step-by-step derivation
      1. lower-*.f6457.7

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

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

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

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

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

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

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

    if -2.55000000000000005e54 < h < -5.00000000000023e-311

    1. Initial program 73.0%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Applied rewrites72.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.00000000000023e-311 < h

    1. Initial program 64.7%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Applied rewrites64.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(\left(\left(\frac{D}{d} \cdot \frac{M}{2}\right) \cdot \left(\frac{D}{d} \cdot \color{blue}{\left(\frac{1}{2} \cdot M\right)}\right)\right) \cdot \frac{1}{2}\right)\right)\right) \]
    7. Step-by-step derivation
      1. lower-*.f6464.1

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

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

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

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

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

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

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

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

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

Alternative 9: 72.4% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;d \leq -2.3 \cdot 10^{-56}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_0 \cdot \left(1 - \frac{h \cdot \left(\left(\frac{M}{2} \cdot \frac{D}{d}\right) \cdot \left(\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right) \cdot 0.5\right)\right)}{\ell}\right)\right)\\ \mathbf{elif}\;d \leq 2 \cdot 10^{-301}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right), -0.125, \sqrt{\frac{h}{\ell}} \cdot \left(d \cdot d\right)\right)}{d}}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_0 \cdot \left(1 - \frac{h}{\ell} \cdot \left(\left(\left(\frac{D}{d} \cdot \frac{M}{2}\right) \cdot \left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)\right) \cdot 0.5\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d l))))
   (if (<= d -2.3e-56)
     (*
      (sqrt (/ d h))
      (*
       t_0
       (-
        1.0
        (/ (* h (* (* (/ M 2.0) (/ D d)) (* (* (* 0.5 M) (/ D d)) 0.5))) l))))
     (if (<= d 2e-301)
       (/
        (/
         (fma
          (* (pow (/ h l) 1.5) (* (* M D) (* M D)))
          -0.125
          (* (sqrt (/ h l)) (* d d)))
         d)
        h)
       (*
        (/ (sqrt d) (sqrt h))
        (*
         t_0
         (-
          1.0
          (*
           (/ h l)
           (* (* (* (/ D d) (/ M 2.0)) (* (/ D d) (* 0.5 M))) 0.5)))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / l));
	double tmp;
	if (d <= -2.3e-56) {
		tmp = sqrt((d / h)) * (t_0 * (1.0 - ((h * (((M / 2.0) * (D / d)) * (((0.5 * M) * (D / d)) * 0.5))) / l)));
	} else if (d <= 2e-301) {
		tmp = (fma((pow((h / l), 1.5) * ((M * D) * (M * D))), -0.125, (sqrt((h / l)) * (d * d))) / d) / h;
	} else {
		tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 - ((h / l) * ((((D / d) * (M / 2.0)) * ((D / d) * (0.5 * M))) * 0.5))));
	}
	return tmp;
}
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / l))
	tmp = 0.0
	if (d <= -2.3e-56)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(1.0 - Float64(Float64(h * Float64(Float64(Float64(M / 2.0) * Float64(D / d)) * Float64(Float64(Float64(0.5 * M) * Float64(D / d)) * 0.5))) / l))));
	elseif (d <= 2e-301)
		tmp = Float64(Float64(fma(Float64((Float64(h / l) ^ 1.5) * Float64(Float64(M * D) * Float64(M * D))), -0.125, Float64(sqrt(Float64(h / l)) * Float64(d * d))) / d) / h);
	else
		tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * Float64(1.0 - Float64(Float64(h / l) * Float64(Float64(Float64(Float64(D / d) * Float64(M / 2.0)) * Float64(Float64(D / d) * Float64(0.5 * M))) * 0.5)))));
	end
	return tmp
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -2.3e-56], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(N[(h * N[(N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2e-301], N[(N[(N[(N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] * N[(N[(M * D), $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125 + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[(N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 78.0%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Applied rewrites78.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(\left(\left(\frac{D}{d} \cdot \frac{M}{2}\right) \cdot \left(\frac{D}{d} \cdot \color{blue}{\left(\frac{1}{2} \cdot M\right)}\right)\right) \cdot \frac{1}{2}\right)\right)\right) \]
    7. Step-by-step derivation
      1. lower-*.f6478.0

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

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

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

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

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

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

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

    if -2.30000000000000002e-56 < d < 2.00000000000000013e-301

    1. Initial program 49.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{fma}\left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \left(\left(M \cdot D\right) \cdot \left(M \cdot D\right)\right), -0.125, \sqrt{\frac{h}{\ell}} \cdot \left(d \cdot d\right)\right)}{d}}{h} \]
    10. Applied rewrites53.5%

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

    if 2.00000000000000013e-301 < d

    1. Initial program 65.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(\left(\left(\frac{D}{d} \cdot \frac{M}{2}\right) \cdot \left(\frac{D}{d} \cdot \color{blue}{\left(\frac{1}{2} \cdot M\right)}\right)\right) \cdot \frac{1}{2}\right)\right)\right) \]
    7. Step-by-step derivation
      1. lower-*.f6464.4

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

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

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

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

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

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

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

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

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

Alternative 10: 72.8% accurate, 2.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{\ell}}\\ \mathbf{if}\;d \leq -9 \cdot 10^{-178}:\\ \;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_0 \cdot \left(1 - \frac{h \cdot \left(\left(\frac{M}{2} \cdot \frac{D}{d}\right) \cdot \left(\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right) \cdot 0.5\right)\right)}{\ell}\right)\right)\\ \mathbf{elif}\;d \leq 1.18 \cdot 10^{-303}:\\ \;\;\;\;\left(-0.125 \cdot \frac{\left(\left(D \cdot M\right) \cdot \left(D \cdot M\right)\right) \cdot -1}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_0 \cdot \left(1 - \frac{h}{\ell} \cdot \left(\left(\left(\frac{D}{d} \cdot \frac{M}{2}\right) \cdot \left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)\right) \cdot 0.5\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (let* ((t_0 (sqrt (/ d l))))
   (if (<= d -9e-178)
     (*
      (sqrt (/ d h))
      (*
       t_0
       (-
        1.0
        (/ (* h (* (* (/ M 2.0) (/ D d)) (* (* (* 0.5 M) (/ D d)) 0.5))) l))))
     (if (<= d 1.18e-303)
       (*
        (* -0.125 (/ (* (* (* D M) (* D M)) -1.0) d))
        (sqrt (/ h (pow l 3.0))))
       (*
        (/ (sqrt d) (sqrt h))
        (*
         t_0
         (-
          1.0
          (*
           (/ h l)
           (* (* (* (/ D d) (/ M 2.0)) (* (/ D d) (* 0.5 M))) 0.5)))))))))
double code(double d, double h, double l, double M, double D) {
	double t_0 = sqrt((d / l));
	double tmp;
	if (d <= -9e-178) {
		tmp = sqrt((d / h)) * (t_0 * (1.0 - ((h * (((M / 2.0) * (D / d)) * (((0.5 * M) * (D / d)) * 0.5))) / l)));
	} else if (d <= 1.18e-303) {
		tmp = (-0.125 * ((((D * M) * (D * M)) * -1.0) / d)) * sqrt((h / pow(l, 3.0)));
	} else {
		tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 - ((h / l) * ((((D / d) * (M / 2.0)) * ((D / d) * (0.5 * M))) * 0.5))));
	}
	return tmp;
}
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
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt((d / l))
    if (d <= (-9d-178)) then
        tmp = sqrt((d / h)) * (t_0 * (1.0d0 - ((h * (((m / 2.0d0) * (d_1 / d)) * (((0.5d0 * m) * (d_1 / d)) * 0.5d0))) / l)))
    else if (d <= 1.18d-303) then
        tmp = ((-0.125d0) * ((((d_1 * m) * (d_1 * m)) * (-1.0d0)) / d)) * sqrt((h / (l ** 3.0d0)))
    else
        tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0d0 - ((h / l) * ((((d_1 / d) * (m / 2.0d0)) * ((d_1 / d) * (0.5d0 * m))) * 0.5d0))))
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double t_0 = Math.sqrt((d / l));
	double tmp;
	if (d <= -9e-178) {
		tmp = Math.sqrt((d / h)) * (t_0 * (1.0 - ((h * (((M / 2.0) * (D / d)) * (((0.5 * M) * (D / d)) * 0.5))) / l)));
	} else if (d <= 1.18e-303) {
		tmp = (-0.125 * ((((D * M) * (D * M)) * -1.0) / d)) * Math.sqrt((h / Math.pow(l, 3.0)));
	} else {
		tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_0 * (1.0 - ((h / l) * ((((D / d) * (M / 2.0)) * ((D / d) * (0.5 * M))) * 0.5))));
	}
	return tmp;
}
def code(d, h, l, M, D):
	t_0 = math.sqrt((d / l))
	tmp = 0
	if d <= -9e-178:
		tmp = math.sqrt((d / h)) * (t_0 * (1.0 - ((h * (((M / 2.0) * (D / d)) * (((0.5 * M) * (D / d)) * 0.5))) / l)))
	elif d <= 1.18e-303:
		tmp = (-0.125 * ((((D * M) * (D * M)) * -1.0) / d)) * math.sqrt((h / math.pow(l, 3.0)))
	else:
		tmp = (math.sqrt(d) / math.sqrt(h)) * (t_0 * (1.0 - ((h / l) * ((((D / d) * (M / 2.0)) * ((D / d) * (0.5 * M))) * 0.5))))
	return tmp
function code(d, h, l, M, D)
	t_0 = sqrt(Float64(d / l))
	tmp = 0.0
	if (d <= -9e-178)
		tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(1.0 - Float64(Float64(h * Float64(Float64(Float64(M / 2.0) * Float64(D / d)) * Float64(Float64(Float64(0.5 * M) * Float64(D / d)) * 0.5))) / l))));
	elseif (d <= 1.18e-303)
		tmp = Float64(Float64(-0.125 * Float64(Float64(Float64(Float64(D * M) * Float64(D * M)) * -1.0) / d)) * sqrt(Float64(h / (l ^ 3.0))));
	else
		tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * Float64(1.0 - Float64(Float64(h / l) * Float64(Float64(Float64(Float64(D / d) * Float64(M / 2.0)) * Float64(Float64(D / d) * Float64(0.5 * M))) * 0.5)))));
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	t_0 = sqrt((d / l));
	tmp = 0.0;
	if (d <= -9e-178)
		tmp = sqrt((d / h)) * (t_0 * (1.0 - ((h * (((M / 2.0) * (D / d)) * (((0.5 * M) * (D / d)) * 0.5))) / l)));
	elseif (d <= 1.18e-303)
		tmp = (-0.125 * ((((D * M) * (D * M)) * -1.0) / d)) * sqrt((h / (l ^ 3.0)));
	else
		tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 - ((h / l) * ((((D / d) * (M / 2.0)) * ((D / d) * (0.5 * M))) * 0.5))));
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -9e-178], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(N[(h * N[(N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.18e-303], N[(N[(-0.125 * N[(N[(N[(N[(D * M), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] * -1.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[(N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;d \leq 1.18 \cdot 10^{-303}:\\
\;\;\;\;\left(-0.125 \cdot \frac{\left(\left(D \cdot M\right) \cdot \left(D \cdot M\right)\right) \cdot -1}{d}\right) \cdot \sqrt{\frac{h}{{\ell}^{3}}}\\

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


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

    1. Initial program 74.3%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Applied rewrites73.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(\left(\left(\frac{D}{d} \cdot \frac{M}{2}\right) \cdot \left(\frac{D}{d} \cdot \color{blue}{\left(\frac{1}{2} \cdot M\right)}\right)\right) \cdot \frac{1}{2}\right)\right)\right) \]
    7. Step-by-step derivation
      1. lower-*.f6473.9

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

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

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

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

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

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

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

    if -8.99999999999999957e-178 < d < 1.18e-303

    1. Initial program 38.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.18e-303 < d

    1. Initial program 64.9%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Applied rewrites64.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 71.1% accurate, 2.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if h < 5.2e-274

    1. Initial program 66.4%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Applied rewrites65.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(\left(\left(\frac{D}{d} \cdot \frac{M}{2}\right) \cdot \left(\frac{D}{d} \cdot \color{blue}{\left(\frac{1}{2} \cdot M\right)}\right)\right) \cdot \frac{1}{2}\right)\right)\right) \]
    7. Step-by-step derivation
      1. lower-*.f6465.9

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

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

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

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

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

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

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

    if 5.2e-274 < h

    1. Initial program 65.0%

      \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
    2. Add Preprocessing
    3. Applied rewrites64.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(\left(\left(\frac{D}{d} \cdot \frac{M}{2}\right) \cdot \left(\frac{D}{d} \cdot \color{blue}{\left(\frac{1}{2} \cdot M\right)}\right)\right) \cdot \frac{1}{2}\right)\right)\right) \]
    7. Step-by-step derivation
      1. lower-*.f6464.5

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

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

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

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

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

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

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

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

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

Alternative 12: 38.9% accurate, 9.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq -1.3 \cdot 10^{-100}:\\ \;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= d -1.3e-100) (/ (* (sqrt (/ h l)) d) h) (* (sqrt (/ (/ 1.0 l) h)) d)))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -1.3e-100) {
		tmp = (sqrt((h / l)) * d) / h;
	} else {
		tmp = sqrt(((1.0 / l) / h)) * d;
	}
	return tmp;
}
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
    real(8) :: tmp
    if (d <= (-1.3d-100)) then
        tmp = (sqrt((h / l)) * d) / h
    else
        tmp = sqrt(((1.0d0 / l) / h)) * d
    end if
    code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (d <= -1.3e-100) {
		tmp = (Math.sqrt((h / l)) * d) / h;
	} else {
		tmp = Math.sqrt(((1.0 / l) / h)) * d;
	}
	return tmp;
}
def code(d, h, l, M, D):
	tmp = 0
	if d <= -1.3e-100:
		tmp = (math.sqrt((h / l)) * d) / h
	else:
		tmp = math.sqrt(((1.0 / l) / h)) * d
	return tmp
function code(d, h, l, M, D)
	tmp = 0.0
	if (d <= -1.3e-100)
		tmp = Float64(Float64(sqrt(Float64(h / l)) * d) / h);
	else
		tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * d);
	end
	return tmp
end
function tmp_2 = code(d, h, l, M, D)
	tmp = 0.0;
	if (d <= -1.3e-100)
		tmp = (sqrt((h / l)) * d) / h;
	else
		tmp = sqrt(((1.0 / l) / h)) * d;
	end
	tmp_2 = tmp;
end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -1.3e-100], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / h), $MachinePrecision], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.3 \cdot 10^{-100}:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\

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


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

    1. Initial program 77.1%

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

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

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

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

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

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

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

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

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

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

    if -1.2999999999999999e-100 < d

    1. Initial program 60.0%

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

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

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

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

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

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

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

        \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
      7. lower-*.f6434.8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 25.8% accurate, 12.9× speedup?

\[\begin{array}{l} \\ \frac{1 \cdot d}{\sqrt{\ell \cdot h}} \end{array} \]
(FPCore (d h l M D) :precision binary64 (/ (* 1.0 d) (sqrt (* l h))))
double code(double d, double h, double l, double M, double D) {
	return (1.0 * d) / sqrt((l * h));
}
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 = (1.0d0 * d) / sqrt((l * h))
end function
public static double code(double d, double h, double l, double M, double D) {
	return (1.0 * d) / Math.sqrt((l * h));
}
def code(d, h, l, M, D):
	return (1.0 * d) / math.sqrt((l * h))
function code(d, h, l, M, D)
	return Float64(Float64(1.0 * d) / sqrt(Float64(l * h)))
end
function tmp = code(d, h, l, M, D)
	tmp = (1.0 * d) / sqrt((l * h));
end
code[d_, h_, l_, M_, D_] := N[(N[(1.0 * d), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1 \cdot d}{\sqrt{\ell \cdot h}}
\end{array}
Derivation
  1. Initial program 65.8%

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

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

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

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

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

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

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

      \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
    7. lower-*.f6426.0

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

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

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

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

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

      \[\leadsto \sqrt{{\left(h \cdot \ell\right)}^{-1}} \cdot d \]
    5. inv-powN/A

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

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

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

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

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

      \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
    11. lift-*.f6425.8

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1 \cdot d}{\sqrt{\ell \cdot h}} \]
    11. lift-*.f6425.8

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

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

Alternative 14: 26.0% accurate, 12.9× speedup?

\[\begin{array}{l} \\ \sqrt{\frac{1}{\ell \cdot h}} \cdot d \end{array} \]
(FPCore (d h l M D) :precision binary64 (* (sqrt (/ 1.0 (* l h))) d))
double code(double d, double h, double l, double M, double D) {
	return sqrt((1.0 / (l * h))) * d;
}
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 = sqrt((1.0d0 / (l * h))) * d
end function
public static double code(double d, double h, double l, double M, double D) {
	return Math.sqrt((1.0 / (l * h))) * d;
}
def code(d, h, l, M, D):
	return math.sqrt((1.0 / (l * h))) * d
function code(d, h, l, M, D)
	return Float64(sqrt(Float64(1.0 / Float64(l * h))) * d)
end
function tmp = code(d, h, l, M, D)
	tmp = sqrt((1.0 / (l * h))) * d;
end
code[d_, h_, l_, M_, D_] := N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]
\begin{array}{l}

\\
\sqrt{\frac{1}{\ell \cdot h}} \cdot d
\end{array}
Derivation
  1. Initial program 65.8%

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

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

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

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

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

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

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

      \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
    7. lower-*.f6426.0

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

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

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

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

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

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

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

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

Reproduce

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