Henrywood and Agarwal, Equation (12)

Percentage Accurate: 34.9% → 78.3%
Time: 8.9s
Alternatives: 11
Speedup: 10.2×

Specification

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

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

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

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

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 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: 34.9% 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: 78.3% accurate, 1.7× speedup?

\[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := M \cdot \frac{D}{d\_m + d\_m}\\ t_1 := 1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\\ \mathbf{if}\;\ell \leq 2.9 \cdot 10^{-282}:\\ \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}} \cdot t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{1 \cdot d\_m}{\sqrt{\ell} \cdot \sqrt{h}} \cdot t\_1\\ \end{array} \end{array} \]
d_m = (fabs.f64 d)
(FPCore (d_m h l M D)
 :precision binary64
 (let* ((t_0 (* M (/ D (+ d_m d_m))))
        (t_1 (- 1.0 (/ (* (* (* t_0 t_0) 0.5) h) l))))
   (if (<= l 2.9e-282)
     (* (/ d_m (sqrt (* l h))) t_1)
     (* (/ (* 1.0 d_m) (* (sqrt l) (sqrt h))) t_1))))
d_m = fabs(d);
double code(double d_m, double h, double l, double M, double D) {
	double t_0 = M * (D / (d_m + d_m));
	double t_1 = 1.0 - ((((t_0 * t_0) * 0.5) * h) / l);
	double tmp;
	if (l <= 2.9e-282) {
		tmp = (d_m / sqrt((l * h))) * t_1;
	} else {
		tmp = ((1.0 * d_m) / (sqrt(l) * sqrt(h))) * t_1;
	}
	return tmp;
}
d_m =     private
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(d_m, h, l, m, d)
use fmin_fmax_functions
    real(8), intent (in) :: d_m
    real(8), intent (in) :: h
    real(8), intent (in) :: l
    real(8), intent (in) :: m
    real(8), intent (in) :: d
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = m * (d / (d_m + d_m))
    t_1 = 1.0d0 - ((((t_0 * t_0) * 0.5d0) * h) / l)
    if (l <= 2.9d-282) then
        tmp = (d_m / sqrt((l * h))) * t_1
    else
        tmp = ((1.0d0 * d_m) / (sqrt(l) * sqrt(h))) * t_1
    end if
    code = tmp
end function
d_m = Math.abs(d);
public static double code(double d_m, double h, double l, double M, double D) {
	double t_0 = M * (D / (d_m + d_m));
	double t_1 = 1.0 - ((((t_0 * t_0) * 0.5) * h) / l);
	double tmp;
	if (l <= 2.9e-282) {
		tmp = (d_m / Math.sqrt((l * h))) * t_1;
	} else {
		tmp = ((1.0 * d_m) / (Math.sqrt(l) * Math.sqrt(h))) * t_1;
	}
	return tmp;
}
d_m = math.fabs(d)
def code(d_m, h, l, M, D):
	t_0 = M * (D / (d_m + d_m))
	t_1 = 1.0 - ((((t_0 * t_0) * 0.5) * h) / l)
	tmp = 0
	if l <= 2.9e-282:
		tmp = (d_m / math.sqrt((l * h))) * t_1
	else:
		tmp = ((1.0 * d_m) / (math.sqrt(l) * math.sqrt(h))) * t_1
	return tmp
d_m = abs(d)
function code(d_m, h, l, M, D)
	t_0 = Float64(M * Float64(D / Float64(d_m + d_m)))
	t_1 = Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * t_0) * 0.5) * h) / l))
	tmp = 0.0
	if (l <= 2.9e-282)
		tmp = Float64(Float64(d_m / sqrt(Float64(l * h))) * t_1);
	else
		tmp = Float64(Float64(Float64(1.0 * d_m) / Float64(sqrt(l) * sqrt(h))) * t_1);
	end
	return tmp
end
d_m = abs(d);
function tmp_2 = code(d_m, h, l, M, D)
	t_0 = M * (D / (d_m + d_m));
	t_1 = 1.0 - ((((t_0 * t_0) * 0.5) * h) / l);
	tmp = 0.0;
	if (l <= 2.9e-282)
		tmp = (d_m / sqrt((l * h))) * t_1;
	else
		tmp = ((1.0 * d_m) / (sqrt(l) * sqrt(h))) * t_1;
	end
	tmp_2 = tmp;
end
d_m = N[Abs[d], $MachinePrecision]
code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(M * N[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 2.9e-282], N[(N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[(1.0 * d$95$m), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]]]]
\begin{array}{l}
d_m = \left|d\right|

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

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


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

    1. Initial program 7.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{d}{\sqrt{\color{blue}{\ell \cdot h}}} \cdot \left(1 - \frac{\left(\left(\left(M \cdot \frac{D}{d + d}\right) \cdot \left(M \cdot \frac{D}{d + d}\right)\right) \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
    10. Step-by-step derivation
      1. Applied rewrites74.3%

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

      if 2.89999999999999998e-282 < l

      1. Initial program 65.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 2: 73.9% accurate, 1.9× speedup?

    \[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := M \cdot \frac{D}{d\_m + d\_m}\\ \mathbf{if}\;\ell \leq 1.25 \cdot 10^{+58}:\\ \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\_m\\ \end{array} \end{array} \]
    d_m = (fabs.f64 d)
    (FPCore (d_m h l M D)
     :precision binary64
     (let* ((t_0 (* M (/ D (+ d_m d_m)))))
       (if (<= l 1.25e+58)
         (* (/ d_m (sqrt (* l h))) (- 1.0 (/ (* (* (* t_0 t_0) 0.5) h) l)))
         (* (/ 1.0 (* (sqrt l) (sqrt h))) d_m))))
    d_m = fabs(d);
    double code(double d_m, double h, double l, double M, double D) {
    	double t_0 = M * (D / (d_m + d_m));
    	double tmp;
    	if (l <= 1.25e+58) {
    		tmp = (d_m / sqrt((l * h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
    	} else {
    		tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m;
    	}
    	return tmp;
    }
    
    d_m =     private
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(d_m, h, l, m, d)
    use fmin_fmax_functions
        real(8), intent (in) :: d_m
        real(8), intent (in) :: h
        real(8), intent (in) :: l
        real(8), intent (in) :: m
        real(8), intent (in) :: d
        real(8) :: t_0
        real(8) :: tmp
        t_0 = m * (d / (d_m + d_m))
        if (l <= 1.25d+58) then
            tmp = (d_m / sqrt((l * h))) * (1.0d0 - ((((t_0 * t_0) * 0.5d0) * h) / l))
        else
            tmp = (1.0d0 / (sqrt(l) * sqrt(h))) * d_m
        end if
        code = tmp
    end function
    
    d_m = Math.abs(d);
    public static double code(double d_m, double h, double l, double M, double D) {
    	double t_0 = M * (D / (d_m + d_m));
    	double tmp;
    	if (l <= 1.25e+58) {
    		tmp = (d_m / Math.sqrt((l * h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
    	} else {
    		tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d_m;
    	}
    	return tmp;
    }
    
    d_m = math.fabs(d)
    def code(d_m, h, l, M, D):
    	t_0 = M * (D / (d_m + d_m))
    	tmp = 0
    	if l <= 1.25e+58:
    		tmp = (d_m / math.sqrt((l * h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l))
    	else:
    		tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d_m
    	return tmp
    
    d_m = abs(d)
    function code(d_m, h, l, M, D)
    	t_0 = Float64(M * Float64(D / Float64(d_m + d_m)))
    	tmp = 0.0
    	if (l <= 1.25e+58)
    		tmp = Float64(Float64(d_m / sqrt(Float64(l * h))) * Float64(1.0 - Float64(Float64(Float64(Float64(t_0 * t_0) * 0.5) * h) / l)));
    	else
    		tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d_m);
    	end
    	return tmp
    end
    
    d_m = abs(d);
    function tmp_2 = code(d_m, h, l, M, D)
    	t_0 = M * (D / (d_m + d_m));
    	tmp = 0.0;
    	if (l <= 1.25e+58)
    		tmp = (d_m / sqrt((l * h))) * (1.0 - ((((t_0 * t_0) * 0.5) * h) / l));
    	else
    		tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m;
    	end
    	tmp_2 = tmp;
    end
    
    d_m = N[Abs[d], $MachinePrecision]
    code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(M * N[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 1.25e+58], N[(N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 0.5), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision]]]
    
    \begin{array}{l}
    d_m = \left|d\right|
    
    \\
    \begin{array}{l}
    t_0 := M \cdot \frac{D}{d\_m + d\_m}\\
    \mathbf{if}\;\ell \leq 1.25 \cdot 10^{+58}:\\
    \;\;\;\;\frac{d\_m}{\sqrt{\ell \cdot h}} \cdot \left(1 - \frac{\left(\left(t\_0 \cdot t\_0\right) \cdot 0.5\right) \cdot h}{\ell}\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\_m\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if l < 1.24999999999999996e58

      1. Initial program 29.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{d}{\sqrt{\color{blue}{\ell \cdot h}}} \cdot \left(1 - \frac{\left(\left(\left(M \cdot \frac{D}{d + d}\right) \cdot \left(M \cdot \frac{D}{d + d}\right)\right) \cdot \frac{1}{2}\right) \cdot h}{\ell}\right) \]
      10. Step-by-step derivation
        1. Applied rewrites77.8%

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

        if 1.24999999999999996e58 < l

        1. Initial program 56.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 3: 58.8% accurate, 1.8× speedup?

      \[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := \frac{D}{d\_m + d\_m}\\ t_1 := \frac{d\_m}{\sqrt{\ell \cdot h}}\\ \mathbf{if}\;M \cdot D \leq 5 \cdot 10^{-38}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\left(1 - \left(\left(M \cdot \left(t\_0 \cdot \left(t\_0 \cdot M\right)\right)\right) \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \cdot t\_1\\ \end{array} \end{array} \]
      d_m = (fabs.f64 d)
      (FPCore (d_m h l M D)
       :precision binary64
       (let* ((t_0 (/ D (+ d_m d_m))) (t_1 (/ d_m (sqrt (* l h)))))
         (if (<= (* M D) 5e-38)
           t_1
           (* (- 1.0 (* (* (* M (* t_0 (* t_0 M))) 0.5) (/ h l))) t_1))))
      d_m = fabs(d);
      double code(double d_m, double h, double l, double M, double D) {
      	double t_0 = D / (d_m + d_m);
      	double t_1 = d_m / sqrt((l * h));
      	double tmp;
      	if ((M * D) <= 5e-38) {
      		tmp = t_1;
      	} else {
      		tmp = (1.0 - (((M * (t_0 * (t_0 * M))) * 0.5) * (h / l))) * t_1;
      	}
      	return tmp;
      }
      
      d_m =     private
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(d_m, h, l, m, d)
      use fmin_fmax_functions
          real(8), intent (in) :: d_m
          real(8), intent (in) :: h
          real(8), intent (in) :: l
          real(8), intent (in) :: m
          real(8), intent (in) :: d
          real(8) :: t_0
          real(8) :: t_1
          real(8) :: tmp
          t_0 = d / (d_m + d_m)
          t_1 = d_m / sqrt((l * h))
          if ((m * d) <= 5d-38) then
              tmp = t_1
          else
              tmp = (1.0d0 - (((m * (t_0 * (t_0 * m))) * 0.5d0) * (h / l))) * t_1
          end if
          code = tmp
      end function
      
      d_m = Math.abs(d);
      public static double code(double d_m, double h, double l, double M, double D) {
      	double t_0 = D / (d_m + d_m);
      	double t_1 = d_m / Math.sqrt((l * h));
      	double tmp;
      	if ((M * D) <= 5e-38) {
      		tmp = t_1;
      	} else {
      		tmp = (1.0 - (((M * (t_0 * (t_0 * M))) * 0.5) * (h / l))) * t_1;
      	}
      	return tmp;
      }
      
      d_m = math.fabs(d)
      def code(d_m, h, l, M, D):
      	t_0 = D / (d_m + d_m)
      	t_1 = d_m / math.sqrt((l * h))
      	tmp = 0
      	if (M * D) <= 5e-38:
      		tmp = t_1
      	else:
      		tmp = (1.0 - (((M * (t_0 * (t_0 * M))) * 0.5) * (h / l))) * t_1
      	return tmp
      
      d_m = abs(d)
      function code(d_m, h, l, M, D)
      	t_0 = Float64(D / Float64(d_m + d_m))
      	t_1 = Float64(d_m / sqrt(Float64(l * h)))
      	tmp = 0.0
      	if (Float64(M * D) <= 5e-38)
      		tmp = t_1;
      	else
      		tmp = Float64(Float64(1.0 - Float64(Float64(Float64(M * Float64(t_0 * Float64(t_0 * M))) * 0.5) * Float64(h / l))) * t_1);
      	end
      	return tmp
      end
      
      d_m = abs(d);
      function tmp_2 = code(d_m, h, l, M, D)
      	t_0 = D / (d_m + d_m);
      	t_1 = d_m / sqrt((l * h));
      	tmp = 0.0;
      	if ((M * D) <= 5e-38)
      		tmp = t_1;
      	else
      		tmp = (1.0 - (((M * (t_0 * (t_0 * M))) * 0.5) * (h / l))) * t_1;
      	end
      	tmp_2 = tmp;
      end
      
      d_m = N[Abs[d], $MachinePrecision]
      code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(D / N[(d$95$m + d$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(M * D), $MachinePrecision], 5e-38], t$95$1, N[(N[(1.0 - N[(N[(N[(M * N[(t$95$0 * N[(t$95$0 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]]]]
      
      \begin{array}{l}
      d_m = \left|d\right|
      
      \\
      \begin{array}{l}
      t_0 := \frac{D}{d\_m + d\_m}\\
      t_1 := \frac{d\_m}{\sqrt{\ell \cdot h}}\\
      \mathbf{if}\;M \cdot D \leq 5 \cdot 10^{-38}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(1 - \left(\left(M \cdot \left(t\_0 \cdot \left(t\_0 \cdot M\right)\right)\right) \cdot 0.5\right) \cdot \frac{h}{\ell}\right) \cdot t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (*.f64 M D) < 5.00000000000000033e-38

        1. Initial program 35.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{1 \cdot d}{\color{blue}{\sqrt{\ell \cdot h}}} \]
          15. *-lft-identity50.0

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

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

        if 5.00000000000000033e-38 < (*.f64 M D)

        1. Initial program 33.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 4: 57.0% accurate, 1.9× speedup?

      \[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := \left(d\_m \cdot d\_m\right) \cdot \ell\\ t_1 := \sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\\ \mathbf{if}\;d\_m \leq 4.8 \cdot 10^{-163}:\\ \;\;\;\;\mathsf{fma}\left(\sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}} \cdot \left(\left(D \cdot D\right) \cdot \frac{M \cdot M}{d\_m}\right), -0.125, t\_1\right)\\ \mathbf{elif}\;d\_m \leq 120000000000:\\ \;\;\;\;t\_1 \cdot \mathsf{fma}\left(\frac{M \cdot \left(\left(M \cdot h\right) \cdot \left(D \cdot D\right)\right)}{t\_0}, -0.125, 1\right)\\ \mathbf{elif}\;d\_m \leq 1.5 \cdot 10^{+153}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\left(\left(\left(M \cdot M\right) \cdot h\right) \cdot D\right) \cdot D}{t\_0}, -0.125, 1\right) \cdot \frac{d\_m}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d\_m\\ \end{array} \end{array} \]
      d_m = (fabs.f64 d)
      (FPCore (d_m h l M D)
       :precision binary64
       (let* ((t_0 (* (* d_m d_m) l)) (t_1 (* (sqrt (/ 1.0 (* l h))) d_m)))
         (if (<= d_m 4.8e-163)
           (fma
            (* (sqrt (/ h (* (* l l) l))) (* (* D D) (/ (* M M) d_m)))
            -0.125
            t_1)
           (if (<= d_m 120000000000.0)
             (* t_1 (fma (/ (* M (* (* M h) (* D D))) t_0) -0.125 1.0))
             (if (<= d_m 1.5e+153)
               (*
                (fma (/ (* (* (* (* M M) h) D) D) t_0) -0.125 1.0)
                (/ d_m (sqrt (* l h))))
               (* (sqrt (/ (/ 1.0 l) h)) d_m))))))
      d_m = fabs(d);
      double code(double d_m, double h, double l, double M, double D) {
      	double t_0 = (d_m * d_m) * l;
      	double t_1 = sqrt((1.0 / (l * h))) * d_m;
      	double tmp;
      	if (d_m <= 4.8e-163) {
      		tmp = fma((sqrt((h / ((l * l) * l))) * ((D * D) * ((M * M) / d_m))), -0.125, t_1);
      	} else if (d_m <= 120000000000.0) {
      		tmp = t_1 * fma(((M * ((M * h) * (D * D))) / t_0), -0.125, 1.0);
      	} else if (d_m <= 1.5e+153) {
      		tmp = fma((((((M * M) * h) * D) * D) / t_0), -0.125, 1.0) * (d_m / sqrt((l * h)));
      	} else {
      		tmp = sqrt(((1.0 / l) / h)) * d_m;
      	}
      	return tmp;
      }
      
      d_m = abs(d)
      function code(d_m, h, l, M, D)
      	t_0 = Float64(Float64(d_m * d_m) * l)
      	t_1 = Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m)
      	tmp = 0.0
      	if (d_m <= 4.8e-163)
      		tmp = fma(Float64(sqrt(Float64(h / Float64(Float64(l * l) * l))) * Float64(Float64(D * D) * Float64(Float64(M * M) / d_m))), -0.125, t_1);
      	elseif (d_m <= 120000000000.0)
      		tmp = Float64(t_1 * fma(Float64(Float64(M * Float64(Float64(M * h) * Float64(D * D))) / t_0), -0.125, 1.0));
      	elseif (d_m <= 1.5e+153)
      		tmp = Float64(fma(Float64(Float64(Float64(Float64(Float64(M * M) * h) * D) * D) / t_0), -0.125, 1.0) * Float64(d_m / sqrt(Float64(l * h))));
      	else
      		tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * d_m);
      	end
      	return tmp
      end
      
      d_m = N[Abs[d], $MachinePrecision]
      code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision]}, If[LessEqual[d$95$m, 4.8e-163], N[(N[(N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(D * D), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125 + t$95$1), $MachinePrecision], If[LessEqual[d$95$m, 120000000000.0], N[(t$95$1 * N[(N[(N[(M * N[(N[(M * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d$95$m, 1.5e+153], N[(N[(N[(N[(N[(N[(N[(M * M), $MachinePrecision] * h), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision] / t$95$0), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision]]]]]]
      
      \begin{array}{l}
      d_m = \left|d\right|
      
      \\
      \begin{array}{l}
      t_0 := \left(d\_m \cdot d\_m\right) \cdot \ell\\
      t_1 := \sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\\
      \mathbf{if}\;d\_m \leq 4.8 \cdot 10^{-163}:\\
      \;\;\;\;\mathsf{fma}\left(\sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}} \cdot \left(\left(D \cdot D\right) \cdot \frac{M \cdot M}{d\_m}\right), -0.125, t\_1\right)\\
      
      \mathbf{elif}\;d\_m \leq 120000000000:\\
      \;\;\;\;t\_1 \cdot \mathsf{fma}\left(\frac{M \cdot \left(\left(M \cdot h\right) \cdot \left(D \cdot D\right)\right)}{t\_0}, -0.125, 1\right)\\
      
      \mathbf{elif}\;d\_m \leq 1.5 \cdot 10^{+153}:\\
      \;\;\;\;\mathsf{fma}\left(\frac{\left(\left(\left(M \cdot M\right) \cdot h\right) \cdot D\right) \cdot D}{t\_0}, -0.125, 1\right) \cdot \frac{d\_m}{\sqrt{\ell \cdot h}}\\
      
      \mathbf{else}:\\
      \;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d\_m\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if d < 4.8000000000000001e-163

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

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

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

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

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

        if 4.8000000000000001e-163 < d < 1.2e11

        1. Initial program 33.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 1.2e11 < d < 1.50000000000000009e153

        1. Initial program 40.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 1.50000000000000009e153 < d

        1. Initial program 44.4%

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
          3. 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-/.f6467.8

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

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

      Alternative 5: 56.9% accurate, 1.9× speedup?

      \[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := \sqrt{\ell \cdot h}\\ t_1 := \left(d\_m \cdot d\_m\right) \cdot \ell\\ \mathbf{if}\;d\_m \leq 1.5 \cdot 10^{-163}:\\ \;\;\;\;\frac{\left(\left(\left(D \cdot D\right) \cdot \frac{\left(M \cdot M\right) \cdot -1}{d\_m}\right) \cdot t\_0\right) \cdot 0.125}{\ell \cdot \ell}\\ \mathbf{elif}\;d\_m \leq 120000000000:\\ \;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right) \cdot \mathsf{fma}\left(\frac{M \cdot \left(\left(M \cdot h\right) \cdot \left(D \cdot D\right)\right)}{t\_1}, -0.125, 1\right)\\ \mathbf{elif}\;d\_m \leq 1.5 \cdot 10^{+153}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\left(\left(\left(M \cdot M\right) \cdot h\right) \cdot D\right) \cdot D}{t\_1}, -0.125, 1\right) \cdot \frac{d\_m}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d\_m\\ \end{array} \end{array} \]
      d_m = (fabs.f64 d)
      (FPCore (d_m h l M D)
       :precision binary64
       (let* ((t_0 (sqrt (* l h))) (t_1 (* (* d_m d_m) l)))
         (if (<= d_m 1.5e-163)
           (/ (* (* (* (* D D) (/ (* (* M M) -1.0) d_m)) t_0) 0.125) (* l l))
           (if (<= d_m 120000000000.0)
             (*
              (* (sqrt (/ 1.0 (* l h))) d_m)
              (fma (/ (* M (* (* M h) (* D D))) t_1) -0.125 1.0))
             (if (<= d_m 1.5e+153)
               (* (fma (/ (* (* (* (* M M) h) D) D) t_1) -0.125 1.0) (/ d_m t_0))
               (* (sqrt (/ (/ 1.0 l) h)) d_m))))))
      d_m = fabs(d);
      double code(double d_m, double h, double l, double M, double D) {
      	double t_0 = sqrt((l * h));
      	double t_1 = (d_m * d_m) * l;
      	double tmp;
      	if (d_m <= 1.5e-163) {
      		tmp = ((((D * D) * (((M * M) * -1.0) / d_m)) * t_0) * 0.125) / (l * l);
      	} else if (d_m <= 120000000000.0) {
      		tmp = (sqrt((1.0 / (l * h))) * d_m) * fma(((M * ((M * h) * (D * D))) / t_1), -0.125, 1.0);
      	} else if (d_m <= 1.5e+153) {
      		tmp = fma((((((M * M) * h) * D) * D) / t_1), -0.125, 1.0) * (d_m / t_0);
      	} else {
      		tmp = sqrt(((1.0 / l) / h)) * d_m;
      	}
      	return tmp;
      }
      
      d_m = abs(d)
      function code(d_m, h, l, M, D)
      	t_0 = sqrt(Float64(l * h))
      	t_1 = Float64(Float64(d_m * d_m) * l)
      	tmp = 0.0
      	if (d_m <= 1.5e-163)
      		tmp = Float64(Float64(Float64(Float64(Float64(D * D) * Float64(Float64(Float64(M * M) * -1.0) / d_m)) * t_0) * 0.125) / Float64(l * l));
      	elseif (d_m <= 120000000000.0)
      		tmp = Float64(Float64(sqrt(Float64(1.0 / Float64(l * h))) * d_m) * fma(Float64(Float64(M * Float64(Float64(M * h) * Float64(D * D))) / t_1), -0.125, 1.0));
      	elseif (d_m <= 1.5e+153)
      		tmp = Float64(fma(Float64(Float64(Float64(Float64(Float64(M * M) * h) * D) * D) / t_1), -0.125, 1.0) * Float64(d_m / t_0));
      	else
      		tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * d_m);
      	end
      	return tmp
      end
      
      d_m = N[Abs[d], $MachinePrecision]
      code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]}, If[LessEqual[d$95$m, 1.5e-163], N[(N[(N[(N[(N[(D * D), $MachinePrecision] * N[(N[(N[(M * M), $MachinePrecision] * -1.0), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * 0.125), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision], If[LessEqual[d$95$m, 120000000000.0], N[(N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision] * N[(N[(N[(M * N[(N[(M * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d$95$m, 1.5e+153], N[(N[(N[(N[(N[(N[(N[(M * M), $MachinePrecision] * h), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision] / t$95$1), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[(d$95$m / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision]]]]]]
      
      \begin{array}{l}
      d_m = \left|d\right|
      
      \\
      \begin{array}{l}
      t_0 := \sqrt{\ell \cdot h}\\
      t_1 := \left(d\_m \cdot d\_m\right) \cdot \ell\\
      \mathbf{if}\;d\_m \leq 1.5 \cdot 10^{-163}:\\
      \;\;\;\;\frac{\left(\left(\left(D \cdot D\right) \cdot \frac{\left(M \cdot M\right) \cdot -1}{d\_m}\right) \cdot t\_0\right) \cdot 0.125}{\ell \cdot \ell}\\
      
      \mathbf{elif}\;d\_m \leq 120000000000:\\
      \;\;\;\;\left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\_m\right) \cdot \mathsf{fma}\left(\frac{M \cdot \left(\left(M \cdot h\right) \cdot \left(D \cdot D\right)\right)}{t\_1}, -0.125, 1\right)\\
      
      \mathbf{elif}\;d\_m \leq 1.5 \cdot 10^{+153}:\\
      \;\;\;\;\mathsf{fma}\left(\frac{\left(\left(\left(M \cdot M\right) \cdot h\right) \cdot D\right) \cdot D}{t\_1}, -0.125, 1\right) \cdot \frac{d\_m}{t\_0}\\
      
      \mathbf{else}:\\
      \;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d\_m\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if d < 1.5000000000000001e-163

        1. Initial program 22.6%

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

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

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

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

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

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

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

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

        if 1.5000000000000001e-163 < d < 1.2e11

        1. Initial program 33.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 1.2e11 < d < 1.50000000000000009e153

        1. Initial program 40.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 1.50000000000000009e153 < d

        1. Initial program 44.4%

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
          3. 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-/.f6467.8

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

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

      Alternative 6: 54.7% accurate, 2.0× speedup?

      \[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := \sqrt{\ell \cdot h}\\ \mathbf{if}\;d\_m \leq 3.2 \cdot 10^{-163}:\\ \;\;\;\;\frac{\left(\left(\left(D \cdot D\right) \cdot \frac{\left(M \cdot M\right) \cdot -1}{d\_m}\right) \cdot t\_0\right) \cdot 0.125}{\ell \cdot \ell}\\ \mathbf{elif}\;d\_m \leq 1.5 \cdot 10^{+153}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\left(\left(\left(M \cdot M\right) \cdot h\right) \cdot D\right) \cdot D}{\left(d\_m \cdot d\_m\right) \cdot \ell}, -0.125, 1\right) \cdot \frac{d\_m}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d\_m\\ \end{array} \end{array} \]
      d_m = (fabs.f64 d)
      (FPCore (d_m h l M D)
       :precision binary64
       (let* ((t_0 (sqrt (* l h))))
         (if (<= d_m 3.2e-163)
           (/ (* (* (* (* D D) (/ (* (* M M) -1.0) d_m)) t_0) 0.125) (* l l))
           (if (<= d_m 1.5e+153)
             (*
              (fma (/ (* (* (* (* M M) h) D) D) (* (* d_m d_m) l)) -0.125 1.0)
              (/ d_m t_0))
             (* (sqrt (/ (/ 1.0 l) h)) d_m)))))
      d_m = fabs(d);
      double code(double d_m, double h, double l, double M, double D) {
      	double t_0 = sqrt((l * h));
      	double tmp;
      	if (d_m <= 3.2e-163) {
      		tmp = ((((D * D) * (((M * M) * -1.0) / d_m)) * t_0) * 0.125) / (l * l);
      	} else if (d_m <= 1.5e+153) {
      		tmp = fma((((((M * M) * h) * D) * D) / ((d_m * d_m) * l)), -0.125, 1.0) * (d_m / t_0);
      	} else {
      		tmp = sqrt(((1.0 / l) / h)) * d_m;
      	}
      	return tmp;
      }
      
      d_m = abs(d)
      function code(d_m, h, l, M, D)
      	t_0 = sqrt(Float64(l * h))
      	tmp = 0.0
      	if (d_m <= 3.2e-163)
      		tmp = Float64(Float64(Float64(Float64(Float64(D * D) * Float64(Float64(Float64(M * M) * -1.0) / d_m)) * t_0) * 0.125) / Float64(l * l));
      	elseif (d_m <= 1.5e+153)
      		tmp = Float64(fma(Float64(Float64(Float64(Float64(Float64(M * M) * h) * D) * D) / Float64(Float64(d_m * d_m) * l)), -0.125, 1.0) * Float64(d_m / t_0));
      	else
      		tmp = Float64(sqrt(Float64(Float64(1.0 / l) / h)) * d_m);
      	end
      	return tmp
      end
      
      d_m = N[Abs[d], $MachinePrecision]
      code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d$95$m, 3.2e-163], N[(N[(N[(N[(N[(D * D), $MachinePrecision] * N[(N[(N[(M * M), $MachinePrecision] * -1.0), $MachinePrecision] / d$95$m), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * 0.125), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision], If[LessEqual[d$95$m, 1.5e+153], N[(N[(N[(N[(N[(N[(N[(M * M), $MachinePrecision] * h), $MachinePrecision] * D), $MachinePrecision] * D), $MachinePrecision] / N[(N[(d$95$m * d$95$m), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] * -0.125 + 1.0), $MachinePrecision] * N[(d$95$m / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision] * d$95$m), $MachinePrecision]]]]
      
      \begin{array}{l}
      d_m = \left|d\right|
      
      \\
      \begin{array}{l}
      t_0 := \sqrt{\ell \cdot h}\\
      \mathbf{if}\;d\_m \leq 3.2 \cdot 10^{-163}:\\
      \;\;\;\;\frac{\left(\left(\left(D \cdot D\right) \cdot \frac{\left(M \cdot M\right) \cdot -1}{d\_m}\right) \cdot t\_0\right) \cdot 0.125}{\ell \cdot \ell}\\
      
      \mathbf{elif}\;d\_m \leq 1.5 \cdot 10^{+153}:\\
      \;\;\;\;\mathsf{fma}\left(\frac{\left(\left(\left(M \cdot M\right) \cdot h\right) \cdot D\right) \cdot D}{\left(d\_m \cdot d\_m\right) \cdot \ell}, -0.125, 1\right) \cdot \frac{d\_m}{t\_0}\\
      
      \mathbf{else}:\\
      \;\;\;\;\sqrt{\frac{\frac{1}{\ell}}{h}} \cdot d\_m\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if d < 3.19999999999999988e-163

        1. Initial program 22.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. Taylor expanded in l around 0

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

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

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

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

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

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

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

        if 3.19999999999999988e-163 < d < 1.50000000000000009e153

        1. Initial program 36.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 1.50000000000000009e153 < d

        1. Initial program 44.4%

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \sqrt{\frac{1}{\ell \cdot h}} \cdot d \]
          3. 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-/.f6467.8

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

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

      Alternative 7: 48.9% accurate, 2.7× speedup?

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

        1. Initial program 36.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{1 \cdot d}{\color{blue}{\sqrt{\ell \cdot h}}} \]
          15. *-lft-identity48.1

            \[\leadsto \frac{d}{\sqrt{\color{blue}{\ell \cdot h}}} \]
        8. Applied rewrites48.1%

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

        if 1.37999999999999998e-64 < M

        1. Initial program 31.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 8: 45.9% accurate, 2.7× speedup?

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

        1. Initial program 36.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{1 \cdot d}{\color{blue}{\sqrt{\ell \cdot h}}} \]
          15. *-lft-identity48.1

            \[\leadsto \frac{d}{\sqrt{\color{blue}{\ell \cdot h}}} \]
        8. Applied rewrites48.1%

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

        if 5.50000000000000026e-75 < M

        1. Initial program 31.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 9: 45.0% accurate, 0.5× speedup?

      \[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := \sqrt{\ell \cdot h}\\ t_1 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{-58}:\\ \;\;\;\;\left(-\frac{1}{t\_0}\right) \cdot d\_m\\ \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+252}:\\ \;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\_m\\ \mathbf{else}:\\ \;\;\;\;\frac{d\_m}{t\_0}\\ \end{array} \end{array} \]
      d_m = (fabs.f64 d)
      (FPCore (d_m h l M D)
       :precision binary64
       (let* ((t_0 (sqrt (* l h)))
              (t_1
               (*
                (* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
                (-
                 1.0
                 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))))
         (if (<= t_1 -5e-58)
           (* (- (/ 1.0 t_0)) d_m)
           (if (<= t_1 5e+252) (* (/ 1.0 (* (sqrt l) (sqrt h))) d_m) (/ d_m t_0)))))
      d_m = fabs(d);
      double code(double d_m, double h, double l, double M, double D) {
      	double t_0 = sqrt((l * h));
      	double t_1 = (pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
      	double tmp;
      	if (t_1 <= -5e-58) {
      		tmp = -(1.0 / t_0) * d_m;
      	} else if (t_1 <= 5e+252) {
      		tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m;
      	} else {
      		tmp = d_m / t_0;
      	}
      	return tmp;
      }
      
      d_m =     private
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(d_m, h, l, m, d)
      use fmin_fmax_functions
          real(8), intent (in) :: d_m
          real(8), intent (in) :: h
          real(8), intent (in) :: l
          real(8), intent (in) :: m
          real(8), intent (in) :: d
          real(8) :: t_0
          real(8) :: t_1
          real(8) :: tmp
          t_0 = sqrt((l * h))
          t_1 = (((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))
          if (t_1 <= (-5d-58)) then
              tmp = -(1.0d0 / t_0) * d_m
          else if (t_1 <= 5d+252) then
              tmp = (1.0d0 / (sqrt(l) * sqrt(h))) * d_m
          else
              tmp = d_m / t_0
          end if
          code = tmp
      end function
      
      d_m = Math.abs(d);
      public static double code(double d_m, double h, double l, double M, double D) {
      	double t_0 = Math.sqrt((l * h));
      	double t_1 = (Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)));
      	double tmp;
      	if (t_1 <= -5e-58) {
      		tmp = -(1.0 / t_0) * d_m;
      	} else if (t_1 <= 5e+252) {
      		tmp = (1.0 / (Math.sqrt(l) * Math.sqrt(h))) * d_m;
      	} else {
      		tmp = d_m / t_0;
      	}
      	return tmp;
      }
      
      d_m = math.fabs(d)
      def code(d_m, h, l, M, D):
      	t_0 = math.sqrt((l * h))
      	t_1 = (math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)))
      	tmp = 0
      	if t_1 <= -5e-58:
      		tmp = -(1.0 / t_0) * d_m
      	elif t_1 <= 5e+252:
      		tmp = (1.0 / (math.sqrt(l) * math.sqrt(h))) * d_m
      	else:
      		tmp = d_m / t_0
      	return tmp
      
      d_m = abs(d)
      function code(d_m, h, l, M, D)
      	t_0 = sqrt(Float64(l * h))
      	t_1 = Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l))))
      	tmp = 0.0
      	if (t_1 <= -5e-58)
      		tmp = Float64(Float64(-Float64(1.0 / t_0)) * d_m);
      	elseif (t_1 <= 5e+252)
      		tmp = Float64(Float64(1.0 / Float64(sqrt(l) * sqrt(h))) * d_m);
      	else
      		tmp = Float64(d_m / t_0);
      	end
      	return tmp
      end
      
      d_m = abs(d);
      function tmp_2 = code(d_m, h, l, M, D)
      	t_0 = sqrt((l * h));
      	t_1 = (((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d_m)) ^ 2.0)) * (h / l)));
      	tmp = 0.0;
      	if (t_1 <= -5e-58)
      		tmp = -(1.0 / t_0) * d_m;
      	elseif (t_1 <= 5e+252)
      		tmp = (1.0 / (sqrt(l) * sqrt(h))) * d_m;
      	else
      		tmp = d_m / t_0;
      	end
      	tmp_2 = tmp;
      end
      
      d_m = N[Abs[d], $MachinePrecision]
      code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d$95$m / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d$95$m / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-58], N[((-N[(1.0 / t$95$0), $MachinePrecision]) * d$95$m), $MachinePrecision], If[LessEqual[t$95$1, 5e+252], N[(N[(1.0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d$95$m), $MachinePrecision], N[(d$95$m / t$95$0), $MachinePrecision]]]]]
      
      \begin{array}{l}
      d_m = \left|d\right|
      
      \\
      \begin{array}{l}
      t_0 := \sqrt{\ell \cdot h}\\
      t_1 := \left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
      \mathbf{if}\;t\_1 \leq -5 \cdot 10^{-58}:\\
      \;\;\;\;\left(-\frac{1}{t\_0}\right) \cdot d\_m\\
      
      \mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+252}:\\
      \;\;\;\;\frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d\_m\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{d\_m}{t\_0}\\
      
      
      \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)))) < -4.99999999999999977e-58

        1. Initial program 83.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -4.99999999999999977e-58 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.9999999999999997e252

        1. Initial program 87.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 4.9999999999999997e252 < (*.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 7.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{1 \cdot d}{\color{blue}{\sqrt{\ell \cdot h}}} \]
          15. *-lft-identity44.6

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

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

      Alternative 10: 44.1% accurate, 0.9× speedup?

      \[\begin{array}{l} d_m = \left|d\right| \\ \begin{array}{l} t_0 := \sqrt{\ell \cdot h}\\ \mathbf{if}\;\left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{-58}:\\ \;\;\;\;\left(-\frac{1}{t\_0}\right) \cdot d\_m\\ \mathbf{else}:\\ \;\;\;\;\frac{d\_m}{t\_0}\\ \end{array} \end{array} \]
      d_m = (fabs.f64 d)
      (FPCore (d_m h l M D)
       :precision binary64
       (let* ((t_0 (sqrt (* l h))))
         (if (<=
              (*
               (* (pow (/ d_m h) (/ 1.0 2.0)) (pow (/ d_m l) (/ 1.0 2.0)))
               (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d_m)) 2.0)) (/ h l))))
              -5e-58)
           (* (- (/ 1.0 t_0)) d_m)
           (/ d_m t_0))))
      d_m = fabs(d);
      double code(double d_m, double h, double l, double M, double D) {
      	double t_0 = sqrt((l * h));
      	double tmp;
      	if (((pow((d_m / h), (1.0 / 2.0)) * pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -5e-58) {
      		tmp = -(1.0 / t_0) * d_m;
      	} else {
      		tmp = d_m / t_0;
      	}
      	return tmp;
      }
      
      d_m =     private
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(d_m, h, l, m, d)
      use fmin_fmax_functions
          real(8), intent (in) :: d_m
          real(8), intent (in) :: h
          real(8), intent (in) :: l
          real(8), intent (in) :: m
          real(8), intent (in) :: d
          real(8) :: t_0
          real(8) :: tmp
          t_0 = sqrt((l * h))
          if (((((d_m / h) ** (1.0d0 / 2.0d0)) * ((d_m / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d) / (2.0d0 * d_m)) ** 2.0d0)) * (h / l)))) <= (-5d-58)) then
              tmp = -(1.0d0 / t_0) * d_m
          else
              tmp = d_m / t_0
          end if
          code = tmp
      end function
      
      d_m = Math.abs(d);
      public static double code(double d_m, double h, double l, double M, double D) {
      	double t_0 = Math.sqrt((l * h));
      	double tmp;
      	if (((Math.pow((d_m / h), (1.0 / 2.0)) * Math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -5e-58) {
      		tmp = -(1.0 / t_0) * d_m;
      	} else {
      		tmp = d_m / t_0;
      	}
      	return tmp;
      }
      
      d_m = math.fabs(d)
      def code(d_m, h, l, M, D):
      	t_0 = math.sqrt((l * h))
      	tmp = 0
      	if ((math.pow((d_m / h), (1.0 / 2.0)) * math.pow((d_m / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d_m)), 2.0)) * (h / l)))) <= -5e-58:
      		tmp = -(1.0 / t_0) * d_m
      	else:
      		tmp = d_m / t_0
      	return tmp
      
      d_m = abs(d)
      function code(d_m, h, l, M, D)
      	t_0 = sqrt(Float64(l * h))
      	tmp = 0.0
      	if (Float64(Float64((Float64(d_m / h) ^ Float64(1.0 / 2.0)) * (Float64(d_m / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d_m)) ^ 2.0)) * Float64(h / l)))) <= -5e-58)
      		tmp = Float64(Float64(-Float64(1.0 / t_0)) * d_m);
      	else
      		tmp = Float64(d_m / t_0);
      	end
      	return tmp
      end
      
      d_m = abs(d);
      function tmp_2 = code(d_m, h, l, M, D)
      	t_0 = sqrt((l * h));
      	tmp = 0.0;
      	if (((((d_m / h) ^ (1.0 / 2.0)) * ((d_m / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d_m)) ^ 2.0)) * (h / l)))) <= -5e-58)
      		tmp = -(1.0 / t_0) * d_m;
      	else
      		tmp = d_m / t_0;
      	end
      	tmp_2 = tmp;
      end
      
      d_m = N[Abs[d], $MachinePrecision]
      code[d$95$m_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(N[Power[N[(d$95$m / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d$95$m / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e-58], N[((-N[(1.0 / t$95$0), $MachinePrecision]) * d$95$m), $MachinePrecision], N[(d$95$m / t$95$0), $MachinePrecision]]]
      
      \begin{array}{l}
      d_m = \left|d\right|
      
      \\
      \begin{array}{l}
      t_0 := \sqrt{\ell \cdot h}\\
      \mathbf{if}\;\left({\left(\frac{d\_m}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d\_m}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d\_m}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -5 \cdot 10^{-58}:\\
      \;\;\;\;\left(-\frac{1}{t\_0}\right) \cdot d\_m\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{d\_m}{t\_0}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -4.99999999999999977e-58

        1. Initial program 83.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -4.99999999999999977e-58 < (*.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 25.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{1 \cdot d}{\color{blue}{\sqrt{\ell \cdot h}}} \]
          15. *-lft-identity50.6

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

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

      Alternative 11: 42.5% accurate, 10.2× speedup?

      \[\begin{array}{l} d_m = \left|d\right| \\ \frac{d\_m}{\sqrt{\ell \cdot h}} \end{array} \]
      d_m = (fabs.f64 d)
      (FPCore (d_m h l M D) :precision binary64 (/ d_m (sqrt (* l h))))
      d_m = fabs(d);
      double code(double d_m, double h, double l, double M, double D) {
      	return d_m / sqrt((l * h));
      }
      
      d_m =     private
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(d_m, h, l, m, d)
      use fmin_fmax_functions
          real(8), intent (in) :: d_m
          real(8), intent (in) :: h
          real(8), intent (in) :: l
          real(8), intent (in) :: m
          real(8), intent (in) :: d
          code = d_m / sqrt((l * h))
      end function
      
      d_m = Math.abs(d);
      public static double code(double d_m, double h, double l, double M, double D) {
      	return d_m / Math.sqrt((l * h));
      }
      
      d_m = math.fabs(d)
      def code(d_m, h, l, M, D):
      	return d_m / math.sqrt((l * h))
      
      d_m = abs(d)
      function code(d_m, h, l, M, D)
      	return Float64(d_m / sqrt(Float64(l * h)))
      end
      
      d_m = abs(d);
      function tmp = code(d_m, h, l, M, D)
      	tmp = d_m / sqrt((l * h));
      end
      
      d_m = N[Abs[d], $MachinePrecision]
      code[d$95$m_, h_, l_, M_, D_] := N[(d$95$m / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      d_m = \left|d\right|
      
      \\
      \frac{d\_m}{\sqrt{\ell \cdot h}}
      \end{array}
      
      Derivation
      1. Initial program 34.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{1 \cdot d}{\color{blue}{\sqrt{\ell \cdot h}}} \]
        15. *-lft-identity42.5

          \[\leadsto \frac{d}{\sqrt{\color{blue}{\ell \cdot h}}} \]
      8. Applied rewrites42.5%

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

      Reproduce

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