Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.4% → 78.2%
Time: 15.4s
Alternatives: 19
Speedup: 0.8×

Specification

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

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

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

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

Sampling outcomes in binary64 precision:

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 19 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: 66.4% 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.2% accurate, 0.8× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M\_m}{-2} \cdot \frac{D}{d}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (if (<= l -5e-310)
   (*
    (* (/ (sqrt (- d)) (sqrt (- h))) (pow (/ d l) (pow 2.0 -1.0)))
    (- 1.0 (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))
   (/
    (*
     (fma (* (/ h l) -0.5) (pow (* (/ M_m -2.0) (/ D d)) 2.0) 1.0)
     (/ d (sqrt l)))
    (sqrt h))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double tmp;
	if (l <= -5e-310) {
		tmp = ((sqrt(-d) / sqrt(-h)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
	} else {
		tmp = (fma(((h / l) * -0.5), pow(((M_m / -2.0) * (D / d)), 2.0), 1.0) * (d / sqrt(l))) / sqrt(h);
	}
	return tmp;
}
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	tmp = 0.0
	if (l <= -5e-310)
		tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))));
	else
		tmp = Float64(Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M_m / -2.0) * Float64(D / d)) ^ 2.0), 1.0) * Float64(d / sqrt(l))) / sqrt(h));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[l, -5e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M$95$m / -2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M\_m}{-2} \cdot \frac{D}{d}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\


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

    1. Initial program 78.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < l

    1. Initial program 74.2%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M}{-2} \cdot \frac{D}{d}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 69.7% accurate, 0.3× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\ t_1 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_1 \leq 5 \cdot 10^{-46}:\\ \;\;\;\;t\_0 \cdot \left(1 - \frac{\left(\frac{D}{\ell} \cdot \left(h \cdot \frac{M\_m}{d}\right)\right) \cdot \left(0.5 \cdot D\right)}{4} \cdot \frac{M\_m}{d}\right)\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;t\_0 \cdot \left(1 - \left(\frac{h}{d} \cdot \frac{M\_m}{\ell}\right) \cdot \left(\frac{D}{2} \cdot \left(\frac{0.5 \cdot D}{d} \cdot \frac{M\_m}{2}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\_m\right) \cdot M\_m}{d}, 0.125, \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D)
 :precision binary64
 (let* ((t_0 (* (sqrt (/ d h)) (sqrt (/ d l))))
        (t_1
         (*
          (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
          (-
           1.0
           (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))))
   (if (<= t_1 5e-46)
     (*
      t_0
      (- 1.0 (* (/ (* (* (/ D l) (* h (/ M_m d))) (* 0.5 D)) 4.0) (/ M_m d))))
     (if (<= t_1 INFINITY)
       (*
        t_0
        (-
         1.0
         (*
          (* (/ h d) (/ M_m l))
          (* (/ D 2.0) (* (/ (* 0.5 D) d) (/ M_m 2.0))))))
       (fma
        (* (* (/ (sqrt (/ h l)) l) (* D D)) (/ (* (- M_m) M_m) d))
        0.125
        (* (- d) (sqrt (pow (* l h) -1.0))))))))
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D);
double code(double d, double h, double l, double M_m, double D) {
	double t_0 = sqrt((d / h)) * sqrt((d / l));
	double t_1 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
	double tmp;
	if (t_1 <= 5e-46) {
		tmp = t_0 * (1.0 - (((((D / l) * (h * (M_m / d))) * (0.5 * D)) / 4.0) * (M_m / d)));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = t_0 * (1.0 - (((h / d) * (M_m / l)) * ((D / 2.0) * (((0.5 * D) / d) * (M_m / 2.0)))));
	} else {
		tmp = fma((((sqrt((h / l)) / l) * (D * D)) * ((-M_m * M_m) / d)), 0.125, (-d * sqrt(pow((l * h), -1.0))));
	}
	return tmp;
}
M_m = abs(M)
d, h, l, M_m, D = sort([d, h, l, M_m, D])
function code(d, h, l, M_m, D)
	t_0 = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))
	t_1 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
	tmp = 0.0
	if (t_1 <= 5e-46)
		tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D / l) * Float64(h * Float64(M_m / d))) * Float64(0.5 * D)) / 4.0) * Float64(M_m / d))));
	elseif (t_1 <= Inf)
		tmp = Float64(t_0 * Float64(1.0 - Float64(Float64(Float64(h / d) * Float64(M_m / l)) * Float64(Float64(D / 2.0) * Float64(Float64(Float64(0.5 * D) / d) * Float64(M_m / 2.0))))));
	else
		tmp = fma(Float64(Float64(Float64(sqrt(Float64(h / l)) / l) * Float64(D * D)) * Float64(Float64(Float64(-M_m) * M_m) / d)), 0.125, Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))));
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-46], N[(t$95$0 * N[(1.0 - N[(N[(N[(N[(N[(D / l), $MachinePrecision] * N[(h * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 * D), $MachinePrecision]), $MachinePrecision] / 4.0), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(t$95$0 * N[(1.0 - N[(N[(N[(h / d), $MachinePrecision] * N[(M$95$m / l), $MachinePrecision]), $MachinePrecision] * N[(N[(D / 2.0), $MachinePrecision] * N[(N[(N[(0.5 * D), $MachinePrecision] / d), $MachinePrecision] * N[(M$95$m / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / l), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[((-M$95$m) * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * 0.125 + N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
[d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-46}:\\
\;\;\;\;t\_0 \cdot \left(1 - \frac{\left(\frac{D}{\ell} \cdot \left(h \cdot \frac{M\_m}{d}\right)\right) \cdot \left(0.5 \cdot D\right)}{4} \cdot \frac{M\_m}{d}\right)\\

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

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


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

    1. Initial program 93.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 87.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

        \[\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}}} \]
    7. Applied rewrites15.7%

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

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

      \[\leadsto \mathsf{fma}\left(\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, \color{blue}{0.125}, \left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \]
    10. Step-by-step derivation
      1. Applied rewrites36.8%

        \[\leadsto \mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, 0.125, \left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \]
    11. Recombined 3 regimes into one program.
    12. Final simplification79.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq 5 \cdot 10^{-46}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{\ell} \cdot \left(h \cdot \frac{M}{d}\right)\right) \cdot \left(0.5 \cdot D\right)}{4} \cdot \frac{M}{d}\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\frac{h}{d} \cdot \frac{M}{\ell}\right) \cdot \left(\frac{D}{2} \cdot \left(\frac{0.5 \cdot D}{d} \cdot \frac{M}{2}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, 0.125, \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right)\\ \end{array} \]
    13. Add Preprocessing

    Alternative 3: 65.4% accurate, 0.3× speedup?

    \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \sqrt{\frac{d}{\ell}}\\ t_2 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_2 \leq -4 \cdot 10^{-48}:\\ \;\;\;\;\left(t\_0 \cdot t\_1\right) \cdot \mathsf{fma}\left(\frac{-0.125 \cdot D}{d} \cdot \frac{h \cdot D}{\ell \cdot d}, M\_m \cdot M\_m, 1\right)\\ \mathbf{elif}\;t\_2 \leq \infty:\\ \;\;\;\;\left(t\_0 \cdot 1\right) \cdot t\_1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\_m\right) \cdot M\_m}{d}, 0.125, \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right)\\ \end{array} \end{array} \]
    M_m = (fabs.f64 M)
    NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
    (FPCore (d h l M_m D)
     :precision binary64
     (let* ((t_0 (sqrt (/ d h)))
            (t_1 (sqrt (/ d l)))
            (t_2
             (*
              (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
              (-
               1.0
               (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))))
       (if (<= t_2 -4e-48)
         (*
          (* t_0 t_1)
          (fma (* (/ (* -0.125 D) d) (/ (* h D) (* l d))) (* M_m M_m) 1.0))
         (if (<= t_2 INFINITY)
           (* (* t_0 1.0) t_1)
           (fma
            (* (* (/ (sqrt (/ h l)) l) (* D D)) (/ (* (- M_m) M_m) d))
            0.125
            (* (- d) (sqrt (pow (* l h) -1.0))))))))
    M_m = fabs(M);
    assert(d < h && h < l && l < M_m && M_m < D);
    double code(double d, double h, double l, double M_m, double D) {
    	double t_0 = sqrt((d / h));
    	double t_1 = sqrt((d / l));
    	double t_2 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
    	double tmp;
    	if (t_2 <= -4e-48) {
    		tmp = (t_0 * t_1) * fma((((-0.125 * D) / d) * ((h * D) / (l * d))), (M_m * M_m), 1.0);
    	} else if (t_2 <= ((double) INFINITY)) {
    		tmp = (t_0 * 1.0) * t_1;
    	} else {
    		tmp = fma((((sqrt((h / l)) / l) * (D * D)) * ((-M_m * M_m) / d)), 0.125, (-d * sqrt(pow((l * h), -1.0))));
    	}
    	return tmp;
    }
    
    M_m = abs(M)
    d, h, l, M_m, D = sort([d, h, l, M_m, D])
    function code(d, h, l, M_m, D)
    	t_0 = sqrt(Float64(d / h))
    	t_1 = sqrt(Float64(d / l))
    	t_2 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
    	tmp = 0.0
    	if (t_2 <= -4e-48)
    		tmp = Float64(Float64(t_0 * t_1) * fma(Float64(Float64(Float64(-0.125 * D) / d) * Float64(Float64(h * D) / Float64(l * d))), Float64(M_m * M_m), 1.0));
    	elseif (t_2 <= Inf)
    		tmp = Float64(Float64(t_0 * 1.0) * t_1);
    	else
    		tmp = fma(Float64(Float64(Float64(sqrt(Float64(h / l)) / l) * Float64(D * D)) * Float64(Float64(Float64(-M_m) * M_m) / d)), 0.125, Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))));
    	end
    	return tmp
    end
    
    M_m = N[Abs[M], $MachinePrecision]
    NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
    code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e-48], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(N[(N[(N[(-0.125 * D), $MachinePrecision] / d), $MachinePrecision] * N[(N[(h * D), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(M$95$m * M$95$m), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(t$95$0 * 1.0), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / l), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[((-M$95$m) * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * 0.125 + N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
    
    \begin{array}{l}
    M_m = \left|M\right|
    \\
    [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
    \\
    \begin{array}{l}
    t_0 := \sqrt{\frac{d}{h}}\\
    t_1 := \sqrt{\frac{d}{\ell}}\\
    t_2 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
    \mathbf{if}\;t\_2 \leq -4 \cdot 10^{-48}:\\
    \;\;\;\;\left(t\_0 \cdot t\_1\right) \cdot \mathsf{fma}\left(\frac{-0.125 \cdot D}{d} \cdot \frac{h \cdot D}{\ell \cdot d}, M\_m \cdot M\_m, 1\right)\\
    
    \mathbf{elif}\;t\_2 \leq \infty:\\
    \;\;\;\;\left(t\_0 \cdot 1\right) \cdot t\_1\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\_m\right) \cdot M\_m}{d}, 0.125, \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -3.9999999999999999e-48

      1. Initial program 92.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({M}^{2} \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell} + \frac{1}{{M}^{2}}\right)}\right) \]
        3. distribute-rgt-inN/A

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot {M}^{2} + \frac{1}{{M}^{2}} \cdot {M}^{2}\right)} \]
        4. lft-mult-inverseN/A

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

          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}, {M}^{2}, 1\right)} \]
      9. Applied rewrites75.7%

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\mathsf{fma}\left(\frac{-0.125}{\ell \cdot d} \cdot \frac{\left(D \cdot D\right) \cdot h}{d}, M \cdot M, 1\right)} \]
      10. Step-by-step derivation
        1. Applied rewrites78.2%

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

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

        1. Initial program 88.8%

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

          \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{1} \]
        4. Step-by-step derivation
          1. Applied rewrites83.9%

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

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

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

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

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

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

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

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

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

          1. Initial program 0.0%

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

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

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

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

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

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

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

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

              \[\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}}} \]
          7. Applied rewrites15.7%

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

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

            \[\leadsto \mathsf{fma}\left(\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, \color{blue}{0.125}, \left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \]
          10. Step-by-step derivation
            1. Applied rewrites36.8%

              \[\leadsto \mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, 0.125, \left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \]
          11. Recombined 3 regimes into one program.
          12. Final simplification74.6%

            \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -4 \cdot 10^{-48}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left(\frac{-0.125 \cdot D}{d} \cdot \frac{h \cdot D}{\ell \cdot d}, M \cdot M, 1\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, 0.125, \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right)\\ \end{array} \]
          13. Add Preprocessing

          Alternative 4: 64.2% accurate, 0.3× speedup?

          \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \sqrt{\frac{d}{\ell}}\\ t_2 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_2 \leq -4 \cdot 10^{-48}:\\ \;\;\;\;\left(t\_0 \cdot t\_1\right) \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d} \cdot \frac{\left(D \cdot D\right) \cdot h}{d}, M\_m \cdot M\_m, 1\right)\\ \mathbf{elif}\;t\_2 \leq \infty:\\ \;\;\;\;\left(t\_0 \cdot 1\right) \cdot t\_1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\_m\right) \cdot M\_m}{d}, 0.125, \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right)\\ \end{array} \end{array} \]
          M_m = (fabs.f64 M)
          NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
          (FPCore (d h l M_m D)
           :precision binary64
           (let* ((t_0 (sqrt (/ d h)))
                  (t_1 (sqrt (/ d l)))
                  (t_2
                   (*
                    (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                    (-
                     1.0
                     (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))))
             (if (<= t_2 -4e-48)
               (*
                (* t_0 t_1)
                (fma (* (/ -0.125 (* l d)) (/ (* (* D D) h) d)) (* M_m M_m) 1.0))
               (if (<= t_2 INFINITY)
                 (* (* t_0 1.0) t_1)
                 (fma
                  (* (* (/ (sqrt (/ h l)) l) (* D D)) (/ (* (- M_m) M_m) d))
                  0.125
                  (* (- d) (sqrt (pow (* l h) -1.0))))))))
          M_m = fabs(M);
          assert(d < h && h < l && l < M_m && M_m < D);
          double code(double d, double h, double l, double M_m, double D) {
          	double t_0 = sqrt((d / h));
          	double t_1 = sqrt((d / l));
          	double t_2 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
          	double tmp;
          	if (t_2 <= -4e-48) {
          		tmp = (t_0 * t_1) * fma(((-0.125 / (l * d)) * (((D * D) * h) / d)), (M_m * M_m), 1.0);
          	} else if (t_2 <= ((double) INFINITY)) {
          		tmp = (t_0 * 1.0) * t_1;
          	} else {
          		tmp = fma((((sqrt((h / l)) / l) * (D * D)) * ((-M_m * M_m) / d)), 0.125, (-d * sqrt(pow((l * h), -1.0))));
          	}
          	return tmp;
          }
          
          M_m = abs(M)
          d, h, l, M_m, D = sort([d, h, l, M_m, D])
          function code(d, h, l, M_m, D)
          	t_0 = sqrt(Float64(d / h))
          	t_1 = sqrt(Float64(d / l))
          	t_2 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
          	tmp = 0.0
          	if (t_2 <= -4e-48)
          		tmp = Float64(Float64(t_0 * t_1) * fma(Float64(Float64(-0.125 / Float64(l * d)) * Float64(Float64(Float64(D * D) * h) / d)), Float64(M_m * M_m), 1.0));
          	elseif (t_2 <= Inf)
          		tmp = Float64(Float64(t_0 * 1.0) * t_1);
          	else
          		tmp = fma(Float64(Float64(Float64(sqrt(Float64(h / l)) / l) * Float64(D * D)) * Float64(Float64(Float64(-M_m) * M_m) / d)), 0.125, Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))));
          	end
          	return tmp
          end
          
          M_m = N[Abs[M], $MachinePrecision]
          NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
          code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e-48], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(N[(N[(-0.125 / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(M$95$m * M$95$m), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(t$95$0 * 1.0), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / l), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[((-M$95$m) * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * 0.125 + N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
          
          \begin{array}{l}
          M_m = \left|M\right|
          \\
          [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
          \\
          \begin{array}{l}
          t_0 := \sqrt{\frac{d}{h}}\\
          t_1 := \sqrt{\frac{d}{\ell}}\\
          t_2 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
          \mathbf{if}\;t\_2 \leq -4 \cdot 10^{-48}:\\
          \;\;\;\;\left(t\_0 \cdot t\_1\right) \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d} \cdot \frac{\left(D \cdot D\right) \cdot h}{d}, M\_m \cdot M\_m, 1\right)\\
          
          \mathbf{elif}\;t\_2 \leq \infty:\\
          \;\;\;\;\left(t\_0 \cdot 1\right) \cdot t\_1\\
          
          \mathbf{else}:\\
          \;\;\;\;\mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\_m\right) \cdot M\_m}{d}, 0.125, \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -3.9999999999999999e-48

            1. Initial program 92.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({M}^{2} \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell} + \frac{1}{{M}^{2}}\right)}\right) \]
              3. distribute-rgt-inN/A

                \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot {M}^{2} + \frac{1}{{M}^{2}} \cdot {M}^{2}\right)} \]
              4. lft-mult-inverseN/A

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

                \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}, {M}^{2}, 1\right)} \]
            9. Applied rewrites75.7%

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

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

            1. Initial program 88.8%

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

              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{1} \]
            4. Step-by-step derivation
              1. Applied rewrites83.9%

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

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

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

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

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

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

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

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

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

              1. Initial program 0.0%

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

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

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

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

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

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

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

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

                  \[\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}}} \]
              7. Applied rewrites15.7%

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

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

                \[\leadsto \mathsf{fma}\left(\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, \color{blue}{0.125}, \left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \]
              10. Step-by-step derivation
                1. Applied rewrites36.8%

                  \[\leadsto \mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, 0.125, \left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \]
              11. Recombined 3 regimes into one program.
              12. Final simplification73.8%

                \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -4 \cdot 10^{-48}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d} \cdot \frac{\left(D \cdot D\right) \cdot h}{d}, M \cdot M, 1\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, 0.125, \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right)\\ \end{array} \]
              13. Add Preprocessing

              Alternative 5: 62.1% accurate, 0.3× speedup?

              \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \sqrt{\frac{d}{\ell}}\\ t_2 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_2 \leq -4 \cdot 10^{-48}:\\ \;\;\;\;\left(t\_0 \cdot t\_1\right) \cdot \mathsf{fma}\left(\frac{\left(\left(D \cdot D\right) \cdot h\right) \cdot -0.125}{\left(\ell \cdot d\right) \cdot d}, M\_m \cdot M\_m, 1\right)\\ \mathbf{elif}\;t\_2 \leq \infty:\\ \;\;\;\;\left(t\_0 \cdot 1\right) \cdot t\_1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\_m\right) \cdot M\_m}{d}, 0.125, \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right)\\ \end{array} \end{array} \]
              M_m = (fabs.f64 M)
              NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
              (FPCore (d h l M_m D)
               :precision binary64
               (let* ((t_0 (sqrt (/ d h)))
                      (t_1 (sqrt (/ d l)))
                      (t_2
                       (*
                        (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                        (-
                         1.0
                         (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))))
                 (if (<= t_2 -4e-48)
                   (*
                    (* t_0 t_1)
                    (fma (/ (* (* (* D D) h) -0.125) (* (* l d) d)) (* M_m M_m) 1.0))
                   (if (<= t_2 INFINITY)
                     (* (* t_0 1.0) t_1)
                     (fma
                      (* (* (/ (sqrt (/ h l)) l) (* D D)) (/ (* (- M_m) M_m) d))
                      0.125
                      (* (- d) (sqrt (pow (* l h) -1.0))))))))
              M_m = fabs(M);
              assert(d < h && h < l && l < M_m && M_m < D);
              double code(double d, double h, double l, double M_m, double D) {
              	double t_0 = sqrt((d / h));
              	double t_1 = sqrt((d / l));
              	double t_2 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
              	double tmp;
              	if (t_2 <= -4e-48) {
              		tmp = (t_0 * t_1) * fma(((((D * D) * h) * -0.125) / ((l * d) * d)), (M_m * M_m), 1.0);
              	} else if (t_2 <= ((double) INFINITY)) {
              		tmp = (t_0 * 1.0) * t_1;
              	} else {
              		tmp = fma((((sqrt((h / l)) / l) * (D * D)) * ((-M_m * M_m) / d)), 0.125, (-d * sqrt(pow((l * h), -1.0))));
              	}
              	return tmp;
              }
              
              M_m = abs(M)
              d, h, l, M_m, D = sort([d, h, l, M_m, D])
              function code(d, h, l, M_m, D)
              	t_0 = sqrt(Float64(d / h))
              	t_1 = sqrt(Float64(d / l))
              	t_2 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
              	tmp = 0.0
              	if (t_2 <= -4e-48)
              		tmp = Float64(Float64(t_0 * t_1) * fma(Float64(Float64(Float64(Float64(D * D) * h) * -0.125) / Float64(Float64(l * d) * d)), Float64(M_m * M_m), 1.0));
              	elseif (t_2 <= Inf)
              		tmp = Float64(Float64(t_0 * 1.0) * t_1);
              	else
              		tmp = fma(Float64(Float64(Float64(sqrt(Float64(h / l)) / l) * Float64(D * D)) * Float64(Float64(Float64(-M_m) * M_m) / d)), 0.125, Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))));
              	end
              	return tmp
              end
              
              M_m = N[Abs[M], $MachinePrecision]
              NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
              code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e-48], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(N[(N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] * -0.125), $MachinePrecision] / N[(N[(l * d), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] * N[(M$95$m * M$95$m), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(t$95$0 * 1.0), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / l), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[((-M$95$m) * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * 0.125 + N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
              
              \begin{array}{l}
              M_m = \left|M\right|
              \\
              [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
              \\
              \begin{array}{l}
              t_0 := \sqrt{\frac{d}{h}}\\
              t_1 := \sqrt{\frac{d}{\ell}}\\
              t_2 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
              \mathbf{if}\;t\_2 \leq -4 \cdot 10^{-48}:\\
              \;\;\;\;\left(t\_0 \cdot t\_1\right) \cdot \mathsf{fma}\left(\frac{\left(\left(D \cdot D\right) \cdot h\right) \cdot -0.125}{\left(\ell \cdot d\right) \cdot d}, M\_m \cdot M\_m, 1\right)\\
              
              \mathbf{elif}\;t\_2 \leq \infty:\\
              \;\;\;\;\left(t\_0 \cdot 1\right) \cdot t\_1\\
              
              \mathbf{else}:\\
              \;\;\;\;\mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\_m\right) \cdot M\_m}{d}, 0.125, \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -3.9999999999999999e-48

                1. Initial program 92.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({M}^{2} \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell} + \frac{1}{{M}^{2}}\right)}\right) \]
                  3. distribute-rgt-inN/A

                    \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot {M}^{2} + \frac{1}{{M}^{2}} \cdot {M}^{2}\right)} \]
                  4. lft-mult-inverseN/A

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

                    \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}, {M}^{2}, 1\right)} \]
                9. Applied rewrites75.7%

                  \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\mathsf{fma}\left(\frac{-0.125}{\ell \cdot d} \cdot \frac{\left(D \cdot D\right) \cdot h}{d}, M \cdot M, 1\right)} \]
                10. Step-by-step derivation
                  1. Applied rewrites69.9%

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

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

                  1. Initial program 88.8%

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

                    \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{1} \]
                  4. Step-by-step derivation
                    1. Applied rewrites83.9%

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

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

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

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

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

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

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

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

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

                    1. Initial program 0.0%

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

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

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

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

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

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

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

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

                        \[\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}}} \]
                    7. Applied rewrites15.7%

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

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

                      \[\leadsto \mathsf{fma}\left(\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, \color{blue}{0.125}, \left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \]
                    10. Step-by-step derivation
                      1. Applied rewrites36.8%

                        \[\leadsto \mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, 0.125, \left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \]
                    11. Recombined 3 regimes into one program.
                    12. Final simplification71.8%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -4 \cdot 10^{-48}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left(\frac{\left(\left(D \cdot D\right) \cdot h\right) \cdot -0.125}{\left(\ell \cdot d\right) \cdot d}, M \cdot M, 1\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, 0.125, \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right)\\ \end{array} \]
                    13. Add Preprocessing

                    Alternative 6: 50.3% accurate, 0.3× speedup?

                    \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_0 \leq -4 \cdot 10^{-48} \lor \neg \left(t\_0 \leq \infty\right):\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{M\_m \cdot M\_m}{\ell}, \frac{\frac{\left(D \cdot D\right) \cdot h}{d}}{d} \cdot -0.125, 1\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\ \end{array} \end{array} \]
                    M_m = (fabs.f64 M)
                    NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                    (FPCore (d h l M_m D)
                     :precision binary64
                     (let* ((t_0
                             (*
                              (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                              (-
                               1.0
                               (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))))
                       (if (or (<= t_0 -4e-48) (not (<= t_0 INFINITY)))
                         (*
                          (/ d (sqrt (* l h)))
                          (fma (/ (* M_m M_m) l) (* (/ (/ (* (* D D) h) d) d) -0.125) 1.0))
                         (* (* (sqrt (/ d h)) 1.0) (sqrt (/ d l))))))
                    M_m = fabs(M);
                    assert(d < h && h < l && l < M_m && M_m < D);
                    double code(double d, double h, double l, double M_m, double D) {
                    	double t_0 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
                    	double tmp;
                    	if ((t_0 <= -4e-48) || !(t_0 <= ((double) INFINITY))) {
                    		tmp = (d / sqrt((l * h))) * fma(((M_m * M_m) / l), (((((D * D) * h) / d) / d) * -0.125), 1.0);
                    	} else {
                    		tmp = (sqrt((d / h)) * 1.0) * sqrt((d / l));
                    	}
                    	return tmp;
                    }
                    
                    M_m = abs(M)
                    d, h, l, M_m, D = sort([d, h, l, M_m, D])
                    function code(d, h, l, M_m, D)
                    	t_0 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
                    	tmp = 0.0
                    	if ((t_0 <= -4e-48) || !(t_0 <= Inf))
                    		tmp = Float64(Float64(d / sqrt(Float64(l * h))) * fma(Float64(Float64(M_m * M_m) / l), Float64(Float64(Float64(Float64(Float64(D * D) * h) / d) / d) * -0.125), 1.0));
                    	else
                    		tmp = Float64(Float64(sqrt(Float64(d / h)) * 1.0) * sqrt(Float64(d / l)));
                    	end
                    	return tmp
                    end
                    
                    M_m = N[Abs[M], $MachinePrecision]
                    NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                    code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -4e-48], N[Not[LessEqual[t$95$0, Infinity]], $MachinePrecision]], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
                    
                    \begin{array}{l}
                    M_m = \left|M\right|
                    \\
                    [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                    \\
                    \begin{array}{l}
                    t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
                    \mathbf{if}\;t\_0 \leq -4 \cdot 10^{-48} \lor \neg \left(t\_0 \leq \infty\right):\\
                    \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{M\_m \cdot M\_m}{\ell}, \frac{\frac{\left(D \cdot D\right) \cdot h}{d}}{d} \cdot -0.125, 1\right)\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\
                    
                    
                    \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)))) < -3.9999999999999999e-48 or +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

                      1. Initial program 63.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({M}^{2} \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell} + \frac{1}{{M}^{2}}\right)}\right) \]
                        3. distribute-rgt-inN/A

                          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot {M}^{2} + \frac{1}{{M}^{2}} \cdot {M}^{2}\right)} \]
                        4. lft-mult-inverseN/A

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

                          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}, {M}^{2}, 1\right)} \]
                      9. Applied rewrites53.5%

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

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

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

                      1. Initial program 88.8%

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

                        \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{1} \]
                      4. Step-by-step derivation
                        1. Applied rewrites83.9%

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

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

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

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

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

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

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

                          \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}} \]
                      5. Recombined 2 regimes into one program.
                      6. Final simplification60.3%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -4 \cdot 10^{-48} \lor \neg \left(\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty\right):\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{M \cdot M}{\ell}, \frac{\frac{\left(D \cdot D\right) \cdot h}{d}}{d} \cdot -0.125, 1\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\ \end{array} \]
                      7. Add Preprocessing

                      Alternative 7: 59.5% accurate, 0.3× speedup?

                      \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := \sqrt{\frac{d}{h}}\\ t_1 := \sqrt{\frac{d}{\ell}}\\ t_2 := \left(D \cdot D\right) \cdot h\\ t_3 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_3 \leq -4 \cdot 10^{-48}:\\ \;\;\;\;\left(t\_0 \cdot t\_1\right) \cdot \mathsf{fma}\left(\frac{t\_2 \cdot -0.125}{\left(\ell \cdot d\right) \cdot d}, M\_m \cdot M\_m, 1\right)\\ \mathbf{elif}\;t\_3 \leq \infty:\\ \;\;\;\;\left(t\_0 \cdot 1\right) \cdot t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{M\_m \cdot M\_m}{\ell}, \frac{\frac{t\_2}{d}}{d} \cdot -0.125, 1\right)\\ \end{array} \end{array} \]
                      M_m = (fabs.f64 M)
                      NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                      (FPCore (d h l M_m D)
                       :precision binary64
                       (let* ((t_0 (sqrt (/ d h)))
                              (t_1 (sqrt (/ d l)))
                              (t_2 (* (* D D) h))
                              (t_3
                               (*
                                (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                                (-
                                 1.0
                                 (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))))
                         (if (<= t_3 -4e-48)
                           (* (* t_0 t_1) (fma (/ (* t_2 -0.125) (* (* l d) d)) (* M_m M_m) 1.0))
                           (if (<= t_3 INFINITY)
                             (* (* t_0 1.0) t_1)
                             (*
                              (/ d (sqrt (* l h)))
                              (fma (/ (* M_m M_m) l) (* (/ (/ t_2 d) d) -0.125) 1.0))))))
                      M_m = fabs(M);
                      assert(d < h && h < l && l < M_m && M_m < D);
                      double code(double d, double h, double l, double M_m, double D) {
                      	double t_0 = sqrt((d / h));
                      	double t_1 = sqrt((d / l));
                      	double t_2 = (D * D) * h;
                      	double t_3 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
                      	double tmp;
                      	if (t_3 <= -4e-48) {
                      		tmp = (t_0 * t_1) * fma(((t_2 * -0.125) / ((l * d) * d)), (M_m * M_m), 1.0);
                      	} else if (t_3 <= ((double) INFINITY)) {
                      		tmp = (t_0 * 1.0) * t_1;
                      	} else {
                      		tmp = (d / sqrt((l * h))) * fma(((M_m * M_m) / l), (((t_2 / d) / d) * -0.125), 1.0);
                      	}
                      	return tmp;
                      }
                      
                      M_m = abs(M)
                      d, h, l, M_m, D = sort([d, h, l, M_m, D])
                      function code(d, h, l, M_m, D)
                      	t_0 = sqrt(Float64(d / h))
                      	t_1 = sqrt(Float64(d / l))
                      	t_2 = Float64(Float64(D * D) * h)
                      	t_3 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
                      	tmp = 0.0
                      	if (t_3 <= -4e-48)
                      		tmp = Float64(Float64(t_0 * t_1) * fma(Float64(Float64(t_2 * -0.125) / Float64(Float64(l * d) * d)), Float64(M_m * M_m), 1.0));
                      	elseif (t_3 <= Inf)
                      		tmp = Float64(Float64(t_0 * 1.0) * t_1);
                      	else
                      		tmp = Float64(Float64(d / sqrt(Float64(l * h))) * fma(Float64(Float64(M_m * M_m) / l), Float64(Float64(Float64(t_2 / d) / d) * -0.125), 1.0));
                      	end
                      	return tmp
                      end
                      
                      M_m = N[Abs[M], $MachinePrecision]
                      NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                      code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -4e-48], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(N[(N[(t$95$2 * -0.125), $MachinePrecision] / N[(N[(l * d), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] * N[(M$95$m * M$95$m), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(N[(t$95$0 * 1.0), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(t$95$2 / d), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]]
                      
                      \begin{array}{l}
                      M_m = \left|M\right|
                      \\
                      [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                      \\
                      \begin{array}{l}
                      t_0 := \sqrt{\frac{d}{h}}\\
                      t_1 := \sqrt{\frac{d}{\ell}}\\
                      t_2 := \left(D \cdot D\right) \cdot h\\
                      t_3 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
                      \mathbf{if}\;t\_3 \leq -4 \cdot 10^{-48}:\\
                      \;\;\;\;\left(t\_0 \cdot t\_1\right) \cdot \mathsf{fma}\left(\frac{t\_2 \cdot -0.125}{\left(\ell \cdot d\right) \cdot d}, M\_m \cdot M\_m, 1\right)\\
                      
                      \mathbf{elif}\;t\_3 \leq \infty:\\
                      \;\;\;\;\left(t\_0 \cdot 1\right) \cdot t\_1\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{M\_m \cdot M\_m}{\ell}, \frac{\frac{t\_2}{d}}{d} \cdot -0.125, 1\right)\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -3.9999999999999999e-48

                        1. Initial program 92.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({M}^{2} \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell} + \frac{1}{{M}^{2}}\right)}\right) \]
                          3. distribute-rgt-inN/A

                            \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot {M}^{2} + \frac{1}{{M}^{2}} \cdot {M}^{2}\right)} \]
                          4. lft-mult-inverseN/A

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

                            \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}, {M}^{2}, 1\right)} \]
                        9. Applied rewrites75.7%

                          \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\mathsf{fma}\left(\frac{-0.125}{\ell \cdot d} \cdot \frac{\left(D \cdot D\right) \cdot h}{d}, M \cdot M, 1\right)} \]
                        10. Step-by-step derivation
                          1. Applied rewrites69.9%

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

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

                          1. Initial program 88.8%

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

                            \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{1} \]
                          4. Step-by-step derivation
                            1. Applied rewrites83.9%

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

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

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

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

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

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

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

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

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

                            1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({M}^{2} \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell} + \frac{1}{{M}^{2}}\right)}\right) \]
                              3. distribute-rgt-inN/A

                                \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot {M}^{2} + \frac{1}{{M}^{2}} \cdot {M}^{2}\right)} \]
                              4. lft-mult-inverseN/A

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

                                \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}, {M}^{2}, 1\right)} \]
                            9. Applied rewrites5.8%

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

                              \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{M \cdot M}{\ell}, \frac{\frac{\left(D \cdot D\right) \cdot h}{d}}{d} \cdot -0.125, 1\right)} \]
                          5. Recombined 3 regimes into one program.
                          6. Final simplification70.1%

                            \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -4 \cdot 10^{-48}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left(\frac{\left(\left(D \cdot D\right) \cdot h\right) \cdot -0.125}{\left(\ell \cdot d\right) \cdot d}, M \cdot M, 1\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{M \cdot M}{\ell}, \frac{\frac{\left(D \cdot D\right) \cdot h}{d}}{d} \cdot -0.125, 1\right)\\ \end{array} \]
                          7. Add Preprocessing

                          Alternative 8: 58.9% accurate, 0.3× speedup?

                          \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ t_1 := \frac{\left(D \cdot D\right) \cdot h}{d}\\ \mathbf{if}\;t\_0 \leq -4 \cdot 10^{-48}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d} \cdot t\_1, M\_m \cdot M\_m, 1\right)\\ \mathbf{elif}\;t\_0 \leq \infty:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{M\_m \cdot M\_m}{\ell}, \frac{t\_1}{d} \cdot -0.125, 1\right)\\ \end{array} \end{array} \]
                          M_m = (fabs.f64 M)
                          NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                          (FPCore (d h l M_m D)
                           :precision binary64
                           (let* ((t_0
                                   (*
                                    (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                                    (-
                                     1.0
                                     (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l)))))
                                  (t_1 (/ (* (* D D) h) d)))
                             (if (<= t_0 -4e-48)
                               (*
                                (sqrt (* (/ d l) (/ d h)))
                                (fma (* (/ -0.125 (* l d)) t_1) (* M_m M_m) 1.0))
                               (if (<= t_0 INFINITY)
                                 (* (* (sqrt (/ d h)) 1.0) (sqrt (/ d l)))
                                 (*
                                  (/ d (sqrt (* l h)))
                                  (fma (/ (* M_m M_m) l) (* (/ t_1 d) -0.125) 1.0))))))
                          M_m = fabs(M);
                          assert(d < h && h < l && l < M_m && M_m < D);
                          double code(double d, double h, double l, double M_m, double D) {
                          	double t_0 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
                          	double t_1 = ((D * D) * h) / d;
                          	double tmp;
                          	if (t_0 <= -4e-48) {
                          		tmp = sqrt(((d / l) * (d / h))) * fma(((-0.125 / (l * d)) * t_1), (M_m * M_m), 1.0);
                          	} else if (t_0 <= ((double) INFINITY)) {
                          		tmp = (sqrt((d / h)) * 1.0) * sqrt((d / l));
                          	} else {
                          		tmp = (d / sqrt((l * h))) * fma(((M_m * M_m) / l), ((t_1 / d) * -0.125), 1.0);
                          	}
                          	return tmp;
                          }
                          
                          M_m = abs(M)
                          d, h, l, M_m, D = sort([d, h, l, M_m, D])
                          function code(d, h, l, M_m, D)
                          	t_0 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
                          	t_1 = Float64(Float64(Float64(D * D) * h) / d)
                          	tmp = 0.0
                          	if (t_0 <= -4e-48)
                          		tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * fma(Float64(Float64(-0.125 / Float64(l * d)) * t_1), Float64(M_m * M_m), 1.0));
                          	elseif (t_0 <= Inf)
                          		tmp = Float64(Float64(sqrt(Float64(d / h)) * 1.0) * sqrt(Float64(d / l)));
                          	else
                          		tmp = Float64(Float64(d / sqrt(Float64(l * h))) * fma(Float64(Float64(M_m * M_m) / l), Float64(Float64(t_1 / d) * -0.125), 1.0));
                          	end
                          	return tmp
                          end
                          
                          M_m = N[Abs[M], $MachinePrecision]
                          NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                          code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[t$95$0, -4e-48], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(-0.125 / N[(l * d), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(M$95$m * M$95$m), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] / l), $MachinePrecision] * N[(N[(t$95$1 / d), $MachinePrecision] * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
                          
                          \begin{array}{l}
                          M_m = \left|M\right|
                          \\
                          [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                          \\
                          \begin{array}{l}
                          t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
                          t_1 := \frac{\left(D \cdot D\right) \cdot h}{d}\\
                          \mathbf{if}\;t\_0 \leq -4 \cdot 10^{-48}:\\
                          \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d} \cdot t\_1, M\_m \cdot M\_m, 1\right)\\
                          
                          \mathbf{elif}\;t\_0 \leq \infty:\\
                          \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{M\_m \cdot M\_m}{\ell}, \frac{t\_1}{d} \cdot -0.125, 1\right)\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 3 regimes
                          2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -3.9999999999999999e-48

                            1. Initial program 92.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({M}^{2} \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell} + \frac{1}{{M}^{2}}\right)}\right) \]
                              3. distribute-rgt-inN/A

                                \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot {M}^{2} + \frac{1}{{M}^{2}} \cdot {M}^{2}\right)} \]
                              4. lft-mult-inverseN/A

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

                                \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}, {M}^{2}, 1\right)} \]
                            9. Applied rewrites75.7%

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

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

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

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

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

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

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

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

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

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

                            1. Initial program 88.8%

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

                              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{1} \]
                            4. Step-by-step derivation
                              1. Applied rewrites83.9%

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

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

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

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

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

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

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

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

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

                              1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({M}^{2} \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell} + \frac{1}{{M}^{2}}\right)}\right) \]
                                3. distribute-rgt-inN/A

                                  \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot {M}^{2} + \frac{1}{{M}^{2}} \cdot {M}^{2}\right)} \]
                                4. lft-mult-inverseN/A

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

                                  \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}, {M}^{2}, 1\right)} \]
                              9. Applied rewrites5.8%

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

                                \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{M \cdot M}{\ell}, \frac{\frac{\left(D \cdot D\right) \cdot h}{d}}{d} \cdot -0.125, 1\right)} \]
                            5. Recombined 3 regimes into one program.
                            6. Final simplification69.3%

                              \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -4 \cdot 10^{-48}:\\ \;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d} \cdot \frac{\left(D \cdot D\right) \cdot h}{d}, M \cdot M, 1\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{M \cdot M}{\ell}, \frac{\frac{\left(D \cdot D\right) \cdot h}{d}}{d} \cdot -0.125, 1\right)\\ \end{array} \]
                            7. Add Preprocessing

                            Alternative 9: 50.1% accurate, 0.3× speedup?

                            \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_0 \leq -4 \cdot 10^{-48} \lor \neg \left(t\_0 \leq \infty\right):\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d} \cdot \frac{\left(D \cdot D\right) \cdot h}{d}, M\_m \cdot M\_m, 1\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\ \end{array} \end{array} \]
                            M_m = (fabs.f64 M)
                            NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                            (FPCore (d h l M_m D)
                             :precision binary64
                             (let* ((t_0
                                     (*
                                      (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                                      (-
                                       1.0
                                       (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))))
                               (if (or (<= t_0 -4e-48) (not (<= t_0 INFINITY)))
                                 (*
                                  (/ d (sqrt (* l h)))
                                  (fma (* (/ -0.125 (* l d)) (/ (* (* D D) h) d)) (* M_m M_m) 1.0))
                                 (* (* (sqrt (/ d h)) 1.0) (sqrt (/ d l))))))
                            M_m = fabs(M);
                            assert(d < h && h < l && l < M_m && M_m < D);
                            double code(double d, double h, double l, double M_m, double D) {
                            	double t_0 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
                            	double tmp;
                            	if ((t_0 <= -4e-48) || !(t_0 <= ((double) INFINITY))) {
                            		tmp = (d / sqrt((l * h))) * fma(((-0.125 / (l * d)) * (((D * D) * h) / d)), (M_m * M_m), 1.0);
                            	} else {
                            		tmp = (sqrt((d / h)) * 1.0) * sqrt((d / l));
                            	}
                            	return tmp;
                            }
                            
                            M_m = abs(M)
                            d, h, l, M_m, D = sort([d, h, l, M_m, D])
                            function code(d, h, l, M_m, D)
                            	t_0 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
                            	tmp = 0.0
                            	if ((t_0 <= -4e-48) || !(t_0 <= Inf))
                            		tmp = Float64(Float64(d / sqrt(Float64(l * h))) * fma(Float64(Float64(-0.125 / Float64(l * d)) * Float64(Float64(Float64(D * D) * h) / d)), Float64(M_m * M_m), 1.0));
                            	else
                            		tmp = Float64(Float64(sqrt(Float64(d / h)) * 1.0) * sqrt(Float64(d / l)));
                            	end
                            	return tmp
                            end
                            
                            M_m = N[Abs[M], $MachinePrecision]
                            NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                            code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -4e-48], N[Not[LessEqual[t$95$0, Infinity]], $MachinePrecision]], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(-0.125 / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(M$95$m * M$95$m), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
                            
                            \begin{array}{l}
                            M_m = \left|M\right|
                            \\
                            [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                            \\
                            \begin{array}{l}
                            t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
                            \mathbf{if}\;t\_0 \leq -4 \cdot 10^{-48} \lor \neg \left(t\_0 \leq \infty\right):\\
                            \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d} \cdot \frac{\left(D \cdot D\right) \cdot h}{d}, M\_m \cdot M\_m, 1\right)\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\
                            
                            
                            \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)))) < -3.9999999999999999e-48 or +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l))))

                              1. Initial program 63.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({M}^{2} \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell} + \frac{1}{{M}^{2}}\right)}\right) \]
                                3. distribute-rgt-inN/A

                                  \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot {M}^{2} + \frac{1}{{M}^{2}} \cdot {M}^{2}\right)} \]
                                4. lft-mult-inverseN/A

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

                                  \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}, {M}^{2}, 1\right)} \]
                              9. Applied rewrites53.5%

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{\frac{-1}{8}}{\ell \cdot d} \cdot \frac{\left(D \cdot D\right) \cdot h}{d}, M \cdot M, 1\right) \]
                                12. rem-square-sqrtN/A

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

                                  \[\leadsto \frac{d}{\color{blue}{\sqrt{\ell \cdot h}}} \cdot \mathsf{fma}\left(\frac{\frac{-1}{8}}{\ell \cdot d} \cdot \frac{\left(D \cdot D\right) \cdot h}{d}, M \cdot M, 1\right) \]
                                14. lower-/.f6433.6

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

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

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

                              1. Initial program 88.8%

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

                                \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{1} \]
                              4. Step-by-step derivation
                                1. Applied rewrites83.9%

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

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

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

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

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

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

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

                                  \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}} \]
                              5. Recombined 2 regimes into one program.
                              6. Final simplification59.1%

                                \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -4 \cdot 10^{-48} \lor \neg \left(\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty\right):\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d} \cdot \frac{\left(D \cdot D\right) \cdot h}{d}, M \cdot M, 1\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\ \end{array} \]
                              7. Add Preprocessing

                              Alternative 10: 50.1% accurate, 0.3× speedup?

                              \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d} \cdot \frac{\left(D \cdot D\right) \cdot h}{d}, M\_m \cdot M\_m, 1\right)\\ t_1 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{if}\;t\_1 \leq -4 \cdot 10^{-48}:\\ \;\;\;\;\left(\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d\right) \cdot t\_0\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot t\_0\\ \end{array} \end{array} \]
                              M_m = (fabs.f64 M)
                              NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                              (FPCore (d h l M_m D)
                               :precision binary64
                               (let* ((t_0 (fma (* (/ -0.125 (* l d)) (/ (* (* D D) h) d)) (* M_m M_m) 1.0))
                                      (t_1
                                       (*
                                        (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                                        (-
                                         1.0
                                         (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))))
                                 (if (<= t_1 -4e-48)
                                   (* (* (sqrt (pow (* l h) -1.0)) d) t_0)
                                   (if (<= t_1 INFINITY)
                                     (* (* (sqrt (/ d h)) 1.0) (sqrt (/ d l)))
                                     (* (/ d (sqrt (* l h))) t_0)))))
                              M_m = fabs(M);
                              assert(d < h && h < l && l < M_m && M_m < D);
                              double code(double d, double h, double l, double M_m, double D) {
                              	double t_0 = fma(((-0.125 / (l * d)) * (((D * D) * h) / d)), (M_m * M_m), 1.0);
                              	double t_1 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)));
                              	double tmp;
                              	if (t_1 <= -4e-48) {
                              		tmp = (sqrt(pow((l * h), -1.0)) * d) * t_0;
                              	} else if (t_1 <= ((double) INFINITY)) {
                              		tmp = (sqrt((d / h)) * 1.0) * sqrt((d / l));
                              	} else {
                              		tmp = (d / sqrt((l * h))) * t_0;
                              	}
                              	return tmp;
                              }
                              
                              M_m = abs(M)
                              d, h, l, M_m, D = sort([d, h, l, M_m, D])
                              function code(d, h, l, M_m, D)
                              	t_0 = fma(Float64(Float64(-0.125 / Float64(l * d)) * Float64(Float64(Float64(D * D) * h) / d)), Float64(M_m * M_m), 1.0)
                              	t_1 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l))))
                              	tmp = 0.0
                              	if (t_1 <= -4e-48)
                              		tmp = Float64(Float64(sqrt((Float64(l * h) ^ -1.0)) * d) * t_0);
                              	elseif (t_1 <= Inf)
                              		tmp = Float64(Float64(sqrt(Float64(d / h)) * 1.0) * sqrt(Float64(d / l)));
                              	else
                              		tmp = Float64(Float64(d / sqrt(Float64(l * h))) * t_0);
                              	end
                              	return tmp
                              end
                              
                              M_m = N[Abs[M], $MachinePrecision]
                              NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                              code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(N[(N[(-0.125 / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(M$95$m * M$95$m), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-48], N[(N[(N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]]]
                              
                              \begin{array}{l}
                              M_m = \left|M\right|
                              \\
                              [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                              \\
                              \begin{array}{l}
                              t_0 := \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d} \cdot \frac{\left(D \cdot D\right) \cdot h}{d}, M\_m \cdot M\_m, 1\right)\\
                              t_1 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
                              \mathbf{if}\;t\_1 \leq -4 \cdot 10^{-48}:\\
                              \;\;\;\;\left(\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d\right) \cdot t\_0\\
                              
                              \mathbf{elif}\;t\_1 \leq \infty:\\
                              \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot 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)))) < -3.9999999999999999e-48

                                1. Initial program 92.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({M}^{2} \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell} + \frac{1}{{M}^{2}}\right)}\right) \]
                                  3. distribute-rgt-inN/A

                                    \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot {M}^{2} + \frac{1}{{M}^{2}} \cdot {M}^{2}\right)} \]
                                  4. lft-mult-inverseN/A

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

                                    \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}, {M}^{2}, 1\right)} \]
                                9. Applied rewrites75.7%

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

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

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

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

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

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

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

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

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

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

                                1. Initial program 88.8%

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

                                  \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{1} \]
                                4. Step-by-step derivation
                                  1. Applied rewrites83.9%

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

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

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

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

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

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

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

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

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

                                  1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({M}^{2} \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell} + \frac{1}{{M}^{2}}\right)}\right) \]
                                    3. distribute-rgt-inN/A

                                      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot {M}^{2} + \frac{1}{{M}^{2}} \cdot {M}^{2}\right)} \]
                                    4. lft-mult-inverseN/A

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

                                      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}, {M}^{2}, 1\right)} \]
                                  9. Applied rewrites5.8%

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

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \frac{\color{blue}{\sqrt{d} \cdot \sqrt{d}}}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{\frac{-1}{8}}{\ell \cdot d} \cdot \frac{\left(D \cdot D\right) \cdot h}{d}, M \cdot M, 1\right) \]
                                    12. rem-square-sqrtN/A

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

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

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

                                    \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d} \cdot \frac{\left(D \cdot D\right) \cdot h}{d}, M \cdot M, 1\right) \]
                                5. Recombined 3 regimes into one program.
                                6. Final simplification59.1%

                                  \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -4 \cdot 10^{-48}:\\ \;\;\;\;\left(\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d\right) \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d} \cdot \frac{\left(D \cdot D\right) \cdot h}{d}, M \cdot M, 1\right)\\ \mathbf{elif}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d} \cdot \frac{\left(D \cdot D\right) \cdot h}{d}, M \cdot M, 1\right)\\ \end{array} \]
                                7. Add Preprocessing

                                Alternative 11: 72.8% accurate, 0.5× speedup?

                                \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\\ \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot t\_0\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(0.5 \cdot t\_0\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\_m\right) \cdot M\_m}{d}, 0.125, \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right)\\ \end{array} \end{array} \]
                                M_m = (fabs.f64 M)
                                NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                (FPCore (d h l M_m D)
                                 :precision binary64
                                 (let* ((t_0 (pow (/ (* M_m D) (* 2.0 d)) 2.0)))
                                   (if (<=
                                        (*
                                         (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                                         (- 1.0 (* (* (pow 2.0 -1.0) t_0) (/ h l))))
                                        INFINITY)
                                     (* (* (sqrt (/ d h)) (sqrt (/ d l))) (- 1.0 (* (* 0.5 t_0) (/ h l))))
                                     (fma
                                      (* (* (/ (sqrt (/ h l)) l) (* D D)) (/ (* (- M_m) M_m) d))
                                      0.125
                                      (* (- d) (sqrt (pow (* l h) -1.0)))))))
                                M_m = fabs(M);
                                assert(d < h && h < l && l < M_m && M_m < D);
                                double code(double d, double h, double l, double M_m, double D) {
                                	double t_0 = pow(((M_m * D) / (2.0 * d)), 2.0);
                                	double tmp;
                                	if (((pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * t_0) * (h / l)))) <= ((double) INFINITY)) {
                                		tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - ((0.5 * t_0) * (h / l)));
                                	} else {
                                		tmp = fma((((sqrt((h / l)) / l) * (D * D)) * ((-M_m * M_m) / d)), 0.125, (-d * sqrt(pow((l * h), -1.0))));
                                	}
                                	return tmp;
                                }
                                
                                M_m = abs(M)
                                d, h, l, M_m, D = sort([d, h, l, M_m, D])
                                function code(d, h, l, M_m, D)
                                	t_0 = Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0
                                	tmp = 0.0
                                	if (Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * t_0) * Float64(h / l)))) <= Inf)
                                		tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(Float64(0.5 * t_0) * Float64(h / l))));
                                	else
                                		tmp = fma(Float64(Float64(Float64(sqrt(Float64(h / l)) / l) * Float64(D * D)) * Float64(Float64(Float64(-M_m) * M_m) / d)), 0.125, Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))));
                                	end
                                	return tmp
                                end
                                
                                M_m = N[Abs[M], $MachinePrecision]
                                NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * t$95$0), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * t$95$0), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / l), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[((-M$95$m) * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * 0.125 + N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                                
                                \begin{array}{l}
                                M_m = \left|M\right|
                                \\
                                [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                                \\
                                \begin{array}{l}
                                t_0 := {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\\
                                \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot t\_0\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\
                                \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(0.5 \cdot t\_0\right) \cdot \frac{h}{\ell}\right)\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;\mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\_m\right) \cdot M\_m}{d}, 0.125, \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right)\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

                                  1. Initial program 90.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  1. Initial program 0.0%

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

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

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

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

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

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

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

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

                                      \[\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}}} \]
                                  7. Applied rewrites15.7%

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

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

                                    \[\leadsto \mathsf{fma}\left(\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, \color{blue}{0.125}, \left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \]
                                  10. Step-by-step derivation
                                    1. Applied rewrites36.8%

                                      \[\leadsto \mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, 0.125, \left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \]
                                  11. Recombined 2 regimes into one program.
                                  12. Final simplification82.0%

                                    \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(0.5 \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, 0.125, \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right)\\ \end{array} \]
                                  13. Add Preprocessing

                                  Alternative 12: 73.3% accurate, 0.5× speedup?

                                  \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\frac{\frac{D}{d}}{2} \cdot M\_m\right) \cdot \left(\frac{h}{\ell} \cdot \left(\frac{0.5 \cdot D}{d} \cdot \frac{M\_m}{2}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\_m\right) \cdot M\_m}{d}, 0.125, \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right)\\ \end{array} \end{array} \]
                                  M_m = (fabs.f64 M)
                                  NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                  (FPCore (d h l M_m D)
                                   :precision binary64
                                   (if (<=
                                        (*
                                         (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                                         (-
                                          1.0
                                          (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))
                                        INFINITY)
                                     (*
                                      (* (sqrt (/ d h)) (sqrt (/ d l)))
                                      (-
                                       1.0
                                       (* (* (/ (/ D d) 2.0) M_m) (* (/ h l) (* (/ (* 0.5 D) d) (/ M_m 2.0))))))
                                     (fma
                                      (* (* (/ (sqrt (/ h l)) l) (* D D)) (/ (* (- M_m) M_m) d))
                                      0.125
                                      (* (- d) (sqrt (pow (* l h) -1.0))))))
                                  M_m = fabs(M);
                                  assert(d < h && h < l && l < M_m && M_m < D);
                                  double code(double d, double h, double l, double M_m, double D) {
                                  	double tmp;
                                  	if (((pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= ((double) INFINITY)) {
                                  		tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - ((((D / d) / 2.0) * M_m) * ((h / l) * (((0.5 * D) / d) * (M_m / 2.0)))));
                                  	} else {
                                  		tmp = fma((((sqrt((h / l)) / l) * (D * D)) * ((-M_m * M_m) / d)), 0.125, (-d * sqrt(pow((l * h), -1.0))));
                                  	}
                                  	return tmp;
                                  }
                                  
                                  M_m = abs(M)
                                  d, h, l, M_m, D = sort([d, h, l, M_m, D])
                                  function code(d, h, l, M_m, D)
                                  	tmp = 0.0
                                  	if (Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= Inf)
                                  		tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(Float64(Float64(Float64(D / d) / 2.0) * M_m) * Float64(Float64(h / l) * Float64(Float64(Float64(0.5 * D) / d) * Float64(M_m / 2.0))))));
                                  	else
                                  		tmp = fma(Float64(Float64(Float64(sqrt(Float64(h / l)) / l) * Float64(D * D)) * Float64(Float64(Float64(-M_m) * M_m) / d)), 0.125, Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))));
                                  	end
                                  	return tmp
                                  end
                                  
                                  M_m = N[Abs[M], $MachinePrecision]
                                  NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                  code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision] * M$95$m), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * N[(N[(N[(0.5 * D), $MachinePrecision] / d), $MachinePrecision] * N[(M$95$m / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / l), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[((-M$95$m) * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * 0.125 + N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                  
                                  \begin{array}{l}
                                  M_m = \left|M\right|
                                  \\
                                  [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                                  \\
                                  \begin{array}{l}
                                  \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\
                                  \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\frac{\frac{D}{d}}{2} \cdot M\_m\right) \cdot \left(\frac{h}{\ell} \cdot \left(\frac{0.5 \cdot D}{d} \cdot \frac{M\_m}{2}\right)\right)\right)\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;\mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\_m\right) \cdot M\_m}{d}, 0.125, \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right)\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 2 regimes
                                  2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

                                    1. Initial program 90.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    1. Initial program 0.0%

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

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

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

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

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

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

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

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

                                        \[\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}}} \]
                                    7. Applied rewrites15.7%

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

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

                                      \[\leadsto \mathsf{fma}\left(\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, \color{blue}{0.125}, \left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \]
                                    10. Step-by-step derivation
                                      1. Applied rewrites36.8%

                                        \[\leadsto \mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, 0.125, \left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \]
                                    11. Recombined 2 regimes into one program.
                                    12. Final simplification81.7%

                                      \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \left(\frac{\frac{D}{d}}{2} \cdot M\right) \cdot \left(\frac{h}{\ell} \cdot \left(\frac{0.5 \cdot D}{d} \cdot \frac{M}{2}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, 0.125, \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right)\\ \end{array} \]
                                    13. Add Preprocessing

                                    Alternative 13: 69.1% accurate, 0.5× speedup?

                                    \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{\ell} \cdot \left(h \cdot \frac{M\_m}{d}\right)\right) \cdot \left(0.5 \cdot D\right)}{4} \cdot \frac{M\_m}{d}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\_m\right) \cdot M\_m}{d}, 0.125, \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right)\\ \end{array} \end{array} \]
                                    M_m = (fabs.f64 M)
                                    NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                    (FPCore (d h l M_m D)
                                     :precision binary64
                                     (if (<=
                                          (*
                                           (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                                           (-
                                            1.0
                                            (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))
                                          INFINITY)
                                       (*
                                        (* (sqrt (/ d h)) (sqrt (/ d l)))
                                        (- 1.0 (* (/ (* (* (/ D l) (* h (/ M_m d))) (* 0.5 D)) 4.0) (/ M_m d))))
                                       (fma
                                        (* (* (/ (sqrt (/ h l)) l) (* D D)) (/ (* (- M_m) M_m) d))
                                        0.125
                                        (* (- d) (sqrt (pow (* l h) -1.0))))))
                                    M_m = fabs(M);
                                    assert(d < h && h < l && l < M_m && M_m < D);
                                    double code(double d, double h, double l, double M_m, double D) {
                                    	double tmp;
                                    	if (((pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= ((double) INFINITY)) {
                                    		tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (((((D / l) * (h * (M_m / d))) * (0.5 * D)) / 4.0) * (M_m / d)));
                                    	} else {
                                    		tmp = fma((((sqrt((h / l)) / l) * (D * D)) * ((-M_m * M_m) / d)), 0.125, (-d * sqrt(pow((l * h), -1.0))));
                                    	}
                                    	return tmp;
                                    }
                                    
                                    M_m = abs(M)
                                    d, h, l, M_m, D = sort([d, h, l, M_m, D])
                                    function code(d, h, l, M_m, D)
                                    	tmp = 0.0
                                    	if (Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= Inf)
                                    		tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D / l) * Float64(h * Float64(M_m / d))) * Float64(0.5 * D)) / 4.0) * Float64(M_m / d))));
                                    	else
                                    		tmp = fma(Float64(Float64(Float64(sqrt(Float64(h / l)) / l) * Float64(D * D)) * Float64(Float64(Float64(-M_m) * M_m) / d)), 0.125, Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))));
                                    	end
                                    	return tmp
                                    end
                                    
                                    M_m = N[Abs[M], $MachinePrecision]
                                    NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                    code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(D / l), $MachinePrecision] * N[(h * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 * D), $MachinePrecision]), $MachinePrecision] / 4.0), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / l), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[((-M$95$m) * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * 0.125 + N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                    
                                    \begin{array}{l}
                                    M_m = \left|M\right|
                                    \\
                                    [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                                    \\
                                    \begin{array}{l}
                                    \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\
                                    \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{\ell} \cdot \left(h \cdot \frac{M\_m}{d}\right)\right) \cdot \left(0.5 \cdot D\right)}{4} \cdot \frac{M\_m}{d}\right)\\
                                    
                                    \mathbf{else}:\\
                                    \;\;\;\;\mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\_m\right) \cdot M\_m}{d}, 0.125, \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right)\\
                                    
                                    
                                    \end{array}
                                    \end{array}
                                    
                                    Derivation
                                    1. Split input into 2 regimes
                                    2. if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0

                                      1. Initial program 90.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      1. Initial program 0.0%

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

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

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

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

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

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

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

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

                                          \[\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}}} \]
                                      7. Applied rewrites15.7%

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

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

                                        \[\leadsto \mathsf{fma}\left(\left(\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, \color{blue}{0.125}, \left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \]
                                      10. Step-by-step derivation
                                        1. Applied rewrites36.8%

                                          \[\leadsto \mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, 0.125, \left(-d\right) \cdot \sqrt{\frac{1}{\ell \cdot h}}\right) \]
                                      11. Recombined 2 regimes into one program.
                                      12. Final simplification77.7%

                                        \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq \infty:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{\left(\frac{D}{\ell} \cdot \left(h \cdot \frac{M}{d}\right)\right) \cdot \left(0.5 \cdot D\right)}{4} \cdot \frac{M}{d}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{\left(-M\right) \cdot M}{d}, 0.125, \left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right)\\ \end{array} \]
                                      13. Add Preprocessing

                                      Alternative 14: 47.1% accurate, 0.5× speedup?

                                      \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -4 \cdot 10^{-69}:\\ \;\;\;\;\frac{\left(\left(D \cdot D\right) \cdot -0.125\right) \cdot \left(\frac{M\_m \cdot M\_m}{d} \cdot \sqrt{\ell \cdot h}\right)}{\ell \cdot \ell}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\ \end{array} \end{array} \]
                                      M_m = (fabs.f64 M)
                                      NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                      (FPCore (d h l M_m D)
                                       :precision binary64
                                       (if (<=
                                            (*
                                             (* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
                                             (-
                                              1.0
                                              (* (* (pow 2.0 -1.0) (pow (/ (* M_m D) (* 2.0 d)) 2.0)) (/ h l))))
                                            -4e-69)
                                         (/ (* (* (* D D) -0.125) (* (/ (* M_m M_m) d) (sqrt (* l h)))) (* l l))
                                         (* (* (sqrt (/ d h)) 1.0) (sqrt (/ d l)))))
                                      M_m = fabs(M);
                                      assert(d < h && h < l && l < M_m && M_m < D);
                                      double code(double d, double h, double l, double M_m, double D) {
                                      	double tmp;
                                      	if (((pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -4e-69) {
                                      		tmp = (((D * D) * -0.125) * (((M_m * M_m) / d) * sqrt((l * h)))) / (l * l);
                                      	} else {
                                      		tmp = (sqrt((d / h)) * 1.0) * sqrt((d / l));
                                      	}
                                      	return tmp;
                                      }
                                      
                                      M_m =     private
                                      NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                      module fmin_fmax_functions
                                          implicit none
                                          private
                                          public fmax
                                          public fmin
                                      
                                          interface fmax
                                              module procedure fmax88
                                              module procedure fmax44
                                              module procedure fmax84
                                              module procedure fmax48
                                          end interface
                                          interface fmin
                                              module procedure fmin88
                                              module procedure fmin44
                                              module procedure fmin84
                                              module procedure fmin48
                                          end interface
                                      contains
                                          real(8) function fmax88(x, y) result (res)
                                              real(8), intent (in) :: x
                                              real(8), intent (in) :: y
                                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                          end function
                                          real(4) function fmax44(x, y) result (res)
                                              real(4), intent (in) :: x
                                              real(4), intent (in) :: y
                                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                          end function
                                          real(8) function fmax84(x, y) result(res)
                                              real(8), intent (in) :: x
                                              real(4), intent (in) :: y
                                              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                          end function
                                          real(8) function fmax48(x, y) result(res)
                                              real(4), intent (in) :: x
                                              real(8), intent (in) :: y
                                              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                          end function
                                          real(8) function fmin88(x, y) result (res)
                                              real(8), intent (in) :: x
                                              real(8), intent (in) :: y
                                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                          end function
                                          real(4) function fmin44(x, y) result (res)
                                              real(4), intent (in) :: x
                                              real(4), intent (in) :: y
                                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                          end function
                                          real(8) function fmin84(x, y) result(res)
                                              real(8), intent (in) :: x
                                              real(4), intent (in) :: y
                                              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                          end function
                                          real(8) function fmin48(x, y) result(res)
                                              real(4), intent (in) :: x
                                              real(8), intent (in) :: y
                                              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                          end function
                                      end module
                                      
                                      real(8) function code(d, h, l, m_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_m
                                          real(8), intent (in) :: d_1
                                          real(8) :: tmp
                                          if (((((d / h) ** (2.0d0 ** (-1.0d0))) * ((d / l) ** (2.0d0 ** (-1.0d0)))) * (1.0d0 - (((2.0d0 ** (-1.0d0)) * (((m_m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))) <= (-4d-69)) then
                                              tmp = (((d_1 * d_1) * (-0.125d0)) * (((m_m * m_m) / d) * sqrt((l * h)))) / (l * l)
                                          else
                                              tmp = (sqrt((d / h)) * 1.0d0) * sqrt((d / l))
                                          end if
                                          code = tmp
                                      end function
                                      
                                      M_m = Math.abs(M);
                                      assert d < h && h < l && l < M_m && M_m < D;
                                      public static double code(double d, double h, double l, double M_m, double D) {
                                      	double tmp;
                                      	if (((Math.pow((d / h), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -4e-69) {
                                      		tmp = (((D * D) * -0.125) * (((M_m * M_m) / d) * Math.sqrt((l * h)))) / (l * l);
                                      	} else {
                                      		tmp = (Math.sqrt((d / h)) * 1.0) * Math.sqrt((d / l));
                                      	}
                                      	return tmp;
                                      }
                                      
                                      M_m = math.fabs(M)
                                      [d, h, l, M_m, D] = sort([d, h, l, M_m, D])
                                      def code(d, h, l, M_m, D):
                                      	tmp = 0
                                      	if ((math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M_m * D) / (2.0 * d)), 2.0)) * (h / l)))) <= -4e-69:
                                      		tmp = (((D * D) * -0.125) * (((M_m * M_m) / d) * math.sqrt((l * h)))) / (l * l)
                                      	else:
                                      		tmp = (math.sqrt((d / h)) * 1.0) * math.sqrt((d / l))
                                      	return tmp
                                      
                                      M_m = abs(M)
                                      d, h, l, M_m, D = sort([d, h, l, M_m, D])
                                      function code(d, h, l, M_m, D)
                                      	tmp = 0.0
                                      	if (Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) <= -4e-69)
                                      		tmp = Float64(Float64(Float64(Float64(D * D) * -0.125) * Float64(Float64(Float64(M_m * M_m) / d) * sqrt(Float64(l * h)))) / Float64(l * l));
                                      	else
                                      		tmp = Float64(Float64(sqrt(Float64(d / h)) * 1.0) * sqrt(Float64(d / l)));
                                      	end
                                      	return tmp
                                      end
                                      
                                      M_m = abs(M);
                                      d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
                                      function tmp_2 = code(d, h, l, M_m, D)
                                      	tmp = 0.0;
                                      	if (((((d / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M_m * D) / (2.0 * d)) ^ 2.0)) * (h / l)))) <= -4e-69)
                                      		tmp = (((D * D) * -0.125) * (((M_m * M_m) / d) * sqrt((l * h)))) / (l * l);
                                      	else
                                      		tmp = (sqrt((d / h)) * 1.0) * sqrt((d / l));
                                      	end
                                      	tmp_2 = tmp;
                                      end
                                      
                                      M_m = N[Abs[M], $MachinePrecision]
                                      NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                      code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -4e-69], N[(N[(N[(N[(D * D), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
                                      
                                      \begin{array}{l}
                                      M_m = \left|M\right|
                                      \\
                                      [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                                      \\
                                      \begin{array}{l}
                                      \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -4 \cdot 10^{-69}:\\
                                      \;\;\;\;\frac{\left(\left(D \cdot D\right) \cdot -0.125\right) \cdot \left(\frac{M\_m \cdot M\_m}{d} \cdot \sqrt{\ell \cdot h}\right)}{\ell \cdot \ell}\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\
                                      
                                      
                                      \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)))) < -3.9999999999999999e-69

                                        1. Initial program 92.9%

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

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

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

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

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

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

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

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

                                            \[\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}}} \]
                                        7. Applied rewrites25.4%

                                          \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\left(-0.125 \cdot \left(M \cdot M\right)\right) \cdot \frac{D \cdot D}{d}, \sqrt{\ell \cdot h}, \sqrt{\frac{{\ell}^{3}}{h}} \cdot d\right)}{\ell \cdot \ell}} \]
                                        8. 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} \]
                                        9. Step-by-step derivation
                                          1. Applied rewrites28.8%

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

                                          if -3.9999999999999999e-69 < (*.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 67.8%

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

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

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

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

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

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

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

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

                                                \[\leadsto \color{blue}{\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot 1\right) \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}} \]
                                            3. Applied rewrites66.8%

                                              \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}} \]
                                          5. Recombined 2 regimes into one program.
                                          6. Final simplification53.9%

                                            \[\leadsto \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \leq -4 \cdot 10^{-69}:\\ \;\;\;\;\frac{\left(\left(D \cdot D\right) \cdot -0.125\right) \cdot \left(\frac{M \cdot M}{d} \cdot \sqrt{\ell \cdot h}\right)}{\ell \cdot \ell}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\ \end{array} \]
                                          7. Add Preprocessing

                                          Alternative 15: 58.5% accurate, 2.1× speedup?

                                          \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} t_0 := \frac{\left(D \cdot D\right) \cdot h}{d}\\ \mathbf{if}\;\ell \leq -3.8 \cdot 10^{+122}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;\ell \leq -1.5 \cdot 10^{-289}:\\ \;\;\;\;\left(\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right) \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d} \cdot t\_0, M\_m \cdot M\_m, 1\right)\\ \mathbf{elif}\;\ell \leq 4.3 \cdot 10^{+111}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{M\_m \cdot M\_m}{\ell}, \frac{t\_0}{d} \cdot -0.125, 1\right)\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt{\ell} \cdot \sqrt{h}\right)}^{-1} \cdot d\\ \end{array} \end{array} \]
                                          M_m = (fabs.f64 M)
                                          NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                          (FPCore (d h l M_m D)
                                           :precision binary64
                                           (let* ((t_0 (/ (* (* D D) h) d)))
                                             (if (<= l -3.8e+122)
                                               (* (* (sqrt (/ d h)) 1.0) (sqrt (/ d l)))
                                               (if (<= l -1.5e-289)
                                                 (*
                                                  (* (- d) (sqrt (pow (* l h) -1.0)))
                                                  (fma (* (/ -0.125 (* l d)) t_0) (* M_m M_m) 1.0))
                                                 (if (<= l 4.3e+111)
                                                   (*
                                                    (/ d (sqrt (* l h)))
                                                    (fma (/ (* M_m M_m) l) (* (/ t_0 d) -0.125) 1.0))
                                                   (* (pow (* (sqrt l) (sqrt h)) -1.0) d))))))
                                          M_m = fabs(M);
                                          assert(d < h && h < l && l < M_m && M_m < D);
                                          double code(double d, double h, double l, double M_m, double D) {
                                          	double t_0 = ((D * D) * h) / d;
                                          	double tmp;
                                          	if (l <= -3.8e+122) {
                                          		tmp = (sqrt((d / h)) * 1.0) * sqrt((d / l));
                                          	} else if (l <= -1.5e-289) {
                                          		tmp = (-d * sqrt(pow((l * h), -1.0))) * fma(((-0.125 / (l * d)) * t_0), (M_m * M_m), 1.0);
                                          	} else if (l <= 4.3e+111) {
                                          		tmp = (d / sqrt((l * h))) * fma(((M_m * M_m) / l), ((t_0 / d) * -0.125), 1.0);
                                          	} else {
                                          		tmp = pow((sqrt(l) * sqrt(h)), -1.0) * d;
                                          	}
                                          	return tmp;
                                          }
                                          
                                          M_m = abs(M)
                                          d, h, l, M_m, D = sort([d, h, l, M_m, D])
                                          function code(d, h, l, M_m, D)
                                          	t_0 = Float64(Float64(Float64(D * D) * h) / d)
                                          	tmp = 0.0
                                          	if (l <= -3.8e+122)
                                          		tmp = Float64(Float64(sqrt(Float64(d / h)) * 1.0) * sqrt(Float64(d / l)));
                                          	elseif (l <= -1.5e-289)
                                          		tmp = Float64(Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))) * fma(Float64(Float64(-0.125 / Float64(l * d)) * t_0), Float64(M_m * M_m), 1.0));
                                          	elseif (l <= 4.3e+111)
                                          		tmp = Float64(Float64(d / sqrt(Float64(l * h))) * fma(Float64(Float64(M_m * M_m) / l), Float64(Float64(t_0 / d) * -0.125), 1.0));
                                          	else
                                          		tmp = Float64((Float64(sqrt(l) * sqrt(h)) ^ -1.0) * d);
                                          	end
                                          	return tmp
                                          end
                                          
                                          M_m = N[Abs[M], $MachinePrecision]
                                          NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                          code[d_, h_, l_, M$95$m_, D_] := Block[{t$95$0 = N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[l, -3.8e+122], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1.5e-289], N[(N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(-0.125 / N[(l * d), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(M$95$m * M$95$m), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.3e+111], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] / l), $MachinePrecision] * N[(N[(t$95$0 / d), $MachinePrecision] * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] * d), $MachinePrecision]]]]]
                                          
                                          \begin{array}{l}
                                          M_m = \left|M\right|
                                          \\
                                          [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                                          \\
                                          \begin{array}{l}
                                          t_0 := \frac{\left(D \cdot D\right) \cdot h}{d}\\
                                          \mathbf{if}\;\ell \leq -3.8 \cdot 10^{+122}:\\
                                          \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\
                                          
                                          \mathbf{elif}\;\ell \leq -1.5 \cdot 10^{-289}:\\
                                          \;\;\;\;\left(\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right) \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d} \cdot t\_0, M\_m \cdot M\_m, 1\right)\\
                                          
                                          \mathbf{elif}\;\ell \leq 4.3 \cdot 10^{+111}:\\
                                          \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{M\_m \cdot M\_m}{\ell}, \frac{t\_0}{d} \cdot -0.125, 1\right)\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;{\left(\sqrt{\ell} \cdot \sqrt{h}\right)}^{-1} \cdot d\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 4 regimes
                                          2. if l < -3.7999999999999998e122

                                            1. Initial program 80.3%

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

                                              \[\leadsto \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \color{blue}{1} \]
                                            4. Step-by-step derivation
                                              1. Applied rewrites68.5%

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

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

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

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

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

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

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

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

                                              if -3.7999999999999998e122 < l < -1.4999999999999999e-289

                                              1. Initial program 78.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                  \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({M}^{2} \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell} + \frac{1}{{M}^{2}}\right)}\right) \]
                                                3. distribute-rgt-inN/A

                                                  \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot {M}^{2} + \frac{1}{{M}^{2}} \cdot {M}^{2}\right)} \]
                                                4. lft-mult-inverseN/A

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

                                                  \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}, {M}^{2}, 1\right)} \]
                                              9. Applied rewrites59.8%

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

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

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

                                                  \[\leadsto \left(\left(\color{blue}{\left(\sqrt{-1} \cdot \sqrt{-1}\right)} \cdot d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \mathsf{fma}\left(\frac{\frac{-1}{8}}{\ell \cdot d} \cdot \frac{\left(D \cdot D\right) \cdot h}{d}, M \cdot M, 1\right) \]
                                                3. rem-square-sqrtN/A

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

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

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

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

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

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

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

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

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

                                              if -1.4999999999999999e-289 < l < 4.29999999999999993e111

                                              1. Initial program 78.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                  \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left({M}^{2} \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell} + \frac{1}{{M}^{2}}\right)}\right) \]
                                                3. distribute-rgt-inN/A

                                                  \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{1}{8}\right)\right) \cdot \frac{{D}^{2} \cdot h}{{d}^{2} \cdot \ell}\right) \cdot {M}^{2} + \frac{1}{{M}^{2}} \cdot {M}^{2}\right)} \]
                                                4. lft-mult-inverseN/A

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

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

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

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

                                              if 4.29999999999999993e111 < l

                                              1. Initial program 65.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                              8. Step-by-step derivation
                                                1. Applied rewrites49.2%

                                                  \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
                                                2. Step-by-step derivation
                                                  1. Applied rewrites69.7%

                                                    \[\leadsto \frac{1}{\sqrt{\ell} \cdot \sqrt{h}} \cdot d \]
                                                3. Recombined 4 regimes into one program.
                                                4. Final simplification67.6%

                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -3.8 \cdot 10^{+122}:\\ \;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot 1\right) \cdot \sqrt{\frac{d}{\ell}}\\ \mathbf{elif}\;\ell \leq -1.5 \cdot 10^{-289}:\\ \;\;\;\;\left(\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right) \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d} \cdot \frac{\left(D \cdot D\right) \cdot h}{d}, M \cdot M, 1\right)\\ \mathbf{elif}\;\ell \leq 4.3 \cdot 10^{+111}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{M \cdot M}{\ell}, \frac{\frac{\left(D \cdot D\right) \cdot h}{d}}{d} \cdot -0.125, 1\right)\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt{\ell} \cdot \sqrt{h}\right)}^{-1} \cdot d\\ \end{array} \]
                                                5. Add Preprocessing

                                                Alternative 16: 44.9% accurate, 3.0× speedup?

                                                \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;h \leq 6 \cdot 10^{-272}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt{\ell} \cdot \sqrt{h}\right)}^{-1} \cdot d\\ \end{array} \end{array} \]
                                                M_m = (fabs.f64 M)
                                                NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                (FPCore (d h l M_m D)
                                                 :precision binary64
                                                 (if (<= h 6e-272)
                                                   (* (- d) (sqrt (pow (* l h) -1.0)))
                                                   (* (pow (* (sqrt l) (sqrt h)) -1.0) d)))
                                                M_m = fabs(M);
                                                assert(d < h && h < l && l < M_m && M_m < D);
                                                double code(double d, double h, double l, double M_m, double D) {
                                                	double tmp;
                                                	if (h <= 6e-272) {
                                                		tmp = -d * sqrt(pow((l * h), -1.0));
                                                	} else {
                                                		tmp = pow((sqrt(l) * sqrt(h)), -1.0) * d;
                                                	}
                                                	return tmp;
                                                }
                                                
                                                M_m =     private
                                                NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                module fmin_fmax_functions
                                                    implicit none
                                                    private
                                                    public fmax
                                                    public fmin
                                                
                                                    interface fmax
                                                        module procedure fmax88
                                                        module procedure fmax44
                                                        module procedure fmax84
                                                        module procedure fmax48
                                                    end interface
                                                    interface fmin
                                                        module procedure fmin88
                                                        module procedure fmin44
                                                        module procedure fmin84
                                                        module procedure fmin48
                                                    end interface
                                                contains
                                                    real(8) function fmax88(x, y) result (res)
                                                        real(8), intent (in) :: x
                                                        real(8), intent (in) :: y
                                                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                    end function
                                                    real(4) function fmax44(x, y) result (res)
                                                        real(4), intent (in) :: x
                                                        real(4), intent (in) :: y
                                                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                    end function
                                                    real(8) function fmax84(x, y) result(res)
                                                        real(8), intent (in) :: x
                                                        real(4), intent (in) :: y
                                                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                    end function
                                                    real(8) function fmax48(x, y) result(res)
                                                        real(4), intent (in) :: x
                                                        real(8), intent (in) :: y
                                                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                    end function
                                                    real(8) function fmin88(x, y) result (res)
                                                        real(8), intent (in) :: x
                                                        real(8), intent (in) :: y
                                                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                    end function
                                                    real(4) function fmin44(x, y) result (res)
                                                        real(4), intent (in) :: x
                                                        real(4), intent (in) :: y
                                                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                    end function
                                                    real(8) function fmin84(x, y) result(res)
                                                        real(8), intent (in) :: x
                                                        real(4), intent (in) :: y
                                                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                    end function
                                                    real(8) function fmin48(x, y) result(res)
                                                        real(4), intent (in) :: x
                                                        real(8), intent (in) :: y
                                                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                    end function
                                                end module
                                                
                                                real(8) function code(d, h, l, m_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_m
                                                    real(8), intent (in) :: d_1
                                                    real(8) :: tmp
                                                    if (h <= 6d-272) then
                                                        tmp = -d * sqrt(((l * h) ** (-1.0d0)))
                                                    else
                                                        tmp = ((sqrt(l) * sqrt(h)) ** (-1.0d0)) * d
                                                    end if
                                                    code = tmp
                                                end function
                                                
                                                M_m = Math.abs(M);
                                                assert d < h && h < l && l < M_m && M_m < D;
                                                public static double code(double d, double h, double l, double M_m, double D) {
                                                	double tmp;
                                                	if (h <= 6e-272) {
                                                		tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
                                                	} else {
                                                		tmp = Math.pow((Math.sqrt(l) * Math.sqrt(h)), -1.0) * d;
                                                	}
                                                	return tmp;
                                                }
                                                
                                                M_m = math.fabs(M)
                                                [d, h, l, M_m, D] = sort([d, h, l, M_m, D])
                                                def code(d, h, l, M_m, D):
                                                	tmp = 0
                                                	if h <= 6e-272:
                                                		tmp = -d * math.sqrt(math.pow((l * h), -1.0))
                                                	else:
                                                		tmp = math.pow((math.sqrt(l) * math.sqrt(h)), -1.0) * d
                                                	return tmp
                                                
                                                M_m = abs(M)
                                                d, h, l, M_m, D = sort([d, h, l, M_m, D])
                                                function code(d, h, l, M_m, D)
                                                	tmp = 0.0
                                                	if (h <= 6e-272)
                                                		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
                                                	else
                                                		tmp = Float64((Float64(sqrt(l) * sqrt(h)) ^ -1.0) * d);
                                                	end
                                                	return tmp
                                                end
                                                
                                                M_m = abs(M);
                                                d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
                                                function tmp_2 = code(d, h, l, M_m, D)
                                                	tmp = 0.0;
                                                	if (h <= 6e-272)
                                                		tmp = -d * sqrt(((l * h) ^ -1.0));
                                                	else
                                                		tmp = ((sqrt(l) * sqrt(h)) ^ -1.0) * d;
                                                	end
                                                	tmp_2 = tmp;
                                                end
                                                
                                                M_m = N[Abs[M], $MachinePrecision]
                                                NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[h, 6e-272], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] * d), $MachinePrecision]]
                                                
                                                \begin{array}{l}
                                                M_m = \left|M\right|
                                                \\
                                                [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                                                \\
                                                \begin{array}{l}
                                                \mathbf{if}\;h \leq 6 \cdot 10^{-272}:\\
                                                \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
                                                
                                                \mathbf{else}:\\
                                                \;\;\;\;{\left(\sqrt{\ell} \cdot \sqrt{h}\right)}^{-1} \cdot d\\
                                                
                                                
                                                \end{array}
                                                \end{array}
                                                
                                                Derivation
                                                1. Split input into 2 regimes
                                                2. if h < 6.0000000000000006e-272

                                                  1. Initial program 79.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                      \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
                                                    10. lower-*.f6446.6

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

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

                                                  if 6.0000000000000006e-272 < h

                                                  1. Initial program 73.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                    \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                                  8. Step-by-step derivation
                                                    1. Applied rewrites38.8%

                                                      \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
                                                    2. Step-by-step derivation
                                                      1. Applied rewrites51.5%

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

                                                      \[\leadsto \begin{array}{l} \mathbf{if}\;h \leq 6 \cdot 10^{-272}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;{\left(\sqrt{\ell} \cdot \sqrt{h}\right)}^{-1} \cdot d\\ \end{array} \]
                                                    5. Add Preprocessing

                                                    Alternative 17: 41.6% accurate, 3.2× speedup?

                                                    \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \begin{array}{l} \mathbf{if}\;d \leq -8.4 \cdot 10^{-129}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \end{array} \end{array} \]
                                                    M_m = (fabs.f64 M)
                                                    NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                    (FPCore (d h l M_m D)
                                                     :precision binary64
                                                     (if (<= d -8.4e-129)
                                                       (* (- d) (sqrt (pow (* l h) -1.0)))
                                                       (/ d (sqrt (* l h)))))
                                                    M_m = fabs(M);
                                                    assert(d < h && h < l && l < M_m && M_m < D);
                                                    double code(double d, double h, double l, double M_m, double D) {
                                                    	double tmp;
                                                    	if (d <= -8.4e-129) {
                                                    		tmp = -d * sqrt(pow((l * h), -1.0));
                                                    	} else {
                                                    		tmp = d / sqrt((l * h));
                                                    	}
                                                    	return tmp;
                                                    }
                                                    
                                                    M_m =     private
                                                    NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                    module fmin_fmax_functions
                                                        implicit none
                                                        private
                                                        public fmax
                                                        public fmin
                                                    
                                                        interface fmax
                                                            module procedure fmax88
                                                            module procedure fmax44
                                                            module procedure fmax84
                                                            module procedure fmax48
                                                        end interface
                                                        interface fmin
                                                            module procedure fmin88
                                                            module procedure fmin44
                                                            module procedure fmin84
                                                            module procedure fmin48
                                                        end interface
                                                    contains
                                                        real(8) function fmax88(x, y) result (res)
                                                            real(8), intent (in) :: x
                                                            real(8), intent (in) :: y
                                                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                        end function
                                                        real(4) function fmax44(x, y) result (res)
                                                            real(4), intent (in) :: x
                                                            real(4), intent (in) :: y
                                                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                        end function
                                                        real(8) function fmax84(x, y) result(res)
                                                            real(8), intent (in) :: x
                                                            real(4), intent (in) :: y
                                                            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                        end function
                                                        real(8) function fmax48(x, y) result(res)
                                                            real(4), intent (in) :: x
                                                            real(8), intent (in) :: y
                                                            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                        end function
                                                        real(8) function fmin88(x, y) result (res)
                                                            real(8), intent (in) :: x
                                                            real(8), intent (in) :: y
                                                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                        end function
                                                        real(4) function fmin44(x, y) result (res)
                                                            real(4), intent (in) :: x
                                                            real(4), intent (in) :: y
                                                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                        end function
                                                        real(8) function fmin84(x, y) result(res)
                                                            real(8), intent (in) :: x
                                                            real(4), intent (in) :: y
                                                            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                        end function
                                                        real(8) function fmin48(x, y) result(res)
                                                            real(4), intent (in) :: x
                                                            real(8), intent (in) :: y
                                                            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                        end function
                                                    end module
                                                    
                                                    real(8) function code(d, h, l, m_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_m
                                                        real(8), intent (in) :: d_1
                                                        real(8) :: tmp
                                                        if (d <= (-8.4d-129)) then
                                                            tmp = -d * sqrt(((l * h) ** (-1.0d0)))
                                                        else
                                                            tmp = d / sqrt((l * h))
                                                        end if
                                                        code = tmp
                                                    end function
                                                    
                                                    M_m = Math.abs(M);
                                                    assert d < h && h < l && l < M_m && M_m < D;
                                                    public static double code(double d, double h, double l, double M_m, double D) {
                                                    	double tmp;
                                                    	if (d <= -8.4e-129) {
                                                    		tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
                                                    	} else {
                                                    		tmp = d / Math.sqrt((l * h));
                                                    	}
                                                    	return tmp;
                                                    }
                                                    
                                                    M_m = math.fabs(M)
                                                    [d, h, l, M_m, D] = sort([d, h, l, M_m, D])
                                                    def code(d, h, l, M_m, D):
                                                    	tmp = 0
                                                    	if d <= -8.4e-129:
                                                    		tmp = -d * math.sqrt(math.pow((l * h), -1.0))
                                                    	else:
                                                    		tmp = d / math.sqrt((l * h))
                                                    	return tmp
                                                    
                                                    M_m = abs(M)
                                                    d, h, l, M_m, D = sort([d, h, l, M_m, D])
                                                    function code(d, h, l, M_m, D)
                                                    	tmp = 0.0
                                                    	if (d <= -8.4e-129)
                                                    		tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0)));
                                                    	else
                                                    		tmp = Float64(d / sqrt(Float64(l * h)));
                                                    	end
                                                    	return tmp
                                                    end
                                                    
                                                    M_m = abs(M);
                                                    d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
                                                    function tmp_2 = code(d, h, l, M_m, D)
                                                    	tmp = 0.0;
                                                    	if (d <= -8.4e-129)
                                                    		tmp = -d * sqrt(((l * h) ^ -1.0));
                                                    	else
                                                    		tmp = d / sqrt((l * h));
                                                    	end
                                                    	tmp_2 = tmp;
                                                    end
                                                    
                                                    M_m = N[Abs[M], $MachinePrecision]
                                                    NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                    code[d_, h_, l_, M$95$m_, D_] := If[LessEqual[d, -8.4e-129], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
                                                    
                                                    \begin{array}{l}
                                                    M_m = \left|M\right|
                                                    \\
                                                    [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                                                    \\
                                                    \begin{array}{l}
                                                    \mathbf{if}\;d \leq -8.4 \cdot 10^{-129}:\\
                                                    \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
                                                    
                                                    \mathbf{else}:\\
                                                    \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\
                                                    
                                                    
                                                    \end{array}
                                                    \end{array}
                                                    
                                                    Derivation
                                                    1. Split input into 2 regimes
                                                    2. if d < -8.4e-129

                                                      1. Initial program 85.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                          \[\leadsto \left(-d\right) \cdot \sqrt{\frac{1}{\color{blue}{\ell \cdot h}}} \]
                                                        10. lower-*.f6455.1

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

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

                                                      if -8.4e-129 < d

                                                      1. Initial program 71.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                        \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                                      8. Step-by-step derivation
                                                        1. Applied rewrites35.9%

                                                          \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
                                                        2. Step-by-step derivation
                                                          1. Applied rewrites35.9%

                                                            \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell \cdot h}}} \]
                                                        3. Recombined 2 regimes into one program.
                                                        4. Final simplification42.5%

                                                          \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -8.4 \cdot 10^{-129}:\\ \;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\ \end{array} \]
                                                        5. Add Preprocessing

                                                        Alternative 18: 26.4% accurate, 3.4× speedup?

                                                        \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \end{array} \]
                                                        M_m = (fabs.f64 M)
                                                        NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                        (FPCore (d h l M_m D) :precision binary64 (* (sqrt (pow (* l h) -1.0)) d))
                                                        M_m = fabs(M);
                                                        assert(d < h && h < l && l < M_m && M_m < D);
                                                        double code(double d, double h, double l, double M_m, double D) {
                                                        	return sqrt(pow((l * h), -1.0)) * d;
                                                        }
                                                        
                                                        M_m =     private
                                                        NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                        module fmin_fmax_functions
                                                            implicit none
                                                            private
                                                            public fmax
                                                            public fmin
                                                        
                                                            interface fmax
                                                                module procedure fmax88
                                                                module procedure fmax44
                                                                module procedure fmax84
                                                                module procedure fmax48
                                                            end interface
                                                            interface fmin
                                                                module procedure fmin88
                                                                module procedure fmin44
                                                                module procedure fmin84
                                                                module procedure fmin48
                                                            end interface
                                                        contains
                                                            real(8) function fmax88(x, y) result (res)
                                                                real(8), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                            end function
                                                            real(4) function fmax44(x, y) result (res)
                                                                real(4), intent (in) :: x
                                                                real(4), intent (in) :: y
                                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmax84(x, y) result(res)
                                                                real(8), intent (in) :: x
                                                                real(4), intent (in) :: y
                                                                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmax48(x, y) result(res)
                                                                real(4), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmin88(x, y) result (res)
                                                                real(8), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                            end function
                                                            real(4) function fmin44(x, y) result (res)
                                                                real(4), intent (in) :: x
                                                                real(4), intent (in) :: y
                                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmin84(x, y) result(res)
                                                                real(8), intent (in) :: x
                                                                real(4), intent (in) :: y
                                                                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmin48(x, y) result(res)
                                                                real(4), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                            end function
                                                        end module
                                                        
                                                        real(8) function code(d, h, l, m_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_m
                                                            real(8), intent (in) :: d_1
                                                            code = sqrt(((l * h) ** (-1.0d0))) * d
                                                        end function
                                                        
                                                        M_m = Math.abs(M);
                                                        assert d < h && h < l && l < M_m && M_m < D;
                                                        public static double code(double d, double h, double l, double M_m, double D) {
                                                        	return Math.sqrt(Math.pow((l * h), -1.0)) * d;
                                                        }
                                                        
                                                        M_m = math.fabs(M)
                                                        [d, h, l, M_m, D] = sort([d, h, l, M_m, D])
                                                        def code(d, h, l, M_m, D):
                                                        	return math.sqrt(math.pow((l * h), -1.0)) * d
                                                        
                                                        M_m = abs(M)
                                                        d, h, l, M_m, D = sort([d, h, l, M_m, D])
                                                        function code(d, h, l, M_m, D)
                                                        	return Float64(sqrt((Float64(l * h) ^ -1.0)) * d)
                                                        end
                                                        
                                                        M_m = abs(M);
                                                        d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
                                                        function tmp = code(d, h, l, M_m, D)
                                                        	tmp = sqrt(((l * h) ^ -1.0)) * d;
                                                        end
                                                        
                                                        M_m = N[Abs[M], $MachinePrecision]
                                                        NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                        code[d_, h_, l_, M$95$m_, D_] := N[(N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]
                                                        
                                                        \begin{array}{l}
                                                        M_m = \left|M\right|
                                                        \\
                                                        [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                                                        \\
                                                        \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d
                                                        \end{array}
                                                        
                                                        Derivation
                                                        1. Initial program 76.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                          \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                                        8. Final simplification26.5%

                                                          \[\leadsto \sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d \]
                                                        9. Add Preprocessing

                                                        Alternative 19: 26.2% accurate, 15.3× speedup?

                                                        \[\begin{array}{l} M_m = \left|M\right| \\ [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\ \\ \frac{d}{\sqrt{\ell \cdot h}} \end{array} \]
                                                        M_m = (fabs.f64 M)
                                                        NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                        (FPCore (d h l M_m D) :precision binary64 (/ d (sqrt (* l h))))
                                                        M_m = fabs(M);
                                                        assert(d < h && h < l && l < M_m && M_m < D);
                                                        double code(double d, double h, double l, double M_m, double D) {
                                                        	return d / sqrt((l * h));
                                                        }
                                                        
                                                        M_m =     private
                                                        NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                        module fmin_fmax_functions
                                                            implicit none
                                                            private
                                                            public fmax
                                                            public fmin
                                                        
                                                            interface fmax
                                                                module procedure fmax88
                                                                module procedure fmax44
                                                                module procedure fmax84
                                                                module procedure fmax48
                                                            end interface
                                                            interface fmin
                                                                module procedure fmin88
                                                                module procedure fmin44
                                                                module procedure fmin84
                                                                module procedure fmin48
                                                            end interface
                                                        contains
                                                            real(8) function fmax88(x, y) result (res)
                                                                real(8), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                            end function
                                                            real(4) function fmax44(x, y) result (res)
                                                                real(4), intent (in) :: x
                                                                real(4), intent (in) :: y
                                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmax84(x, y) result(res)
                                                                real(8), intent (in) :: x
                                                                real(4), intent (in) :: y
                                                                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmax48(x, y) result(res)
                                                                real(4), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmin88(x, y) result (res)
                                                                real(8), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                            end function
                                                            real(4) function fmin44(x, y) result (res)
                                                                real(4), intent (in) :: x
                                                                real(4), intent (in) :: y
                                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmin84(x, y) result(res)
                                                                real(8), intent (in) :: x
                                                                real(4), intent (in) :: y
                                                                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmin48(x, y) result(res)
                                                                real(4), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                            end function
                                                        end module
                                                        
                                                        real(8) function code(d, h, l, m_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_m
                                                            real(8), intent (in) :: d_1
                                                            code = d / sqrt((l * h))
                                                        end function
                                                        
                                                        M_m = Math.abs(M);
                                                        assert d < h && h < l && l < M_m && M_m < D;
                                                        public static double code(double d, double h, double l, double M_m, double D) {
                                                        	return d / Math.sqrt((l * h));
                                                        }
                                                        
                                                        M_m = math.fabs(M)
                                                        [d, h, l, M_m, D] = sort([d, h, l, M_m, D])
                                                        def code(d, h, l, M_m, D):
                                                        	return d / math.sqrt((l * h))
                                                        
                                                        M_m = abs(M)
                                                        d, h, l, M_m, D = sort([d, h, l, M_m, D])
                                                        function code(d, h, l, M_m, D)
                                                        	return Float64(d / sqrt(Float64(l * h)))
                                                        end
                                                        
                                                        M_m = abs(M);
                                                        d, h, l, M_m, D = num2cell(sort([d, h, l, M_m, D])){:}
                                                        function tmp = code(d, h, l, M_m, D)
                                                        	tmp = d / sqrt((l * h));
                                                        end
                                                        
                                                        M_m = N[Abs[M], $MachinePrecision]
                                                        NOTE: d, h, l, M_m, and D should be sorted in increasing order before calling this function.
                                                        code[d_, h_, l_, M$95$m_, D_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
                                                        
                                                        \begin{array}{l}
                                                        M_m = \left|M\right|
                                                        \\
                                                        [d, h, l, M_m, D] = \mathsf{sort}([d, h, l, M_m, D])\\
                                                        \\
                                                        \frac{d}{\sqrt{\ell \cdot h}}
                                                        \end{array}
                                                        
                                                        Derivation
                                                        1. Initial program 76.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                          \[\leadsto \color{blue}{\sqrt{\frac{1}{\ell \cdot h}} \cdot d} \]
                                                        8. Step-by-step derivation
                                                          1. Applied rewrites26.2%

                                                            \[\leadsto \frac{1}{\sqrt{\ell \cdot h}} \cdot d \]
                                                          2. Step-by-step derivation
                                                            1. Applied rewrites26.2%

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

                                                            Reproduce

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