Henrywood and Agarwal, Equation (13)

Percentage Accurate: 24.0% → 66.1%
Time: 19.8s
Alternatives: 10
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 10 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 24.0% 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: 66.1% accurate, 0.9× 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{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{w \cdot \left(h \cdot \left(w \cdot D\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{0.25 \cdot \left(D \cdot \left(D \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)\right)}{d}}{d}\\ \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)
     (* (/ (* c0 d) D) (/ (* c0 d) (* w (* h (* w D)))))
     (/ (/ (* 0.25 (* D (* D (* h (* M M))))) d) d))))
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 = ((c0 * d) / D) * ((c0 * d) / (w * (h * (w * D))));
	} else {
		tmp = ((0.25 * (D * (D * (h * (M * M))))) / d) / d;
	}
	return tmp;
}
public static double code(double c0, double w, double h, double D, double d, double M) {
	double t_0 = (c0 * (d * d)) / ((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 = ((c0 * d) / D) * ((c0 * d) / (w * (h * (w * D))));
	} else {
		tmp = ((0.25 * (D * (D * (h * (M * M))))) / d) / d;
	}
	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 = ((c0 * d) / D) * ((c0 * d) / (w * (h * (w * D))))
	else:
		tmp = ((0.25 * (D * (D * (h * (M * M))))) / d) / d
	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) / D) * Float64(Float64(c0 * d) / Float64(w * Float64(h * Float64(w * D)))));
	else
		tmp = Float64(Float64(Float64(0.25 * Float64(D * Float64(D * Float64(h * Float64(M * M))))) / d) / d);
	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) / D) * ((c0 * d) / (w * (h * (w * D))));
	else
		tmp = ((0.25 * (D * (D * (h * (M * M))))) / d) / d;
	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[(N[(c0 * d), $MachinePrecision] / D), $MachinePrecision] * N[(N[(c0 * d), $MachinePrecision] / N[(w * N[(h * N[(w * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.25 * N[(D * N[(D * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] / d), $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{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{w \cdot \left(h \cdot \left(w \cdot D\right)\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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 68.3%

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

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

        \[\leadsto \mathsf{/.f64}\left(\left({c0}^{2} \cdot {d}^{2}\right), \color{blue}{\left({D}^{2} \cdot \left(h \cdot {w}^{2}\right)\right)}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left({d}^{2} \cdot {c0}^{2}\right), \left(\color{blue}{{D}^{2}} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({d}^{2}\right), \left({c0}^{2}\right)\right), \left(\color{blue}{{D}^{2}} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(d \cdot d\right), \left({c0}^{2}\right)\right), \left({\color{blue}{D}}^{2} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \left({c0}^{2}\right)\right), \left({\color{blue}{D}}^{2} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \left(c0 \cdot c0\right)\right), \left({D}^{\color{blue}{2}} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \left({D}^{\color{blue}{2}} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\left({D}^{2}\right), \color{blue}{\left(h \cdot {w}^{2}\right)}\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\left(D \cdot D\right), \left(\color{blue}{h} \cdot {w}^{2}\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \left(\color{blue}{h} \cdot {w}^{2}\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \mathsf{*.f64}\left(h, \color{blue}{\left({w}^{2}\right)}\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \mathsf{*.f64}\left(h, \left(w \cdot \color{blue}{w}\right)\right)\right)\right) \]
      13. *-lowering-*.f6454.9%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \mathsf{*.f64}\left(h, \mathsf{*.f64}\left(w, \color{blue}{w}\right)\right)\right)\right) \]
    5. Simplified54.9%

      \[\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)}} \]
    6. Step-by-step derivation
      1. unswap-sqrN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)\right), \mathsf{*.f64}\left(\color{blue}{\mathsf{*.f64}\left(D, D\right)}, \mathsf{*.f64}\left(h, \mathsf{*.f64}\left(w, w\right)\right)\right)\right) \]
      2. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\left(d \cdot \left(c0 \cdot \left(d \cdot c0\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{\mathsf{*.f64}\left(D, D\right)}, \mathsf{*.f64}\left(h, \mathsf{*.f64}\left(w, w\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(d, \left(c0 \cdot \left(d \cdot c0\right)\right)\right), \mathsf{*.f64}\left(\color{blue}{\mathsf{*.f64}\left(D, D\right)}, \mathsf{*.f64}\left(h, \mathsf{*.f64}\left(w, w\right)\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(d, \left(c0 \cdot \left(c0 \cdot d\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \mathsf{*.f64}\left(h, \mathsf{*.f64}\left(w, w\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(d, \mathsf{*.f64}\left(c0, \left(c0 \cdot d\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, \color{blue}{D}\right), \mathsf{*.f64}\left(h, \mathsf{*.f64}\left(w, w\right)\right)\right)\right) \]
      6. *-lowering-*.f6466.7%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(d, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(c0, d\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \mathsf{*.f64}\left(h, \mathsf{*.f64}\left(w, w\right)\right)\right)\right) \]
    7. Applied egg-rr66.7%

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

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

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

        \[\leadsto \frac{\left(c0 \cdot d\right) \cdot \left(c0 \cdot d\right)}{D \cdot \color{blue}{\left(D \cdot \left(h \cdot \left(w \cdot w\right)\right)\right)}} \]
      4. times-fracN/A

        \[\leadsto \frac{c0 \cdot d}{D} \cdot \color{blue}{\frac{c0 \cdot d}{D \cdot \left(h \cdot \left(w \cdot w\right)\right)}} \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{c0 \cdot d}{D}\right), \color{blue}{\left(\frac{c0 \cdot d}{D \cdot \left(h \cdot \left(w \cdot w\right)\right)}\right)}\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(c0 \cdot d\right), D\right), \left(\frac{\color{blue}{c0 \cdot d}}{D \cdot \left(h \cdot \left(w \cdot w\right)\right)}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \left(\frac{\color{blue}{c0} \cdot d}{D \cdot \left(h \cdot \left(w \cdot w\right)\right)}\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\left(c0 \cdot d\right), \color{blue}{\left(D \cdot \left(h \cdot \left(w \cdot w\right)\right)\right)}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \left(\color{blue}{D} \cdot \left(h \cdot \left(w \cdot w\right)\right)\right)\right)\right) \]
      10. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \left(D \cdot \left(\left(h \cdot w\right) \cdot \color{blue}{w}\right)\right)\right)\right) \]
      11. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \left(\left(D \cdot \left(h \cdot w\right)\right) \cdot \color{blue}{w}\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \left(\left(D \cdot \left(w \cdot h\right)\right) \cdot w\right)\right)\right) \]
      13. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \left(\left(\left(D \cdot w\right) \cdot h\right) \cdot w\right)\right)\right) \]
      14. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \left(\left(\left(w \cdot D\right) \cdot h\right) \cdot w\right)\right)\right) \]
      15. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \left(\left(w \cdot \left(D \cdot h\right)\right) \cdot w\right)\right)\right) \]
      16. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \left(\left(w \cdot \left(h \cdot D\right)\right) \cdot w\right)\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{*.f64}\left(\left(w \cdot \left(h \cdot D\right)\right), \color{blue}{w}\right)\right)\right) \]
      18. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{*.f64}\left(\left(w \cdot \left(D \cdot h\right)\right), w\right)\right)\right) \]
      19. associate-*r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{*.f64}\left(\left(\left(w \cdot D\right) \cdot h\right), w\right)\right)\right) \]
      20. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(w \cdot D\right), h\right), w\right)\right)\right) \]
      21. *-lowering-*.f6479.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(w, D\right), h\right), w\right)\right)\right) \]
    9. Applied egg-rr79.2%

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

    if +inf.0 < (*.f64 (/.f64 c0 (*.f64 #s(literal 2 binary64) 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. Add Preprocessing
    3. Taylor expanded in c0 around -inf

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left({c0}^{2}\right), \color{blue}{\left(\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\left(c0 \cdot c0\right), \left(\color{blue}{\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\color{blue}{\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \color{blue}{\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}}\right)\right) \]
      5. distribute-lft1-inN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \frac{-1}{2} \cdot \frac{\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}\right)\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \frac{-1}{2} \cdot \frac{0 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}\right)\right) \]
      7. mul0-lftN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \frac{-1}{2} \cdot \frac{0}{w}\right)\right) \]
      8. div0N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \frac{-1}{2} \cdot 0\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + 0\right)\right) \]
      10. metadata-evalN/A

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{1}{4} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{d}\right), \color{blue}{d}\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{4} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)\right), d\right), d\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)\right), d\right), d\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(D \cdot D\right) \cdot \left({M}^{2} \cdot h\right)\right)\right), d\right), d\right) \]
      8. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(D \cdot \left(D \cdot \left({M}^{2} \cdot h\right)\right)\right)\right), d\right), d\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(D \cdot \left(\left({M}^{2} \cdot h\right) \cdot D\right)\right)\right), d\right), d\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \left(\left({M}^{2} \cdot h\right) \cdot D\right)\right)\right), d\right), d\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \left(D \cdot \left({M}^{2} \cdot h\right)\right)\right)\right), d\right), d\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \left({M}^{2} \cdot h\right)\right)\right)\right), d\right), d\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \left(h \cdot {M}^{2}\right)\right)\right)\right), d\right), d\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(h, \left({M}^{2}\right)\right)\right)\right)\right), d\right), d\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(h, \left(M \cdot M\right)\right)\right)\right)\right), d\right), d\right) \]
      16. *-lowering-*.f6456.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(h, \mathsf{*.f64}\left(M, M\right)\right)\right)\right)\right), d\right), d\right) \]
    8. Simplified56.2%

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

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

Alternative 2: 46.1% accurate, 4.7× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{\frac{0.25 \cdot \left(D \cdot \left(D \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)\right)}{d}}{d}\\
t_1 := \frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D \cdot \left(w \cdot \left(w \cdot h\right)\right)}\\
\mathbf{if}\;w \leq -4 \cdot 10^{-211}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;w \leq 1.45 \cdot 10^{-114}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;w \leq 3.4 \cdot 10^{+30}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if w < -4.00000000000000034e-211 or 1.44999999999999998e-114 < w < 3.4000000000000002e30

    1. Initial program 29.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. Add Preprocessing
    3. Taylor expanded in c0 around inf

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

        \[\leadsto \mathsf{/.f64}\left(\left({c0}^{2} \cdot {d}^{2}\right), \color{blue}{\left({D}^{2} \cdot \left(h \cdot {w}^{2}\right)\right)}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left({d}^{2} \cdot {c0}^{2}\right), \left(\color{blue}{{D}^{2}} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({d}^{2}\right), \left({c0}^{2}\right)\right), \left(\color{blue}{{D}^{2}} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(d \cdot d\right), \left({c0}^{2}\right)\right), \left({\color{blue}{D}}^{2} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \left({c0}^{2}\right)\right), \left({\color{blue}{D}}^{2} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \left(c0 \cdot c0\right)\right), \left({D}^{\color{blue}{2}} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \left({D}^{\color{blue}{2}} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\left({D}^{2}\right), \color{blue}{\left(h \cdot {w}^{2}\right)}\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\left(D \cdot D\right), \left(\color{blue}{h} \cdot {w}^{2}\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \left(\color{blue}{h} \cdot {w}^{2}\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \mathsf{*.f64}\left(h, \color{blue}{\left({w}^{2}\right)}\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \mathsf{*.f64}\left(h, \left(w \cdot \color{blue}{w}\right)\right)\right)\right) \]
      13. *-lowering-*.f6431.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \mathsf{*.f64}\left(h, \mathsf{*.f64}\left(w, \color{blue}{w}\right)\right)\right)\right) \]
    5. Simplified31.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)}} \]
    6. Step-by-step derivation
      1. unswap-sqrN/A

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

        \[\leadsto \frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{D \cdot \color{blue}{\left(D \cdot \left(h \cdot \left(w \cdot w\right)\right)\right)}} \]
      3. times-fracN/A

        \[\leadsto \frac{d \cdot c0}{D} \cdot \color{blue}{\frac{d \cdot c0}{D \cdot \left(h \cdot \left(w \cdot w\right)\right)}} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{d \cdot c0}{D}\right), \color{blue}{\left(\frac{d \cdot c0}{D \cdot \left(h \cdot \left(w \cdot w\right)\right)}\right)}\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{c0 \cdot d}{D}\right), \left(\frac{\color{blue}{d} \cdot c0}{D \cdot \left(h \cdot \left(w \cdot w\right)\right)}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(c0 \cdot d\right), D\right), \left(\frac{\color{blue}{d \cdot c0}}{D \cdot \left(h \cdot \left(w \cdot w\right)\right)}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \left(\frac{\color{blue}{d} \cdot c0}{D \cdot \left(h \cdot \left(w \cdot w\right)\right)}\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \left(\frac{c0 \cdot d}{\color{blue}{D} \cdot \left(h \cdot \left(w \cdot w\right)\right)}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\left(c0 \cdot d\right), \color{blue}{\left(D \cdot \left(h \cdot \left(w \cdot w\right)\right)\right)}\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \left(\color{blue}{D} \cdot \left(h \cdot \left(w \cdot w\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{*.f64}\left(D, \color{blue}{\left(h \cdot \left(w \cdot w\right)\right)}\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{*.f64}\left(D, \left(\left(w \cdot w\right) \cdot \color{blue}{h}\right)\right)\right)\right) \]
      13. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{*.f64}\left(D, \left(w \cdot \color{blue}{\left(w \cdot h\right)}\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(w, \color{blue}{\left(w \cdot h\right)}\right)\right)\right)\right) \]
      15. *-lowering-*.f6455.7%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), D\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(w, \mathsf{*.f64}\left(w, \color{blue}{h}\right)\right)\right)\right)\right) \]
    7. Applied egg-rr55.7%

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

    if -4.00000000000000034e-211 < w < 1.44999999999999998e-114 or 3.4000000000000002e30 < w

    1. Initial program 19.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. Add Preprocessing
    3. Taylor expanded in c0 around -inf

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left({c0}^{2}\right), \color{blue}{\left(\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\left(c0 \cdot c0\right), \left(\color{blue}{\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\color{blue}{\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \color{blue}{\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}}\right)\right) \]
      5. distribute-lft1-inN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \frac{-1}{2} \cdot \frac{\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}\right)\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \frac{-1}{2} \cdot \frac{0 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}\right)\right) \]
      7. mul0-lftN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \frac{-1}{2} \cdot \frac{0}{w}\right)\right) \]
      8. div0N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \frac{-1}{2} \cdot 0\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + 0\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \left(-1 + \color{blue}{1}\right)\right)\right) \]
    5. Simplified19.7%

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{1}{4} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{d}\right), \color{blue}{d}\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{4} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)\right), d\right), d\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)\right), d\right), d\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(D \cdot D\right) \cdot \left({M}^{2} \cdot h\right)\right)\right), d\right), d\right) \]
      8. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(D \cdot \left(D \cdot \left({M}^{2} \cdot h\right)\right)\right)\right), d\right), d\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(D \cdot \left(\left({M}^{2} \cdot h\right) \cdot D\right)\right)\right), d\right), d\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \left(\left({M}^{2} \cdot h\right) \cdot D\right)\right)\right), d\right), d\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \left(D \cdot \left({M}^{2} \cdot h\right)\right)\right)\right), d\right), d\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \left({M}^{2} \cdot h\right)\right)\right)\right), d\right), d\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \left(h \cdot {M}^{2}\right)\right)\right)\right), d\right), d\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(h, \left({M}^{2}\right)\right)\right)\right)\right), d\right), d\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(h, \left(M \cdot M\right)\right)\right)\right)\right), d\right), d\right) \]
      16. *-lowering-*.f6453.1%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(h, \mathsf{*.f64}\left(M, M\right)\right)\right)\right)\right), d\right), d\right) \]
    8. Simplified53.1%

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

Alternative 3: 45.6% accurate, 6.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;w \leq -2.7 \cdot 10^{-209}:\\
\;\;\;\;\left(c0 \cdot d\right) \cdot \frac{c0 \cdot d}{D \cdot \left(D \cdot \left(w \cdot \left(w \cdot h\right)\right)\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if w < -2.69999999999999998e-209

    1. Initial program 30.9%

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

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

        \[\leadsto \mathsf{/.f64}\left(\left({c0}^{2} \cdot {d}^{2}\right), \color{blue}{\left({D}^{2} \cdot \left(h \cdot {w}^{2}\right)\right)}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left({d}^{2} \cdot {c0}^{2}\right), \left(\color{blue}{{D}^{2}} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({d}^{2}\right), \left({c0}^{2}\right)\right), \left(\color{blue}{{D}^{2}} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(d \cdot d\right), \left({c0}^{2}\right)\right), \left({\color{blue}{D}}^{2} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \left({c0}^{2}\right)\right), \left({\color{blue}{D}}^{2} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \left(c0 \cdot c0\right)\right), \left({D}^{\color{blue}{2}} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \left({D}^{\color{blue}{2}} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\left({D}^{2}\right), \color{blue}{\left(h \cdot {w}^{2}\right)}\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\left(D \cdot D\right), \left(\color{blue}{h} \cdot {w}^{2}\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \left(\color{blue}{h} \cdot {w}^{2}\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \mathsf{*.f64}\left(h, \color{blue}{\left({w}^{2}\right)}\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \mathsf{*.f64}\left(h, \left(w \cdot \color{blue}{w}\right)\right)\right)\right) \]
      13. *-lowering-*.f6430.9%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \mathsf{*.f64}\left(h, \mathsf{*.f64}\left(w, \color{blue}{w}\right)\right)\right)\right) \]
    5. Simplified30.9%

      \[\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)}} \]
    6. Step-by-step derivation
      1. div-invN/A

        \[\leadsto \left(\left(d \cdot d\right) \cdot \left(c0 \cdot c0\right)\right) \cdot \color{blue}{\frac{1}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}} \]
      2. unswap-sqrN/A

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

        \[\leadsto \left(d \cdot c0\right) \cdot \color{blue}{\left(\left(d \cdot c0\right) \cdot \frac{1}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}\right)} \]
      4. *-commutativeN/A

        \[\leadsto \left(c0 \cdot d\right) \cdot \left(\color{blue}{\left(d \cdot c0\right)} \cdot \frac{1}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(c0 \cdot d\right), \color{blue}{\left(\left(d \cdot c0\right) \cdot \frac{1}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}\right)}\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, d\right), \left(\color{blue}{\left(d \cdot c0\right)} \cdot \frac{1}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, d\right), \left(\left(c0 \cdot d\right) \cdot \frac{\color{blue}{1}}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}\right)\right) \]
      8. un-div-invN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, d\right), \left(\frac{c0 \cdot d}{\color{blue}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{/.f64}\left(\left(c0 \cdot d\right), \color{blue}{\left(\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)\right)}\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \left(\color{blue}{\left(D \cdot D\right)} \cdot \left(h \cdot \left(w \cdot w\right)\right)\right)\right)\right) \]
      11. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \left(D \cdot \color{blue}{\left(D \cdot \left(h \cdot \left(w \cdot w\right)\right)\right)}\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{*.f64}\left(D, \color{blue}{\left(D \cdot \left(h \cdot \left(w \cdot w\right)\right)\right)}\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \color{blue}{\left(h \cdot \left(w \cdot w\right)\right)}\right)\right)\right)\right) \]
      14. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \left(\left(w \cdot w\right) \cdot \color{blue}{h}\right)\right)\right)\right)\right) \]
      15. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \left(w \cdot \color{blue}{\left(w \cdot h\right)}\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(w, \color{blue}{\left(w \cdot h\right)}\right)\right)\right)\right)\right) \]
      17. *-lowering-*.f6449.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(c0, d\right), \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(w, \mathsf{*.f64}\left(w, \color{blue}{h}\right)\right)\right)\right)\right)\right) \]
    7. Applied egg-rr49.2%

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

    if -2.69999999999999998e-209 < w

    1. Initial program 20.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. Add Preprocessing
    3. Taylor expanded in c0 around -inf

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left({c0}^{2}\right), \color{blue}{\left(\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\left(c0 \cdot c0\right), \left(\color{blue}{\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\color{blue}{\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \color{blue}{\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}}\right)\right) \]
      5. distribute-lft1-inN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \frac{-1}{2} \cdot \frac{\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}\right)\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \frac{-1}{2} \cdot \frac{0 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}\right)\right) \]
      7. mul0-lftN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \frac{-1}{2} \cdot \frac{0}{w}\right)\right) \]
      8. div0N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \frac{-1}{2} \cdot 0\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + 0\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \left(-1 + \color{blue}{1}\right)\right)\right) \]
    5. Simplified17.6%

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{1}{4} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{d}\right), \color{blue}{d}\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{4} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)\right), d\right), d\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)\right), d\right), d\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(D \cdot D\right) \cdot \left({M}^{2} \cdot h\right)\right)\right), d\right), d\right) \]
      8. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(D \cdot \left(D \cdot \left({M}^{2} \cdot h\right)\right)\right)\right), d\right), d\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(D \cdot \left(\left({M}^{2} \cdot h\right) \cdot D\right)\right)\right), d\right), d\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \left(\left({M}^{2} \cdot h\right) \cdot D\right)\right)\right), d\right), d\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \left(D \cdot \left({M}^{2} \cdot h\right)\right)\right)\right), d\right), d\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \left({M}^{2} \cdot h\right)\right)\right)\right), d\right), d\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \left(h \cdot {M}^{2}\right)\right)\right)\right), d\right), d\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(h, \left({M}^{2}\right)\right)\right)\right)\right), d\right), d\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(h, \left(M \cdot M\right)\right)\right)\right)\right), d\right), d\right) \]
      16. *-lowering-*.f6450.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(h, \mathsf{*.f64}\left(M, M\right)\right)\right)\right)\right), d\right), d\right) \]
    8. Simplified50.0%

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

Alternative 4: 46.0% accurate, 6.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;w \leq -1.75 \cdot 10^{-214}:\\
\;\;\;\;d \cdot \left(d \cdot \left(c0 \cdot \frac{c0}{D \cdot \left(D \cdot \left(w \cdot \left(w \cdot h\right)\right)\right)}\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if w < -1.75e-214

    1. Initial program 30.9%

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

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

        \[\leadsto \mathsf{/.f64}\left(\left({c0}^{2} \cdot {d}^{2}\right), \color{blue}{\left({D}^{2} \cdot \left(h \cdot {w}^{2}\right)\right)}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left({d}^{2} \cdot {c0}^{2}\right), \left(\color{blue}{{D}^{2}} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({d}^{2}\right), \left({c0}^{2}\right)\right), \left(\color{blue}{{D}^{2}} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(d \cdot d\right), \left({c0}^{2}\right)\right), \left({\color{blue}{D}}^{2} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \left({c0}^{2}\right)\right), \left({\color{blue}{D}}^{2} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \left(c0 \cdot c0\right)\right), \left({D}^{\color{blue}{2}} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \left({D}^{\color{blue}{2}} \cdot \left(h \cdot {w}^{2}\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\left({D}^{2}\right), \color{blue}{\left(h \cdot {w}^{2}\right)}\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\left(D \cdot D\right), \left(\color{blue}{h} \cdot {w}^{2}\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \left(\color{blue}{h} \cdot {w}^{2}\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \mathsf{*.f64}\left(h, \color{blue}{\left({w}^{2}\right)}\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \mathsf{*.f64}\left(h, \left(w \cdot \color{blue}{w}\right)\right)\right)\right) \]
      13. *-lowering-*.f6430.9%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(d, d\right), \mathsf{*.f64}\left(c0, c0\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \mathsf{*.f64}\left(h, \mathsf{*.f64}\left(w, \color{blue}{w}\right)\right)\right)\right) \]
    5. Simplified30.9%

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

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

        \[\leadsto d \cdot \color{blue}{\left(d \cdot \frac{c0 \cdot c0}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}\right)} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(d, \color{blue}{\left(d \cdot \frac{c0 \cdot c0}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}\right)}\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(d, \color{blue}{\left(\frac{c0 \cdot c0}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}\right)}\right)\right) \]
      5. associate-/l*N/A

        \[\leadsto \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(d, \left(c0 \cdot \color{blue}{\frac{c0}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}}\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(c0, \color{blue}{\left(\frac{c0}{\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)}\right)}\right)\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(c0, \color{blue}{\left(\left(D \cdot D\right) \cdot \left(h \cdot \left(w \cdot w\right)\right)\right)}\right)\right)\right)\right) \]
      8. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(c0, \left(D \cdot \color{blue}{\left(D \cdot \left(h \cdot \left(w \cdot w\right)\right)\right)}\right)\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(D, \color{blue}{\left(D \cdot \left(h \cdot \left(w \cdot w\right)\right)\right)}\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \color{blue}{\left(h \cdot \left(w \cdot w\right)\right)}\right)\right)\right)\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \left(\left(w \cdot w\right) \cdot \color{blue}{h}\right)\right)\right)\right)\right)\right)\right) \]
      12. associate-*l*N/A

        \[\leadsto \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \left(w \cdot \color{blue}{\left(w \cdot h\right)}\right)\right)\right)\right)\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(w, \color{blue}{\left(w \cdot h\right)}\right)\right)\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f6448.4%

        \[\leadsto \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(d, \mathsf{*.f64}\left(c0, \mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(w, \mathsf{*.f64}\left(w, \color{blue}{h}\right)\right)\right)\right)\right)\right)\right)\right) \]
    7. Applied egg-rr48.4%

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

    if -1.75e-214 < w

    1. Initial program 20.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. Add Preprocessing
    3. Taylor expanded in c0 around -inf

      \[\leadsto \color{blue}{{c0}^{2} \cdot \left(\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left({c0}^{2}\right), \color{blue}{\left(\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\left(c0 \cdot c0\right), \left(\color{blue}{\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\color{blue}{\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \color{blue}{\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}}\right)\right) \]
      5. distribute-lft1-inN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \frac{-1}{2} \cdot \frac{\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}\right)\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \frac{-1}{2} \cdot \frac{0 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}\right)\right) \]
      7. mul0-lftN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \frac{-1}{2} \cdot \frac{0}{w}\right)\right) \]
      8. div0N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \frac{-1}{2} \cdot 0\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + 0\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \left(-1 + \color{blue}{1}\right)\right)\right) \]
    5. Simplified17.6%

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{1}{4} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{d}\right), \color{blue}{d}\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{4} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)\right), d\right), d\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)\right), d\right), d\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(D \cdot D\right) \cdot \left({M}^{2} \cdot h\right)\right)\right), d\right), d\right) \]
      8. associate-*l*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(D \cdot \left(D \cdot \left({M}^{2} \cdot h\right)\right)\right)\right), d\right), d\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(D \cdot \left(\left({M}^{2} \cdot h\right) \cdot D\right)\right)\right), d\right), d\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \left(\left({M}^{2} \cdot h\right) \cdot D\right)\right)\right), d\right), d\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \left(D \cdot \left({M}^{2} \cdot h\right)\right)\right)\right), d\right), d\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \left({M}^{2} \cdot h\right)\right)\right)\right), d\right), d\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \left(h \cdot {M}^{2}\right)\right)\right)\right), d\right), d\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(h, \left({M}^{2}\right)\right)\right)\right)\right), d\right), d\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(h, \left(M \cdot M\right)\right)\right)\right)\right), d\right), d\right) \]
      16. *-lowering-*.f6450.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(h, \mathsf{*.f64}\left(M, M\right)\right)\right)\right)\right), d\right), d\right) \]
    8. Simplified50.0%

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

Alternative 5: 33.4% accurate, 9.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;D \leq 1.2 \cdot 10^{+66}:\\
\;\;\;\;0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if D < 1.2000000000000001e66

    1. Initial program 26.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. Add Preprocessing
    3. Taylor expanded in c0 around -inf

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

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \color{blue}{\frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}}\right) \]
      2. distribute-lft1-inN/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}\right) \]
      3. metadata-evalN/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{0 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}\right) \]
      4. mul0-lftN/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{0}{w}\right) \]
      5. div0N/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot 0\right) \]
      6. mul0-rgtN/A

        \[\leadsto \frac{-1}{2} \cdot 0 \]
      7. metadata-eval29.7%

        \[\leadsto 0 \]
    5. Simplified29.7%

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

    if 1.2000000000000001e66 < D

    1. Initial program 12.9%

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \color{blue}{\left(2 \cdot \frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}\right) \]
    4. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{2 \cdot \left(c0 \cdot {d}^{2}\right)}{\color{blue}{{D}^{2} \cdot \left(h \cdot w\right)}}\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\left(2 \cdot \left(c0 \cdot {d}^{2}\right)\right), \color{blue}{\left({D}^{2} \cdot \left(h \cdot w\right)\right)}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \left(c0 \cdot {d}^{2}\right)\right), \left(\color{blue}{{D}^{2}} \cdot \left(h \cdot w\right)\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \left({d}^{2}\right)\right)\right), \left({D}^{\color{blue}{2}} \cdot \left(h \cdot w\right)\right)\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \left(d \cdot d\right)\right)\right), \left({D}^{2} \cdot \left(h \cdot w\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \left({D}^{2} \cdot \left(h \cdot w\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \mathsf{*.f64}\left(\left({D}^{2}\right), \color{blue}{\left(h \cdot w\right)}\right)\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \mathsf{*.f64}\left(\left(D \cdot D\right), \left(\color{blue}{h} \cdot w\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \left(\color{blue}{h} \cdot w\right)\right)\right)\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \left(w \cdot \color{blue}{h}\right)\right)\right)\right) \]
      11. *-lowering-*.f6413.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \mathsf{*.f64}\left(w, \color{blue}{h}\right)\right)\right)\right) \]
    5. Simplified13.4%

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\left(w \cdot h\right) \cdot \color{blue}{\left(D \cdot D\right)}}\right)\right) \]
      2. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(2 \cdot \color{blue}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}}\right)\right) \]
      3. count-2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \color{blue}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}}\right)\right) \]
      4. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \frac{\frac{c0 \cdot \left(d \cdot d\right)}{w \cdot h}}{\color{blue}{D \cdot D}}\right)\right) \]
      5. associate-/l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{\color{blue}{D} \cdot D}\right)\right) \]
      6. flip-+N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{\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)} - \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D} \cdot \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D}}{\color{blue}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D}}}\right)\right) \]
      7. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{1}{\color{blue}{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D}}{\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)} - \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D} \cdot \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D}}}}\right)\right) \]
    7. Applied egg-rr17.6%

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

      \[\leadsto \color{blue}{\frac{1}{4} \cdot \frac{{D}^{2} \cdot h}{{d}^{2}}} \]
    9. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \color{blue}{\left(\frac{{D}^{2} \cdot h}{{d}^{2}}\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \left(\frac{{D}^{2} \cdot h}{d \cdot \color{blue}{d}}\right)\right) \]
      3. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \left(\frac{\frac{{D}^{2} \cdot h}{d}}{\color{blue}{d}}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\left(\frac{{D}^{2} \cdot h}{d}\right), \color{blue}{d}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left({D}^{2} \cdot h\right), d\right), d\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({D}^{2}\right), h\right), d\right), d\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(D \cdot D\right), h\right), d\right), d\right)\right) \]
      8. *-lowering-*.f6440.2%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), h\right), d\right), d\right)\right) \]
    10. Simplified40.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;D \leq 1.2 \cdot 10^{+66}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;0.25 \cdot \frac{\frac{h \cdot \left(D \cdot D\right)}{d}}{d}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 33.8% accurate, 9.4× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0.25 \cdot \frac{\frac{D \cdot D}{d}}{\frac{d}{h}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 3.39999999999999982e-106

    1. Initial program 27.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. Add Preprocessing
    3. Taylor expanded in c0 around -inf

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

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \color{blue}{\frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}}\right) \]
      2. distribute-lft1-inN/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}\right) \]
      3. metadata-evalN/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{0 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}\right) \]
      4. mul0-lftN/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{0}{w}\right) \]
      5. div0N/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot 0\right) \]
      6. mul0-rgtN/A

        \[\leadsto \frac{-1}{2} \cdot 0 \]
      7. metadata-eval29.5%

        \[\leadsto 0 \]
    5. Simplified29.5%

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

    if 3.39999999999999982e-106 < M

    1. Initial program 17.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. Add Preprocessing
    3. Taylor expanded in c0 around inf

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \color{blue}{\left(2 \cdot \frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}\right) \]
    4. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{2 \cdot \left(c0 \cdot {d}^{2}\right)}{\color{blue}{{D}^{2} \cdot \left(h \cdot w\right)}}\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\left(2 \cdot \left(c0 \cdot {d}^{2}\right)\right), \color{blue}{\left({D}^{2} \cdot \left(h \cdot w\right)\right)}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \left(c0 \cdot {d}^{2}\right)\right), \left(\color{blue}{{D}^{2}} \cdot \left(h \cdot w\right)\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \left({d}^{2}\right)\right)\right), \left({D}^{\color{blue}{2}} \cdot \left(h \cdot w\right)\right)\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \left(d \cdot d\right)\right)\right), \left({D}^{2} \cdot \left(h \cdot w\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \left({D}^{2} \cdot \left(h \cdot w\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \mathsf{*.f64}\left(\left({D}^{2}\right), \color{blue}{\left(h \cdot w\right)}\right)\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \mathsf{*.f64}\left(\left(D \cdot D\right), \left(\color{blue}{h} \cdot w\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \left(\color{blue}{h} \cdot w\right)\right)\right)\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \left(w \cdot \color{blue}{h}\right)\right)\right)\right) \]
      11. *-lowering-*.f6430.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \mathsf{*.f64}\left(w, \color{blue}{h}\right)\right)\right)\right) \]
    5. Simplified30.8%

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\left(w \cdot h\right) \cdot \color{blue}{\left(D \cdot D\right)}}\right)\right) \]
      2. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(2 \cdot \color{blue}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}}\right)\right) \]
      3. count-2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \color{blue}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}}\right)\right) \]
      4. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \frac{\frac{c0 \cdot \left(d \cdot d\right)}{w \cdot h}}{\color{blue}{D \cdot D}}\right)\right) \]
      5. associate-/l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{\color{blue}{D} \cdot D}\right)\right) \]
      6. flip-+N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{\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)} - \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D} \cdot \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D}}{\color{blue}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D}}}\right)\right) \]
      7. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{1}{\color{blue}{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D}}{\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)} - \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D} \cdot \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D}}}}\right)\right) \]
    7. Applied egg-rr22.8%

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

      \[\leadsto \color{blue}{\frac{1}{4} \cdot \frac{{D}^{2} \cdot h}{{d}^{2}}} \]
    9. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \color{blue}{\left(\frac{{D}^{2} \cdot h}{{d}^{2}}\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \left(\frac{{D}^{2} \cdot h}{d \cdot \color{blue}{d}}\right)\right) \]
      3. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \left(\frac{\frac{{D}^{2} \cdot h}{d}}{\color{blue}{d}}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\left(\frac{{D}^{2} \cdot h}{d}\right), \color{blue}{d}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left({D}^{2} \cdot h\right), d\right), d\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({D}^{2}\right), h\right), d\right), d\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(D \cdot D\right), h\right), d\right), d\right)\right) \]
      8. *-lowering-*.f6432.2%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), h\right), d\right), d\right)\right) \]
    10. Simplified32.2%

      \[\leadsto \color{blue}{0.25 \cdot \frac{\frac{\left(D \cdot D\right) \cdot h}{d}}{d}} \]
    11. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \left(\frac{\left(D \cdot D\right) \cdot h}{\color{blue}{d \cdot d}}\right)\right) \]
      2. times-fracN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \left(\frac{D \cdot D}{d} \cdot \color{blue}{\frac{h}{d}}\right)\right) \]
      3. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \left(\frac{D \cdot D}{d} \cdot \frac{1}{\color{blue}{\frac{d}{h}}}\right)\right) \]
      4. un-div-invN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \left(\frac{\frac{D \cdot D}{d}}{\color{blue}{\frac{d}{h}}}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\left(\frac{D \cdot D}{d}\right), \color{blue}{\left(\frac{d}{h}\right)}\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(D \cdot D\right), d\right), \left(\frac{\color{blue}{d}}{h}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \left(\frac{d}{h}\right)\right)\right) \]
      8. /-lowering-/.f6433.4%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(d, \color{blue}{h}\right)\right)\right) \]
    12. Applied egg-rr33.4%

      \[\leadsto 0.25 \cdot \color{blue}{\frac{\frac{D \cdot D}{d}}{\frac{d}{h}}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 33.8% accurate, 9.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 1.05000000000000002e-106

    1. Initial program 27.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. Add Preprocessing
    3. Taylor expanded in c0 around -inf

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

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \color{blue}{\frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}}\right) \]
      2. distribute-lft1-inN/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}\right) \]
      3. metadata-evalN/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{0 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}\right) \]
      4. mul0-lftN/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{0}{w}\right) \]
      5. div0N/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot 0\right) \]
      6. mul0-rgtN/A

        \[\leadsto \frac{-1}{2} \cdot 0 \]
      7. metadata-eval29.5%

        \[\leadsto 0 \]
    5. Simplified29.5%

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

    if 1.05000000000000002e-106 < M

    1. Initial program 17.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. Add Preprocessing
    3. Taylor expanded in c0 around inf

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \color{blue}{\left(2 \cdot \frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}\right) \]
    4. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{2 \cdot \left(c0 \cdot {d}^{2}\right)}{\color{blue}{{D}^{2} \cdot \left(h \cdot w\right)}}\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\left(2 \cdot \left(c0 \cdot {d}^{2}\right)\right), \color{blue}{\left({D}^{2} \cdot \left(h \cdot w\right)\right)}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \left(c0 \cdot {d}^{2}\right)\right), \left(\color{blue}{{D}^{2}} \cdot \left(h \cdot w\right)\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \left({d}^{2}\right)\right)\right), \left({D}^{\color{blue}{2}} \cdot \left(h \cdot w\right)\right)\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \left(d \cdot d\right)\right)\right), \left({D}^{2} \cdot \left(h \cdot w\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \left({D}^{2} \cdot \left(h \cdot w\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \mathsf{*.f64}\left(\left({D}^{2}\right), \color{blue}{\left(h \cdot w\right)}\right)\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \mathsf{*.f64}\left(\left(D \cdot D\right), \left(\color{blue}{h} \cdot w\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \left(\color{blue}{h} \cdot w\right)\right)\right)\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \left(w \cdot \color{blue}{h}\right)\right)\right)\right) \]
      11. *-lowering-*.f6430.8%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \mathsf{*.f64}\left(w, \color{blue}{h}\right)\right)\right)\right) \]
    5. Simplified30.8%

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\left(w \cdot h\right) \cdot \color{blue}{\left(D \cdot D\right)}}\right)\right) \]
      2. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(2 \cdot \color{blue}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}}\right)\right) \]
      3. count-2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \color{blue}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}}\right)\right) \]
      4. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \frac{\frac{c0 \cdot \left(d \cdot d\right)}{w \cdot h}}{\color{blue}{D \cdot D}}\right)\right) \]
      5. associate-/l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{\color{blue}{D} \cdot D}\right)\right) \]
      6. flip-+N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{\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)} - \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D} \cdot \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D}}{\color{blue}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D}}}\right)\right) \]
      7. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{1}{\color{blue}{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D}}{\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)} - \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D} \cdot \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D}}}}\right)\right) \]
    7. Applied egg-rr22.8%

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

      \[\leadsto \color{blue}{\frac{1}{4} \cdot \frac{{D}^{2} \cdot h}{{d}^{2}}} \]
    9. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \color{blue}{\left(\frac{{D}^{2} \cdot h}{{d}^{2}}\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \left(\frac{{D}^{2} \cdot h}{d \cdot \color{blue}{d}}\right)\right) \]
      3. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \left(\frac{\frac{{D}^{2} \cdot h}{d}}{\color{blue}{d}}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\left(\frac{{D}^{2} \cdot h}{d}\right), \color{blue}{d}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left({D}^{2} \cdot h\right), d\right), d\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({D}^{2}\right), h\right), d\right), d\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(D \cdot D\right), h\right), d\right), d\right)\right) \]
      8. *-lowering-*.f6432.2%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), h\right), d\right), d\right)\right) \]
    10. Simplified32.2%

      \[\leadsto \color{blue}{0.25 \cdot \frac{\frac{\left(D \cdot D\right) \cdot h}{d}}{d}} \]
    11. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \left(\frac{\left(D \cdot D\right) \cdot h}{\color{blue}{d \cdot d}}\right)\right) \]
      2. times-fracN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \left(\frac{D \cdot D}{d} \cdot \color{blue}{\frac{h}{d}}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(\frac{D \cdot D}{d}\right), \color{blue}{\left(\frac{h}{d}\right)}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\left(D \cdot D\right), d\right), \left(\frac{\color{blue}{h}}{d}\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \left(\frac{h}{d}\right)\right)\right) \]
      6. /-lowering-/.f6433.4%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(D, D\right), d\right), \mathsf{/.f64}\left(h, \color{blue}{d}\right)\right)\right) \]
    12. Applied egg-rr33.4%

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

Alternative 8: 33.8% accurate, 9.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 2.4e-14

    1. Initial program 26.4%

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

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

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \color{blue}{\frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}}\right) \]
      2. distribute-lft1-inN/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}\right) \]
      3. metadata-evalN/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{0 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}\right) \]
      4. mul0-lftN/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{0}{w}\right) \]
      5. div0N/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot 0\right) \]
      6. mul0-rgtN/A

        \[\leadsto \frac{-1}{2} \cdot 0 \]
      7. metadata-eval31.1%

        \[\leadsto 0 \]
    5. Simplified31.1%

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

    if 2.4e-14 < M

    1. Initial program 17.6%

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \color{blue}{\left(2 \cdot \frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)}\right) \]
    4. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{2 \cdot \left(c0 \cdot {d}^{2}\right)}{\color{blue}{{D}^{2} \cdot \left(h \cdot w\right)}}\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\left(2 \cdot \left(c0 \cdot {d}^{2}\right)\right), \color{blue}{\left({D}^{2} \cdot \left(h \cdot w\right)\right)}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \left(c0 \cdot {d}^{2}\right)\right), \left(\color{blue}{{D}^{2}} \cdot \left(h \cdot w\right)\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \left({d}^{2}\right)\right)\right), \left({D}^{\color{blue}{2}} \cdot \left(h \cdot w\right)\right)\right)\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \left(d \cdot d\right)\right)\right), \left({D}^{2} \cdot \left(h \cdot w\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \left({D}^{2} \cdot \left(h \cdot w\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \mathsf{*.f64}\left(\left({D}^{2}\right), \color{blue}{\left(h \cdot w\right)}\right)\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \mathsf{*.f64}\left(\left(D \cdot D\right), \left(\color{blue}{h} \cdot w\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \left(\color{blue}{h} \cdot w\right)\right)\right)\right) \]
      10. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \left(w \cdot \color{blue}{h}\right)\right)\right)\right) \]
      11. *-lowering-*.f6435.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \mathsf{/.f64}\left(\mathsf{*.f64}\left(2, \mathsf{*.f64}\left(c0, \mathsf{*.f64}\left(d, d\right)\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \mathsf{*.f64}\left(w, \color{blue}{h}\right)\right)\right)\right) \]
    5. Simplified35.3%

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\left(w \cdot h\right) \cdot \color{blue}{\left(D \cdot D\right)}}\right)\right) \]
      2. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(2 \cdot \color{blue}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}}\right)\right) \]
      3. count-2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \color{blue}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}}\right)\right) \]
      4. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \frac{\frac{c0 \cdot \left(d \cdot d\right)}{w \cdot h}}{\color{blue}{D \cdot D}}\right)\right) \]
      5. associate-/l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{\color{blue}{D} \cdot D}\right)\right) \]
      6. flip-+N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{\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)} - \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D} \cdot \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D}}{\color{blue}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D}}}\right)\right) \]
      7. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(c0, \mathsf{*.f64}\left(2, w\right)\right), \left(\frac{1}{\color{blue}{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D}}{\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)} - \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D} \cdot \frac{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{h}}{w}}{D \cdot D}}}}\right)\right) \]
    7. Applied egg-rr18.9%

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

      \[\leadsto \color{blue}{\frac{1}{4} \cdot \frac{{D}^{2} \cdot h}{{d}^{2}}} \]
    9. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \color{blue}{\left(\frac{{D}^{2} \cdot h}{{d}^{2}}\right)}\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \left(\frac{{D}^{2} \cdot h}{d \cdot \color{blue}{d}}\right)\right) \]
      3. associate-/r*N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \left(\frac{\frac{{D}^{2} \cdot h}{d}}{\color{blue}{d}}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\left(\frac{{D}^{2} \cdot h}{d}\right), \color{blue}{d}\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left({D}^{2} \cdot h\right), d\right), d\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\left({D}^{2}\right), h\right), d\right), d\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\left(D \cdot D\right), h\right), d\right), d\right)\right) \]
      8. *-lowering-*.f6428.0%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), h\right), d\right), d\right)\right) \]
    10. Simplified28.0%

      \[\leadsto \color{blue}{0.25 \cdot \frac{\frac{\left(D \cdot D\right) \cdot h}{d}}{d}} \]
    11. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \left(\frac{\left(D \cdot D\right) \cdot h}{\color{blue}{d \cdot d}}\right)\right) \]
      2. associate-/l*N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \left(\left(D \cdot D\right) \cdot \color{blue}{\frac{h}{d \cdot d}}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(D \cdot D\right), \color{blue}{\left(\frac{h}{d \cdot d}\right)}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \left(\frac{\color{blue}{h}}{d \cdot d}\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \mathsf{/.f64}\left(h, \color{blue}{\left(d \cdot d\right)}\right)\right)\right) \]
      6. *-lowering-*.f6423.3%

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(D, D\right), \mathsf{/.f64}\left(h, \mathsf{*.f64}\left(d, \color{blue}{d}\right)\right)\right)\right) \]
    12. Applied egg-rr23.3%

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

Alternative 9: 47.4% accurate, 10.1× speedup?

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

\\
\frac{\frac{0.25 \cdot \left(D \cdot \left(D \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)\right)}{d}}{d}
\end{array}
Derivation
  1. Initial program 24.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. Add Preprocessing
  3. Taylor expanded in c0 around -inf

    \[\leadsto \color{blue}{{c0}^{2} \cdot \left(\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)} \]
  4. Step-by-step derivation
    1. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\left({c0}^{2}\right), \color{blue}{\left(\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)}\right) \]
    2. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\left(c0 \cdot c0\right), \left(\color{blue}{\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\color{blue}{\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}} + \frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}}\right)\right) \]
    4. +-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \color{blue}{\frac{-1}{2} \cdot \frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}}\right)\right) \]
    5. distribute-lft1-inN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \frac{-1}{2} \cdot \frac{\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}\right)\right) \]
    6. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \frac{-1}{2} \cdot \frac{0 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}\right)\right) \]
    7. mul0-lftN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \frac{-1}{2} \cdot \frac{0}{w}\right)\right) \]
    8. div0N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + \frac{-1}{2} \cdot 0\right)\right) \]
    9. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(c0, c0\right), \left(\frac{1}{4} \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{c0}^{2} \cdot {d}^{2}} + 0\right)\right) \]
    10. metadata-evalN/A

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\left(\frac{\frac{1}{4} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{d}\right), \color{blue}{d}\right) \]
    5. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{4} \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)\right), d\right), d\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)\right), d\right), d\right) \]
    7. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(D \cdot D\right) \cdot \left({M}^{2} \cdot h\right)\right)\right), d\right), d\right) \]
    8. associate-*l*N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(D \cdot \left(D \cdot \left({M}^{2} \cdot h\right)\right)\right)\right), d\right), d\right) \]
    9. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(D \cdot \left(\left({M}^{2} \cdot h\right) \cdot D\right)\right)\right), d\right), d\right) \]
    10. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \left(\left({M}^{2} \cdot h\right) \cdot D\right)\right)\right), d\right), d\right) \]
    11. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \left(D \cdot \left({M}^{2} \cdot h\right)\right)\right)\right), d\right), d\right) \]
    12. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \left({M}^{2} \cdot h\right)\right)\right)\right), d\right), d\right) \]
    13. *-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \left(h \cdot {M}^{2}\right)\right)\right)\right), d\right), d\right) \]
    14. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(h, \left({M}^{2}\right)\right)\right)\right)\right), d\right), d\right) \]
    15. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(h, \left(M \cdot M\right)\right)\right)\right)\right), d\right), d\right) \]
    16. *-lowering-*.f6445.0%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(D, \mathsf{*.f64}\left(h, \mathsf{*.f64}\left(M, M\right)\right)\right)\right)\right), d\right), d\right) \]
  8. Simplified45.0%

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

Alternative 10: 33.3% 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 24.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. Add Preprocessing
  3. Taylor expanded in c0 around -inf

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

      \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \color{blue}{\frac{-1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)} + \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}}\right) \]
    2. distribute-lft1-inN/A

      \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{\left(-1 + 1\right) \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}\right) \]
    3. metadata-evalN/A

      \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{0 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}}{w}\right) \]
    4. mul0-lftN/A

      \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{0}{w}\right) \]
    5. div0N/A

      \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot 0\right) \]
    6. mul0-rgtN/A

      \[\leadsto \frac{-1}{2} \cdot 0 \]
    7. metadata-eval29.0%

      \[\leadsto 0 \]
  5. Simplified29.0%

    \[\leadsto \color{blue}{0} \]
  6. Add Preprocessing

Reproduce

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