Henrywood and Agarwal, Equation (13)

Percentage Accurate: 24.0% → 46.9%
Time: 18.5s
Alternatives: 7
Speedup: 156.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 7 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: 46.9% accurate, 2.2× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ \begin{array}{l} t_0 := \frac{c0 \cdot d}{D}\\ \mathbf{if}\;M\_m \leq 6.5 \cdot 10^{-188}:\\ \;\;\;\;t\_0 \cdot \frac{\frac{t\_0}{w \cdot h}}{w}\\ \mathbf{elif}\;M\_m \leq 7.8 \cdot 10^{-150}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \left(d \cdot \left(c0 \cdot \frac{d}{D \cdot \left(w \cdot \left(D \cdot \left(w \cdot h\right)\right)\right)}\right)\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
(FPCore (c0 w h D d M_m)
 :precision binary64
 (let* ((t_0 (/ (* c0 d) D)))
   (if (<= M_m 6.5e-188)
     (* t_0 (/ (/ t_0 (* w h)) w))
     (if (<= M_m 7.8e-150)
       0.0
       (* c0 (* d (* c0 (/ d (* D (* w (* D (* w h))))))))))))
M_m = fabs(M);
double code(double c0, double w, double h, double D, double d, double M_m) {
	double t_0 = (c0 * d) / D;
	double tmp;
	if (M_m <= 6.5e-188) {
		tmp = t_0 * ((t_0 / (w * h)) / w);
	} else if (M_m <= 7.8e-150) {
		tmp = 0.0;
	} else {
		tmp = c0 * (d * (c0 * (d / (D * (w * (D * (w * h)))))));
	}
	return tmp;
}
M_m = abs(m)
real(8) function code(c0, w, h, d, d_1, m_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_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (c0 * d_1) / d
    if (m_m <= 6.5d-188) then
        tmp = t_0 * ((t_0 / (w * h)) / w)
    else if (m_m <= 7.8d-150) then
        tmp = 0.0d0
    else
        tmp = c0 * (d_1 * (c0 * (d_1 / (d * (w * (d * (w * h)))))))
    end if
    code = tmp
end function
M_m = Math.abs(M);
public static double code(double c0, double w, double h, double D, double d, double M_m) {
	double t_0 = (c0 * d) / D;
	double tmp;
	if (M_m <= 6.5e-188) {
		tmp = t_0 * ((t_0 / (w * h)) / w);
	} else if (M_m <= 7.8e-150) {
		tmp = 0.0;
	} else {
		tmp = c0 * (d * (c0 * (d / (D * (w * (D * (w * h)))))));
	}
	return tmp;
}
M_m = math.fabs(M)
def code(c0, w, h, D, d, M_m):
	t_0 = (c0 * d) / D
	tmp = 0
	if M_m <= 6.5e-188:
		tmp = t_0 * ((t_0 / (w * h)) / w)
	elif M_m <= 7.8e-150:
		tmp = 0.0
	else:
		tmp = c0 * (d * (c0 * (d / (D * (w * (D * (w * h)))))))
	return tmp
M_m = abs(M)
function code(c0, w, h, D, d, M_m)
	t_0 = Float64(Float64(c0 * d) / D)
	tmp = 0.0
	if (M_m <= 6.5e-188)
		tmp = Float64(t_0 * Float64(Float64(t_0 / Float64(w * h)) / w));
	elseif (M_m <= 7.8e-150)
		tmp = 0.0;
	else
		tmp = Float64(c0 * Float64(d * Float64(c0 * Float64(d / Float64(D * Float64(w * Float64(D * Float64(w * h))))))));
	end
	return tmp
end
M_m = abs(M);
function tmp_2 = code(c0, w, h, D, d, M_m)
	t_0 = (c0 * d) / D;
	tmp = 0.0;
	if (M_m <= 6.5e-188)
		tmp = t_0 * ((t_0 / (w * h)) / w);
	elseif (M_m <= 7.8e-150)
		tmp = 0.0;
	else
		tmp = c0 * (d * (c0 * (d / (D * (w * (D * (w * h)))))));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
code[c0_, w_, h_, D_, d_, M$95$m_] := Block[{t$95$0 = N[(N[(c0 * d), $MachinePrecision] / D), $MachinePrecision]}, If[LessEqual[M$95$m, 6.5e-188], N[(t$95$0 * N[(N[(t$95$0 / N[(w * h), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision], If[LessEqual[M$95$m, 7.8e-150], 0.0, N[(c0 * N[(d * N[(c0 * N[(d / N[(D * N[(w * N[(D * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|

\\
\begin{array}{l}
t_0 := \frac{c0 \cdot d}{D}\\
\mathbf{if}\;M\_m \leq 6.5 \cdot 10^{-188}:\\
\;\;\;\;t\_0 \cdot \frac{\frac{t\_0}{w \cdot h}}{w}\\

\mathbf{elif}\;M\_m \leq 7.8 \cdot 10^{-150}:\\
\;\;\;\;0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if M < 6.4999999999999998e-188

    1. Initial program 19.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{{c0}^{2} \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{c0 \cdot d}}{D} \cdot \frac{c0 \cdot d}{D \cdot \left(h \cdot \left(w \cdot w\right)\right)} \]
      9. lower-/.f64N/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)}} \]
      10. lower-*.f64N/A

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

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

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

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

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

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

        \[\leadsto \frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D \cdot \color{blue}{\left(\left(w \cdot h\right) \cdot w\right)}} \]
      17. lower-*.f6442.3

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

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

        \[\leadsto \frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D \cdot \color{blue}{\left(w \cdot \left(w \cdot h\right)\right)}} \]
      20. lower-*.f6442.3

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{c0 \cdot d}{D} \cdot \color{blue}{\frac{\frac{\frac{c0 \cdot d}{D}}{w \cdot h}}{w}} \]
      9. lower-/.f64N/A

        \[\leadsto \frac{c0 \cdot d}{D} \cdot \color{blue}{\frac{\frac{\frac{c0 \cdot d}{D}}{w \cdot h}}{w}} \]
      10. lower-/.f6447.5

        \[\leadsto \frac{c0 \cdot d}{D} \cdot \frac{\color{blue}{\frac{\frac{c0 \cdot d}{D}}{w \cdot h}}}{w} \]
    9. Applied rewrites47.5%

      \[\leadsto \frac{c0 \cdot d}{D} \cdot \color{blue}{\frac{\frac{\frac{c0 \cdot d}{D}}{w \cdot h}}{w}} \]

    if 6.4999999999999998e-188 < M < 7.8000000000000004e-150

    1. Initial program 8.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{-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 \color{blue}{\left({c0}^{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)} \]
      2. distribute-lft1-inN/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{\color{blue}{\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{\color{blue}{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{\color{blue}{0}}{w}\right) \]
      5. div0N/A

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

        \[\leadsto \frac{-1}{2} \cdot \color{blue}{0} \]
      7. metadata-eval70.2

        \[\leadsto \color{blue}{0} \]
    5. Applied rewrites70.2%

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

    if 7.8000000000000004e-150 < M

    1. Initial program 24.4%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. 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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{c0 \cdot d}}{D} \cdot \frac{c0 \cdot d}{D \cdot \left(h \cdot \left(w \cdot w\right)\right)} \]
      9. lower-/.f64N/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)}} \]
      10. lower-*.f64N/A

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

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

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

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

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

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

        \[\leadsto \frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D \cdot \color{blue}{\left(\left(w \cdot h\right) \cdot w\right)}} \]
      17. lower-*.f6457.4

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

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

        \[\leadsto \frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D \cdot \color{blue}{\left(w \cdot \left(w \cdot h\right)\right)}} \]
      20. lower-*.f6457.4

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 6.5 \cdot 10^{-188}:\\ \;\;\;\;\frac{c0 \cdot d}{D} \cdot \frac{\frac{\frac{c0 \cdot d}{D}}{w \cdot h}}{w}\\ \mathbf{elif}\;M \leq 7.8 \cdot 10^{-150}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \left(d \cdot \left(c0 \cdot \frac{d}{D \cdot \left(w \cdot \left(D \cdot \left(w \cdot h\right)\right)\right)}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 53.3% accurate, 0.7× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ \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}{w \cdot 2} \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M\_m \cdot M\_m}\right) \leq \infty:\\ \;\;\;\;c0 \cdot \left(c0 \cdot \frac{d \cdot d}{D \cdot \left(w \cdot \left(h \cdot \left(D \cdot w\right)\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
(FPCore (c0 w h D d M_m)
 :precision binary64
 (let* ((t_0 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
   (if (<=
        (* (/ c0 (* w 2.0)) (+ t_0 (sqrt (- (* t_0 t_0) (* M_m M_m)))))
        INFINITY)
     (* c0 (* c0 (/ (* d d) (* D (* w (* h (* D w)))))))
     0.0)))
M_m = fabs(M);
double code(double c0, double w, double h, double D, double d, double M_m) {
	double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
	double tmp;
	if (((c0 / (w * 2.0)) * (t_0 + sqrt(((t_0 * t_0) - (M_m * M_m))))) <= ((double) INFINITY)) {
		tmp = c0 * (c0 * ((d * d) / (D * (w * (h * (D * w))))));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
M_m = Math.abs(M);
public static double code(double c0, double w, double h, double D, double d, double M_m) {
	double t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
	double tmp;
	if (((c0 / (w * 2.0)) * (t_0 + Math.sqrt(((t_0 * t_0) - (M_m * M_m))))) <= Double.POSITIVE_INFINITY) {
		tmp = c0 * (c0 * ((d * d) / (D * (w * (h * (D * w))))));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
M_m = math.fabs(M)
def code(c0, w, h, D, d, M_m):
	t_0 = (c0 * (d * d)) / ((w * h) * (D * D))
	tmp = 0
	if ((c0 / (w * 2.0)) * (t_0 + math.sqrt(((t_0 * t_0) - (M_m * M_m))))) <= math.inf:
		tmp = c0 * (c0 * ((d * d) / (D * (w * (h * (D * w))))))
	else:
		tmp = 0.0
	return tmp
M_m = abs(M)
function code(c0, w, h, D, d, M_m)
	t_0 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D)))
	tmp = 0.0
	if (Float64(Float64(c0 / Float64(w * 2.0)) * Float64(t_0 + sqrt(Float64(Float64(t_0 * t_0) - Float64(M_m * M_m))))) <= Inf)
		tmp = Float64(c0 * Float64(c0 * Float64(Float64(d * d) / Float64(D * Float64(w * Float64(h * Float64(D * w)))))));
	else
		tmp = 0.0;
	end
	return tmp
end
M_m = abs(M);
function tmp_2 = code(c0, w, h, D, d, M_m)
	t_0 = (c0 * (d * d)) / ((w * h) * (D * D));
	tmp = 0.0;
	if (((c0 / (w * 2.0)) * (t_0 + sqrt(((t_0 * t_0) - (M_m * M_m))))) <= Inf)
		tmp = c0 * (c0 * ((d * d) / (D * (w * (h * (D * w))))));
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
code[c0_, w_, h_, D_, d_, M$95$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[(w * 2.0), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + N[Sqrt[N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(c0 * N[(c0 * N[(N[(d * d), $MachinePrecision] / N[(D * N[(w * N[(h * N[(D * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
M_m = \left|M\right|

\\
\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}{w \cdot 2} \cdot \left(t\_0 + \sqrt{t\_0 \cdot t\_0 - M\_m \cdot M\_m}\right) \leq \infty:\\
\;\;\;\;c0 \cdot \left(c0 \cdot \frac{d \cdot d}{D \cdot \left(w \cdot \left(h \cdot \left(D \cdot w\right)\right)\right)}\right)\\

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


\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 65.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}{\frac{{c0}^{2} \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(c0 \cdot c0\right) \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot \left(h \cdot \color{blue}{\left(w \cdot w\right)}\right)} \]
      12. lower-*.f6452.4

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto c0 \cdot \left(c0 \cdot \frac{d \cdot d}{D \cdot \left(w \cdot \color{blue}{\left(h \cdot \left(D \cdot w\right)\right)}\right)}\right) \]
      16. lower-*.f6466.8

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

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

    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}{\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 \color{blue}{\left({c0}^{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)} \]
      2. distribute-lft1-inN/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{\color{blue}{\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{\color{blue}{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{\color{blue}{0}}{w}\right) \]
      5. div0N/A

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

        \[\leadsto \frac{-1}{2} \cdot \color{blue}{0} \]
      7. metadata-eval37.2

        \[\leadsto \color{blue}{0} \]
    5. Applied rewrites37.2%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification46.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{c0}{w \cdot 2} \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:\\ \;\;\;\;c0 \cdot \left(c0 \cdot \frac{d \cdot d}{D \cdot \left(w \cdot \left(h \cdot \left(D \cdot w\right)\right)\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 46.2% accurate, 2.6× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ \begin{array}{l} t_0 := w \cdot \left(D \cdot \left(w \cdot h\right)\right)\\ \mathbf{if}\;M\_m \leq 6.2 \cdot 10^{-188}:\\ \;\;\;\;\left(c0 \cdot d\right) \cdot \frac{\frac{c0 \cdot d}{t\_0}}{D}\\ \mathbf{elif}\;M\_m \leq 7.8 \cdot 10^{-150}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \left(d \cdot \left(c0 \cdot \frac{d}{D \cdot t\_0}\right)\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
(FPCore (c0 w h D d M_m)
 :precision binary64
 (let* ((t_0 (* w (* D (* w h)))))
   (if (<= M_m 6.2e-188)
     (* (* c0 d) (/ (/ (* c0 d) t_0) D))
     (if (<= M_m 7.8e-150) 0.0 (* c0 (* d (* c0 (/ d (* D t_0)))))))))
M_m = fabs(M);
double code(double c0, double w, double h, double D, double d, double M_m) {
	double t_0 = w * (D * (w * h));
	double tmp;
	if (M_m <= 6.2e-188) {
		tmp = (c0 * d) * (((c0 * d) / t_0) / D);
	} else if (M_m <= 7.8e-150) {
		tmp = 0.0;
	} else {
		tmp = c0 * (d * (c0 * (d / (D * t_0))));
	}
	return tmp;
}
M_m = abs(m)
real(8) function code(c0, w, h, d, d_1, m_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_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = w * (d * (w * h))
    if (m_m <= 6.2d-188) then
        tmp = (c0 * d_1) * (((c0 * d_1) / t_0) / d)
    else if (m_m <= 7.8d-150) then
        tmp = 0.0d0
    else
        tmp = c0 * (d_1 * (c0 * (d_1 / (d * t_0))))
    end if
    code = tmp
end function
M_m = Math.abs(M);
public static double code(double c0, double w, double h, double D, double d, double M_m) {
	double t_0 = w * (D * (w * h));
	double tmp;
	if (M_m <= 6.2e-188) {
		tmp = (c0 * d) * (((c0 * d) / t_0) / D);
	} else if (M_m <= 7.8e-150) {
		tmp = 0.0;
	} else {
		tmp = c0 * (d * (c0 * (d / (D * t_0))));
	}
	return tmp;
}
M_m = math.fabs(M)
def code(c0, w, h, D, d, M_m):
	t_0 = w * (D * (w * h))
	tmp = 0
	if M_m <= 6.2e-188:
		tmp = (c0 * d) * (((c0 * d) / t_0) / D)
	elif M_m <= 7.8e-150:
		tmp = 0.0
	else:
		tmp = c0 * (d * (c0 * (d / (D * t_0))))
	return tmp
M_m = abs(M)
function code(c0, w, h, D, d, M_m)
	t_0 = Float64(w * Float64(D * Float64(w * h)))
	tmp = 0.0
	if (M_m <= 6.2e-188)
		tmp = Float64(Float64(c0 * d) * Float64(Float64(Float64(c0 * d) / t_0) / D));
	elseif (M_m <= 7.8e-150)
		tmp = 0.0;
	else
		tmp = Float64(c0 * Float64(d * Float64(c0 * Float64(d / Float64(D * t_0)))));
	end
	return tmp
end
M_m = abs(M);
function tmp_2 = code(c0, w, h, D, d, M_m)
	t_0 = w * (D * (w * h));
	tmp = 0.0;
	if (M_m <= 6.2e-188)
		tmp = (c0 * d) * (((c0 * d) / t_0) / D);
	elseif (M_m <= 7.8e-150)
		tmp = 0.0;
	else
		tmp = c0 * (d * (c0 * (d / (D * t_0))));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
code[c0_, w_, h_, D_, d_, M$95$m_] := Block[{t$95$0 = N[(w * N[(D * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M$95$m, 6.2e-188], N[(N[(c0 * d), $MachinePrecision] * N[(N[(N[(c0 * d), $MachinePrecision] / t$95$0), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision], If[LessEqual[M$95$m, 7.8e-150], 0.0, N[(c0 * N[(d * N[(c0 * N[(d / N[(D * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|

\\
\begin{array}{l}
t_0 := w \cdot \left(D \cdot \left(w \cdot h\right)\right)\\
\mathbf{if}\;M\_m \leq 6.2 \cdot 10^{-188}:\\
\;\;\;\;\left(c0 \cdot d\right) \cdot \frac{\frac{c0 \cdot d}{t\_0}}{D}\\

\mathbf{elif}\;M\_m \leq 7.8 \cdot 10^{-150}:\\
\;\;\;\;0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if M < 6.2000000000000004e-188

    1. Initial program 19.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{{c0}^{2} \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{c0 \cdot d}}{D} \cdot \frac{c0 \cdot d}{D \cdot \left(h \cdot \left(w \cdot w\right)\right)} \]
      9. lower-/.f64N/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)}} \]
      10. lower-*.f64N/A

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

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

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

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

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

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

        \[\leadsto \frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D \cdot \color{blue}{\left(\left(w \cdot h\right) \cdot w\right)}} \]
      17. lower-*.f6442.3

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

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

        \[\leadsto \frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D \cdot \color{blue}{\left(w \cdot \left(w \cdot h\right)\right)}} \]
      20. lower-*.f6442.3

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

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

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

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

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

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

        \[\leadsto \frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{\color{blue}{D \cdot \left(w \cdot \left(w \cdot h\right)\right)}} \]
      6. clear-numN/A

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

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

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

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

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

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

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

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

        \[\leadsto \left(c0 \cdot d\right) \cdot \color{blue}{\frac{\frac{c0 \cdot d}{D \cdot \left(w \cdot \left(w \cdot h\right)\right)}}{D}} \]
      15. lower-/.f6444.4

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

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

    if 6.2000000000000004e-188 < M < 7.8000000000000004e-150

    1. Initial program 8.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{-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 \color{blue}{\left({c0}^{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)} \]
      2. distribute-lft1-inN/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{\color{blue}{\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{\color{blue}{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{\color{blue}{0}}{w}\right) \]
      5. div0N/A

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

        \[\leadsto \frac{-1}{2} \cdot \color{blue}{0} \]
      7. metadata-eval70.2

        \[\leadsto \color{blue}{0} \]
    5. Applied rewrites70.2%

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

    if 7.8000000000000004e-150 < M

    1. Initial program 24.4%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. 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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{c0 \cdot d}}{D} \cdot \frac{c0 \cdot d}{D \cdot \left(h \cdot \left(w \cdot w\right)\right)} \]
      9. lower-/.f64N/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)}} \]
      10. lower-*.f64N/A

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

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

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

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

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

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

        \[\leadsto \frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D \cdot \color{blue}{\left(\left(w \cdot h\right) \cdot w\right)}} \]
      17. lower-*.f6457.4

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

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

        \[\leadsto \frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D \cdot \color{blue}{\left(w \cdot \left(w \cdot h\right)\right)}} \]
      20. lower-*.f6457.4

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 6.2 \cdot 10^{-188}:\\ \;\;\;\;\left(c0 \cdot d\right) \cdot \frac{\frac{c0 \cdot d}{w \cdot \left(D \cdot \left(w \cdot h\right)\right)}}{D}\\ \mathbf{elif}\;M \leq 7.8 \cdot 10^{-150}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \left(d \cdot \left(c0 \cdot \frac{d}{D \cdot \left(w \cdot \left(D \cdot \left(w \cdot h\right)\right)\right)}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 45.7% accurate, 2.6× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ \begin{array}{l} t_0 := D \cdot \left(w \cdot \left(D \cdot \left(w \cdot h\right)\right)\right)\\ \mathbf{if}\;M\_m \leq 6.2 \cdot 10^{-188}:\\ \;\;\;\;\left(c0 \cdot d\right) \cdot \frac{c0 \cdot d}{t\_0}\\ \mathbf{elif}\;M\_m \leq 7.8 \cdot 10^{-150}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \left(d \cdot \left(c0 \cdot \frac{d}{t\_0}\right)\right)\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
(FPCore (c0 w h D d M_m)
 :precision binary64
 (let* ((t_0 (* D (* w (* D (* w h))))))
   (if (<= M_m 6.2e-188)
     (* (* c0 d) (/ (* c0 d) t_0))
     (if (<= M_m 7.8e-150) 0.0 (* c0 (* d (* c0 (/ d t_0))))))))
M_m = fabs(M);
double code(double c0, double w, double h, double D, double d, double M_m) {
	double t_0 = D * (w * (D * (w * h)));
	double tmp;
	if (M_m <= 6.2e-188) {
		tmp = (c0 * d) * ((c0 * d) / t_0);
	} else if (M_m <= 7.8e-150) {
		tmp = 0.0;
	} else {
		tmp = c0 * (d * (c0 * (d / t_0)));
	}
	return tmp;
}
M_m = abs(m)
real(8) function code(c0, w, h, d, d_1, m_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_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = d * (w * (d * (w * h)))
    if (m_m <= 6.2d-188) then
        tmp = (c0 * d_1) * ((c0 * d_1) / t_0)
    else if (m_m <= 7.8d-150) then
        tmp = 0.0d0
    else
        tmp = c0 * (d_1 * (c0 * (d_1 / t_0)))
    end if
    code = tmp
end function
M_m = Math.abs(M);
public static double code(double c0, double w, double h, double D, double d, double M_m) {
	double t_0 = D * (w * (D * (w * h)));
	double tmp;
	if (M_m <= 6.2e-188) {
		tmp = (c0 * d) * ((c0 * d) / t_0);
	} else if (M_m <= 7.8e-150) {
		tmp = 0.0;
	} else {
		tmp = c0 * (d * (c0 * (d / t_0)));
	}
	return tmp;
}
M_m = math.fabs(M)
def code(c0, w, h, D, d, M_m):
	t_0 = D * (w * (D * (w * h)))
	tmp = 0
	if M_m <= 6.2e-188:
		tmp = (c0 * d) * ((c0 * d) / t_0)
	elif M_m <= 7.8e-150:
		tmp = 0.0
	else:
		tmp = c0 * (d * (c0 * (d / t_0)))
	return tmp
M_m = abs(M)
function code(c0, w, h, D, d, M_m)
	t_0 = Float64(D * Float64(w * Float64(D * Float64(w * h))))
	tmp = 0.0
	if (M_m <= 6.2e-188)
		tmp = Float64(Float64(c0 * d) * Float64(Float64(c0 * d) / t_0));
	elseif (M_m <= 7.8e-150)
		tmp = 0.0;
	else
		tmp = Float64(c0 * Float64(d * Float64(c0 * Float64(d / t_0))));
	end
	return tmp
end
M_m = abs(M);
function tmp_2 = code(c0, w, h, D, d, M_m)
	t_0 = D * (w * (D * (w * h)));
	tmp = 0.0;
	if (M_m <= 6.2e-188)
		tmp = (c0 * d) * ((c0 * d) / t_0);
	elseif (M_m <= 7.8e-150)
		tmp = 0.0;
	else
		tmp = c0 * (d * (c0 * (d / t_0)));
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
code[c0_, w_, h_, D_, d_, M$95$m_] := Block[{t$95$0 = N[(D * N[(w * N[(D * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M$95$m, 6.2e-188], N[(N[(c0 * d), $MachinePrecision] * N[(N[(c0 * d), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[M$95$m, 7.8e-150], 0.0, N[(c0 * N[(d * N[(c0 * N[(d / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|

\\
\begin{array}{l}
t_0 := D \cdot \left(w \cdot \left(D \cdot \left(w \cdot h\right)\right)\right)\\
\mathbf{if}\;M\_m \leq 6.2 \cdot 10^{-188}:\\
\;\;\;\;\left(c0 \cdot d\right) \cdot \frac{c0 \cdot d}{t\_0}\\

\mathbf{elif}\;M\_m \leq 7.8 \cdot 10^{-150}:\\
\;\;\;\;0\\

\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(d \cdot \left(c0 \cdot \frac{d}{t\_0}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if M < 6.2000000000000004e-188

    1. Initial program 19.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{{c0}^{2} \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{c0 \cdot d}}{D} \cdot \frac{c0 \cdot d}{D \cdot \left(h \cdot \left(w \cdot w\right)\right)} \]
      9. lower-/.f64N/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)}} \]
      10. lower-*.f64N/A

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

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

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

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

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

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

        \[\leadsto \frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D \cdot \color{blue}{\left(\left(w \cdot h\right) \cdot w\right)}} \]
      17. lower-*.f6442.3

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

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

        \[\leadsto \frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D \cdot \color{blue}{\left(w \cdot \left(w \cdot h\right)\right)}} \]
      20. lower-*.f6442.3

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

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

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

    if 6.2000000000000004e-188 < M < 7.8000000000000004e-150

    1. Initial program 8.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{-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 \color{blue}{\left({c0}^{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)} \]
      2. distribute-lft1-inN/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{\color{blue}{\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{\color{blue}{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{\color{blue}{0}}{w}\right) \]
      5. div0N/A

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

        \[\leadsto \frac{-1}{2} \cdot \color{blue}{0} \]
      7. metadata-eval70.2

        \[\leadsto \color{blue}{0} \]
    5. Applied rewrites70.2%

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

    if 7.8000000000000004e-150 < M

    1. Initial program 24.4%

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
    2. 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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{c0 \cdot d}}{D} \cdot \frac{c0 \cdot d}{D \cdot \left(h \cdot \left(w \cdot w\right)\right)} \]
      9. lower-/.f64N/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)}} \]
      10. lower-*.f64N/A

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

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

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

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

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

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

        \[\leadsto \frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D \cdot \color{blue}{\left(\left(w \cdot h\right) \cdot w\right)}} \]
      17. lower-*.f6457.4

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

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

        \[\leadsto \frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D \cdot \color{blue}{\left(w \cdot \left(w \cdot h\right)\right)}} \]
      20. lower-*.f6457.4

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 6.2 \cdot 10^{-188}:\\ \;\;\;\;\left(c0 \cdot d\right) \cdot \frac{c0 \cdot d}{D \cdot \left(w \cdot \left(D \cdot \left(w \cdot h\right)\right)\right)}\\ \mathbf{elif}\;M \leq 7.8 \cdot 10^{-150}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \left(d \cdot \left(c0 \cdot \frac{d}{D \cdot \left(w \cdot \left(D \cdot \left(w \cdot h\right)\right)\right)}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 45.6% accurate, 2.6× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ \begin{array}{l} t_0 := \left(c0 \cdot d\right) \cdot \frac{c0 \cdot d}{D \cdot \left(w \cdot \left(D \cdot \left(w \cdot h\right)\right)\right)}\\ \mathbf{if}\;M\_m \leq 6.2 \cdot 10^{-188}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;M\_m \leq 8.2 \cdot 10^{-150}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
(FPCore (c0 w h D d M_m)
 :precision binary64
 (let* ((t_0 (* (* c0 d) (/ (* c0 d) (* D (* w (* D (* w h))))))))
   (if (<= M_m 6.2e-188) t_0 (if (<= M_m 8.2e-150) 0.0 t_0))))
M_m = fabs(M);
double code(double c0, double w, double h, double D, double d, double M_m) {
	double t_0 = (c0 * d) * ((c0 * d) / (D * (w * (D * (w * h)))));
	double tmp;
	if (M_m <= 6.2e-188) {
		tmp = t_0;
	} else if (M_m <= 8.2e-150) {
		tmp = 0.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
M_m = abs(m)
real(8) function code(c0, w, h, d, d_1, m_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_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (c0 * d_1) * ((c0 * d_1) / (d * (w * (d * (w * h)))))
    if (m_m <= 6.2d-188) then
        tmp = t_0
    else if (m_m <= 8.2d-150) then
        tmp = 0.0d0
    else
        tmp = t_0
    end if
    code = tmp
end function
M_m = Math.abs(M);
public static double code(double c0, double w, double h, double D, double d, double M_m) {
	double t_0 = (c0 * d) * ((c0 * d) / (D * (w * (D * (w * h)))));
	double tmp;
	if (M_m <= 6.2e-188) {
		tmp = t_0;
	} else if (M_m <= 8.2e-150) {
		tmp = 0.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
M_m = math.fabs(M)
def code(c0, w, h, D, d, M_m):
	t_0 = (c0 * d) * ((c0 * d) / (D * (w * (D * (w * h)))))
	tmp = 0
	if M_m <= 6.2e-188:
		tmp = t_0
	elif M_m <= 8.2e-150:
		tmp = 0.0
	else:
		tmp = t_0
	return tmp
M_m = abs(M)
function code(c0, w, h, D, d, M_m)
	t_0 = Float64(Float64(c0 * d) * Float64(Float64(c0 * d) / Float64(D * Float64(w * Float64(D * Float64(w * h))))))
	tmp = 0.0
	if (M_m <= 6.2e-188)
		tmp = t_0;
	elseif (M_m <= 8.2e-150)
		tmp = 0.0;
	else
		tmp = t_0;
	end
	return tmp
end
M_m = abs(M);
function tmp_2 = code(c0, w, h, D, d, M_m)
	t_0 = (c0 * d) * ((c0 * d) / (D * (w * (D * (w * h)))));
	tmp = 0.0;
	if (M_m <= 6.2e-188)
		tmp = t_0;
	elseif (M_m <= 8.2e-150)
		tmp = 0.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
code[c0_, w_, h_, D_, d_, M$95$m_] := Block[{t$95$0 = N[(N[(c0 * d), $MachinePrecision] * N[(N[(c0 * d), $MachinePrecision] / N[(D * N[(w * N[(D * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M$95$m, 6.2e-188], t$95$0, If[LessEqual[M$95$m, 8.2e-150], 0.0, t$95$0]]]
\begin{array}{l}
M_m = \left|M\right|

\\
\begin{array}{l}
t_0 := \left(c0 \cdot d\right) \cdot \frac{c0 \cdot d}{D \cdot \left(w \cdot \left(D \cdot \left(w \cdot h\right)\right)\right)}\\
\mathbf{if}\;M\_m \leq 6.2 \cdot 10^{-188}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;M\_m \leq 8.2 \cdot 10^{-150}:\\
\;\;\;\;0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 6.2000000000000004e-188 or 8.1999999999999997e-150 < M

    1. Initial program 21.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{{c0}^{2} \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{c0 \cdot d}}{D} \cdot \frac{c0 \cdot d}{D \cdot \left(h \cdot \left(w \cdot w\right)\right)} \]
      9. lower-/.f64N/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)}} \]
      10. lower-*.f64N/A

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

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

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

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

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

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

        \[\leadsto \frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D \cdot \color{blue}{\left(\left(w \cdot h\right) \cdot w\right)}} \]
      17. lower-*.f6448.5

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

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

        \[\leadsto \frac{c0 \cdot d}{D} \cdot \frac{c0 \cdot d}{D \cdot \color{blue}{\left(w \cdot \left(w \cdot h\right)\right)}} \]
      20. lower-*.f6448.5

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

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

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

    if 6.2000000000000004e-188 < M < 8.1999999999999997e-150

    1. Initial program 8.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{-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 \color{blue}{\left({c0}^{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)} \]
      2. distribute-lft1-inN/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{\color{blue}{\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{\color{blue}{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{\color{blue}{0}}{w}\right) \]
      5. div0N/A

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

        \[\leadsto \frac{-1}{2} \cdot \color{blue}{0} \]
      7. metadata-eval70.2

        \[\leadsto \color{blue}{0} \]
    5. Applied rewrites70.2%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 44.3% accurate, 2.6× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ \begin{array}{l} t_0 := c0 \cdot \left(\left(c0 \cdot d\right) \cdot \frac{d}{D \cdot \left(w \cdot \left(D \cdot \left(w \cdot h\right)\right)\right)}\right)\\ \mathbf{if}\;M\_m \leq 6.2 \cdot 10^{-188}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;M\_m \leq 8.2 \cdot 10^{-150}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
(FPCore (c0 w h D d M_m)
 :precision binary64
 (let* ((t_0 (* c0 (* (* c0 d) (/ d (* D (* w (* D (* w h)))))))))
   (if (<= M_m 6.2e-188) t_0 (if (<= M_m 8.2e-150) 0.0 t_0))))
M_m = fabs(M);
double code(double c0, double w, double h, double D, double d, double M_m) {
	double t_0 = c0 * ((c0 * d) * (d / (D * (w * (D * (w * h))))));
	double tmp;
	if (M_m <= 6.2e-188) {
		tmp = t_0;
	} else if (M_m <= 8.2e-150) {
		tmp = 0.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
M_m = abs(m)
real(8) function code(c0, w, h, d, d_1, m_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_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = c0 * ((c0 * d_1) * (d_1 / (d * (w * (d * (w * h))))))
    if (m_m <= 6.2d-188) then
        tmp = t_0
    else if (m_m <= 8.2d-150) then
        tmp = 0.0d0
    else
        tmp = t_0
    end if
    code = tmp
end function
M_m = Math.abs(M);
public static double code(double c0, double w, double h, double D, double d, double M_m) {
	double t_0 = c0 * ((c0 * d) * (d / (D * (w * (D * (w * h))))));
	double tmp;
	if (M_m <= 6.2e-188) {
		tmp = t_0;
	} else if (M_m <= 8.2e-150) {
		tmp = 0.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
M_m = math.fabs(M)
def code(c0, w, h, D, d, M_m):
	t_0 = c0 * ((c0 * d) * (d / (D * (w * (D * (w * h))))))
	tmp = 0
	if M_m <= 6.2e-188:
		tmp = t_0
	elif M_m <= 8.2e-150:
		tmp = 0.0
	else:
		tmp = t_0
	return tmp
M_m = abs(M)
function code(c0, w, h, D, d, M_m)
	t_0 = Float64(c0 * Float64(Float64(c0 * d) * Float64(d / Float64(D * Float64(w * Float64(D * Float64(w * h)))))))
	tmp = 0.0
	if (M_m <= 6.2e-188)
		tmp = t_0;
	elseif (M_m <= 8.2e-150)
		tmp = 0.0;
	else
		tmp = t_0;
	end
	return tmp
end
M_m = abs(M);
function tmp_2 = code(c0, w, h, D, d, M_m)
	t_0 = c0 * ((c0 * d) * (d / (D * (w * (D * (w * h))))));
	tmp = 0.0;
	if (M_m <= 6.2e-188)
		tmp = t_0;
	elseif (M_m <= 8.2e-150)
		tmp = 0.0;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
code[c0_, w_, h_, D_, d_, M$95$m_] := Block[{t$95$0 = N[(c0 * N[(N[(c0 * d), $MachinePrecision] * N[(d / N[(D * N[(w * N[(D * N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M$95$m, 6.2e-188], t$95$0, If[LessEqual[M$95$m, 8.2e-150], 0.0, t$95$0]]]
\begin{array}{l}
M_m = \left|M\right|

\\
\begin{array}{l}
t_0 := c0 \cdot \left(\left(c0 \cdot d\right) \cdot \frac{d}{D \cdot \left(w \cdot \left(D \cdot \left(w \cdot h\right)\right)\right)}\right)\\
\mathbf{if}\;M\_m \leq 6.2 \cdot 10^{-188}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;M\_m \leq 8.2 \cdot 10^{-150}:\\
\;\;\;\;0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < 6.2000000000000004e-188 or 8.1999999999999997e-150 < M

    1. Initial program 21.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{{c0}^{2} \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot {w}^{2}\right)}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto c0 \cdot \left(c0 \cdot \frac{d \cdot d}{\color{blue}{w \cdot \left(w \cdot \left(h \cdot \left(D \cdot D\right)\right)\right)}}\right) \]
      6. div-invN/A

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

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

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

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

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

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

        \[\leadsto c0 \cdot \color{blue}{\left(\left(c0 \cdot d\right) \cdot \frac{d}{w \cdot \left(w \cdot \left(h \cdot \left(D \cdot D\right)\right)\right)}\right)} \]
      13. lower-/.f6441.2

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

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

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

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

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

    if 6.2000000000000004e-188 < M < 8.1999999999999997e-150

    1. Initial program 8.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{-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 \color{blue}{\left({c0}^{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)} \]
      2. distribute-lft1-inN/A

        \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{\color{blue}{\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{\color{blue}{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{\color{blue}{0}}{w}\right) \]
      5. div0N/A

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

        \[\leadsto \frac{-1}{2} \cdot \color{blue}{0} \]
      7. metadata-eval70.2

        \[\leadsto \color{blue}{0} \]
    5. Applied rewrites70.2%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 33.7% accurate, 156.0× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ 0 \end{array} \]
M_m = (fabs.f64 M)
(FPCore (c0 w h D d M_m) :precision binary64 0.0)
M_m = fabs(M);
double code(double c0, double w, double h, double D, double d, double M_m) {
	return 0.0;
}
M_m = abs(m)
real(8) function code(c0, w, h, d, d_1, m_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_m
    code = 0.0d0
end function
M_m = Math.abs(M);
public static double code(double c0, double w, double h, double D, double d, double M_m) {
	return 0.0;
}
M_m = math.fabs(M)
def code(c0, w, h, D, d, M_m):
	return 0.0
M_m = abs(M)
function code(c0, w, h, D, d, M_m)
	return 0.0
end
M_m = abs(M);
function tmp = code(c0, w, h, D, d, M_m)
	tmp = 0.0;
end
M_m = N[Abs[M], $MachinePrecision]
code[c0_, w_, h_, D_, d_, M$95$m_] := 0.0
\begin{array}{l}
M_m = \left|M\right|

\\
0
\end{array}
Derivation
  1. Initial program 20.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 \color{blue}{\left({c0}^{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)} \]
    2. distribute-lft1-inN/A

      \[\leadsto \frac{-1}{2} \cdot \left({c0}^{2} \cdot \frac{\color{blue}{\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{\color{blue}{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{\color{blue}{0}}{w}\right) \]
    5. div0N/A

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

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

      \[\leadsto \color{blue}{0} \]
  5. Applied rewrites29.1%

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

Reproduce

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