Henrywood and Agarwal, Equation (12)

Percentage Accurate: 66.6% → 84.0%
Time: 1.9min
Alternatives: 21
Speedup: 1.0×

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 21 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.6% 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: 84.0% accurate, 0.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if 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. Simplified67.3%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg67.3%

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

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

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

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

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

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

    if -4.999999999999985e-310 < l < 1.14999999999999996e131

    1. Initial program 68.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. Simplified67.4%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def50.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p86.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right)} \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
    9. Step-by-step derivation
      1. associate-*l/93.1%

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

        \[\leadsto \left(\frac{h \cdot \color{blue}{\left(-0.5 \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\right)}}{\ell} + 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
      3. *-un-lft-identity93.1%

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

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

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

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

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

    if 1.14999999999999996e131 < l

    1. Initial program 51.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. Simplified51.8%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Simplified71.8%

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

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

Alternative 2: 78.1% accurate, 0.8× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -4.99999999999999975e60

    1. Initial program 52.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. Simplified54.2%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg64.1%

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

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

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

    if -4.99999999999999975e60 < l < -4.999999999999985e-310

    1. Initial program 75.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. Simplified75.2%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num75.2%

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

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\color{blue}{\left(\frac{1 \cdot D}{\frac{2}{M} \cdot d}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      3. *-un-lft-identity76.3%

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

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

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < l < 7.0000000000000002e130

    1. Initial program 68.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. Simplified67.4%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def50.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p86.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right)} \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
    9. Step-by-step derivation
      1. associate-*l/93.1%

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

        \[\leadsto \left(\frac{h \cdot \color{blue}{\left(-0.5 \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\right)}}{\ell} + 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
      3. *-un-lft-identity93.1%

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

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

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

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

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

    if 7.0000000000000002e130 < l

    1. Initial program 51.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. Simplified51.8%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Simplified71.8%

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

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

Alternative 3: 78.1% accurate, 0.8× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -7.4999999999999999e50

    1. Initial program 54.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. Simplified54.0%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num54.0%

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

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\color{blue}{\left(\frac{D}{2 \cdot \frac{d}{M}}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. frac-2neg63.6%

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

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

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

    if -7.4999999999999999e50 < l < -4.999999999999985e-310

    1. Initial program 74.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. Simplified75.8%

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
    6. Step-by-step derivation
      1. clear-num80.6%

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

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

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

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

    if -4.999999999999985e-310 < l < 8.0000000000000005e130

    1. Initial program 68.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. Simplified67.4%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def50.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p86.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right)} \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
    9. Step-by-step derivation
      1. associate-*l/93.1%

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

        \[\leadsto \left(\frac{h \cdot \color{blue}{\left(-0.5 \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\right)}}{\ell} + 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
      3. *-un-lft-identity93.1%

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

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

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

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

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

    if 8.0000000000000005e130 < l

    1. Initial program 51.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. Simplified51.8%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Simplified71.8%

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

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

Alternative 4: 79.8% accurate, 0.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if 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. Simplified67.3%

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
    6. Step-by-step derivation
      1. frac-2neg77.3%

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

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

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

    if -4.999999999999985e-310 < l < 7.1000000000000002e130

    1. Initial program 68.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. Simplified67.4%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def50.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p86.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right)} \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
    9. Step-by-step derivation
      1. associate-*l/93.1%

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

        \[\leadsto \left(\frac{h \cdot \color{blue}{\left(-0.5 \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\right)}}{\ell} + 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
      3. *-un-lft-identity93.1%

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

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

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

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

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

    if 7.1000000000000002e130 < l

    1. Initial program 51.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. Simplified51.8%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Simplified71.8%

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

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

Alternative 5: 79.7% accurate, 0.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if 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. Simplified67.3%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num67.3%

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{D}{\color{blue}{\frac{2 \cdot d}{M}}}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      5. *-un-lft-identity67.6%

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\frac{D}{\frac{2 \cdot d}{M}}\right)}^{2} \cdot h}{\ell}}\right) \]
    8. Step-by-step derivation
      1. frac-2neg77.3%

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

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

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

    if -4.999999999999985e-310 < l < 7.5000000000000003e130

    1. Initial program 68.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. Simplified67.4%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def50.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p86.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right)} \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
    9. Step-by-step derivation
      1. associate-*l/93.1%

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

        \[\leadsto \left(\frac{h \cdot \color{blue}{\left(-0.5 \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\right)}}{\ell} + 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
      3. *-un-lft-identity93.1%

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

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

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

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

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

    if 7.5000000000000003e130 < l

    1. Initial program 51.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. Simplified51.8%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Simplified71.8%

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

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

Alternative 6: 80.7% accurate, 0.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if 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. Simplified67.3%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-2neg67.3%

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

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

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

    if -4.999999999999985e-310 < l < 7.0000000000000002e130

    1. Initial program 68.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. Simplified67.4%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def50.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p86.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right)} \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
    9. Step-by-step derivation
      1. associate-*l/93.1%

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

        \[\leadsto \left(\frac{h \cdot \color{blue}{\left(-0.5 \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\right)}}{\ell} + 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
      3. *-un-lft-identity93.1%

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

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

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

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

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

    if 7.0000000000000002e130 < l

    1. Initial program 51.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. Simplified51.8%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Simplified71.8%

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

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

Alternative 7: 76.5% accurate, 0.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if 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. Simplified67.3%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num67.3%

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{D}{\color{blue}{\frac{2 \cdot d}{M}}}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      5. *-un-lft-identity67.6%

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < l < 6.6e130

    1. Initial program 68.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. Simplified67.4%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def50.2%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p86.3%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right)} \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
    9. Step-by-step derivation
      1. associate-*l/93.1%

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

        \[\leadsto \left(\frac{h \cdot \color{blue}{\left(-0.5 \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\right)}}{\ell} + 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
      3. *-un-lft-identity93.1%

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

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

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

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

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

    if 6.6e130 < l

    1. Initial program 51.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. Simplified51.8%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Simplified71.8%

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

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

Alternative 8: 75.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq -3.6 \cdot 10^{+213}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -3.6000000000000001e213

    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. Simplified72.1%

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

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

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\color{blue}{\left(\sqrt{\frac{M}{2} \cdot \frac{D}{d}} \cdot \sqrt{\frac{M}{2} \cdot \frac{D}{d}}\right)}}^{2} \cdot h}{\ell}\right) \]
      3. add-sqr-sqrt73.0%

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
    6. Step-by-step derivation
      1. clear-num72.9%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg88.6%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. distribute-rgt-neg-in88.6%

        \[\leadsto \color{blue}{d \cdot \left(-\sqrt{\frac{1}{h \cdot \ell}}\right)} \]
      3. *-commutative88.6%

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

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

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

    if -3.6000000000000001e213 < d < -1.6499999999999999e-303

    1. Initial program 68.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. Simplified67.6%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. frac-times68.5%

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

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

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

    if -1.6499999999999999e-303 < d

    1. Initial program 61.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. Simplified60.6%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def54.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p78.8%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2} \cdot -0.5, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. fma-udef79.6%

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

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

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

      \[\leadsto \color{blue}{\left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right)} \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
    9. Step-by-step derivation
      1. associate-*l/79.8%

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

        \[\leadsto \left(\frac{h \cdot \color{blue}{\left(-0.5 \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\right)}}{\ell} + 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
      3. *-un-lft-identity79.8%

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

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

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

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

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

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

Alternative 9: 69.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq -6 \cdot 10^{+212}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -6e212

    1. Initial program 64.9%

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

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
    6. Step-by-step derivation
      1. clear-num74.1%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg89.1%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. distribute-rgt-neg-in89.1%

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

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

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

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

    if -6e212 < d < -1.6499999999999999e-303

    1. Initial program 68.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. Simplified67.3%

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
    6. Step-by-step derivation
      1. expm1-log1p-u35.4%

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{h}}\right)\right)} - 1} \]
    8. Step-by-step derivation
      1. expm1-def28.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{h}}\right)\right)\right)} \]
      2. expm1-log1p60.4%

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

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

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

    if -1.6499999999999999e-303 < d

    1. Initial program 61.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. Simplified60.6%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def54.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p78.8%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2} \cdot -0.5, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. fma-udef79.6%

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

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

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

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

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

Alternative 10: 71.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq -5.4 \cdot 10^{+212}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -5.4e212

    1. Initial program 64.9%

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

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
    6. Step-by-step derivation
      1. clear-num74.1%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg89.1%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. distribute-rgt-neg-in89.1%

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

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

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

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

    if -5.4e212 < d < -1.6499999999999999e-303

    1. Initial program 68.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. Simplified67.3%

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
    6. Step-by-step derivation
      1. expm1-log1p-u35.4%

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{h}}\right)\right)} - 1} \]
    8. Step-by-step derivation
      1. expm1-def28.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{h}}\right)\right)\right)} \]
      2. expm1-log1p60.4%

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

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

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

    if -1.6499999999999999e-303 < d

    1. Initial program 61.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. Simplified60.6%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def54.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p78.8%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2} \cdot -0.5, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. fma-udef79.6%

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

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

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

      \[\leadsto \color{blue}{\left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right)} \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
    9. Step-by-step derivation
      1. associate-*l/79.8%

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

        \[\leadsto \left(\frac{h \cdot \color{blue}{\left(-0.5 \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\right)}}{\ell} + 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
      3. *-un-lft-identity79.8%

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

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

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

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

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

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

Alternative 11: 75.4% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.65 \cdot 10^{-303}:\\
\;\;\;\;\left(\left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\

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


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

    1. Initial program 67.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. Simplified68.3%

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

    if -1.6499999999999999e-303 < d

    1. Initial program 61.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. Simplified60.6%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def54.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p78.8%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2} \cdot -0.5, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. fma-udef79.6%

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

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

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

      \[\leadsto \color{blue}{\left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right)} \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
    9. Step-by-step derivation
      1. associate-*l/79.8%

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

        \[\leadsto \left(\frac{h \cdot \color{blue}{\left(-0.5 \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\right)}}{\ell} + 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
      3. *-un-lft-identity79.8%

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

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

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

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

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

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

Alternative 12: 76.5% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if 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. Simplified67.3%

      \[\leadsto \color{blue}{\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. associate-*l/68.9%

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

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

    if -4.999999999999985e-310 < l

    1. Initial program 62.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. Simplified61.7%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def55.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p80.1%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2} \cdot -0.5, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. fma-udef81.0%

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

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

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

      \[\leadsto \color{blue}{\left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right)} \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
    9. Step-by-step derivation
      1. associate-*l/81.2%

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

        \[\leadsto \left(\frac{h \cdot \color{blue}{\left(-0.5 \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\right)}}{\ell} + 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
      3. *-un-lft-identity81.2%

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

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

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

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

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

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

Alternative 13: 76.6% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if 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. Simplified67.3%

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < l

    1. Initial program 62.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. Simplified61.7%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def55.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p80.1%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2} \cdot -0.5, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. fma-udef81.0%

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

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

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

      \[\leadsto \color{blue}{\left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right)} \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
    9. Step-by-step derivation
      1. associate-*l/81.2%

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

        \[\leadsto \left(\frac{h \cdot \color{blue}{\left(-0.5 \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\right)}}{\ell} + 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
      3. *-un-lft-identity81.2%

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

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

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

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

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

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

Alternative 14: 76.6% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if 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. Simplified67.3%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num67.3%

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

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

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

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{D}{\color{blue}{\frac{2 \cdot d}{M}}}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \]
      5. *-un-lft-identity67.6%

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

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

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

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

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

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

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

    if -4.999999999999985e-310 < l

    1. Initial program 62.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. Simplified61.7%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def55.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p80.1%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2} \cdot -0.5, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. fma-udef81.0%

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

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

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

      \[\leadsto \color{blue}{\left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right)} \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
    9. Step-by-step derivation
      1. associate-*l/81.2%

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

        \[\leadsto \left(\frac{h \cdot \color{blue}{\left(-0.5 \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\right)}}{\ell} + 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
      3. *-un-lft-identity81.2%

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

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

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

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

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

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

Alternative 15: 58.7% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -1.7 \cdot 10^{-256}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{elif}\;\ell \leq 4.1 \cdot 10^{-304}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\ \mathbf{elif}\;\ell \leq 1.5 \cdot 10^{+145}:\\ \;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \end{array} \]
(FPCore (d h l M D)
 :precision binary64
 (if (<= l -1.7e-256)
   (* d (- (sqrt (/ (/ 1.0 l) h))))
   (if (<= l 4.1e-304)
     (/ d (cbrt (pow (* l h) 1.5)))
     (if (<= l 1.5e+145)
       (*
        (+ 1.0 (* (/ h l) (* -0.5 (pow (/ (* M D) (* d 2.0)) 2.0))))
        (/ d (sqrt (* l h))))
       (/ d (* (sqrt h) (sqrt l)))))))
double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -1.7e-256) {
		tmp = d * -sqrt(((1.0 / l) / h));
	} else if (l <= 4.1e-304) {
		tmp = d / cbrt(pow((l * h), 1.5));
	} else if (l <= 1.5e+145) {
		tmp = (1.0 + ((h / l) * (-0.5 * pow(((M * D) / (d * 2.0)), 2.0)))) * (d / sqrt((l * h)));
	} else {
		tmp = d / (sqrt(h) * sqrt(l));
	}
	return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
	double tmp;
	if (l <= -1.7e-256) {
		tmp = d * -Math.sqrt(((1.0 / l) / h));
	} else if (l <= 4.1e-304) {
		tmp = d / Math.cbrt(Math.pow((l * h), 1.5));
	} else if (l <= 1.5e+145) {
		tmp = (1.0 + ((h / l) * (-0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0)))) * (d / Math.sqrt((l * h)));
	} else {
		tmp = d / (Math.sqrt(h) * Math.sqrt(l));
	}
	return tmp;
}
function code(d, h, l, M, D)
	tmp = 0.0
	if (l <= -1.7e-256)
		tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h))));
	elseif (l <= 4.1e-304)
		tmp = Float64(d / cbrt((Float64(l * h) ^ 1.5)));
	elseif (l <= 1.5e+145)
		tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)))) * Float64(d / sqrt(Float64(l * h))));
	else
		tmp = Float64(d / Float64(sqrt(h) * sqrt(l)));
	end
	return tmp
end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1.7e-256], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 4.1e-304], N[(d / N[Power[N[Power[N[(l * h), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.5e+145], N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.7 \cdot 10^{-256}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\

\mathbf{elif}\;\ell \leq 4.1 \cdot 10^{-304}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -1.7e-256

    1. Initial program 66.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. Simplified66.6%

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
    6. Step-by-step derivation
      1. clear-num68.0%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg49.1%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. distribute-rgt-neg-in49.1%

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

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

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

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

    if -1.7e-256 < l < 4.10000000000000002e-304

    1. Initial program 69.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. Simplified69.1%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow1/225.5%

        \[\leadsto d \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \]
      2. rem-exp-log25.1%

        \[\leadsto d \cdot {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \]
      3. exp-neg25.1%

        \[\leadsto d \cdot {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \]
      4. exp-prod25.1%

        \[\leadsto d \cdot \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \]
      5. distribute-lft-neg-out25.1%

        \[\leadsto d \cdot e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \]
      6. distribute-rgt-neg-in25.1%

        \[\leadsto d \cdot e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}} \]
      7. metadata-eval25.1%

        \[\leadsto d \cdot e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}} \]
      8. exp-to-pow25.5%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
      9. rem-exp-log7.2%

        \[\leadsto \color{blue}{e^{\log d}} \cdot {\left(h \cdot \ell\right)}^{-0.5} \]
      10. rem-exp-log7.3%

        \[\leadsto e^{\log d} \cdot \color{blue}{e^{\log \left({\left(h \cdot \ell\right)}^{-0.5}\right)}} \]
      11. exp-sum6.9%

        \[\leadsto \color{blue}{e^{\log d + \log \left({\left(h \cdot \ell\right)}^{-0.5}\right)}} \]
      12. log-pow6.9%

        \[\leadsto e^{\log d + \color{blue}{-0.5 \cdot \log \left(h \cdot \ell\right)}} \]
      13. metadata-eval6.9%

        \[\leadsto e^{\log d + \color{blue}{\left(0.5 \cdot -1\right)} \cdot \log \left(h \cdot \ell\right)} \]
      14. associate-*r*6.9%

        \[\leadsto e^{\log d + \color{blue}{0.5 \cdot \left(-1 \cdot \log \left(h \cdot \ell\right)\right)}} \]
      15. neg-mul-16.9%

        \[\leadsto e^{\log d + 0.5 \cdot \color{blue}{\left(-\log \left(h \cdot \ell\right)\right)}} \]
      16. distribute-rgt-neg-out6.9%

        \[\leadsto e^{\log d + \color{blue}{\left(-0.5 \cdot \log \left(h \cdot \ell\right)\right)}} \]
      17. log-pow6.9%

        \[\leadsto e^{\log d + \left(-\color{blue}{\log \left({\left(h \cdot \ell\right)}^{0.5}\right)}\right)} \]
      18. unpow1/26.9%

        \[\leadsto e^{\log d + \left(-\log \color{blue}{\left(\sqrt{h \cdot \ell}\right)}\right)} \]
      19. sub-neg6.9%

        \[\leadsto e^{\color{blue}{\log d - \log \left(\sqrt{h \cdot \ell}\right)}} \]
      20. log-div6.9%

        \[\leadsto e^{\color{blue}{\log \left(\frac{d}{\sqrt{h \cdot \ell}}\right)}} \]
    8. Simplified25.5%

      \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
    9. Step-by-step derivation
      1. add-cbrt-cube40.5%

        \[\leadsto \frac{d}{\color{blue}{\sqrt[3]{\left(\sqrt{h \cdot \ell} \cdot \sqrt{h \cdot \ell}\right) \cdot \sqrt{h \cdot \ell}}}} \]
      2. add-sqr-sqrt40.5%

        \[\leadsto \frac{d}{\sqrt[3]{\color{blue}{\left(h \cdot \ell\right)} \cdot \sqrt{h \cdot \ell}}} \]
      3. pow140.5%

        \[\leadsto \frac{d}{\sqrt[3]{\color{blue}{{\left(h \cdot \ell\right)}^{1}} \cdot \sqrt{h \cdot \ell}}} \]
      4. pow1/240.5%

        \[\leadsto \frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1} \cdot \color{blue}{{\left(h \cdot \ell\right)}^{0.5}}}} \]
      5. pow-prod-up40.5%

        \[\leadsto \frac{d}{\sqrt[3]{\color{blue}{{\left(h \cdot \ell\right)}^{\left(1 + 0.5\right)}}}} \]
      6. *-commutative40.5%

        \[\leadsto \frac{d}{\sqrt[3]{{\color{blue}{\left(\ell \cdot h\right)}}^{\left(1 + 0.5\right)}}} \]
      7. metadata-eval40.5%

        \[\leadsto \frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{\color{blue}{1.5}}}} \]
    10. Applied egg-rr40.5%

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

    if 4.10000000000000002e-304 < l < 1.5000000000000001e145

    1. Initial program 70.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. Simplified69.3%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def51.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p87.3%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2} \cdot -0.5, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. fma-udef88.5%

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

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

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

      \[\leadsto \color{blue}{\left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right)} \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u86.9%

        \[\leadsto \left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right) \cdot \frac{d}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{h} \cdot \sqrt{\ell}\right)\right)}} \]
      2. expm1-udef62.0%

        \[\leadsto \left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right) \cdot \frac{d}{\color{blue}{e^{\mathsf{log1p}\left(\sqrt{h} \cdot \sqrt{\ell}\right)} - 1}} \]
      3. sqrt-unprod59.8%

        \[\leadsto \left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right) \cdot \frac{d}{e^{\mathsf{log1p}\left(\color{blue}{\sqrt{h \cdot \ell}}\right)} - 1} \]
    10. Applied egg-rr59.8%

      \[\leadsto \left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right) \cdot \frac{d}{\color{blue}{e^{\mathsf{log1p}\left(\sqrt{h \cdot \ell}\right)} - 1}} \]
    11. Step-by-step derivation
      1. expm1-def81.8%

        \[\leadsto \left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right) \cdot \frac{d}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{h \cdot \ell}\right)\right)}} \]
      2. expm1-log1p83.3%

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

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

    if 1.5000000000000001e145 < l

    1. Initial program 47.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. Simplified47.6%

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

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

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{h \cdot \ell}}} \]
      2. metadata-eval53.8%

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

        \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      4. div-inv68.1%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      5. associate-/r*63.1%

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
    6. Applied egg-rr63.1%

      \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. associate-/l/68.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.7 \cdot 10^{-256}:\\ \;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\ \mathbf{elif}\;\ell \leq 4.1 \cdot 10^{-304}:\\ \;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\ \mathbf{elif}\;\ell \leq 1.5 \cdot 10^{+145}:\\ \;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\ \mathbf{else}:\\ \;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 65.5% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.4 \cdot 10^{+29}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -2.4000000000000001e29

    1. Initial program 59.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. Simplified60.4%

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
    6. Step-by-step derivation
      1. clear-num58.5%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg59.3%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. distribute-rgt-neg-in59.3%

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

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

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

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

    if -2.4000000000000001e29 < l < 4.999999999999985e-310

    1. Initial program 74.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. Simplified74.0%

      \[\leadsto \color{blue}{\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
    3. Add Preprocessing
    4. Step-by-step derivation
      1. clear-num74.0%

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

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\color{blue}{\left(\frac{D}{2 \cdot \frac{d}{M}}\right)}}^{2} \cdot \frac{h}{\ell}\right)\right) \]
    6. Step-by-step derivation
      1. expm1-log1p-u28.5%

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

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left({\left(\frac{D}{\frac{2 \cdot d}{M}}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)} - 1} \]
    8. Step-by-step derivation
      1. expm1-def23.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left({\left(\frac{D}{\frac{2 \cdot d}{M}}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\right)} \]
      2. expm1-log1p66.2%

        \[\leadsto \color{blue}{\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left({\left(\frac{D}{\frac{2 \cdot d}{M}}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)} \]
      3. rem-log-exp62.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \color{blue}{\log \left(e^{1 + -0.5 \cdot \left({\left(\frac{D}{\frac{2 \cdot d}{M}}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)} \]
      4. exp-sum62.2%

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

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \color{blue}{\left(\log \left(e^{1}\right) + \log \left(e^{-0.5 \cdot \left({\left(\frac{D}{\frac{2 \cdot d}{M}}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)\right)} \]
      6. rem-log-exp62.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(\color{blue}{1} + \log \left(e^{-0.5 \cdot \left({\left(\frac{D}{\frac{2 \cdot d}{M}}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right)\right) \]
      7. rem-log-exp66.2%

        \[\leadsto \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \color{blue}{-0.5 \cdot \left({\left(\frac{D}{\frac{2 \cdot d}{M}}\right)}^{2} \cdot \frac{h}{\ell}\right)}\right) \]
      8. associate-/r/66.2%

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

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

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

    if 4.999999999999985e-310 < l < 1.05000000000000003e147

    1. Initial program 69.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. Simplified68.4%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def50.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p86.1%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2} \cdot -0.5, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. fma-udef87.4%

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

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

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

      \[\leadsto \color{blue}{\left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right)} \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u85.8%

        \[\leadsto \left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right) \cdot \frac{d}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{h} \cdot \sqrt{\ell}\right)\right)}} \]
      2. expm1-udef61.2%

        \[\leadsto \left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right) \cdot \frac{d}{\color{blue}{e^{\mathsf{log1p}\left(\sqrt{h} \cdot \sqrt{\ell}\right)} - 1}} \]
      3. sqrt-unprod59.0%

        \[\leadsto \left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right) \cdot \frac{d}{e^{\mathsf{log1p}\left(\color{blue}{\sqrt{h \cdot \ell}}\right)} - 1} \]
    10. Applied egg-rr59.0%

      \[\leadsto \left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right) \cdot \frac{d}{\color{blue}{e^{\mathsf{log1p}\left(\sqrt{h \cdot \ell}\right)} - 1}} \]
    11. Step-by-step derivation
      1. expm1-def80.7%

        \[\leadsto \left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right) \cdot \frac{d}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{h \cdot \ell}\right)\right)}} \]
      2. expm1-log1p82.2%

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

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

    if 1.05000000000000003e147 < l

    1. Initial program 47.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. Simplified47.6%

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

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

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{h \cdot \ell}}} \]
      2. metadata-eval53.8%

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

        \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      4. div-inv68.1%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      5. associate-/r*63.1%

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
    6. Applied egg-rr63.1%

      \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. associate-/l/68.1%

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

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

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

Alternative 17: 65.7% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.35 \cdot 10^{+29}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -2.3500000000000001e29

    1. Initial program 59.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. Simplified60.4%

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
    6. Step-by-step derivation
      1. clear-num58.5%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg59.3%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. distribute-rgt-neg-in59.3%

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

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

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

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

    if -2.3500000000000001e29 < l < -1.9999999999999998e-308

    1. Initial program 74.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. Simplified74.0%

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

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

        \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\color{blue}{\left(\sqrt{\frac{M}{2} \cdot \frac{D}{d}} \cdot \sqrt{\frac{M}{2} \cdot \frac{D}{d}}\right)}}^{2} \cdot h}{\ell}\right) \]
      3. add-sqr-sqrt79.7%

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
    6. Step-by-step derivation
      1. expm1-log1p-u31.4%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}\right)\right)\right)} \]
      2. expm1-udef26.0%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{h}}\right)\right)} - 1} \]
    8. Step-by-step derivation
      1. expm1-def25.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\frac{\ell}{h}}\right)\right)\right)} \]
      2. expm1-log1p67.6%

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

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

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

    if -1.9999999999999998e-308 < l < 7.19999999999999948e145

    1. Initial program 69.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. Simplified68.4%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)} - 1} \]
    5. Step-by-step derivation
      1. expm1-def50.7%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2}\right)\right)\right)\right)} \]
      2. expm1-log1p86.1%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{h}{\ell}, {\left(D \cdot \frac{M}{2 \cdot d}\right)}^{2} \cdot -0.5, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. fma-udef87.4%

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

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

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

      \[\leadsto \color{blue}{\left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right)} \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u85.8%

        \[\leadsto \left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right) \cdot \frac{d}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{h} \cdot \sqrt{\ell}\right)\right)}} \]
      2. expm1-udef61.2%

        \[\leadsto \left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right) \cdot \frac{d}{\color{blue}{e^{\mathsf{log1p}\left(\sqrt{h} \cdot \sqrt{\ell}\right)} - 1}} \]
      3. sqrt-unprod59.0%

        \[\leadsto \left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right) \cdot \frac{d}{e^{\mathsf{log1p}\left(\color{blue}{\sqrt{h \cdot \ell}}\right)} - 1} \]
    10. Applied egg-rr59.0%

      \[\leadsto \left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right) \cdot \frac{d}{\color{blue}{e^{\mathsf{log1p}\left(\sqrt{h \cdot \ell}\right)} - 1}} \]
    11. Step-by-step derivation
      1. expm1-def80.7%

        \[\leadsto \left(\frac{h}{\ell} \cdot \left({\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2} \cdot -0.5\right) + 1\right) \cdot \frac{d}{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{h \cdot \ell}\right)\right)}} \]
      2. expm1-log1p82.2%

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

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

    if 7.19999999999999948e145 < l

    1. Initial program 47.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. Simplified47.6%

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

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

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{h \cdot \ell}}} \]
      2. metadata-eval53.8%

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

        \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      4. div-inv68.1%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      5. associate-/r*63.1%

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
    6. Applied egg-rr63.1%

      \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. associate-/l/68.1%

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

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

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

Alternative 18: 46.9% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;h \leq 3.8 \cdot 10^{-304}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\

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


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

    1. Initial program 66.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. Simplified67.4%

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
    6. Step-by-step derivation
      1. clear-num69.3%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg46.2%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. distribute-rgt-neg-in46.2%

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

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

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

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

    if 3.79999999999999961e-304 < h

    1. Initial program 62.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. Simplified61.5%

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

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

        \[\leadsto d \cdot \color{blue}{\frac{\sqrt{1}}{\sqrt{h \cdot \ell}}} \]
      2. metadata-eval51.6%

        \[\leadsto d \cdot \frac{\color{blue}{1}}{\sqrt{h \cdot \ell}} \]
      3. sqrt-unprod59.2%

        \[\leadsto d \cdot \frac{1}{\color{blue}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      4. div-inv59.2%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}} \]
      5. associate-/r*57.6%

        \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
    6. Applied egg-rr57.6%

      \[\leadsto \color{blue}{\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}} \]
    7. Step-by-step derivation
      1. associate-/l/59.2%

        \[\leadsto \color{blue}{\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}} \]
    8. Simplified59.2%

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

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

Alternative 19: 42.9% accurate, 2.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq -6.2 \cdot 10^{-215}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\

\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\


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

    1. Initial program 70.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. Simplified71.0%

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

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

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

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

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

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

      \[\leadsto \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \color{blue}{\frac{{\left(\left(M \cdot 0.5\right) \cdot \frac{D}{d}\right)}^{2} \cdot h}{\ell}}\right) \]
    6. Step-by-step derivation
      1. clear-num73.3%

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg50.1%

        \[\leadsto \color{blue}{-d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
      2. distribute-rgt-neg-in50.1%

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

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

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

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

    if -6.19999999999999987e-215 < d

    1. Initial program 60.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. Simplified59.3%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
    7. Step-by-step derivation
      1. unpow1/248.1%

        \[\leadsto d \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \]
      2. rem-exp-log46.0%

        \[\leadsto d \cdot {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \]
      3. exp-neg46.0%

        \[\leadsto d \cdot {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \]
      4. exp-prod46.4%

        \[\leadsto d \cdot \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \]
      5. distribute-lft-neg-out46.4%

        \[\leadsto d \cdot e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \]
      6. distribute-rgt-neg-in46.4%

        \[\leadsto d \cdot e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}} \]
      7. metadata-eval46.4%

        \[\leadsto d \cdot e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}} \]
      8. exp-to-pow48.5%

        \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    8. Simplified48.5%

      \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification49.3%

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

Alternative 20: 26.7% accurate, 3.1× speedup?

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

\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Derivation
  1. Initial program 64.9%

    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
  2. Simplified64.8%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
  7. Step-by-step derivation
    1. unpow1/229.6%

      \[\leadsto d \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \]
    2. rem-exp-log28.5%

      \[\leadsto d \cdot {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \]
    3. exp-neg28.5%

      \[\leadsto d \cdot {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \]
    4. exp-prod28.7%

      \[\leadsto d \cdot \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \]
    5. distribute-lft-neg-out28.7%

      \[\leadsto d \cdot e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \]
    6. distribute-rgt-neg-in28.7%

      \[\leadsto d \cdot e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}} \]
    7. metadata-eval28.7%

      \[\leadsto d \cdot e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}} \]
    8. exp-to-pow29.9%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
  8. Simplified29.9%

    \[\leadsto \color{blue}{d \cdot {\left(h \cdot \ell\right)}^{-0.5}} \]
  9. Final simplification29.9%

    \[\leadsto d \cdot {\left(\ell \cdot h\right)}^{-0.5} \]
  10. Add Preprocessing

Alternative 21: 26.7% accurate, 3.2× speedup?

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

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

    \[\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right) \]
  2. Simplified64.8%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{d \cdot \sqrt{\frac{1}{h \cdot \ell}}} \]
  7. Step-by-step derivation
    1. unpow1/229.6%

      \[\leadsto d \cdot \color{blue}{{\left(\frac{1}{h \cdot \ell}\right)}^{0.5}} \]
    2. rem-exp-log28.5%

      \[\leadsto d \cdot {\left(\frac{1}{\color{blue}{e^{\log \left(h \cdot \ell\right)}}}\right)}^{0.5} \]
    3. exp-neg28.5%

      \[\leadsto d \cdot {\color{blue}{\left(e^{-\log \left(h \cdot \ell\right)}\right)}}^{0.5} \]
    4. exp-prod28.7%

      \[\leadsto d \cdot \color{blue}{e^{\left(-\log \left(h \cdot \ell\right)\right) \cdot 0.5}} \]
    5. distribute-lft-neg-out28.7%

      \[\leadsto d \cdot e^{\color{blue}{-\log \left(h \cdot \ell\right) \cdot 0.5}} \]
    6. distribute-rgt-neg-in28.7%

      \[\leadsto d \cdot e^{\color{blue}{\log \left(h \cdot \ell\right) \cdot \left(-0.5\right)}} \]
    7. metadata-eval28.7%

      \[\leadsto d \cdot e^{\log \left(h \cdot \ell\right) \cdot \color{blue}{-0.5}} \]
    8. exp-to-pow29.9%

      \[\leadsto d \cdot \color{blue}{{\left(h \cdot \ell\right)}^{-0.5}} \]
    9. rem-exp-log21.5%

      \[\leadsto \color{blue}{e^{\log d}} \cdot {\left(h \cdot \ell\right)}^{-0.5} \]
    10. rem-exp-log21.5%

      \[\leadsto e^{\log d} \cdot \color{blue}{e^{\log \left({\left(h \cdot \ell\right)}^{-0.5}\right)}} \]
    11. exp-sum21.3%

      \[\leadsto \color{blue}{e^{\log d + \log \left({\left(h \cdot \ell\right)}^{-0.5}\right)}} \]
    12. log-pow21.3%

      \[\leadsto e^{\log d + \color{blue}{-0.5 \cdot \log \left(h \cdot \ell\right)}} \]
    13. metadata-eval21.3%

      \[\leadsto e^{\log d + \color{blue}{\left(0.5 \cdot -1\right)} \cdot \log \left(h \cdot \ell\right)} \]
    14. associate-*r*21.3%

      \[\leadsto e^{\log d + \color{blue}{0.5 \cdot \left(-1 \cdot \log \left(h \cdot \ell\right)\right)}} \]
    15. neg-mul-121.3%

      \[\leadsto e^{\log d + 0.5 \cdot \color{blue}{\left(-\log \left(h \cdot \ell\right)\right)}} \]
    16. distribute-rgt-neg-out21.3%

      \[\leadsto e^{\log d + \color{blue}{\left(-0.5 \cdot \log \left(h \cdot \ell\right)\right)}} \]
    17. log-pow21.3%

      \[\leadsto e^{\log d + \left(-\color{blue}{\log \left({\left(h \cdot \ell\right)}^{0.5}\right)}\right)} \]
    18. unpow1/221.3%

      \[\leadsto e^{\log d + \left(-\log \color{blue}{\left(\sqrt{h \cdot \ell}\right)}\right)} \]
    19. sub-neg21.3%

      \[\leadsto e^{\color{blue}{\log d - \log \left(\sqrt{h \cdot \ell}\right)}} \]
    20. log-div24.4%

      \[\leadsto e^{\color{blue}{\log \left(\frac{d}{\sqrt{h \cdot \ell}}\right)}} \]
  8. Simplified29.8%

    \[\leadsto \color{blue}{\frac{d}{\sqrt{h \cdot \ell}}} \]
  9. Final simplification29.8%

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

Reproduce

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