Henrywood and Agarwal, Equation (13)

Percentage Accurate: 24.8% → 44.4%
Time: 25.0s
Alternatives: 8
Speedup: 151.0×

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 8 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.8% 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: 44.4% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0}{2 \cdot w}\\ t_1 := {\left(\frac{d}{D}\right)}^{2}\\ t_2 := t_0 \cdot \left(\frac{2}{w} \cdot \left(t_1 \cdot \frac{c0}{h}\right)\right)\\ \mathbf{if}\;M \cdot M \leq 1.4 \cdot 10^{-172}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \cdot M \leq 3.4 \cdot 10^{-121}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;M \cdot M \leq 3 \cdot 10^{-73}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \cdot M \leq 1.1 \cdot 10^{+54}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;M \cdot M \leq 7.5 \cdot 10^{+105}:\\ \;\;\;\;\frac{M \cdot M}{c0 \cdot \left(\frac{t_1}{w \cdot h} \cdot -2\right)} \cdot \left(-t_0\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c0 \cdot \left(2 \cdot \left(t_1 \cdot \frac{c0}{w \cdot h}\right)\right)}{2 \cdot w}\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ c0 (* 2.0 w)))
        (t_1 (pow (/ d D) 2.0))
        (t_2 (* t_0 (* (/ 2.0 w) (* t_1 (/ c0 h))))))
   (if (<= (* M M) 1.4e-172)
     0.0
     (if (<= (* M M) 3.4e-121)
       t_2
       (if (<= (* M M) 3e-73)
         0.0
         (if (<= (* M M) 1.1e+54)
           t_2
           (if (<= (* M M) 7.5e+105)
             (* (/ (* M M) (* c0 (* (/ t_1 (* w h)) -2.0))) (- t_0))
             (/ (* c0 (* 2.0 (* t_1 (/ c0 (* w h))))) (* 2.0 w)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = c0 / (2.0 * w);
	double t_1 = pow((d / D), 2.0);
	double t_2 = t_0 * ((2.0 / w) * (t_1 * (c0 / h)));
	double tmp;
	if ((M * M) <= 1.4e-172) {
		tmp = 0.0;
	} else if ((M * M) <= 3.4e-121) {
		tmp = t_2;
	} else if ((M * M) <= 3e-73) {
		tmp = 0.0;
	} else if ((M * M) <= 1.1e+54) {
		tmp = t_2;
	} else if ((M * M) <= 7.5e+105) {
		tmp = ((M * M) / (c0 * ((t_1 / (w * h)) * -2.0))) * -t_0;
	} else {
		tmp = (c0 * (2.0 * (t_1 * (c0 / (w * h))))) / (2.0 * 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) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = c0 / (2.0d0 * w)
    t_1 = (d_1 / d) ** 2.0d0
    t_2 = t_0 * ((2.0d0 / w) * (t_1 * (c0 / h)))
    if ((m * m) <= 1.4d-172) then
        tmp = 0.0d0
    else if ((m * m) <= 3.4d-121) then
        tmp = t_2
    else if ((m * m) <= 3d-73) then
        tmp = 0.0d0
    else if ((m * m) <= 1.1d+54) then
        tmp = t_2
    else if ((m * m) <= 7.5d+105) then
        tmp = ((m * m) / (c0 * ((t_1 / (w * h)) * (-2.0d0)))) * -t_0
    else
        tmp = (c0 * (2.0d0 * (t_1 * (c0 / (w * h))))) / (2.0d0 * w)
    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 = c0 / (2.0 * w);
	double t_1 = Math.pow((d / D), 2.0);
	double t_2 = t_0 * ((2.0 / w) * (t_1 * (c0 / h)));
	double tmp;
	if ((M * M) <= 1.4e-172) {
		tmp = 0.0;
	} else if ((M * M) <= 3.4e-121) {
		tmp = t_2;
	} else if ((M * M) <= 3e-73) {
		tmp = 0.0;
	} else if ((M * M) <= 1.1e+54) {
		tmp = t_2;
	} else if ((M * M) <= 7.5e+105) {
		tmp = ((M * M) / (c0 * ((t_1 / (w * h)) * -2.0))) * -t_0;
	} else {
		tmp = (c0 * (2.0 * (t_1 * (c0 / (w * h))))) / (2.0 * w);
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = c0 / (2.0 * w)
	t_1 = math.pow((d / D), 2.0)
	t_2 = t_0 * ((2.0 / w) * (t_1 * (c0 / h)))
	tmp = 0
	if (M * M) <= 1.4e-172:
		tmp = 0.0
	elif (M * M) <= 3.4e-121:
		tmp = t_2
	elif (M * M) <= 3e-73:
		tmp = 0.0
	elif (M * M) <= 1.1e+54:
		tmp = t_2
	elif (M * M) <= 7.5e+105:
		tmp = ((M * M) / (c0 * ((t_1 / (w * h)) * -2.0))) * -t_0
	else:
		tmp = (c0 * (2.0 * (t_1 * (c0 / (w * h))))) / (2.0 * w)
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(c0 / Float64(2.0 * w))
	t_1 = Float64(d / D) ^ 2.0
	t_2 = Float64(t_0 * Float64(Float64(2.0 / w) * Float64(t_1 * Float64(c0 / h))))
	tmp = 0.0
	if (Float64(M * M) <= 1.4e-172)
		tmp = 0.0;
	elseif (Float64(M * M) <= 3.4e-121)
		tmp = t_2;
	elseif (Float64(M * M) <= 3e-73)
		tmp = 0.0;
	elseif (Float64(M * M) <= 1.1e+54)
		tmp = t_2;
	elseif (Float64(M * M) <= 7.5e+105)
		tmp = Float64(Float64(Float64(M * M) / Float64(c0 * Float64(Float64(t_1 / Float64(w * h)) * -2.0))) * Float64(-t_0));
	else
		tmp = Float64(Float64(c0 * Float64(2.0 * Float64(t_1 * Float64(c0 / Float64(w * h))))) / Float64(2.0 * w));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = c0 / (2.0 * w);
	t_1 = (d / D) ^ 2.0;
	t_2 = t_0 * ((2.0 / w) * (t_1 * (c0 / h)));
	tmp = 0.0;
	if ((M * M) <= 1.4e-172)
		tmp = 0.0;
	elseif ((M * M) <= 3.4e-121)
		tmp = t_2;
	elseif ((M * M) <= 3e-73)
		tmp = 0.0;
	elseif ((M * M) <= 1.1e+54)
		tmp = t_2;
	elseif ((M * M) <= 7.5e+105)
		tmp = ((M * M) / (c0 * ((t_1 / (w * h)) * -2.0))) * -t_0;
	else
		tmp = (c0 * (2.0 * (t_1 * (c0 / (w * h))))) / (2.0 * w);
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * N[(N[(2.0 / w), $MachinePrecision] * N[(t$95$1 * N[(c0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(M * M), $MachinePrecision], 1.4e-172], 0.0, If[LessEqual[N[(M * M), $MachinePrecision], 3.4e-121], t$95$2, If[LessEqual[N[(M * M), $MachinePrecision], 3e-73], 0.0, If[LessEqual[N[(M * M), $MachinePrecision], 1.1e+54], t$95$2, If[LessEqual[N[(M * M), $MachinePrecision], 7.5e+105], N[(N[(N[(M * M), $MachinePrecision] / N[(c0 * N[(N[(t$95$1 / N[(w * h), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * (-t$95$0)), $MachinePrecision], N[(N[(c0 * N[(2.0 * N[(t$95$1 * N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;M \cdot M \leq 3.4 \cdot 10^{-121}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;M \cdot M \leq 3 \cdot 10^{-73}:\\
\;\;\;\;0\\

\mathbf{elif}\;M \cdot M \leq 1.1 \cdot 10^{+54}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;M \cdot M \leq 7.5 \cdot 10^{+105}:\\
\;\;\;\;\frac{M \cdot M}{c0 \cdot \left(\frac{t_1}{w \cdot h} \cdot -2\right)} \cdot \left(-t_0\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 M M) < 1.40000000000000006e-172 or 3.40000000000000001e-121 < (*.f64 M M) < 3e-73

    1. Initial program 28.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. Simplified26.8%

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

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

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

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

      \[\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}} \]
    6. Step-by-step derivation
      1. associate-/l*9.8%

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

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

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

        \[\leadsto -0.5 \cdot \frac{\color{blue}{0}}{\frac{w}{{c0}^{2}}} \]
      5. unpow236.9%

        \[\leadsto -0.5 \cdot \frac{0}{\frac{w}{\color{blue}{c0 \cdot c0}}} \]
    7. Simplified36.9%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{0}{\frac{w}{c0 \cdot c0}}} \]
    8. Taylor expanded in w around 0 51.7%

      \[\leadsto -0.5 \cdot \color{blue}{0} \]

    if 1.40000000000000006e-172 < (*.f64 M M) < 3.40000000000000001e-121 or 3e-73 < (*.f64 M M) < 1.09999999999999995e54

    1. Initial program 39.3%

      \[\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. Simplified45.8%

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

      \[\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)} \]
    4. Step-by-step derivation
      1. *-commutative39.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.09999999999999995e54 < (*.f64 M M) < 7.5000000000000002e105

    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. Step-by-step derivation
      1. div-inv0.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(c0 \cdot \left(d \cdot d\right)\right) \cdot \frac{1}{\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. associate-*l*0.4%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(c0 \cdot \left(d \cdot d\right)\right) \cdot \frac{1}{\color{blue}{w \cdot \left(h \cdot \left(D \cdot D\right)\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) \]
    3. Applied egg-rr0.4%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(c0 \cdot \left(d \cdot d\right)\right) \cdot \frac{1}{w \cdot \left(h \cdot \left(D \cdot D\right)\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) \]
    4. Step-by-step derivation
      1. flip-+0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\frac{\left(\left(c0 \cdot \left(d \cdot d\right)\right) \cdot \frac{1}{w \cdot \left(h \cdot \left(D \cdot D\right)\right)}\right) \cdot \left(\left(c0 \cdot \left(d \cdot d\right)\right) \cdot \frac{1}{w \cdot \left(h \cdot \left(D \cdot D\right)\right)}\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} \cdot \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}}{\left(c0 \cdot \left(d \cdot d\right)\right) \cdot \frac{1}{w \cdot \left(h \cdot \left(D \cdot D\right)\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}}} \]
    5. Applied egg-rr0.0%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\frac{-1 \cdot {M}^{2}}{\left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} - \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0}} \]
      2. neg-mul-150.3%

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \frac{-M \cdot M}{\color{blue}{c0 \cdot \left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} - \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)}} \]
      5. sub-neg50.3%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \frac{-M \cdot M}{c0 \cdot \color{blue}{\left(-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + \left(-\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right)\right)}} \]
      6. mul-1-neg50.3%

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \frac{-M \cdot M}{c0 \cdot \left(\frac{\frac{d \cdot d}{\color{blue}{D \cdot D}}}{w \cdot h} \cdot \left(-1 + -1\right)\right)} \]
      11. times-frac60.8%

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \frac{-M \cdot M}{c0 \cdot \left(\frac{\color{blue}{{\left(\frac{d}{D}\right)}^{2}}}{w \cdot h} \cdot \left(-1 + -1\right)\right)} \]
      13. metadata-eval60.8%

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

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

    if 7.5000000000000002e105 < (*.f64 M M)

    1. Initial program 17.2%

      \[\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. Simplified17.3%

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

      \[\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)} \]
    4. Step-by-step derivation
      1. *-commutative39.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \cdot M \leq 1.4 \cdot 10^{-172}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \cdot M \leq 3.4 \cdot 10^{-121}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{2}{w} \cdot \left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{h}\right)\right)\\ \mathbf{elif}\;M \cdot M \leq 3 \cdot 10^{-73}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \cdot M \leq 1.1 \cdot 10^{+54}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{2}{w} \cdot \left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{h}\right)\right)\\ \mathbf{elif}\;M \cdot M \leq 7.5 \cdot 10^{+105}:\\ \;\;\;\;\frac{M \cdot M}{c0 \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2}}{w \cdot h} \cdot -2\right)} \cdot \left(-\frac{c0}{2 \cdot w}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c0 \cdot \left(2 \cdot \left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w \cdot h}\right)\right)}{2 \cdot w}\\ \end{array} \]

Alternative 2: 55.0% accurate, 0.5× 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)}\\ t_1 := \frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)\\ \mathbf{if}\;t_1 \leq \infty:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D))))
        (t_1 (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))))
   (if (<= t_1 INFINITY) t_1 0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
	double t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
	double tmp;
	if (t_1 <= ((double) INFINITY)) {
		tmp = t_1;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
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));
	double t_1 = (c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))));
	double tmp;
	if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = (c0 * (d * d)) / ((w * h) * (D * D))
	t_1 = (c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))
	tmp = 0
	if t_1 <= math.inf:
		tmp = t_1
	else:
		tmp = 0.0
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D)))
	t_1 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M)))))
	tmp = 0.0
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
	t_1 = (c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))));
	tmp = 0.0;
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
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]}, Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, Infinity], t$95$1, 0.0]]]
\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)}\\
t_1 := \frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right)\\
\mathbf{if}\;t_1 \leq \infty:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 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))))) < +inf.0

    1. Initial program 76.1%

      \[\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) \]

    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. Simplified17.9%

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{\frac{c0}{h}}{w}, \frac{d}{D} \cdot \frac{d}{D}, \sqrt{\mathsf{fma}\left(\frac{\frac{c0}{h}}{w}, \frac{d}{D} \cdot \frac{d}{D}, M\right) \cdot \left(\color{blue}{\left(1 \cdot \frac{\frac{c0 \cdot d}{D}}{D}\right)} \cdot \frac{\frac{d}{h}}{w} - M\right)}\right) \]
    5. Taylor expanded in c0 around -inf 0.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}} \]
    6. Step-by-step derivation
      1. associate-/l*0.1%

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

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

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

        \[\leadsto -0.5 \cdot \frac{\color{blue}{0}}{\frac{w}{{c0}^{2}}} \]
      5. unpow227.9%

        \[\leadsto -0.5 \cdot \frac{0}{\frac{w}{\color{blue}{c0 \cdot c0}}} \]
    7. Simplified27.9%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{0}{\frac{w}{c0 \cdot c0}}} \]
    8. Taylor expanded in w around 0 40.5%

      \[\leadsto -0.5 \cdot \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification52.2%

    \[\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 \infty:\\ \;\;\;\;\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)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 3: 38.8% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(\frac{d}{D}\right)}^{2}\\ t_1 := \frac{c0}{2 \cdot w} \cdot \left(\frac{2}{w} \cdot \left(t_0 \cdot \frac{c0}{h}\right)\right)\\ \mathbf{if}\;M \leq 1.9 \cdot 10^{-88}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.8 \cdot 10^{-58}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;M \leq 4.3 \cdot 10^{-39}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 1.05 \cdot 10^{+28}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;M \leq 8.5 \cdot 10^{+52}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{c0 \cdot \left(2 \cdot \left(t_0 \cdot \frac{c0}{w \cdot h}\right)\right)}{2 \cdot w}\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (pow (/ d D) 2.0))
        (t_1 (* (/ c0 (* 2.0 w)) (* (/ 2.0 w) (* t_0 (/ c0 h))))))
   (if (<= M 1.9e-88)
     0.0
     (if (<= M 2.8e-58)
       t_1
       (if (<= M 4.3e-39)
         0.0
         (if (<= M 1.05e+28)
           t_1
           (if (<= M 8.5e+52)
             0.0
             (/ (* c0 (* 2.0 (* t_0 (/ c0 (* w h))))) (* 2.0 w)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = pow((d / D), 2.0);
	double t_1 = (c0 / (2.0 * w)) * ((2.0 / w) * (t_0 * (c0 / h)));
	double tmp;
	if (M <= 1.9e-88) {
		tmp = 0.0;
	} else if (M <= 2.8e-58) {
		tmp = t_1;
	} else if (M <= 4.3e-39) {
		tmp = 0.0;
	} else if (M <= 1.05e+28) {
		tmp = t_1;
	} else if (M <= 8.5e+52) {
		tmp = 0.0;
	} else {
		tmp = (c0 * (2.0 * (t_0 * (c0 / (w * h))))) / (2.0 * 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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (d_1 / d) ** 2.0d0
    t_1 = (c0 / (2.0d0 * w)) * ((2.0d0 / w) * (t_0 * (c0 / h)))
    if (m <= 1.9d-88) then
        tmp = 0.0d0
    else if (m <= 2.8d-58) then
        tmp = t_1
    else if (m <= 4.3d-39) then
        tmp = 0.0d0
    else if (m <= 1.05d+28) then
        tmp = t_1
    else if (m <= 8.5d+52) then
        tmp = 0.0d0
    else
        tmp = (c0 * (2.0d0 * (t_0 * (c0 / (w * h))))) / (2.0d0 * w)
    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 = Math.pow((d / D), 2.0);
	double t_1 = (c0 / (2.0 * w)) * ((2.0 / w) * (t_0 * (c0 / h)));
	double tmp;
	if (M <= 1.9e-88) {
		tmp = 0.0;
	} else if (M <= 2.8e-58) {
		tmp = t_1;
	} else if (M <= 4.3e-39) {
		tmp = 0.0;
	} else if (M <= 1.05e+28) {
		tmp = t_1;
	} else if (M <= 8.5e+52) {
		tmp = 0.0;
	} else {
		tmp = (c0 * (2.0 * (t_0 * (c0 / (w * h))))) / (2.0 * w);
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = math.pow((d / D), 2.0)
	t_1 = (c0 / (2.0 * w)) * ((2.0 / w) * (t_0 * (c0 / h)))
	tmp = 0
	if M <= 1.9e-88:
		tmp = 0.0
	elif M <= 2.8e-58:
		tmp = t_1
	elif M <= 4.3e-39:
		tmp = 0.0
	elif M <= 1.05e+28:
		tmp = t_1
	elif M <= 8.5e+52:
		tmp = 0.0
	else:
		tmp = (c0 * (2.0 * (t_0 * (c0 / (w * h))))) / (2.0 * w)
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(d / D) ^ 2.0
	t_1 = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(2.0 / w) * Float64(t_0 * Float64(c0 / h))))
	tmp = 0.0
	if (M <= 1.9e-88)
		tmp = 0.0;
	elseif (M <= 2.8e-58)
		tmp = t_1;
	elseif (M <= 4.3e-39)
		tmp = 0.0;
	elseif (M <= 1.05e+28)
		tmp = t_1;
	elseif (M <= 8.5e+52)
		tmp = 0.0;
	else
		tmp = Float64(Float64(c0 * Float64(2.0 * Float64(t_0 * Float64(c0 / Float64(w * h))))) / Float64(2.0 * w));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = (d / D) ^ 2.0;
	t_1 = (c0 / (2.0 * w)) * ((2.0 / w) * (t_0 * (c0 / h)));
	tmp = 0.0;
	if (M <= 1.9e-88)
		tmp = 0.0;
	elseif (M <= 2.8e-58)
		tmp = t_1;
	elseif (M <= 4.3e-39)
		tmp = 0.0;
	elseif (M <= 1.05e+28)
		tmp = t_1;
	elseif (M <= 8.5e+52)
		tmp = 0.0;
	else
		tmp = (c0 * (2.0 * (t_0 * (c0 / (w * h))))) / (2.0 * w);
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 / w), $MachinePrecision] * N[(t$95$0 * N[(c0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, 1.9e-88], 0.0, If[LessEqual[M, 2.8e-58], t$95$1, If[LessEqual[M, 4.3e-39], 0.0, If[LessEqual[M, 1.05e+28], t$95$1, If[LessEqual[M, 8.5e+52], 0.0, N[(N[(c0 * N[(2.0 * N[(t$95$0 * N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;M \leq 2.8 \cdot 10^{-58}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;M \leq 4.3 \cdot 10^{-39}:\\
\;\;\;\;0\\

\mathbf{elif}\;M \leq 1.05 \cdot 10^{+28}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;M \leq 8.5 \cdot 10^{+52}:\\
\;\;\;\;0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if M < 1.90000000000000006e-88 or 2.8000000000000001e-58 < M < 4.2999999999999999e-39 or 1.04999999999999995e28 < M < 8.49999999999999994e52

    1. Initial program 25.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. Simplified30.2%

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

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

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

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

      \[\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}} \]
    6. Step-by-step derivation
      1. associate-/l*6.2%

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

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

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

        \[\leadsto -0.5 \cdot \frac{\color{blue}{0}}{\frac{w}{{c0}^{2}}} \]
      5. unpow230.0%

        \[\leadsto -0.5 \cdot \frac{0}{\frac{w}{\color{blue}{c0 \cdot c0}}} \]
    7. Simplified30.0%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{0}{\frac{w}{c0 \cdot c0}}} \]
    8. Taylor expanded in w around 0 40.4%

      \[\leadsto -0.5 \cdot \color{blue}{0} \]

    if 1.90000000000000006e-88 < M < 2.8000000000000001e-58 or 4.2999999999999999e-39 < M < 1.04999999999999995e28

    1. Initial program 29.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. Simplified36.8%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, -M \cdot M\right)}\right)} \]
    3. Taylor expanded in c0 around inf 30.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)} \]
    4. Step-by-step derivation
      1. *-commutative30.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.49999999999999994e52 < M

    1. Initial program 19.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. Simplified19.0%

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

      \[\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)} \]
    4. Step-by-step derivation
      1. *-commutative50.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 1.9 \cdot 10^{-88}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.8 \cdot 10^{-58}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{2}{w} \cdot \left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{h}\right)\right)\\ \mathbf{elif}\;M \leq 4.3 \cdot 10^{-39}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 1.05 \cdot 10^{+28}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{2}{w} \cdot \left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{h}\right)\right)\\ \mathbf{elif}\;M \leq 8.5 \cdot 10^{+52}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{c0 \cdot \left(2 \cdot \left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w \cdot h}\right)\right)}{2 \cdot w}\\ \end{array} \]

Alternative 4: 38.7% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c0}{2 \cdot w}\\ t_1 := t_0 \cdot \left(\frac{2}{w} \cdot \left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{h}\right)\right)\\ \mathbf{if}\;M \leq 3 \cdot 10^{-88}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 3.2 \cdot 10^{-61}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;M \leq 2.4 \cdot 10^{-38}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 1.85 \cdot 10^{+27}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;M \leq 8.2 \cdot 10^{+52}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \left(2 \cdot \frac{c0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{w \cdot h}\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ c0 (* 2.0 w)))
        (t_1 (* t_0 (* (/ 2.0 w) (* (pow (/ d D) 2.0) (/ c0 h))))))
   (if (<= M 3e-88)
     0.0
     (if (<= M 3.2e-61)
       t_1
       (if (<= M 2.4e-38)
         0.0
         (if (<= M 1.85e+27)
           t_1
           (if (<= M 8.2e+52)
             0.0
             (* t_0 (* 2.0 (/ (* c0 (* (/ d D) (/ d D))) (* w h)))))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = c0 / (2.0 * w);
	double t_1 = t_0 * ((2.0 / w) * (pow((d / D), 2.0) * (c0 / h)));
	double tmp;
	if (M <= 3e-88) {
		tmp = 0.0;
	} else if (M <= 3.2e-61) {
		tmp = t_1;
	} else if (M <= 2.4e-38) {
		tmp = 0.0;
	} else if (M <= 1.85e+27) {
		tmp = t_1;
	} else if (M <= 8.2e+52) {
		tmp = 0.0;
	} else {
		tmp = t_0 * (2.0 * ((c0 * ((d / D) * (d / D))) / (w * h)));
	}
	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 = c0 / (2.0d0 * w)
    t_1 = t_0 * ((2.0d0 / w) * (((d_1 / d) ** 2.0d0) * (c0 / h)))
    if (m <= 3d-88) then
        tmp = 0.0d0
    else if (m <= 3.2d-61) then
        tmp = t_1
    else if (m <= 2.4d-38) then
        tmp = 0.0d0
    else if (m <= 1.85d+27) then
        tmp = t_1
    else if (m <= 8.2d+52) then
        tmp = 0.0d0
    else
        tmp = t_0 * (2.0d0 * ((c0 * ((d_1 / d) * (d_1 / d))) / (w * h)))
    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 = c0 / (2.0 * w);
	double t_1 = t_0 * ((2.0 / w) * (Math.pow((d / D), 2.0) * (c0 / h)));
	double tmp;
	if (M <= 3e-88) {
		tmp = 0.0;
	} else if (M <= 3.2e-61) {
		tmp = t_1;
	} else if (M <= 2.4e-38) {
		tmp = 0.0;
	} else if (M <= 1.85e+27) {
		tmp = t_1;
	} else if (M <= 8.2e+52) {
		tmp = 0.0;
	} else {
		tmp = t_0 * (2.0 * ((c0 * ((d / D) * (d / D))) / (w * h)));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = c0 / (2.0 * w)
	t_1 = t_0 * ((2.0 / w) * (math.pow((d / D), 2.0) * (c0 / h)))
	tmp = 0
	if M <= 3e-88:
		tmp = 0.0
	elif M <= 3.2e-61:
		tmp = t_1
	elif M <= 2.4e-38:
		tmp = 0.0
	elif M <= 1.85e+27:
		tmp = t_1
	elif M <= 8.2e+52:
		tmp = 0.0
	else:
		tmp = t_0 * (2.0 * ((c0 * ((d / D) * (d / D))) / (w * h)))
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(c0 / Float64(2.0 * w))
	t_1 = Float64(t_0 * Float64(Float64(2.0 / w) * Float64((Float64(d / D) ^ 2.0) * Float64(c0 / h))))
	tmp = 0.0
	if (M <= 3e-88)
		tmp = 0.0;
	elseif (M <= 3.2e-61)
		tmp = t_1;
	elseif (M <= 2.4e-38)
		tmp = 0.0;
	elseif (M <= 1.85e+27)
		tmp = t_1;
	elseif (M <= 8.2e+52)
		tmp = 0.0;
	else
		tmp = Float64(t_0 * Float64(2.0 * Float64(Float64(c0 * Float64(Float64(d / D) * Float64(d / D))) / Float64(w * h))));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = c0 / (2.0 * w);
	t_1 = t_0 * ((2.0 / w) * (((d / D) ^ 2.0) * (c0 / h)));
	tmp = 0.0;
	if (M <= 3e-88)
		tmp = 0.0;
	elseif (M <= 3.2e-61)
		tmp = t_1;
	elseif (M <= 2.4e-38)
		tmp = 0.0;
	elseif (M <= 1.85e+27)
		tmp = t_1;
	elseif (M <= 8.2e+52)
		tmp = 0.0;
	else
		tmp = t_0 * (2.0 * ((c0 * ((d / D) * (d / D))) / (w * h)));
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[(2.0 / w), $MachinePrecision] * N[(N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision] * N[(c0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, 3e-88], 0.0, If[LessEqual[M, 3.2e-61], t$95$1, If[LessEqual[M, 2.4e-38], 0.0, If[LessEqual[M, 1.85e+27], t$95$1, If[LessEqual[M, 8.2e+52], 0.0, N[(t$95$0 * N[(2.0 * N[(N[(c0 * N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;M \leq 3.2 \cdot 10^{-61}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;M \leq 2.4 \cdot 10^{-38}:\\
\;\;\;\;0\\

\mathbf{elif}\;M \leq 1.85 \cdot 10^{+27}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;M \leq 8.2 \cdot 10^{+52}:\\
\;\;\;\;0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if M < 2.9999999999999999e-88 or 3.2000000000000001e-61 < M < 2.40000000000000022e-38 or 1.85000000000000001e27 < M < 8.1999999999999999e52

    1. Initial program 25.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. Simplified30.2%

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

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

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

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

      \[\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}} \]
    6. Step-by-step derivation
      1. associate-/l*6.2%

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

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

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

        \[\leadsto -0.5 \cdot \frac{\color{blue}{0}}{\frac{w}{{c0}^{2}}} \]
      5. unpow230.0%

        \[\leadsto -0.5 \cdot \frac{0}{\frac{w}{\color{blue}{c0 \cdot c0}}} \]
    7. Simplified30.0%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{0}{\frac{w}{c0 \cdot c0}}} \]
    8. Taylor expanded in w around 0 40.4%

      \[\leadsto -0.5 \cdot \color{blue}{0} \]

    if 2.9999999999999999e-88 < M < 3.2000000000000001e-61 or 2.40000000000000022e-38 < M < 1.85000000000000001e27

    1. Initial program 29.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. Simplified36.8%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, -M \cdot M\right)}\right)} \]
    3. Taylor expanded in c0 around inf 30.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)} \]
    4. Step-by-step derivation
      1. *-commutative30.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.1999999999999999e52 < M

    1. Initial program 19.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. Simplified19.0%

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

      \[\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)} \]
    4. Step-by-step derivation
      1. *-commutative50.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 3 \cdot 10^{-88}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 3.2 \cdot 10^{-61}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{2}{w} \cdot \left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{h}\right)\right)\\ \mathbf{elif}\;M \leq 2.4 \cdot 10^{-38}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 1.85 \cdot 10^{+27}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{2}{w} \cdot \left({\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{h}\right)\right)\\ \mathbf{elif}\;M \leq 8.2 \cdot 10^{+52}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{c0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{w \cdot h}\right)\\ \end{array} \]

Alternative 5: 38.6% accurate, 5.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;M \leq 5 \cdot 10^{-38}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.95 \cdot 10^{+25} \lor \neg \left(M \leq 8.2 \cdot 10^{+52}\right):\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(c0 \cdot \frac{\frac{d}{D} \cdot \frac{d}{D}}{w \cdot h}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (if (<= M 5e-38)
   0.0
   (if (or (<= M 2.95e+25) (not (<= M 8.2e+52)))
     (* (/ c0 (* 2.0 w)) (* 2.0 (* c0 (/ (* (/ d D) (/ d D)) (* w h)))))
     0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if (M <= 5e-38) {
		tmp = 0.0;
	} else if ((M <= 2.95e+25) || !(M <= 8.2e+52)) {
		tmp = (c0 / (2.0 * w)) * (2.0 * (c0 * (((d / D) * (d / D)) / (w * h))));
	} else {
		tmp = 0.0;
	}
	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 <= 5d-38) then
        tmp = 0.0d0
    else if ((m <= 2.95d+25) .or. (.not. (m <= 8.2d+52))) then
        tmp = (c0 / (2.0d0 * w)) * (2.0d0 * (c0 * (((d_1 / d) * (d_1 / d)) / (w * h))))
    else
        tmp = 0.0d0
    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 <= 5e-38) {
		tmp = 0.0;
	} else if ((M <= 2.95e+25) || !(M <= 8.2e+52)) {
		tmp = (c0 / (2.0 * w)) * (2.0 * (c0 * (((d / D) * (d / D)) / (w * h))));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	tmp = 0
	if M <= 5e-38:
		tmp = 0.0
	elif (M <= 2.95e+25) or not (M <= 8.2e+52):
		tmp = (c0 / (2.0 * w)) * (2.0 * (c0 * (((d / D) * (d / D)) / (w * h))))
	else:
		tmp = 0.0
	return tmp
function code(c0, w, h, D, d, M)
	tmp = 0.0
	if (M <= 5e-38)
		tmp = 0.0;
	elseif ((M <= 2.95e+25) || !(M <= 8.2e+52))
		tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(2.0 * Float64(c0 * Float64(Float64(Float64(d / D) * Float64(d / D)) / Float64(w * h)))));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	tmp = 0.0;
	if (M <= 5e-38)
		tmp = 0.0;
	elseif ((M <= 2.95e+25) || ~((M <= 8.2e+52)))
		tmp = (c0 / (2.0 * w)) * (2.0 * (c0 * (((d / D) * (d / D)) / (w * h))));
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[M, 5e-38], 0.0, If[Or[LessEqual[M, 2.95e+25], N[Not[LessEqual[M, 8.2e+52]], $MachinePrecision]], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(c0 * N[(N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;M \leq 5 \cdot 10^{-38}:\\
\;\;\;\;0\\

\mathbf{elif}\;M \leq 2.95 \cdot 10^{+25} \lor \neg \left(M \leq 8.2 \cdot 10^{+52}\right):\\
\;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(c0 \cdot \frac{\frac{d}{D} \cdot \frac{d}{D}}{w \cdot h}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 5.00000000000000033e-38 or 2.95e25 < M < 8.1999999999999999e52

    1. Initial program 26.3%

      \[\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. Simplified30.5%

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

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

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

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

      \[\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}} \]
    6. Step-by-step derivation
      1. associate-/l*6.1%

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

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

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

        \[\leadsto -0.5 \cdot \frac{\color{blue}{0}}{\frac{w}{{c0}^{2}}} \]
      5. unpow229.3%

        \[\leadsto -0.5 \cdot \frac{0}{\frac{w}{\color{blue}{c0 \cdot c0}}} \]
    7. Simplified29.3%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{0}{\frac{w}{c0 \cdot c0}}} \]
    8. Taylor expanded in w around 0 39.4%

      \[\leadsto -0.5 \cdot \color{blue}{0} \]

    if 5.00000000000000033e-38 < M < 2.95e25 or 8.1999999999999999e52 < M

    1. Initial program 19.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. Simplified21.6%

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

      \[\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)} \]
    4. Step-by-step derivation
      1. *-commutative45.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 5 \cdot 10^{-38}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.95 \cdot 10^{+25} \lor \neg \left(M \leq 8.2 \cdot 10^{+52}\right):\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(c0 \cdot \frac{\frac{d}{D} \cdot \frac{d}{D}}{w \cdot h}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 6: 38.7% accurate, 5.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{d}{D} \cdot \frac{d}{D}\\ t_1 := \frac{c0}{2 \cdot w}\\ \mathbf{if}\;M \leq 8.5 \cdot 10^{-39}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.9 \cdot 10^{+24}:\\ \;\;\;\;t_1 \cdot \left(2 \cdot \left(c0 \cdot \frac{t_0}{w \cdot h}\right)\right)\\ \mathbf{elif}\;M \leq 1.1 \cdot 10^{+53}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \left(2 \cdot \frac{c0 \cdot t_0}{w \cdot h}\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (* (/ d D) (/ d D))) (t_1 (/ c0 (* 2.0 w))))
   (if (<= M 8.5e-39)
     0.0
     (if (<= M 2.9e+24)
       (* t_1 (* 2.0 (* c0 (/ t_0 (* w h)))))
       (if (<= M 1.1e+53) 0.0 (* t_1 (* 2.0 (/ (* c0 t_0) (* w h)))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (d / D) * (d / D);
	double t_1 = c0 / (2.0 * w);
	double tmp;
	if (M <= 8.5e-39) {
		tmp = 0.0;
	} else if (M <= 2.9e+24) {
		tmp = t_1 * (2.0 * (c0 * (t_0 / (w * h))));
	} else if (M <= 1.1e+53) {
		tmp = 0.0;
	} else {
		tmp = t_1 * (2.0 * ((c0 * t_0) / (w * h)));
	}
	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 = (d_1 / d) * (d_1 / d)
    t_1 = c0 / (2.0d0 * w)
    if (m <= 8.5d-39) then
        tmp = 0.0d0
    else if (m <= 2.9d+24) then
        tmp = t_1 * (2.0d0 * (c0 * (t_0 / (w * h))))
    else if (m <= 1.1d+53) then
        tmp = 0.0d0
    else
        tmp = t_1 * (2.0d0 * ((c0 * t_0) / (w * h)))
    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 = (d / D) * (d / D);
	double t_1 = c0 / (2.0 * w);
	double tmp;
	if (M <= 8.5e-39) {
		tmp = 0.0;
	} else if (M <= 2.9e+24) {
		tmp = t_1 * (2.0 * (c0 * (t_0 / (w * h))));
	} else if (M <= 1.1e+53) {
		tmp = 0.0;
	} else {
		tmp = t_1 * (2.0 * ((c0 * t_0) / (w * h)));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = (d / D) * (d / D)
	t_1 = c0 / (2.0 * w)
	tmp = 0
	if M <= 8.5e-39:
		tmp = 0.0
	elif M <= 2.9e+24:
		tmp = t_1 * (2.0 * (c0 * (t_0 / (w * h))))
	elif M <= 1.1e+53:
		tmp = 0.0
	else:
		tmp = t_1 * (2.0 * ((c0 * t_0) / (w * h)))
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(Float64(d / D) * Float64(d / D))
	t_1 = Float64(c0 / Float64(2.0 * w))
	tmp = 0.0
	if (M <= 8.5e-39)
		tmp = 0.0;
	elseif (M <= 2.9e+24)
		tmp = Float64(t_1 * Float64(2.0 * Float64(c0 * Float64(t_0 / Float64(w * h)))));
	elseif (M <= 1.1e+53)
		tmp = 0.0;
	else
		tmp = Float64(t_1 * Float64(2.0 * Float64(Float64(c0 * t_0) / Float64(w * h))));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = (d / D) * (d / D);
	t_1 = c0 / (2.0 * w);
	tmp = 0.0;
	if (M <= 8.5e-39)
		tmp = 0.0;
	elseif (M <= 2.9e+24)
		tmp = t_1 * (2.0 * (c0 * (t_0 / (w * h))));
	elseif (M <= 1.1e+53)
		tmp = 0.0;
	else
		tmp = t_1 * (2.0 * ((c0 * t_0) / (w * h)));
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(N[(d / D), $MachinePrecision] * N[(d / D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, 8.5e-39], 0.0, If[LessEqual[M, 2.9e+24], N[(t$95$1 * N[(2.0 * N[(c0 * N[(t$95$0 / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 1.1e+53], 0.0, N[(t$95$1 * N[(2.0 * N[(N[(c0 * t$95$0), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{d}{D} \cdot \frac{d}{D}\\
t_1 := \frac{c0}{2 \cdot w}\\
\mathbf{if}\;M \leq 8.5 \cdot 10^{-39}:\\
\;\;\;\;0\\

\mathbf{elif}\;M \leq 2.9 \cdot 10^{+24}:\\
\;\;\;\;t_1 \cdot \left(2 \cdot \left(c0 \cdot \frac{t_0}{w \cdot h}\right)\right)\\

\mathbf{elif}\;M \leq 1.1 \cdot 10^{+53}:\\
\;\;\;\;0\\

\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(2 \cdot \frac{c0 \cdot t_0}{w \cdot h}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if M < 8.5000000000000005e-39 or 2.89999999999999979e24 < M < 1.09999999999999999e53

    1. Initial program 26.3%

      \[\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. Simplified30.5%

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

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

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

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

      \[\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}} \]
    6. Step-by-step derivation
      1. associate-/l*6.1%

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

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

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

        \[\leadsto -0.5 \cdot \frac{\color{blue}{0}}{\frac{w}{{c0}^{2}}} \]
      5. unpow229.3%

        \[\leadsto -0.5 \cdot \frac{0}{\frac{w}{\color{blue}{c0 \cdot c0}}} \]
    7. Simplified29.3%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{0}{\frac{w}{c0 \cdot c0}}} \]
    8. Taylor expanded in w around 0 39.4%

      \[\leadsto -0.5 \cdot \color{blue}{0} \]

    if 8.5000000000000005e-39 < M < 2.89999999999999979e24

    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. Simplified33.7%

      \[\leadsto \color{blue}{\frac{c0}{2 \cdot w} \cdot \left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D} + \sqrt{\mathsf{fma}\left(\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, \frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}, -M \cdot M\right)}\right)} \]
    3. Taylor expanded in c0 around inf 23.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)} \]
    4. Step-by-step derivation
      1. *-commutative23.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.09999999999999999e53 < M

    1. Initial program 19.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. Simplified19.0%

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

      \[\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)} \]
    4. Step-by-step derivation
      1. *-commutative50.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 8.5 \cdot 10^{-39}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.9 \cdot 10^{+24}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(c0 \cdot \frac{\frac{d}{D} \cdot \frac{d}{D}}{w \cdot h}\right)\right)\\ \mathbf{elif}\;M \leq 1.1 \cdot 10^{+53}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{c0 \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{w \cdot h}\right)\\ \end{array} \]

Alternative 7: 35.5% accurate, 6.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;M \leq 5.5 \cdot 10^{-27}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.5 \cdot 10^{+26} \lor \neg \left(M \leq 1.5 \cdot 10^{+53}\right):\\ \;\;\;\;\frac{d \cdot d}{D \cdot D} \cdot \frac{c0 \cdot c0}{h \cdot \left(w \cdot w\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (if (<= M 5.5e-27)
   0.0
   (if (or (<= M 2.5e+26) (not (<= M 1.5e+53)))
     (* (/ (* d d) (* D D)) (/ (* c0 c0) (* h (* w w))))
     0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if (M <= 5.5e-27) {
		tmp = 0.0;
	} else if ((M <= 2.5e+26) || !(M <= 1.5e+53)) {
		tmp = ((d * d) / (D * D)) * ((c0 * c0) / (h * (w * w)));
	} else {
		tmp = 0.0;
	}
	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 <= 5.5d-27) then
        tmp = 0.0d0
    else if ((m <= 2.5d+26) .or. (.not. (m <= 1.5d+53))) then
        tmp = ((d_1 * d_1) / (d * d)) * ((c0 * c0) / (h * (w * w)))
    else
        tmp = 0.0d0
    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 <= 5.5e-27) {
		tmp = 0.0;
	} else if ((M <= 2.5e+26) || !(M <= 1.5e+53)) {
		tmp = ((d * d) / (D * D)) * ((c0 * c0) / (h * (w * w)));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	tmp = 0
	if M <= 5.5e-27:
		tmp = 0.0
	elif (M <= 2.5e+26) or not (M <= 1.5e+53):
		tmp = ((d * d) / (D * D)) * ((c0 * c0) / (h * (w * w)))
	else:
		tmp = 0.0
	return tmp
function code(c0, w, h, D, d, M)
	tmp = 0.0
	if (M <= 5.5e-27)
		tmp = 0.0;
	elseif ((M <= 2.5e+26) || !(M <= 1.5e+53))
		tmp = Float64(Float64(Float64(d * d) / Float64(D * D)) * Float64(Float64(c0 * c0) / Float64(h * Float64(w * w))));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	tmp = 0.0;
	if (M <= 5.5e-27)
		tmp = 0.0;
	elseif ((M <= 2.5e+26) || ~((M <= 1.5e+53)))
		tmp = ((d * d) / (D * D)) * ((c0 * c0) / (h * (w * w)));
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[M, 5.5e-27], 0.0, If[Or[LessEqual[M, 2.5e+26], N[Not[LessEqual[M, 1.5e+53]], $MachinePrecision]], N[(N[(N[(d * d), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 * c0), $MachinePrecision] / N[(h * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;M \leq 5.5 \cdot 10^{-27}:\\
\;\;\;\;0\\

\mathbf{elif}\;M \leq 2.5 \cdot 10^{+26} \lor \neg \left(M \leq 1.5 \cdot 10^{+53}\right):\\
\;\;\;\;\frac{d \cdot d}{D \cdot D} \cdot \frac{c0 \cdot c0}{h \cdot \left(w \cdot w\right)}\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 5.5000000000000002e-27 or 2.5e26 < M < 1.49999999999999999e53

    1. Initial program 26.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. Simplified30.5%

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

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

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

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

      \[\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}} \]
    6. Step-by-step derivation
      1. associate-/l*6.0%

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

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

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

        \[\leadsto -0.5 \cdot \frac{\color{blue}{0}}{\frac{w}{{c0}^{2}}} \]
      5. unpow228.9%

        \[\leadsto -0.5 \cdot \frac{0}{\frac{w}{\color{blue}{c0 \cdot c0}}} \]
    7. Simplified28.9%

      \[\leadsto \color{blue}{-0.5 \cdot \frac{0}{\frac{w}{c0 \cdot c0}}} \]
    8. Taylor expanded in w around 0 38.9%

      \[\leadsto -0.5 \cdot \color{blue}{0} \]

    if 5.5000000000000002e-27 < M < 2.5e26 or 1.49999999999999999e53 < M

    1. Initial program 18.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. Simplified48.1%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{d \cdot d}{D \cdot D} \cdot \frac{\color{blue}{c0 \cdot c0}}{{w}^{2} \cdot h} \]
      5. *-commutative40.3%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 5.5 \cdot 10^{-27}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 2.5 \cdot 10^{+26} \lor \neg \left(M \leq 1.5 \cdot 10^{+53}\right):\\ \;\;\;\;\frac{d \cdot d}{D \cdot D} \cdot \frac{c0 \cdot c0}{h \cdot \left(w \cdot w\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 8: 33.6% accurate, 151.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (c0 w h D d M) :precision binary64 0.0)
double code(double c0, double w, double h, double D, double d, double M) {
	return 0.0;
}
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.0d0
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	return 0.0;
}
def code(c0, w, h, D, d, M):
	return 0.0
function code(c0, w, h, D, d, M)
	return 0.0
end
function tmp = code(c0, w, h, D, d, M)
	tmp = 0.0;
end
code[c0_, w_, h_, D_, d_, M_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 25.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. Simplified33.8%

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

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

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

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

    \[\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}} \]
  6. Step-by-step derivation
    1. associate-/l*4.9%

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

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

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

      \[\leadsto -0.5 \cdot \frac{\color{blue}{0}}{\frac{w}{{c0}^{2}}} \]
    5. unpow223.9%

      \[\leadsto -0.5 \cdot \frac{0}{\frac{w}{\color{blue}{c0 \cdot c0}}} \]
  7. Simplified23.9%

    \[\leadsto \color{blue}{-0.5 \cdot \frac{0}{\frac{w}{c0 \cdot c0}}} \]
  8. Taylor expanded in w around 0 32.5%

    \[\leadsto -0.5 \cdot \color{blue}{0} \]
  9. Final simplification32.5%

    \[\leadsto 0 \]

Reproduce

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