Henrywood and Agarwal, Equation (13)

Percentage Accurate: 25.2% → 62.6%
Time: 26.3s
Alternatives: 11
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 11 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: 25.2% 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: 62.6% accurate, 0.6× 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)}\\ \mathbf{if}\;\frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right) \leq \infty:\\ \;\;\;\;-\frac{{\left(c0 \cdot d\right)}^{2}}{\left(-D\right) \cdot \left(\left(w \cdot h\right) \cdot \left(w \cdot D\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{{\left(\frac{d}{D}\right)}^{2}}\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
   (if (<=
        (* (/ c0 (* 2.0 w)) (+ t_0 (sqrt (- (* t_0 t_0) (* M M)))))
        INFINITY)
     (- (/ (pow (* c0 d) 2.0) (* (- D) (* (* w h) (* w D)))))
     (* 0.25 (/ (* h (* M M)) (pow (/ d D) 2.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 tmp;
	if (((c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))))) <= ((double) INFINITY)) {
		tmp = -(pow((c0 * d), 2.0) / (-D * ((w * h) * (w * D))));
	} else {
		tmp = 0.25 * ((h * (M * M)) / pow((d / D), 2.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 tmp;
	if (((c0 / (2.0 * w)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M * M))))) <= Double.POSITIVE_INFINITY) {
		tmp = -(Math.pow((c0 * d), 2.0) / (-D * ((w * h) * (w * D))));
	} else {
		tmp = 0.25 * ((h * (M * M)) / Math.pow((d / D), 2.0));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = (c0 * (d * d)) / ((w * h) * (D * D))
	tmp = 0
	if ((c0 / (2.0 * w)) * (t_0 + math.sqrt(((t_0 * t_0) - (M * M))))) <= math.inf:
		tmp = -(math.pow((c0 * d), 2.0) / (-D * ((w * h) * (w * D))))
	else:
		tmp = 0.25 * ((h * (M * M)) / math.pow((d / D), 2.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)))
	tmp = 0.0
	if (Float64(Float64(c0 / Float64(2.0 * w)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M * M))))) <= Inf)
		tmp = Float64(-Float64((Float64(c0 * d) ^ 2.0) / Float64(Float64(-D) * Float64(Float64(w * h) * Float64(w * D)))));
	else
		tmp = Float64(0.25 * Float64(Float64(h * Float64(M * M)) / (Float64(d / D) ^ 2.0)));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
	tmp = 0.0;
	if (((c0 / (2.0 * w)) * (t_0 + sqrt(((t_0 * t_0) - (M * M))))) <= Inf)
		tmp = -(((c0 * d) ^ 2.0) / (-D * ((w * h) * (w * D))));
	else
		tmp = 0.25 * ((h * (M * M)) / ((d / D) ^ 2.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]}, If[LessEqual[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], Infinity], (-N[(N[Power[N[(c0 * d), $MachinePrecision], 2.0], $MachinePrecision] / N[((-D) * N[(N[(w * h), $MachinePrecision] * N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(0.25 * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[Power[N[(d / D), $MachinePrecision], 2.0], $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)}\\
\mathbf{if}\;\frac{c0}{2 \cdot w} \cdot \left(t_0 + \sqrt{t_0 \cdot t_0 - M \cdot M}\right) \leq \infty:\\
\;\;\;\;-\frac{{\left(c0 \cdot d\right)}^{2}}{\left(-D\right) \cdot \left(\left(w \cdot h\right) \cdot \left(w \cdot D\right)\right)}\\

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


\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 65.7%

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\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) \]
      2. difference-of-squares63.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-{\left(d \cdot c0\right)}^{2}}{-\color{blue}{D \cdot \left(D \cdot \left(h \cdot \left(w \cdot w\right)\right)\right)}} \]
      2. distribute-rgt-neg-in62.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-{\left(d \cdot c0\right)}^{2}}{\color{blue}{D \cdot \left(\left(-D \cdot w\right) \cdot \left(w \cdot h\right)\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. Step-by-step derivation
      1. times-frac0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\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{{\left(c0 \cdot d\right)}^{2}}{\left(-D\right) \cdot \left(\left(w \cdot h\right) \cdot \left(w \cdot D\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{{\left(\frac{d}{D}\right)}^{2}}\\ \end{array} \]

Alternative 2: 46.4% accurate, 1.2× speedup?

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

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

\mathbf{elif}\;M \cdot M \leq 5.5 \cdot 10^{-152}:\\
\;\;\;\;-\frac{t_0}{D \cdot \left(\left(D \cdot \left(w \cdot w\right)\right) \cdot \left(-h\right)\right)}\\

\mathbf{elif}\;M \cdot M \leq 3.8 \cdot 10^{+250}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 M M) < 1.8e-195 or 5.4999999999999998e-152 < (*.f64 M M) < 3.7999999999999997e250

    1. Initial program 23.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. Step-by-step derivation
      1. times-frac20.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.8e-195 < (*.f64 M M) < 5.4999999999999998e-152

    1. Initial program 45.8%

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\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) \]
      2. difference-of-squares45.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.7999999999999997e250 < (*.f64 M M)

    1. Initial program 12.5%

      \[\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. associate-*l*12.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\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) \]
      2. difference-of-squares46.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \cdot M \leq 1.8 \cdot 10^{-195}:\\ \;\;\;\;0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{{\left(\frac{d}{D}\right)}^{2}}\\ \mathbf{elif}\;M \cdot M \leq 5.5 \cdot 10^{-152}:\\ \;\;\;\;-\frac{{\left(c0 \cdot d\right)}^{2}}{D \cdot \left(\left(D \cdot \left(w \cdot w\right)\right) \cdot \left(-h\right)\right)}\\ \mathbf{elif}\;M \cdot M \leq 3.8 \cdot 10^{+250}:\\ \;\;\;\;0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{{\left(\frac{d}{D}\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-{\left(c0 \cdot d\right)}^{2}}{D \cdot \left(\left(w \cdot \left(w \cdot h\right)\right) \cdot \left(-D\right)\right)}\\ \end{array} \]

Alternative 3: 46.9% accurate, 1.3× speedup?

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

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

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


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

    1. Initial program 24.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. times-frac21.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{\color{blue}{\frac{d}{D} \cdot \frac{d}{D}}} \]
      9. unpow251.1%

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

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

    if 2.7e246 < (*.f64 M M)

    1. Initial program 12.5%

      \[\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. associate-*l*12.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\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) \]
      2. difference-of-squares46.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 46.2% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(\frac{d}{D}\right)}^{2}\\ \mathbf{if}\;M \cdot M \leq 5.9 \cdot 10^{+133}:\\ \;\;\;\;0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_0}{h} \cdot \left(c0 \cdot \frac{c0}{w \cdot w}\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (pow (/ d D) 2.0)))
   (if (<= (* M M) 5.9e+133)
     (* 0.25 (/ (* h (* M M)) t_0))
     (* (/ t_0 h) (* c0 (/ c0 (* w w)))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = pow((d / D), 2.0);
	double tmp;
	if ((M * M) <= 5.9e+133) {
		tmp = 0.25 * ((h * (M * M)) / t_0);
	} else {
		tmp = (t_0 / h) * (c0 * (c0 / (w * w)));
	}
	return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
    real(8), intent (in) :: c0
    real(8), intent (in) :: w
    real(8), intent (in) :: h
    real(8), intent (in) :: d
    real(8), intent (in) :: d_1
    real(8), intent (in) :: m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (d_1 / d) ** 2.0d0
    if ((m * m) <= 5.9d+133) then
        tmp = 0.25d0 * ((h * (m * m)) / t_0)
    else
        tmp = (t_0 / h) * (c0 * (c0 / (w * w)))
    end if
    code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = Math.pow((d / D), 2.0);
	double tmp;
	if ((M * M) <= 5.9e+133) {
		tmp = 0.25 * ((h * (M * M)) / t_0);
	} else {
		tmp = (t_0 / h) * (c0 * (c0 / (w * w)));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = math.pow((d / D), 2.0)
	tmp = 0
	if (M * M) <= 5.9e+133:
		tmp = 0.25 * ((h * (M * M)) / t_0)
	else:
		tmp = (t_0 / h) * (c0 * (c0 / (w * w)))
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(d / D) ^ 2.0
	tmp = 0.0
	if (Float64(M * M) <= 5.9e+133)
		tmp = Float64(0.25 * Float64(Float64(h * Float64(M * M)) / t_0));
	else
		tmp = Float64(Float64(t_0 / h) * Float64(c0 * Float64(c0 / Float64(w * w))));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = (d / D) ^ 2.0;
	tmp = 0.0;
	if ((M * M) <= 5.9e+133)
		tmp = 0.25 * ((h * (M * M)) / t_0);
	else
		tmp = (t_0 / h) * (c0 * (c0 / (w * 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]}, If[LessEqual[N[(M * M), $MachinePrecision], 5.9e+133], N[(0.25 * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / h), $MachinePrecision] * N[(c0 * N[(c0 / N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(\frac{d}{D}\right)}^{2}\\
\mathbf{if}\;M \cdot M \leq 5.9 \cdot 10^{+133}:\\
\;\;\;\;0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{t_0}\\

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


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

    1. Initial program 24.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) \]
    2. Step-by-step derivation
      1. times-frac21.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.8999999999999997e133 < (*.f64 M M)

    1. Initial program 15.8%

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\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) \]
      2. difference-of-squares43.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 46.6% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(\frac{d}{D}\right)}^{2}\\ \mathbf{if}\;M \cdot M \leq 2.4 \cdot 10^{+138}:\\ \;\;\;\;0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{t_0}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot \left(c0 \cdot \frac{c0}{w \cdot \left(w \cdot h\right)}\right)\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (let* ((t_0 (pow (/ d D) 2.0)))
   (if (<= (* M M) 2.4e+138)
     (* 0.25 (/ (* h (* M M)) t_0))
     (* t_0 (* c0 (/ c0 (* w (* w h))))))))
double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = pow((d / D), 2.0);
	double tmp;
	if ((M * M) <= 2.4e+138) {
		tmp = 0.25 * ((h * (M * M)) / t_0);
	} else {
		tmp = t_0 * (c0 * (c0 / (w * (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) :: tmp
    t_0 = (d_1 / d) ** 2.0d0
    if ((m * m) <= 2.4d+138) then
        tmp = 0.25d0 * ((h * (m * m)) / t_0)
    else
        tmp = t_0 * (c0 * (c0 / (w * (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 = Math.pow((d / D), 2.0);
	double tmp;
	if ((M * M) <= 2.4e+138) {
		tmp = 0.25 * ((h * (M * M)) / t_0);
	} else {
		tmp = t_0 * (c0 * (c0 / (w * (w * h))));
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	t_0 = math.pow((d / D), 2.0)
	tmp = 0
	if (M * M) <= 2.4e+138:
		tmp = 0.25 * ((h * (M * M)) / t_0)
	else:
		tmp = t_0 * (c0 * (c0 / (w * (w * h))))
	return tmp
function code(c0, w, h, D, d, M)
	t_0 = Float64(d / D) ^ 2.0
	tmp = 0.0
	if (Float64(M * M) <= 2.4e+138)
		tmp = Float64(0.25 * Float64(Float64(h * Float64(M * M)) / t_0));
	else
		tmp = Float64(t_0 * Float64(c0 * Float64(c0 / Float64(w * Float64(w * h)))));
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	t_0 = (d / D) ^ 2.0;
	tmp = 0.0;
	if ((M * M) <= 2.4e+138)
		tmp = 0.25 * ((h * (M * M)) / t_0);
	else
		tmp = t_0 * (c0 * (c0 / (w * (w * h))));
	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]}, If[LessEqual[N[(M * M), $MachinePrecision], 2.4e+138], N[(0.25 * N[(N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(c0 * N[(c0 / N[(w * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(\frac{d}{D}\right)}^{2}\\
\mathbf{if}\;M \cdot M \leq 2.4 \cdot 10^{+138}:\\
\;\;\;\;0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{t_0}\\

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


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

    1. Initial program 24.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) \]
    2. Step-by-step derivation
      1. times-frac21.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.4000000000000001e138 < (*.f64 M M)

    1. Initial program 15.8%

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\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) \]
      2. difference-of-squares43.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 45.4% accurate, 1.3× speedup?

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

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

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


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

    1. Initial program 24.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. times-frac21.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 0.25 \cdot \frac{h \cdot \left(M \cdot M\right)}{\color{blue}{\frac{d}{D} \cdot \frac{d}{D}}} \]
      9. unpow251.1%

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

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

    if 2.1000000000000001e252 < (*.f64 M M)

    1. Initial program 12.5%

      \[\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. associate-*l*12.5%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\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) \]
      2. difference-of-squares46.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 46.0% accurate, 1.3× speedup?

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

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

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


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

    1. Initial program 24.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) \]
    2. Step-by-step derivation
      1. times-frac21.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.2e133 < (*.f64 M M)

    1. Initial program 15.8%

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\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) \]
      2. difference-of-squares43.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{d}{D} \cdot \frac{d}{D}\right)} \cdot \frac{c0 \cdot c0}{h \cdot \left(w \cdot w\right)} \]
    9. Step-by-step derivation
      1. *-un-lft-identity53.5%

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

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

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

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

Alternative 8: 42.5% accurate, 5.2× speedup?

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

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

\mathbf{elif}\;M \cdot M \leq 3.2 \cdot 10^{+21} \lor \neg \left(M \cdot M \leq 5.8 \cdot 10^{+48}\right):\\
\;\;\;\;\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \left(\frac{c0}{w \cdot w} \cdot \frac{c0}{h}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 M M) < 1.39999999999999998e-100

    1. Initial program 24.5%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(-1 \cdot \color{blue}{0}\right) \cdot c0\right) \]
      5. metadata-eval42.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{0} \cdot c0\right) \]
      6. mul0-lft9.6%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0} \]

    if 1.39999999999999998e-100 < (*.f64 M M) < 3.2e21 or 5.7999999999999998e48 < (*.f64 M M)

    1. Initial program 19.7%

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\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) \]
      2. difference-of-squares37.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.2e21 < (*.f64 M M) < 5.7999999999999998e48

    1. Initial program 0.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. Step-by-step derivation
      1. times-frac0.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \cdot M \leq 1.4 \cdot 10^{-100}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \cdot M \leq 3.2 \cdot 10^{+21} \lor \neg \left(M \cdot M \leq 5.8 \cdot 10^{+48}\right):\\ \;\;\;\;\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \left(\frac{c0}{w \cdot w} \cdot \frac{c0}{h}\right)\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\ \end{array} \]

Alternative 9: 42.4% accurate, 5.2× speedup?

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

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

\mathbf{elif}\;M \cdot M \leq 4 \cdot 10^{+21} \lor \neg \left(M \cdot M \leq 6.5 \cdot 10^{+50}\right):\\
\;\;\;\;\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{\frac{h \cdot \left(w \cdot w\right)}{c0}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 M M) < 2.45000000000000007e-98

    1. Initial program 24.5%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(-1 \cdot \color{blue}{0}\right) \cdot c0\right) \]
      5. metadata-eval42.8%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{0} \cdot c0\right) \]
      6. mul0-lft9.6%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0} \]

    if 2.45000000000000007e-98 < (*.f64 M M) < 4e21 or 6.5000000000000003e50 < (*.f64 M M)

    1. Initial program 19.7%

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\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) \]
      2. difference-of-squares37.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4e21 < (*.f64 M M) < 6.5000000000000003e50

    1. Initial program 0.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. Step-by-step derivation
      1. times-frac0.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \cdot M \leq 2.45 \cdot 10^{-98}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \cdot M \leq 4 \cdot 10^{+21} \lor \neg \left(M \cdot M \leq 6.5 \cdot 10^{+50}\right):\\ \;\;\;\;\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{\frac{h \cdot \left(w \cdot w\right)}{c0}}\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\ \end{array} \]

Alternative 10: 39.0% accurate, 6.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \cdot d \leq 6.5 \cdot 10^{-305}:\\ \;\;\;\;0\\ \mathbf{elif}\;d \cdot d \leq 1.62 \cdot 10^{+308}:\\ \;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (c0 w h D d M)
 :precision binary64
 (if (<= (* d d) 6.5e-305)
   0.0
   (if (<= (* d d) 1.62e+308)
     (* 0.25 (/ (* D D) (/ (* d d) (* h (* M M)))))
     0.0)))
double code(double c0, double w, double h, double D, double d, double M) {
	double tmp;
	if ((d * d) <= 6.5e-305) {
		tmp = 0.0;
	} else if ((d * d) <= 1.62e+308) {
		tmp = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
	} 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 ((d_1 * d_1) <= 6.5d-305) then
        tmp = 0.0d0
    else if ((d_1 * d_1) <= 1.62d+308) then
        tmp = 0.25d0 * ((d * d) / ((d_1 * d_1) / (h * (m * m))))
    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 ((d * d) <= 6.5e-305) {
		tmp = 0.0;
	} else if ((d * d) <= 1.62e+308) {
		tmp = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(c0, w, h, D, d, M):
	tmp = 0
	if (d * d) <= 6.5e-305:
		tmp = 0.0
	elif (d * d) <= 1.62e+308:
		tmp = 0.25 * ((D * D) / ((d * d) / (h * (M * M))))
	else:
		tmp = 0.0
	return tmp
function code(c0, w, h, D, d, M)
	tmp = 0.0
	if (Float64(d * d) <= 6.5e-305)
		tmp = 0.0;
	elseif (Float64(d * d) <= 1.62e+308)
		tmp = Float64(0.25 * Float64(Float64(D * D) / Float64(Float64(d * d) / Float64(h * Float64(M * M)))));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(c0, w, h, D, d, M)
	tmp = 0.0;
	if ((d * d) <= 6.5e-305)
		tmp = 0.0;
	elseif ((d * d) <= 1.62e+308)
		tmp = 0.25 * ((D * D) / ((d * d) / (h * (M * M))));
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[c0_, w_, h_, D_, d_, M_] := If[LessEqual[N[(d * d), $MachinePrecision], 6.5e-305], 0.0, If[LessEqual[N[(d * d), $MachinePrecision], 1.62e+308], N[(0.25 * N[(N[(D * D), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] / N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;d \cdot d \leq 6.5 \cdot 10^{-305}:\\
\;\;\;\;0\\

\mathbf{elif}\;d \cdot d \leq 1.62 \cdot 10^{+308}:\\
\;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 d d) < 6.49999999999999991e-305 or 1.62e308 < (*.f64 d d)

    1. Initial program 16.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) \]
    2. Step-by-step derivation
      1. times-frac16.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(-1 \cdot \color{blue}{0}\right) \cdot c0\right) \]
      5. metadata-eval36.3%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{0} \cdot c0\right) \]
      6. mul0-lft0.2%

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

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

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

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

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

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

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot \color{blue}{0}\right) \]
    6. Simplified36.3%

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

      \[\leadsto \color{blue}{0} \]

    if 6.49999999999999991e-305 < (*.f64 d d) < 1.62e308

    1. Initial program 26.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}} \]
    11. Step-by-step derivation
      1. associate-/l*46.8%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \cdot d \leq 6.5 \cdot 10^{-305}:\\ \;\;\;\;0\\ \mathbf{elif}\;d \cdot d \leq 1.62 \cdot 10^{+308}:\\ \;\;\;\;0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{h \cdot \left(M \cdot M\right)}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 11: 33.8% 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 21.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\left(-1 \cdot \color{blue}{0}\right) \cdot c0\right) \]
    5. metadata-eval31.4%

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{0} \cdot c0\right) \]
    6. mul0-lft5.4%

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

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

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

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

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

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

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(c0 \cdot \color{blue}{0}\right) \]
  6. Simplified31.4%

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

    \[\leadsto \color{blue}{0} \]
  8. Final simplification37.2%

    \[\leadsto 0 \]

Reproduce

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