Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.4% → 79.0%
Time: 22.9s
Alternatives: 20
Speedup: 3.5×

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)));
}
real(8) function code(d, h, l, m, d_1)
    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 20 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)));
}
real(8) function code(d, h, l, m, d_1)
    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: 79.0% accurate, 1.2× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} t_0 := 1 - \left(\left(\left(0.25 \cdot D\_m\right) \cdot \left(\frac{M\_m}{d} \cdot h\right)\right) \cdot \frac{M\_m}{\ell}\right) \cdot \left(\frac{0.5}{d} \cdot D\_m\right)\\ \mathbf{if}\;\ell \leq -1.95 \cdot 10^{+39}:\\ \;\;\;\;\left(\left(\frac{-1}{2} \cdot {\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell} - -1\right) \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\ \mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;t\_0 \cdot \left(\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot t\_0\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (let* ((t_0
         (-
          1.0
          (*
           (* (* (* 0.25 D_m) (* (/ M_m d) h)) (/ M_m l))
           (* (/ 0.5 d) D_m)))))
   (if (<= l -1.95e+39)
     (*
      (- (* (* (/ -1.0 2.0) (pow (/ (* D_m M_m) (* 2.0 d)) 2.0)) (/ h l)) -1.0)
      (* (/ (sqrt (- d)) (sqrt (- l))) (pow (/ d h) (/ 1.0 2.0))))
     (if (<= l -5e-310)
       (* t_0 (* (sqrt (/ 1.0 (* h l))) (- d)))
       (* (/ (/ d (sqrt l)) (sqrt h)) t_0)))))
D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double t_0 = 1.0 - ((((0.25 * D_m) * ((M_m / d) * h)) * (M_m / l)) * ((0.5 / d) * D_m));
	double tmp;
	if (l <= -1.95e+39) {
		tmp = ((((-1.0 / 2.0) * pow(((D_m * M_m) / (2.0 * d)), 2.0)) * (h / l)) - -1.0) * ((sqrt(-d) / sqrt(-l)) * pow((d / h), (1.0 / 2.0)));
	} else if (l <= -5e-310) {
		tmp = t_0 * (sqrt((1.0 / (h * l))) * -d);
	} else {
		tmp = ((d / sqrt(l)) / sqrt(h)) * t_0;
	}
	return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    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_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 1.0d0 - ((((0.25d0 * d_m) * ((m_m / d) * h)) * (m_m / l)) * ((0.5d0 / d) * d_m))
    if (l <= (-1.95d+39)) then
        tmp = (((((-1.0d0) / 2.0d0) * (((d_m * m_m) / (2.0d0 * d)) ** 2.0d0)) * (h / l)) - (-1.0d0)) * ((sqrt(-d) / sqrt(-l)) * ((d / h) ** (1.0d0 / 2.0d0)))
    else if (l <= (-5d-310)) then
        tmp = t_0 * (sqrt((1.0d0 / (h * l))) * -d)
    else
        tmp = ((d / sqrt(l)) / sqrt(h)) * t_0
    end if
    code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double t_0 = 1.0 - ((((0.25 * D_m) * ((M_m / d) * h)) * (M_m / l)) * ((0.5 / d) * D_m));
	double tmp;
	if (l <= -1.95e+39) {
		tmp = ((((-1.0 / 2.0) * Math.pow(((D_m * M_m) / (2.0 * d)), 2.0)) * (h / l)) - -1.0) * ((Math.sqrt(-d) / Math.sqrt(-l)) * Math.pow((d / h), (1.0 / 2.0)));
	} else if (l <= -5e-310) {
		tmp = t_0 * (Math.sqrt((1.0 / (h * l))) * -d);
	} else {
		tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * t_0;
	}
	return tmp;
}
D_m = math.fabs(D)
M_m = math.fabs(M)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	t_0 = 1.0 - ((((0.25 * D_m) * ((M_m / d) * h)) * (M_m / l)) * ((0.5 / d) * D_m))
	tmp = 0
	if l <= -1.95e+39:
		tmp = ((((-1.0 / 2.0) * math.pow(((D_m * M_m) / (2.0 * d)), 2.0)) * (h / l)) - -1.0) * ((math.sqrt(-d) / math.sqrt(-l)) * math.pow((d / h), (1.0 / 2.0)))
	elif l <= -5e-310:
		tmp = t_0 * (math.sqrt((1.0 / (h * l))) * -d)
	else:
		tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * t_0
	return tmp
D_m = abs(D)
M_m = abs(M)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	t_0 = Float64(1.0 - Float64(Float64(Float64(Float64(0.25 * D_m) * Float64(Float64(M_m / d) * h)) * Float64(M_m / l)) * Float64(Float64(0.5 / d) * D_m)))
	tmp = 0.0
	if (l <= -1.95e+39)
		tmp = Float64(Float64(Float64(Float64(Float64(-1.0 / 2.0) * (Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)) - -1.0) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * (Float64(d / h) ^ Float64(1.0 / 2.0))));
	elseif (l <= -5e-310)
		tmp = Float64(t_0 * Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(-d)));
	else
		tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * t_0);
	end
	return tmp
end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
	t_0 = 1.0 - ((((0.25 * D_m) * ((M_m / d) * h)) * (M_m / l)) * ((0.5 / d) * D_m));
	tmp = 0.0;
	if (l <= -1.95e+39)
		tmp = ((((-1.0 / 2.0) * (((D_m * M_m) / (2.0 * d)) ^ 2.0)) * (h / l)) - -1.0) * ((sqrt(-d) / sqrt(-l)) * ((d / h) ^ (1.0 / 2.0)));
	elseif (l <= -5e-310)
		tmp = t_0 * (sqrt((1.0 / (h * l))) * -d);
	else
		tmp = ((d / sqrt(l)) / sqrt(h)) * t_0;
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(1.0 - N[(N[(N[(N[(0.25 * D$95$m), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / l), $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 / d), $MachinePrecision] * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.95e+39], N[(N[(N[(N[(N[(-1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(t$95$0 * N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := 1 - \left(\left(\left(0.25 \cdot D\_m\right) \cdot \left(\frac{M\_m}{d} \cdot h\right)\right) \cdot \frac{M\_m}{\ell}\right) \cdot \left(\frac{0.5}{d} \cdot D\_m\right)\\
\mathbf{if}\;\ell \leq -1.95 \cdot 10^{+39}:\\
\;\;\;\;\left(\left(\frac{-1}{2} \cdot {\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell} - -1\right) \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\

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

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


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

    1. Initial program 73.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. lift-/.f64N/A

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

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

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

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

    if -1.95e39 < l < -4.999999999999985e-310

    1. Initial program 66.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < l

    1. Initial program 64.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(\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. clear-numN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 49.0% accurate, 0.8× speedup?

\[\begin{array}{l} D_m = \left|D\right| \\ M_m = \left|M\right| \\ [d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\ \\ \begin{array}{l} \mathbf{if}\;\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(\left(\frac{-1}{2} \cdot {\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell} - -1\right) \leq -1 \cdot 10^{-66}:\\ \;\;\;\;\left(-\sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\right) \cdot \left(\left(\left(D\_m \cdot D\_m\right) \cdot -0.125\right) \cdot \left(\frac{M\_m}{d} \cdot M\_m\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\ \end{array} \end{array} \]
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
 :precision binary64
 (if (<=
      (*
       (* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))
       (-
        (* (* (/ -1.0 2.0) (pow (/ (* D_m M_m) (* 2.0 d)) 2.0)) (/ h l))
        -1.0))
      -1e-66)
   (*
    (- (sqrt (/ h (* (* l l) l))))
    (* (* (* D_m D_m) -0.125) (* (/ M_m d) M_m)))
   (/ (sqrt (/ d l)) (sqrt (/ h d)))))
D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (((pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0))) * ((((-1.0 / 2.0) * pow(((D_m * M_m) / (2.0 * d)), 2.0)) * (h / l)) - -1.0)) <= -1e-66) {
		tmp = -sqrt((h / ((l * l) * l))) * (((D_m * D_m) * -0.125) * ((M_m / d) * M_m));
	} else {
		tmp = sqrt((d / l)) / sqrt((h / d));
	}
	return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
    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_m
    real(8) :: tmp
    if (((((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0))) * (((((-1.0d0) / 2.0d0) * (((d_m * m_m) / (2.0d0 * d)) ** 2.0d0)) * (h / l)) - (-1.0d0))) <= (-1d-66)) then
        tmp = -sqrt((h / ((l * l) * l))) * (((d_m * d_m) * (-0.125d0)) * ((m_m / d) * m_m))
    else
        tmp = sqrt((d / l)) / sqrt((h / d))
    end if
    code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
	double tmp;
	if (((Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0))) * ((((-1.0 / 2.0) * Math.pow(((D_m * M_m) / (2.0 * d)), 2.0)) * (h / l)) - -1.0)) <= -1e-66) {
		tmp = -Math.sqrt((h / ((l * l) * l))) * (((D_m * D_m) * -0.125) * ((M_m / d) * M_m));
	} else {
		tmp = Math.sqrt((d / l)) / Math.sqrt((h / d));
	}
	return tmp;
}
D_m = math.fabs(D)
M_m = math.fabs(M)
[d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m])
def code(d, h, l, M_m, D_m):
	tmp = 0
	if ((math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0))) * ((((-1.0 / 2.0) * math.pow(((D_m * M_m) / (2.0 * d)), 2.0)) * (h / l)) - -1.0)) <= -1e-66:
		tmp = -math.sqrt((h / ((l * l) * l))) * (((D_m * D_m) * -0.125) * ((M_m / d) * M_m))
	else:
		tmp = math.sqrt((d / l)) / math.sqrt((h / d))
	return tmp
D_m = abs(D)
M_m = abs(M)
d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m])
function code(d, h, l, M_m, D_m)
	tmp = 0.0
	if (Float64(Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))) * Float64(Float64(Float64(Float64(-1.0 / 2.0) * (Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)) - -1.0)) <= -1e-66)
		tmp = Float64(Float64(-sqrt(Float64(h / Float64(Float64(l * l) * l)))) * Float64(Float64(Float64(D_m * D_m) * -0.125) * Float64(Float64(M_m / d) * M_m)));
	else
		tmp = Float64(sqrt(Float64(d / l)) / sqrt(Float64(h / d)));
	end
	return tmp
end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
	tmp = 0.0;
	if (((((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0))) * ((((-1.0 / 2.0) * (((D_m * M_m) / (2.0 * d)) ^ 2.0)) * (h / l)) - -1.0)) <= -1e-66)
		tmp = -sqrt((h / ((l * l) * l))) * (((D_m * D_m) * -0.125) * ((M_m / d) * M_m));
	else
		tmp = sqrt((d / l)) / sqrt((h / d));
	end
	tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[N[(N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(-1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], -1e-66], N[((-N[Sqrt[N[(h / N[(N[(l * l), $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) * N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(\left(\frac{-1}{2} \cdot {\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell} - -1\right) \leq -1 \cdot 10^{-66}:\\
\;\;\;\;\left(-\sqrt{\frac{h}{\left(\ell \cdot \ell\right) \cdot \ell}}\right) \cdot \left(\left(\left(D\_m \cdot D\_m\right) \cdot -0.125\right) \cdot \left(\frac{M\_m}{d} \cdot M\_m\right)\right)\\

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


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

    1. Initial program 87.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      1. Initial program 55.7%

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

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

          \[\leadsto \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-*.f6433.6

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

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

          \[\leadsto \frac{\sqrt{\frac{d}{\ell}}}{\color{blue}{\sqrt{\frac{h}{d}}}} \]
      7. Recombined 2 regimes into one program.
      8. Final simplification49.0%

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

      Reproduce

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