Henrywood and Agarwal, Equation (13)

Percentage Accurate: 24.6% → 63.3%
Time: 25.9s
Alternatives: 6
Speedup: 30.2×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ \frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right) \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
   (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
	return (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    t_0 = (c0 * (d_1 * d_1)) / ((w * h) * (d * d))
    code = (c0 / (2.0d0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (m * m))))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
	return (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
}
def code(c0, w, h, D, d, M):
	t_0 = (c0 * (d * d)) / ((w * h) * (D * D))
	return (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D)))
	return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M)))))
end
function tmp = code(c0, w, h, D, d, M)
	t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
	tmp = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)
\end{array}
\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 6 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: 24.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ \frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right) \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
   (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
	return (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    t_0 = (c0 * (d_1 * d_1)) / ((w * h) * (d * d))
    code = (c0 / (2.0d0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (m * m))))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
	return (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
}
def code(c0, w, h, D, d, M):
	t_0 = (c0 * (d * d)) / ((w * h) * (D * D))
	return (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D)))
	return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M)))))
end
function tmp = code(c0, w, h, D, d, M)
	t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
	tmp = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
\frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)
\end{array}
\end{array}

Alternative 1: 63.3% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := c0 \cdot \left(d \cdot d\right)\\
t_1 := \left(w \cdot h\right) \cdot \left(D \cdot D\right)\\
t_2 := \frac{c0}{2 \cdot w}\\
t_3 := \frac{t_0}{t_1}\\
t_4 := t_2 \cdot \left(t_3 + \sqrt{t_3 \cdot t_3 - M \cdot M}\right)\\
\mathbf{if}\;t_4 \leq -5 \cdot 10^{+42}:\\
\;\;\;\;\frac{c0 \cdot \left(2 \cdot \frac{\frac{c0}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{h}\right)}{2 \cdot w}\\

\mathbf{elif}\;t_4 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d}{h} \cdot \frac{d}{M \cdot M}}\\

\mathbf{elif}\;t_4 \leq \infty:\\
\;\;\;\;t_2 \cdot \frac{2 \cdot t_0}{t_1}\\

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\left(M \cdot \left(h \cdot M\right)\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -5.00000000000000007e42

    1. Initial program 84.7%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. times-frac78.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      2. fma-def78.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{d \cdot d}{D \cdot D}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. associate-/r*78.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{\frac{d \cdot d}{D}}{D}}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. difference-of-squares78.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, \sqrt{\color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + M\right) \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M\right)}}\right) \]
    3. Simplified78.7%

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right)} \]
      2. associate-/l/78.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\frac{d \cdot d}{D \cdot D}} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      3. frac-times78.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      4. pow278.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      5. fma-udef78.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{\color{blue}{\left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} + M\right)} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      6. associate-/l/78.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \color{blue}{\frac{d \cdot d}{D \cdot D}} + M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      7. times-frac78.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{\left(\color{blue}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}} + M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      8. associate-/l/78.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\frac{d \cdot d}{D \cdot D}} - M\right)}\right) \]
      9. times-frac78.7%

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{{\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)}^{2} - M \cdot M}\right)} \]
    6. Taylor expanded in c0 around inf 84.7%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(2 \cdot \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}\right)} \]
    7. Step-by-step derivation
      1. unpow284.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{\color{blue}{\left(d \cdot d\right)} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \]
      2. times-frac78.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(\frac{d \cdot d}{{D}^{2}} \cdot \frac{c0}{w \cdot h}\right)}\right) \]
      3. unpow278.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{d \cdot d}{\color{blue}{D \cdot D}} \cdot \frac{c0}{w \cdot h}\right)\right) \]
      4. *-commutative78.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right)}\right) \]
      5. associate-/r*84.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\color{blue}{\frac{\frac{c0}{w}}{h}} \cdot \frac{d \cdot d}{D \cdot D}\right)\right) \]
      6. times-frac84.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right)\right) \]
      7. unpow284.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}}\right)\right) \]
    8. Simplified84.9%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)} \]
    9. Step-by-step derivation
      1. associate-*l/84.9%

        \[\leadsto \color{blue}{\frac{c0 \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)}{2 \cdot w}} \]
      2. associate-*l/91.0%

        \[\leadsto \frac{c0 \cdot \left(2 \cdot \color{blue}{\frac{\frac{c0}{w} \cdot {\left(\frac{d}{D}\right)}^{2}}{h}}\right)}{2 \cdot w} \]
      3. *-commutative91.0%

        \[\leadsto \frac{c0 \cdot \left(2 \cdot \frac{\frac{c0}{w} \cdot {\left(\frac{d}{D}\right)}^{2}}{h}\right)}{\color{blue}{w \cdot 2}} \]
    10. Applied egg-rr91.0%

      \[\leadsto \color{blue}{\frac{c0 \cdot \left(2 \cdot \frac{\frac{c0}{w} \cdot {\left(\frac{d}{D}\right)}^{2}}{h}\right)}{w \cdot 2}} \]
    11. Step-by-step derivation
      1. unpow291.0%

        \[\leadsto \frac{c0 \cdot \left(2 \cdot \frac{\frac{c0}{w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}}{h}\right)}{w \cdot 2} \]
    12. Applied egg-rr91.0%

      \[\leadsto \frac{c0 \cdot \left(2 \cdot \frac{\frac{c0}{w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}}{h}\right)}{w \cdot 2} \]

    if -5.00000000000000007e42 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0

    1. Initial program 45.7%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Taylor expanded in c0 around -inf 71.7%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0} + -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)} \]
    3. Step-by-step derivation
      1. fma-def71.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)} \]
      2. associate-/l*57.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2} \cdot c0}{w \cdot \left({M}^{2} \cdot h\right)}}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      3. *-commutative57.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{{D}^{2}}{\frac{{d}^{2} \cdot c0}{w \cdot \color{blue}{\left(h \cdot {M}^{2}\right)}}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      4. unpow257.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{\color{blue}{D \cdot D}}{\frac{{d}^{2} \cdot c0}{w \cdot \left(h \cdot {M}^{2}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      5. unpow257.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\color{blue}{\left(d \cdot d\right)} \cdot c0}{w \cdot \left(h \cdot {M}^{2}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      6. unpow257.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \color{blue}{\left(M \cdot M\right)}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      7. mul-1-neg57.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, \color{blue}{-\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0}\right) \]
      8. *-commutative57.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, -\color{blue}{c0 \cdot \left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)}\right) \]
    4. Simplified58.4%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, c0 \cdot 0\right)} \]
    5. Taylor expanded in c0 around 0 72.8%

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

        \[\leadsto 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{\color{blue}{d \cdot d}} \]
      2. associate-/l*72.8%

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{d \cdot d}{h \cdot {M}^{2}}}} \]
      3. unpow272.8%

        \[\leadsto 0.25 \cdot \frac{\color{blue}{D \cdot D}}{\frac{d \cdot d}{h \cdot {M}^{2}}} \]
      4. unpow272.8%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \color{blue}{\left(M \cdot M\right)}}} \]
    7. Simplified72.8%

      \[\leadsto \color{blue}{0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}} \]
    8. Step-by-step derivation
      1. times-frac73.5%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\color{blue}{\frac{d}{h} \cdot \frac{d}{M \cdot M}}} \]
    9. Applied egg-rr73.5%

      \[\leadsto 0.25 \cdot \frac{D \cdot D}{\color{blue}{\frac{d}{h} \cdot \frac{d}{M \cdot M}}} \]

    if -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < +inf.0

    1. Initial program 78.9%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. times-frac76.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      2. fma-def76.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{d \cdot d}{D \cdot D}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. associate-/r*76.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{\frac{d \cdot d}{D}}{D}}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. difference-of-squares76.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, \sqrt{\color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + M\right) \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M\right)}}\right) \]
    3. Simplified76.6%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right)} \]
    4. Taylor expanded in c0 around inf 83.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(2 \cdot \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}\right)} \]
    5. Step-by-step derivation
      1. associate-*r/83.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\frac{2 \cdot \left({d}^{2} \cdot c0\right)}{{D}^{2} \cdot \left(w \cdot h\right)}} \]
      2. unpow283.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(\color{blue}{\left(d \cdot d\right)} \cdot c0\right)}{{D}^{2} \cdot \left(w \cdot h\right)} \]
      3. unpow283.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(\left(d \cdot d\right) \cdot c0\right)}{\color{blue}{\left(D \cdot D\right)} \cdot \left(w \cdot h\right)} \]
    6. Simplified83.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\frac{2 \cdot \left(\left(d \cdot d\right) \cdot c0\right)}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}} \]

    if +inf.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M)))))

    1. Initial program 0.0%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Taylor expanded in c0 around -inf 3.4%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0} + -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)} \]
    3. Step-by-step derivation
      1. fma-def3.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)} \]
      2. associate-/l*4.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2} \cdot c0}{w \cdot \left({M}^{2} \cdot h\right)}}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      3. *-commutative4.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{{D}^{2}}{\frac{{d}^{2} \cdot c0}{w \cdot \color{blue}{\left(h \cdot {M}^{2}\right)}}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      4. unpow24.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{\color{blue}{D \cdot D}}{\frac{{d}^{2} \cdot c0}{w \cdot \left(h \cdot {M}^{2}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      5. unpow24.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\color{blue}{\left(d \cdot d\right)} \cdot c0}{w \cdot \left(h \cdot {M}^{2}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      6. unpow24.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \color{blue}{\left(M \cdot M\right)}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      7. mul-1-neg4.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, \color{blue}{-\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0}\right) \]
      8. *-commutative4.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, -\color{blue}{c0 \cdot \left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)}\right) \]
    4. Simplified30.5%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, c0 \cdot 0\right)} \]
    5. Taylor expanded in c0 around 0 42.5%

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

        \[\leadsto 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{\color{blue}{d \cdot d}} \]
      2. associate-/l*43.3%

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{d \cdot d}{h \cdot {M}^{2}}}} \]
      3. unpow243.3%

        \[\leadsto 0.25 \cdot \frac{\color{blue}{D \cdot D}}{\frac{d \cdot d}{h \cdot {M}^{2}}} \]
      4. unpow243.3%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \color{blue}{\left(M \cdot M\right)}}} \]
    7. Simplified43.3%

      \[\leadsto \color{blue}{0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}} \]
    8. Taylor expanded in D around 0 42.5%

      \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}} \]
    9. Step-by-step derivation
      1. *-commutative42.5%

        \[\leadsto 0.25 \cdot \frac{\color{blue}{\left(h \cdot {M}^{2}\right) \cdot {D}^{2}}}{{d}^{2}} \]
      2. unpow242.5%

        \[\leadsto 0.25 \cdot \frac{\left(h \cdot \color{blue}{\left(M \cdot M\right)}\right) \cdot {D}^{2}}{{d}^{2}} \]
      3. associate-*r/42.8%

        \[\leadsto 0.25 \cdot \color{blue}{\left(\left(h \cdot \left(M \cdot M\right)\right) \cdot \frac{{D}^{2}}{{d}^{2}}\right)} \]
      4. associate-*r*44.1%

        \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\left(h \cdot M\right) \cdot M\right)} \cdot \frac{{D}^{2}}{{d}^{2}}\right) \]
      5. unpow244.1%

        \[\leadsto 0.25 \cdot \left(\left(\left(h \cdot M\right) \cdot M\right) \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \]
      6. unpow244.1%

        \[\leadsto 0.25 \cdot \left(\left(\left(h \cdot M\right) \cdot M\right) \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \]
      7. times-frac56.7%

        \[\leadsto 0.25 \cdot \left(\left(\left(h \cdot M\right) \cdot M\right) \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \]
    10. Simplified56.7%

      \[\leadsto 0.25 \cdot \color{blue}{\left(\left(\left(h \cdot M\right) \cdot M\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification66.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \leq -5 \cdot 10^{+42}:\\ \;\;\;\;\frac{c0 \cdot \left(2 \cdot \frac{\frac{c0}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{h}\right)}{2 \cdot w}\\ \mathbf{elif}\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \leq 0:\\ \;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d}{h} \cdot \frac{d}{M \cdot M}}\\ \mathbf{elif}\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \leq \infty:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \left(\left(M \cdot \left(h \cdot M\right)\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\ \end{array} \]

Alternative 2: 43.4% accurate, 5.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := M \cdot \left(h \cdot M\right)\\ t_1 := \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\frac{c0}{w}}{h}\right)\right)\\ \mathbf{if}\;D \leq 9.5 \cdot 10^{-128}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;D \leq 7.6 \cdot 10^{-96}:\\ \;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{t_0}}\\ \mathbf{elif}\;D \leq 8 \cdot 10^{-61}:\\ \;\;\;\;\frac{\left(d \cdot d\right) \cdot \left(c0 \cdot c0\right)}{h \cdot \left(\left(D \cdot D\right) \cdot \left(w \cdot w\right)\right)}\\ \mathbf{elif}\;D \leq 2.6 \cdot 10^{+170}:\\ \;\;\;\;0.25 \cdot \left(t_0 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (* M (* h M)))
        (t_1
         (* (/ c0 (* 2.0 w)) (* 2.0 (* (* (/ d D) (/ d D)) (/ (/ c0 w) h))))))
   (if (<= D 9.5e-128)
     t_1
     (if (<= D 7.6e-96)
       (* 0.25 (/ (* D D) (/ (* d d) t_0)))
       (if (<= D 8e-61)
         (/ (* (* d d) (* c0 c0)) (* h (* (* D D) (* w w))))
         (if (<= D 2.6e+170) (* 0.25 (* t_0 (* (/ D d) (/ D d)))) t_1))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = M * (h * M);
	double t_1 = (c0 / (2.0 * w)) * (2.0 * (((d / D) * (d / D)) * ((c0 / w) / h)));
	double tmp;
	if (D <= 9.5e-128) {
		tmp = t_1;
	} else if (D <= 7.6e-96) {
		tmp = 0.25 * ((D * D) / ((d * d) / t_0));
	} else if (D <= 8e-61) {
		tmp = ((d * d) * (c0 * c0)) / (h * ((D * D) * (w * w)));
	} else if (D <= 2.6e+170) {
		tmp = 0.25 * (t_0 * ((D / d) * (D / d)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = m * (h * m)
    t_1 = (c0 / (2.0d0 * w)) * (2.0d0 * (((d_1 / d) * (d_1 / d)) * ((c0 / w) / h)))
    if (d <= 9.5d-128) then
        tmp = t_1
    else if (d <= 7.6d-96) then
        tmp = 0.25d0 * ((d * d) / ((d_1 * d_1) / t_0))
    else if (d <= 8d-61) then
        tmp = ((d_1 * d_1) * (c0 * c0)) / (h * ((d * d) * (w * w)))
    else if (d <= 2.6d+170) then
        tmp = 0.25d0 * (t_0 * ((d / d_1) * (d / d_1)))
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = M * (h * M);
	double t_1 = (c0 / (2.0 * w)) * (2.0 * (((d / D) * (d / D)) * ((c0 / w) / h)));
	double tmp;
	if (D <= 9.5e-128) {
		tmp = t_1;
	} else if (D <= 7.6e-96) {
		tmp = 0.25 * ((D * D) / ((d * d) / t_0));
	} else if (D <= 8e-61) {
		tmp = ((d * d) * (c0 * c0)) / (h * ((D * D) * (w * w)));
	} else if (D <= 2.6e+170) {
		tmp = 0.25 * (t_0 * ((D / d) * (D / d)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = M * (h * M)
	t_1 = (c0 / (2.0 * w)) * (2.0 * (((d / D) * (d / D)) * ((c0 / w) / h)))
	tmp = 0
	if D <= 9.5e-128:
		tmp = t_1
	elif D <= 7.6e-96:
		tmp = 0.25 * ((D * D) / ((d * d) / t_0))
	elif D <= 8e-61:
		tmp = ((d * d) * (c0 * c0)) / (h * ((D * D) * (w * w)))
	elif D <= 2.6e+170:
		tmp = 0.25 * (t_0 * ((D / d) * (D / d)))
	else:
		tmp = t_1
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(M * Float64(h * M))
	t_1 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(Float64(Float64(d / D) * Float64(d / D)) * Float64(Float64(c0 / w) / h))))
	tmp = 0.0
	if (D <= 9.5e-128)
		tmp = t_1;
	elseif (D <= 7.6e-96)
		tmp = Float64(0.25 * Float64(Float64(D * D) / Float64(Float64(d * d) / t_0)));
	elseif (D <= 8e-61)
		tmp = Float64(Float64(Float64(d * d) * Float64(c0 * c0)) / Float64(h * Float64(Float64(D * D) * Float64(w * w))));
	elseif (D <= 2.6e+170)
		tmp = Float64(0.25 * Float64(t_0 * Float64(Float64(D / d) * Float64(D / d))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = M * (h * M);
	t_1 = (c0 / (2.0 * w)) * (2.0 * (((d / D) * (d / D)) * ((c0 / w) / h)));
	tmp = 0.0;
	if (D <= 9.5e-128)
		tmp = t_1;
	elseif (D <= 7.6e-96)
		tmp = 0.25 * ((D * D) / ((d * d) / t_0));
	elseif (D <= 8e-61)
		tmp = ((d * d) * (c0 * c0)) / (h * ((D * D) * (w * w)));
	elseif (D <= 2.6e+170)
		tmp = 0.25 * (t_0 * ((D / d) * (D / d)));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 / w), $MachinePrecision] / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[D, 9.5e-128], t$95$1, If[LessEqual[D, 7.6e-96], N[(0.25 * N[(N[(D * D), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[D, 8e-61], N[(N[(N[(d * d), $MachinePrecision] * N[(c0 * c0), $MachinePrecision]), $MachinePrecision] / N[(h * N[(N[(D * D), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[D, 2.6e+170], N[(0.25 * N[(t$95$0 * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := M \cdot \left(h \cdot M\right)\\
t_1 := \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\frac{c0}{w}}{h}\right)\right)\\
\mathbf{if}\;D \leq 9.5 \cdot 10^{-128}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;D \leq 7.6 \cdot 10^{-96}:\\
\;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{t_0}}\\

\mathbf{elif}\;D \leq 8 \cdot 10^{-61}:\\
\;\;\;\;\frac{\left(d \cdot d\right) \cdot \left(c0 \cdot c0\right)}{h \cdot \left(\left(D \cdot D\right) \cdot \left(w \cdot w\right)\right)}\\

\mathbf{elif}\;D \leq 2.6 \cdot 10^{+170}:\\
\;\;\;\;0.25 \cdot \left(t_0 \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if D < 9.50000000000000006e-128 or 2.5999999999999998e170 < D

    1. Initial program 29.8%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. times-frac27.3%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      2. fma-def26.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{d \cdot d}{D \cdot D}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. associate-/r*26.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{\frac{d \cdot d}{D}}{D}}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. difference-of-squares30.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, \sqrt{\color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + M\right) \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M\right)}}\right) \]
    3. Simplified37.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right)} \]
    4. Step-by-step derivation
      1. fma-udef38.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right)} \]
      2. associate-/l/32.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\frac{d \cdot d}{D \cdot D}} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      3. frac-times37.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      4. pow237.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      5. fma-udef37.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{\color{blue}{\left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} + M\right)} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      6. associate-/l/32.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \color{blue}{\frac{d \cdot d}{D \cdot D}} + M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      7. times-frac30.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{\left(\color{blue}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}} + M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      8. associate-/l/30.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\frac{d \cdot d}{D \cdot D}} - M\right)}\right) \]
      9. times-frac30.5%

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{{\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)}^{2} - M \cdot M}\right)} \]
    6. Taylor expanded in c0 around inf 35.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(2 \cdot \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}\right)} \]
    7. Step-by-step derivation
      1. unpow235.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{\color{blue}{\left(d \cdot d\right)} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \]
      2. times-frac33.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(\frac{d \cdot d}{{D}^{2}} \cdot \frac{c0}{w \cdot h}\right)}\right) \]
      3. unpow233.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{d \cdot d}{\color{blue}{D \cdot D}} \cdot \frac{c0}{w \cdot h}\right)\right) \]
      4. *-commutative33.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right)}\right) \]
      5. associate-/r*35.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\color{blue}{\frac{\frac{c0}{w}}{h}} \cdot \frac{d \cdot d}{D \cdot D}\right)\right) \]
      6. times-frac47.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right)\right) \]
      7. unpow247.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}}\right)\right) \]
    8. Simplified47.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)} \]
    9. Step-by-step derivation
      1. unpow248.2%

        \[\leadsto \frac{c0 \cdot \left(2 \cdot \frac{\frac{c0}{w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}}{h}\right)}{w \cdot 2} \]
    10. Applied egg-rr47.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right)\right) \]

    if 9.50000000000000006e-128 < D < 7.6000000000000001e-96

    1. Initial program 0.4%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Taylor expanded in c0 around -inf 7.9%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0} + -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)} \]
    3. Step-by-step derivation
      1. fma-def7.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)} \]
      2. associate-/l*7.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2} \cdot c0}{w \cdot \left({M}^{2} \cdot h\right)}}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      3. *-commutative7.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{{D}^{2}}{\frac{{d}^{2} \cdot c0}{w \cdot \color{blue}{\left(h \cdot {M}^{2}\right)}}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      4. unpow27.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{\color{blue}{D \cdot D}}{\frac{{d}^{2} \cdot c0}{w \cdot \left(h \cdot {M}^{2}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      5. unpow27.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\color{blue}{\left(d \cdot d\right)} \cdot c0}{w \cdot \left(h \cdot {M}^{2}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      6. unpow27.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \color{blue}{\left(M \cdot M\right)}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      7. mul-1-neg7.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, \color{blue}{-\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0}\right) \]
      8. *-commutative7.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, -\color{blue}{c0 \cdot \left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)}\right) \]
    4. Simplified55.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, c0 \cdot 0\right)} \]
    5. Taylor expanded in c0 around 0 70.5%

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

        \[\leadsto 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{\color{blue}{d \cdot d}} \]
      2. associate-/l*84.8%

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{d \cdot d}{h \cdot {M}^{2}}}} \]
      3. unpow284.8%

        \[\leadsto 0.25 \cdot \frac{\color{blue}{D \cdot D}}{\frac{d \cdot d}{h \cdot {M}^{2}}} \]
      4. unpow284.8%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \color{blue}{\left(M \cdot M\right)}}} \]
    7. Simplified84.8%

      \[\leadsto \color{blue}{0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}} \]
    8. Taylor expanded in d around 0 84.8%

      \[\leadsto 0.25 \cdot \frac{D \cdot D}{\color{blue}{\frac{{d}^{2}}{h \cdot {M}^{2}}}} \]
    9. Step-by-step derivation
      1. unpow284.8%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{\color{blue}{d \cdot d}}{h \cdot {M}^{2}}} \]
      2. unpow284.8%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \color{blue}{\left(M \cdot M\right)}}} \]
      3. associate-*r*92.5%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{\color{blue}{\left(h \cdot M\right) \cdot M}}} \]
    10. Simplified92.5%

      \[\leadsto 0.25 \cdot \frac{D \cdot D}{\color{blue}{\frac{d \cdot d}{\left(h \cdot M\right) \cdot M}}} \]

    if 7.6000000000000001e-96 < D < 8.0000000000000003e-61

    1. Initial program 22.0%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. times-frac22.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      2. fma-def22.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{d \cdot d}{D \cdot D}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. associate-/r*22.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{\frac{d \cdot d}{D}}{D}}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. difference-of-squares43.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, \sqrt{\color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + M\right) \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M\right)}}\right) \]
    3. Simplified50.6%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right)} \]
    4. Taylor expanded in c0 around inf 57.7%

      \[\leadsto \color{blue}{\frac{{d}^{2} \cdot {c0}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)}} \]
    5. Step-by-step derivation
      1. unpow257.7%

        \[\leadsto \frac{\color{blue}{\left(d \cdot d\right)} \cdot {c0}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)} \]
      2. unpow257.7%

        \[\leadsto \frac{\left(d \cdot d\right) \cdot \color{blue}{\left(c0 \cdot c0\right)}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)} \]
      3. associate-*r*57.7%

        \[\leadsto \frac{\left(d \cdot d\right) \cdot \left(c0 \cdot c0\right)}{\color{blue}{\left({D}^{2} \cdot {w}^{2}\right) \cdot h}} \]
      4. unpow257.7%

        \[\leadsto \frac{\left(d \cdot d\right) \cdot \left(c0 \cdot c0\right)}{\left(\color{blue}{\left(D \cdot D\right)} \cdot {w}^{2}\right) \cdot h} \]
      5. unpow257.7%

        \[\leadsto \frac{\left(d \cdot d\right) \cdot \left(c0 \cdot c0\right)}{\left(\left(D \cdot D\right) \cdot \color{blue}{\left(w \cdot w\right)}\right) \cdot h} \]
    6. Simplified57.7%

      \[\leadsto \color{blue}{\frac{\left(d \cdot d\right) \cdot \left(c0 \cdot c0\right)}{\left(\left(D \cdot D\right) \cdot \left(w \cdot w\right)\right) \cdot h}} \]

    if 8.0000000000000003e-61 < D < 2.5999999999999998e170

    1. Initial program 23.7%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Taylor expanded in c0 around -inf 15.4%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0} + -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)} \]
    3. Step-by-step derivation
      1. fma-def15.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)} \]
      2. associate-/l*15.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2} \cdot c0}{w \cdot \left({M}^{2} \cdot h\right)}}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      3. *-commutative15.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{{D}^{2}}{\frac{{d}^{2} \cdot c0}{w \cdot \color{blue}{\left(h \cdot {M}^{2}\right)}}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      4. unpow215.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{\color{blue}{D \cdot D}}{\frac{{d}^{2} \cdot c0}{w \cdot \left(h \cdot {M}^{2}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      5. unpow215.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\color{blue}{\left(d \cdot d\right)} \cdot c0}{w \cdot \left(h \cdot {M}^{2}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      6. unpow215.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \color{blue}{\left(M \cdot M\right)}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      7. mul-1-neg15.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, \color{blue}{-\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0}\right) \]
      8. *-commutative15.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, -\color{blue}{c0 \cdot \left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)}\right) \]
    4. Simplified34.3%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, c0 \cdot 0\right)} \]
    5. Taylor expanded in c0 around 0 49.7%

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

        \[\leadsto 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{\color{blue}{d \cdot d}} \]
      2. associate-/l*47.3%

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{d \cdot d}{h \cdot {M}^{2}}}} \]
      3. unpow247.3%

        \[\leadsto 0.25 \cdot \frac{\color{blue}{D \cdot D}}{\frac{d \cdot d}{h \cdot {M}^{2}}} \]
      4. unpow247.3%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \color{blue}{\left(M \cdot M\right)}}} \]
    7. Simplified47.3%

      \[\leadsto \color{blue}{0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}} \]
    8. Taylor expanded in D around 0 49.7%

      \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}} \]
    9. Step-by-step derivation
      1. *-commutative49.7%

        \[\leadsto 0.25 \cdot \frac{\color{blue}{\left(h \cdot {M}^{2}\right) \cdot {D}^{2}}}{{d}^{2}} \]
      2. unpow249.7%

        \[\leadsto 0.25 \cdot \frac{\left(h \cdot \color{blue}{\left(M \cdot M\right)}\right) \cdot {D}^{2}}{{d}^{2}} \]
      3. associate-*r/49.7%

        \[\leadsto 0.25 \cdot \color{blue}{\left(\left(h \cdot \left(M \cdot M\right)\right) \cdot \frac{{D}^{2}}{{d}^{2}}\right)} \]
      4. associate-*r*52.4%

        \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\left(h \cdot M\right) \cdot M\right)} \cdot \frac{{D}^{2}}{{d}^{2}}\right) \]
      5. unpow252.3%

        \[\leadsto 0.25 \cdot \left(\left(\left(h \cdot M\right) \cdot M\right) \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \]
      6. unpow252.3%

        \[\leadsto 0.25 \cdot \left(\left(\left(h \cdot M\right) \cdot M\right) \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \]
      7. times-frac62.3%

        \[\leadsto 0.25 \cdot \left(\left(\left(h \cdot M\right) \cdot M\right) \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \]
    10. Simplified62.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;D \leq 9.5 \cdot 10^{-128}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\frac{c0}{w}}{h}\right)\right)\\ \mathbf{elif}\;D \leq 7.6 \cdot 10^{-96}:\\ \;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{M \cdot \left(h \cdot M\right)}}\\ \mathbf{elif}\;D \leq 8 \cdot 10^{-61}:\\ \;\;\;\;\frac{\left(d \cdot d\right) \cdot \left(c0 \cdot c0\right)}{h \cdot \left(\left(D \cdot D\right) \cdot \left(w \cdot w\right)\right)}\\ \mathbf{elif}\;D \leq 2.6 \cdot 10^{+170}:\\ \;\;\;\;0.25 \cdot \left(\left(M \cdot \left(h \cdot M\right)\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\frac{c0}{w}}{h}\right)\right)\\ \end{array} \]

Alternative 3: 46.1% accurate, 5.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;M \cdot M \leq 2 \cdot 10^{-56} \lor \neg \left(M \cdot M \leq 2 \cdot 10^{+49}\right) \land M \cdot M \leq 5 \cdot 10^{+254}:\\ \;\;\;\;0.25 \cdot \left(\left(M \cdot \left(h \cdot M\right)\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{w} \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\frac{c0}{h}}{w}\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (if (or (<= (* M M) 2e-56) (and (not (<= (* M M) 2e+49)) (<= (* M M) 5e+254)))
   (* 0.25 (* (* M (* h M)) (* (/ D d) (/ D d))))
   (* (/ c0 w) (* (* (/ d D) (/ d D)) (/ (/ c0 h) w)))))
double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if (((M * M) <= 2e-56) || (!((M * M) <= 2e+49) && ((M * M) <= 5e+254))) {
		tmp = 0.25 * ((M * (h * M)) * ((D / d) * (D / d)));
	} else {
		tmp = (c0 / w) * (((d / D) * (d / D)) * ((c0 / h) / w));
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: tmp
    if (((m * m) <= 2d-56) .or. (.not. ((m * m) <= 2d+49)) .and. ((m * m) <= 5d+254)) then
        tmp = 0.25d0 * ((m * (h * m)) * ((d / d_1) * (d / d_1)))
    else
        tmp = (c0 / w) * (((d_1 / d) * (d_1 / d)) * ((c0 / h) / w))
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if (((M * M) <= 2e-56) || (!((M * M) <= 2e+49) && ((M * M) <= 5e+254))) {
		tmp = 0.25 * ((M * (h * M)) * ((D / d) * (D / d)));
	} else {
		tmp = (c0 / w) * (((d / D) * (d / D)) * ((c0 / h) / w));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	tmp = 0
	if ((M * M) <= 2e-56) or (not ((M * M) <= 2e+49) and ((M * M) <= 5e+254)):
		tmp = 0.25 * ((M * (h * M)) * ((D / d) * (D / d)))
	else:
		tmp = (c0 / w) * (((d / D) * (d / D)) * ((c0 / h) / w))
	return tmp
function code(c0, w, h, D, d, M)
	tmp = 0.0
	if ((Float64(M * M) <= 2e-56) || (!(Float64(M * M) <= 2e+49) && (Float64(M * M) <= 5e+254)))
		tmp = Float64(0.25 * Float64(Float64(M * Float64(h * M)) * Float64(Float64(D / d) * Float64(D / d))));
	else
		tmp = Float64(Float64(c0 / w) * Float64(Float64(Float64(d / D) * Float64(d / D)) * Float64(Float64(c0 / h) / w)));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	tmp = 0.0;
	if (((M * M) <= 2e-56) || (~(((M * M) <= 2e+49)) && ((M * M) <= 5e+254)))
		tmp = 0.25 * ((M * (h * M)) * ((D / d) * (D / d)));
	else
		tmp = (c0 / w) * (((d / D) * (d / D)) * ((c0 / h) / w));
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := If[Or[LessEqual[N[(M * M), $MachinePrecision], 2e-56], And[N[Not[LessEqual[N[(M * M), $MachinePrecision], 2e+49]], $MachinePrecision], LessEqual[N[(M * M), $MachinePrecision], 5e+254]]], N[(0.25 * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c0 / w), $MachinePrecision] * N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 / h), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;M \cdot M \leq 2 \cdot 10^{-56} \lor \neg \left(M \cdot M \leq 2 \cdot 10^{+49}\right) \land M \cdot M \leq 5 \cdot 10^{+254}:\\
\;\;\;\;0.25 \cdot \left(\left(M \cdot \left(h \cdot M\right)\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{c0}{w} \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\frac{c0}{h}}{w}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 M M) < 2.0000000000000001e-56 or 1.99999999999999989e49 < (*.f64 M M) < 4.99999999999999994e254

    1. Initial program 28.7%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Taylor expanded in c0 around -inf 8.6%

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)} \]
      2. associate-/l*8.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2} \cdot c0}{w \cdot \left({M}^{2} \cdot h\right)}}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      3. *-commutative8.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{{D}^{2}}{\frac{{d}^{2} \cdot c0}{w \cdot \color{blue}{\left(h \cdot {M}^{2}\right)}}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      4. unpow28.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{\color{blue}{D \cdot D}}{\frac{{d}^{2} \cdot c0}{w \cdot \left(h \cdot {M}^{2}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      5. unpow28.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\color{blue}{\left(d \cdot d\right)} \cdot c0}{w \cdot \left(h \cdot {M}^{2}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      6. unpow28.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \color{blue}{\left(M \cdot M\right)}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      7. mul-1-neg8.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, \color{blue}{-\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0}\right) \]
      8. *-commutative8.7%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, -\color{blue}{c0 \cdot \left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)}\right) \]
    4. Simplified30.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, c0 \cdot 0\right)} \]
    5. Taylor expanded in c0 around 0 40.8%

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

        \[\leadsto 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{\color{blue}{d \cdot d}} \]
      2. associate-/l*41.6%

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{d \cdot d}{h \cdot {M}^{2}}}} \]
      3. unpow241.6%

        \[\leadsto 0.25 \cdot \frac{\color{blue}{D \cdot D}}{\frac{d \cdot d}{h \cdot {M}^{2}}} \]
      4. unpow241.6%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \color{blue}{\left(M \cdot M\right)}}} \]
    7. Simplified41.6%

      \[\leadsto \color{blue}{0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}} \]
    8. Taylor expanded in D around 0 40.8%

      \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}} \]
    9. Step-by-step derivation
      1. *-commutative40.8%

        \[\leadsto 0.25 \cdot \frac{\color{blue}{\left(h \cdot {M}^{2}\right) \cdot {D}^{2}}}{{d}^{2}} \]
      2. unpow240.8%

        \[\leadsto 0.25 \cdot \frac{\left(h \cdot \color{blue}{\left(M \cdot M\right)}\right) \cdot {D}^{2}}{{d}^{2}} \]
      3. associate-*r/41.8%

        \[\leadsto 0.25 \cdot \color{blue}{\left(\left(h \cdot \left(M \cdot M\right)\right) \cdot \frac{{D}^{2}}{{d}^{2}}\right)} \]
      4. associate-*r*42.3%

        \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\left(h \cdot M\right) \cdot M\right)} \cdot \frac{{D}^{2}}{{d}^{2}}\right) \]
      5. unpow242.3%

        \[\leadsto 0.25 \cdot \left(\left(\left(h \cdot M\right) \cdot M\right) \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \]
      6. unpow242.3%

        \[\leadsto 0.25 \cdot \left(\left(\left(h \cdot M\right) \cdot M\right) \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \]
      7. times-frac50.7%

        \[\leadsto 0.25 \cdot \left(\left(\left(h \cdot M\right) \cdot M\right) \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \]
    10. Simplified50.7%

      \[\leadsto 0.25 \cdot \color{blue}{\left(\left(\left(h \cdot M\right) \cdot M\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)} \]

    if 2.0000000000000001e-56 < (*.f64 M M) < 1.99999999999999989e49 or 4.99999999999999994e254 < (*.f64 M M)

    1. Initial program 22.6%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. times-frac22.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      2. fma-def22.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{d \cdot d}{D \cdot D}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. associate-/r*22.6%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{\frac{d \cdot d}{D}}{D}}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. difference-of-squares42.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, \sqrt{\color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + M\right) \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M\right)}}\right) \]
    3. Simplified44.9%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right)} \]
    4. Step-by-step derivation
      1. fma-udef44.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right)} \]
      2. associate-/l/42.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\frac{d \cdot d}{D \cdot D}} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      3. frac-times44.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      4. pow244.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      5. fma-udef44.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{\color{blue}{\left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} + M\right)} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      6. associate-/l/42.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \color{blue}{\frac{d \cdot d}{D \cdot D}} + M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      7. times-frac42.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{\left(\color{blue}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}} + M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      8. associate-/l/42.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\frac{d \cdot d}{D \cdot D}} - M\right)}\right) \]
      9. times-frac42.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + M\right) \cdot \left(\color{blue}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}} - M\right)}\right) \]
    5. Applied egg-rr24.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{{\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)}^{2} - M \cdot M}\right)} \]
    6. Taylor expanded in c0 around inf 48.4%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(2 \cdot \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}\right)} \]
    7. Step-by-step derivation
      1. unpow248.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{\color{blue}{\left(d \cdot d\right)} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \]
      2. times-frac48.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(\frac{d \cdot d}{{D}^{2}} \cdot \frac{c0}{w \cdot h}\right)}\right) \]
      3. unpow248.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{d \cdot d}{\color{blue}{D \cdot D}} \cdot \frac{c0}{w \cdot h}\right)\right) \]
      4. *-commutative48.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}\right)}\right) \]
      5. associate-/r*55.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\color{blue}{\frac{\frac{c0}{w}}{h}} \cdot \frac{d \cdot d}{D \cdot D}\right)\right) \]
      6. times-frac60.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right)\right) \]
      7. unpow260.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}}\right)\right) \]
    8. Simplified60.9%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(2 \cdot \left(\frac{\frac{c0}{w}}{h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)} \]
    9. Taylor expanded in c0 around 0 36.8%

      \[\leadsto \color{blue}{\frac{{d}^{2} \cdot {c0}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)}} \]
    10. Step-by-step derivation
      1. unpow236.8%

        \[\leadsto \frac{{d}^{2} \cdot {c0}^{2}}{{D}^{2} \cdot \left(\color{blue}{\left(w \cdot w\right)} \cdot h\right)} \]
      2. *-commutative36.8%

        \[\leadsto \frac{{d}^{2} \cdot {c0}^{2}}{{D}^{2} \cdot \color{blue}{\left(h \cdot \left(w \cdot w\right)\right)}} \]
      3. times-frac36.9%

        \[\leadsto \color{blue}{\frac{{d}^{2}}{{D}^{2}} \cdot \frac{{c0}^{2}}{h \cdot \left(w \cdot w\right)}} \]
      4. unpow236.9%

        \[\leadsto \frac{\color{blue}{d \cdot d}}{{D}^{2}} \cdot \frac{{c0}^{2}}{h \cdot \left(w \cdot w\right)} \]
      5. unpow236.9%

        \[\leadsto \frac{d \cdot d}{\color{blue}{D \cdot D}} \cdot \frac{{c0}^{2}}{h \cdot \left(w \cdot w\right)} \]
      6. times-frac41.2%

        \[\leadsto \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} \cdot \frac{{c0}^{2}}{h \cdot \left(w \cdot w\right)} \]
      7. unpow241.2%

        \[\leadsto \color{blue}{{\left(\frac{d}{D}\right)}^{2}} \cdot \frac{{c0}^{2}}{h \cdot \left(w \cdot w\right)} \]
      8. unpow241.2%

        \[\leadsto {\left(\frac{d}{D}\right)}^{2} \cdot \frac{\color{blue}{c0 \cdot c0}}{h \cdot \left(w \cdot w\right)} \]
      9. times-frac49.7%

        \[\leadsto {\left(\frac{d}{D}\right)}^{2} \cdot \color{blue}{\left(\frac{c0}{h} \cdot \frac{c0}{w \cdot w}\right)} \]
      10. associate-*r/45.3%

        \[\leadsto {\left(\frac{d}{D}\right)}^{2} \cdot \color{blue}{\frac{\frac{c0}{h} \cdot c0}{w \cdot w}} \]
      11. times-frac59.3%

        \[\leadsto {\left(\frac{d}{D}\right)}^{2} \cdot \color{blue}{\left(\frac{\frac{c0}{h}}{w} \cdot \frac{c0}{w}\right)} \]
      12. associate-*r*60.9%

        \[\leadsto \color{blue}{\left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{\frac{c0}{h}}{w}\right) \cdot \frac{c0}{w}} \]
      13. associate-/l/53.9%

        \[\leadsto \left({\left(\frac{d}{D}\right)}^{2} \cdot \color{blue}{\frac{c0}{w \cdot h}}\right) \cdot \frac{c0}{w} \]
      14. *-commutative53.9%

        \[\leadsto \color{blue}{\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)} \cdot \frac{c0}{w} \]
      15. associate-/l/60.9%

        \[\leadsto \left(\color{blue}{\frac{\frac{c0}{h}}{w}} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \cdot \frac{c0}{w} \]
    11. Simplified60.9%

      \[\leadsto \color{blue}{\left(\frac{\frac{c0}{h}}{w} \cdot {\left(\frac{d}{D}\right)}^{2}\right) \cdot \frac{c0}{w}} \]
    12. Step-by-step derivation
      1. unpow261.0%

        \[\leadsto \frac{c0 \cdot \left(2 \cdot \frac{\frac{c0}{w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}}{h}\right)}{w \cdot 2} \]
    13. Applied egg-rr60.9%

      \[\leadsto \left(\frac{\frac{c0}{h}}{w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}\right) \cdot \frac{c0}{w} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification53.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \cdot M \leq 2 \cdot 10^{-56} \lor \neg \left(M \cdot M \leq 2 \cdot 10^{+49}\right) \land M \cdot M \leq 5 \cdot 10^{+254}:\\ \;\;\;\;0.25 \cdot \left(\left(M \cdot \left(h \cdot M\right)\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{w} \cdot \left(\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{\frac{c0}{h}}{w}\right)\\ \end{array} \]

Alternative 4: 45.7% accurate, 7.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;M \cdot M \leq 5 \cdot 10^{+254}:\\ \;\;\;\;0.25 \cdot \left(\left(M \cdot \left(h \cdot M\right)\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \left(\frac{c0}{h} \cdot \frac{c0}{w \cdot w}\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (if (<= (* M M) 5e+254)
   (* 0.25 (* (* M (* h M)) (* (/ D d) (/ D d))))
   (* (* (/ d D) (/ d D)) (* (/ c0 h) (/ c0 (* w w))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if ((M * M) <= 5e+254) {
		tmp = 0.25 * ((M * (h * M)) * ((D / d) * (D / d)));
	} else {
		tmp = ((d / D) * (d / D)) * ((c0 / h) * (c0 / (w * w)));
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: tmp
    if ((m * m) <= 5d+254) then
        tmp = 0.25d0 * ((m * (h * m)) * ((d / d_1) * (d / d_1)))
    else
        tmp = ((d_1 / d) * (d_1 / d)) * ((c0 / h) * (c0 / (w * w)))
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if ((M * M) <= 5e+254) {
		tmp = 0.25 * ((M * (h * M)) * ((D / d) * (D / d)));
	} else {
		tmp = ((d / D) * (d / D)) * ((c0 / h) * (c0 / (w * w)));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	tmp = 0
	if (M * M) <= 5e+254:
		tmp = 0.25 * ((M * (h * M)) * ((D / d) * (D / d)))
	else:
		tmp = ((d / D) * (d / D)) * ((c0 / h) * (c0 / (w * w)))
	return tmp
function code(c0, w, h, D, d, M)
	tmp = 0.0
	if (Float64(M * M) <= 5e+254)
		tmp = Float64(0.25 * Float64(Float64(M * Float64(h * M)) * Float64(Float64(D / d) * Float64(D / d))));
	else
		tmp = Float64(Float64(Float64(d / D) * Float64(d / D)) * Float64(Float64(c0 / h) * Float64(c0 / Float64(w * w))));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	tmp = 0.0;
	if ((M * M) <= 5e+254)
		tmp = 0.25 * ((M * (h * M)) * ((D / d) * (D / d)));
	else
		tmp = ((d / D) * (d / D)) * ((c0 / h) * (c0 / (w * w)));
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[N[(M * M), $MachinePrecision], 5e+254], N[(0.25 * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 / h), $MachinePrecision] * N[(c0 / N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;M \cdot M \leq 5 \cdot 10^{+254}:\\
\;\;\;\;0.25 \cdot \left(\left(M \cdot \left(h \cdot M\right)\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \left(\frac{c0}{h} \cdot \frac{c0}{w \cdot w}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 M M) < 4.99999999999999994e254

    1. Initial program 30.8%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Taylor expanded in c0 around -inf 8.4%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0} + -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)} \]
    3. Step-by-step derivation
      1. fma-def8.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)} \]
      2. associate-/l*8.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2} \cdot c0}{w \cdot \left({M}^{2} \cdot h\right)}}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      3. *-commutative8.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{{D}^{2}}{\frac{{d}^{2} \cdot c0}{w \cdot \color{blue}{\left(h \cdot {M}^{2}\right)}}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      4. unpow28.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{\color{blue}{D \cdot D}}{\frac{{d}^{2} \cdot c0}{w \cdot \left(h \cdot {M}^{2}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      5. unpow28.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\color{blue}{\left(d \cdot d\right)} \cdot c0}{w \cdot \left(h \cdot {M}^{2}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      6. unpow28.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \color{blue}{\left(M \cdot M\right)}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
      7. mul-1-neg8.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, \color{blue}{-\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0}\right) \]
      8. *-commutative8.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, -\color{blue}{c0 \cdot \left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)}\right) \]
    4. Simplified29.6%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, c0 \cdot 0\right)} \]
    5. Taylor expanded in c0 around 0 39.5%

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

        \[\leadsto 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{\color{blue}{d \cdot d}} \]
      2. associate-/l*40.2%

        \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{d \cdot d}{h \cdot {M}^{2}}}} \]
      3. unpow240.2%

        \[\leadsto 0.25 \cdot \frac{\color{blue}{D \cdot D}}{\frac{d \cdot d}{h \cdot {M}^{2}}} \]
      4. unpow240.2%

        \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \color{blue}{\left(M \cdot M\right)}}} \]
    7. Simplified40.2%

      \[\leadsto \color{blue}{0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}} \]
    8. Taylor expanded in D around 0 39.5%

      \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}} \]
    9. Step-by-step derivation
      1. *-commutative39.5%

        \[\leadsto 0.25 \cdot \frac{\color{blue}{\left(h \cdot {M}^{2}\right) \cdot {D}^{2}}}{{d}^{2}} \]
      2. unpow239.5%

        \[\leadsto 0.25 \cdot \frac{\left(h \cdot \color{blue}{\left(M \cdot M\right)}\right) \cdot {D}^{2}}{{d}^{2}} \]
      3. associate-*r/40.4%

        \[\leadsto 0.25 \cdot \color{blue}{\left(\left(h \cdot \left(M \cdot M\right)\right) \cdot \frac{{D}^{2}}{{d}^{2}}\right)} \]
      4. associate-*r*40.9%

        \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\left(h \cdot M\right) \cdot M\right)} \cdot \frac{{D}^{2}}{{d}^{2}}\right) \]
      5. unpow240.9%

        \[\leadsto 0.25 \cdot \left(\left(\left(h \cdot M\right) \cdot M\right) \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \]
      6. unpow240.9%

        \[\leadsto 0.25 \cdot \left(\left(\left(h \cdot M\right) \cdot M\right) \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \]
      7. times-frac48.6%

        \[\leadsto 0.25 \cdot \left(\left(\left(h \cdot M\right) \cdot M\right) \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \]
    10. Simplified48.6%

      \[\leadsto 0.25 \cdot \color{blue}{\left(\left(\left(h \cdot M\right) \cdot M\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)} \]

    if 4.99999999999999994e254 < (*.f64 M M)

    1. Initial program 12.9%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. Step-by-step derivation
      1. times-frac12.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      2. fma-def12.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{d \cdot d}{D \cdot D}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
      3. associate-/r*12.9%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{\frac{d \cdot d}{D}}{D}}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
      4. difference-of-squares38.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, \sqrt{\color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + M\right) \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M\right)}}\right) \]
    3. Simplified42.1%

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right)} \]
      2. associate-/l/38.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\frac{d \cdot d}{D \cdot D}} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      3. frac-times42.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      4. pow242.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{{\left(\frac{d}{D}\right)}^{2}} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      5. fma-udef42.1%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{\color{blue}{\left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} + M\right)} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      6. associate-/l/38.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{\left(\frac{c0}{w \cdot h} \cdot \color{blue}{\frac{d \cdot d}{D \cdot D}} + M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      7. times-frac38.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{\left(\color{blue}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}} + M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right) \]
      8. associate-/l/38.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \color{blue}{\frac{d \cdot d}{D \cdot D}} - M\right)}\right) \]
      9. times-frac38.5%

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2} + \sqrt{{\left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)}^{2} - M \cdot M}\right)} \]
    6. Taylor expanded in c0 around inf 37.3%

      \[\leadsto \color{blue}{\frac{{d}^{2} \cdot {c0}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)}} \]
    7. Step-by-step derivation
      1. unpow237.3%

        \[\leadsto \frac{\color{blue}{\left(d \cdot d\right)} \cdot {c0}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)} \]
      2. times-frac37.4%

        \[\leadsto \color{blue}{\frac{d \cdot d}{{D}^{2}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h}} \]
      3. unpow237.4%

        \[\leadsto \frac{d \cdot d}{\color{blue}{D \cdot D}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h} \]
      4. times-frac42.8%

        \[\leadsto \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h} \]
      5. unpow242.8%

        \[\leadsto \color{blue}{{\left(\frac{d}{D}\right)}^{2}} \cdot \frac{{c0}^{2}}{{w}^{2} \cdot h} \]
      6. unpow242.8%

        \[\leadsto {\left(\frac{d}{D}\right)}^{2} \cdot \frac{\color{blue}{c0 \cdot c0}}{{w}^{2} \cdot h} \]
      7. *-commutative42.8%

        \[\leadsto {\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0 \cdot c0}{\color{blue}{h \cdot {w}^{2}}} \]
      8. times-frac52.0%

        \[\leadsto {\left(\frac{d}{D}\right)}^{2} \cdot \color{blue}{\left(\frac{c0}{h} \cdot \frac{c0}{{w}^{2}}\right)} \]
      9. unpow252.0%

        \[\leadsto {\left(\frac{d}{D}\right)}^{2} \cdot \left(\frac{c0}{h} \cdot \frac{c0}{\color{blue}{w \cdot w}}\right) \]
    8. Simplified52.0%

      \[\leadsto \color{blue}{{\left(\frac{d}{D}\right)}^{2} \cdot \left(\frac{c0}{h} \cdot \frac{c0}{w \cdot w}\right)} \]
    9. Step-by-step derivation
      1. unpow259.6%

        \[\leadsto \frac{c0 \cdot \left(2 \cdot \frac{\frac{c0}{w} \cdot \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)}}{h}\right)}{w \cdot 2} \]
    10. Applied egg-rr52.0%

      \[\leadsto \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} \cdot \left(\frac{c0}{h} \cdot \frac{c0}{w \cdot w}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification49.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \cdot M \leq 5 \cdot 10^{+254}:\\ \;\;\;\;0.25 \cdot \left(\left(M \cdot \left(h \cdot M\right)\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \left(\frac{c0}{h} \cdot \frac{c0}{w \cdot w}\right)\\ \end{array} \]

Alternative 5: 43.6% accurate, 10.1× speedup?

\[\begin{array}{l} \\ 0.25 \cdot \left(\left(M \cdot \left(h \cdot M\right)\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (* 0.25 (* (* M (* h M)) (* (/ D d) (/ D d)))))
double code(double c0, double w, double h, double D, double d, double M) {
	return 0.25 * ((M * (h * M)) * ((D / d) * (D / d)));
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    code = 0.25d0 * ((m * (h * m)) * ((d / d_1) * (d / d_1)))
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	return 0.25 * ((M * (h * M)) * ((D / d) * (D / d)));
}
def code(c0, w, h, D, d, M):
	return 0.25 * ((M * (h * M)) * ((D / d) * (D / d)))
function code(c0, w, h, D, d, M)
	return Float64(0.25 * Float64(Float64(M * Float64(h * M)) * Float64(Float64(D / d) * Float64(D / d))))
end
function tmp = code(c0, w, h, D, d, M)
	tmp = 0.25 * ((M * (h * M)) * ((D / d) * (D / d)));
end
code[c0_, w_, h_, D_, d_, M_] := N[(0.25 * N[(N[(M * N[(h * M), $MachinePrecision]), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
0.25 \cdot \left(\left(M \cdot \left(h \cdot M\right)\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)
\end{array}
Derivation
  1. Initial program 27.0%

    \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
  2. Taylor expanded in c0 around -inf 7.0%

    \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0} + -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)} \]
  3. Step-by-step derivation
    1. fma-def7.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)} \]
    2. associate-/l*7.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2} \cdot c0}{w \cdot \left({M}^{2} \cdot h\right)}}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
    3. *-commutative7.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{{D}^{2}}{\frac{{d}^{2} \cdot c0}{w \cdot \color{blue}{\left(h \cdot {M}^{2}\right)}}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
    4. unpow27.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{\color{blue}{D \cdot D}}{\frac{{d}^{2} \cdot c0}{w \cdot \left(h \cdot {M}^{2}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
    5. unpow27.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\color{blue}{\left(d \cdot d\right)} \cdot c0}{w \cdot \left(h \cdot {M}^{2}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
    6. unpow27.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \color{blue}{\left(M \cdot M\right)}\right)}}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right) \]
    7. mul-1-neg7.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, \color{blue}{-\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0}\right) \]
    8. *-commutative7.0%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, -\color{blue}{c0 \cdot \left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)}\right) \]
  4. Simplified24.8%

    \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{D \cdot D}{\frac{\left(d \cdot d\right) \cdot c0}{w \cdot \left(h \cdot \left(M \cdot M\right)\right)}}, c0 \cdot 0\right)} \]
  5. Taylor expanded in c0 around 0 33.4%

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

      \[\leadsto 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{\color{blue}{d \cdot d}} \]
    2. associate-/l*34.0%

      \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{d \cdot d}{h \cdot {M}^{2}}}} \]
    3. unpow234.0%

      \[\leadsto 0.25 \cdot \frac{\color{blue}{D \cdot D}}{\frac{d \cdot d}{h \cdot {M}^{2}}} \]
    4. unpow234.0%

      \[\leadsto 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \color{blue}{\left(M \cdot M\right)}}} \]
  7. Simplified34.0%

    \[\leadsto \color{blue}{0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}} \]
  8. Taylor expanded in D around 0 33.4%

    \[\leadsto 0.25 \cdot \color{blue}{\frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}} \]
  9. Step-by-step derivation
    1. *-commutative33.4%

      \[\leadsto 0.25 \cdot \frac{\color{blue}{\left(h \cdot {M}^{2}\right) \cdot {D}^{2}}}{{d}^{2}} \]
    2. unpow233.4%

      \[\leadsto 0.25 \cdot \frac{\left(h \cdot \color{blue}{\left(M \cdot M\right)}\right) \cdot {D}^{2}}{{d}^{2}} \]
    3. associate-*r/33.3%

      \[\leadsto 0.25 \cdot \color{blue}{\left(\left(h \cdot \left(M \cdot M\right)\right) \cdot \frac{{D}^{2}}{{d}^{2}}\right)} \]
    4. associate-*r*34.1%

      \[\leadsto 0.25 \cdot \left(\color{blue}{\left(\left(h \cdot M\right) \cdot M\right)} \cdot \frac{{D}^{2}}{{d}^{2}}\right) \]
    5. unpow234.1%

      \[\leadsto 0.25 \cdot \left(\left(\left(h \cdot M\right) \cdot M\right) \cdot \frac{\color{blue}{D \cdot D}}{{d}^{2}}\right) \]
    6. unpow234.1%

      \[\leadsto 0.25 \cdot \left(\left(\left(h \cdot M\right) \cdot M\right) \cdot \frac{D \cdot D}{\color{blue}{d \cdot d}}\right) \]
    7. times-frac42.6%

      \[\leadsto 0.25 \cdot \left(\left(\left(h \cdot M\right) \cdot M\right) \cdot \color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)}\right) \]
  10. Simplified42.6%

    \[\leadsto 0.25 \cdot \color{blue}{\left(\left(\left(h \cdot M\right) \cdot M\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right)} \]
  11. Final simplification42.6%

    \[\leadsto 0.25 \cdot \left(\left(M \cdot \left(h \cdot M\right)\right) \cdot \left(\frac{D}{d} \cdot \frac{D}{d}\right)\right) \]

Alternative 6: 33.2% accurate, 30.2× speedup?

\[\begin{array}{l} \\ -0.5 \cdot \frac{0}{w} \end{array} \]
(FPCore (c0 w h D d M) :precision binary64 (* -0.5 (/ 0.0 w)))
double code(double c0, double w, double h, double D, double d, double M) {
	return -0.5 * (0.0 / w);
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    code = (-0.5d0) * (0.0d0 / w)
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	return -0.5 * (0.0 / w);
}
def code(c0, w, h, D, d, M):
	return -0.5 * (0.0 / w)
function code(c0, w, h, D, d, M)
	return Float64(-0.5 * Float64(0.0 / w))
end
function tmp = code(c0, w, h, D, d, M)
	tmp = -0.5 * (0.0 / w);
end
code[c0_, w_, h_, D_, d_, M_] := N[(-0.5 * N[(0.0 / w), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
-0.5 \cdot \frac{0}{w}
\end{array}
Derivation
  1. Initial program 27.0%

    \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
  2. Step-by-step derivation
    1. times-frac25.1%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. fma-def24.7%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{d \cdot d}{D \cdot D}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)} \]
    3. associate-/r*24.7%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{\frac{d \cdot d}{D}}{D}}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    4. difference-of-squares30.2%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, \sqrt{\color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + M\right) \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M\right)}}\right) \]
  3. Simplified36.5%

    \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, M\right) \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{\frac{d \cdot d}{D}}{D} - M\right)}\right)} \]
  4. Taylor expanded in c0 around -inf 2.7%

    \[\leadsto \color{blue}{-0.5 \cdot \frac{\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot {c0}^{2}}{w}} \]
  5. Step-by-step derivation
    1. *-commutative2.7%

      \[\leadsto -0.5 \cdot \frac{\color{blue}{{c0}^{2} \cdot \left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)}}{w} \]
    2. unpow22.7%

      \[\leadsto -0.5 \cdot \frac{\color{blue}{\left(c0 \cdot c0\right)} \cdot \left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)}{w} \]
    3. distribute-rgt1-in2.7%

      \[\leadsto -0.5 \cdot \frac{\left(c0 \cdot c0\right) \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)}}{w} \]
    4. metadata-eval2.7%

      \[\leadsto -0.5 \cdot \frac{\left(c0 \cdot c0\right) \cdot \left(\color{blue}{0} \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)}{w} \]
    5. mul0-lft24.8%

      \[\leadsto -0.5 \cdot \frac{\left(c0 \cdot c0\right) \cdot \color{blue}{0}}{w} \]
  6. Simplified24.8%

    \[\leadsto \color{blue}{-0.5 \cdot \frac{\left(c0 \cdot c0\right) \cdot 0}{w}} \]
  7. Taylor expanded in c0 around 0 31.3%

    \[\leadsto -0.5 \cdot \frac{\color{blue}{0}}{w} \]
  8. Final simplification31.3%

    \[\leadsto -0.5 \cdot \frac{0}{w} \]

Reproduce

?
herbie shell --seed 2023192 
(FPCore (c0 w h D d M)
  :name "Henrywood and Agarwal, Equation (13)"
  :precision binary64
  (* (/ c0 (* 2.0 w)) (+ (/ (* c0 (* d d)) (* (* w h) (* D D))) (sqrt (- (* (/ (* c0 (* d d)) (* (* w h) (* D D))) (/ (* c0 (* d d)) (* (* w h) (* D D)))) (* M M))))))