Henrywood and Agarwal, Equation (13)

Percentage Accurate: 24.8% → 39.2%
Time: 15.5s
Alternatives: 9
Speedup: 3.3×

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 9 alternatives:

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

Initial Program: 24.8% accurate, 1.0× speedup?

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

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

Alternative 1: 39.2% accurate, 0.3× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ \begin{array}{l} t_0 := \frac{c0}{w + w}\\ t_1 := {\left(\frac{d}{D}\right)}^{2}\\ t_2 := \frac{t\_1}{w}\\ t_3 := \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{h}}{w}, t\_1, M\_m\right)}, \sqrt{\mathsf{fma}\left(t\_2, \frac{c0}{h}, -M\_m\right)}, t\_2 \cdot \frac{c0}{h}\right)\\ \mathbf{if}\;c0 \leq -5 \cdot 10^{-135}:\\ \;\;\;\;\left(\left(0.5 \cdot c0\right) \cdot {w}^{-1}\right) \cdot t\_3\\ \mathbf{elif}\;c0 \leq 7.5 \cdot 10^{-133}:\\ \;\;\;\;t\_0 \cdot \left({1}^{0.25} \cdot M\_m\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot t\_3\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
(FPCore (c0 w h D d M_m)
 :precision binary64
 (let* ((t_0 (/ c0 (+ w w)))
        (t_1 (pow (/ d D) 2.0))
        (t_2 (/ t_1 w))
        (t_3
         (fma
          (sqrt (fma (/ (/ c0 h) w) t_1 M_m))
          (sqrt (fma t_2 (/ c0 h) (- M_m)))
          (* t_2 (/ c0 h)))))
   (if (<= c0 -5e-135)
     (* (* (* 0.5 c0) (pow w -1.0)) t_3)
     (if (<= c0 7.5e-133) (* t_0 (* (pow 1.0 0.25) M_m)) (* t_0 t_3)))))
M_m = fabs(M);
double code(double c0, double w, double h, double D, double d, double M_m) {
	double t_0 = c0 / (w + w);
	double t_1 = pow((d / D), 2.0);
	double t_2 = t_1 / w;
	double t_3 = fma(sqrt(fma(((c0 / h) / w), t_1, M_m)), sqrt(fma(t_2, (c0 / h), -M_m)), (t_2 * (c0 / h)));
	double tmp;
	if (c0 <= -5e-135) {
		tmp = ((0.5 * c0) * pow(w, -1.0)) * t_3;
	} else if (c0 <= 7.5e-133) {
		tmp = t_0 * (pow(1.0, 0.25) * M_m);
	} else {
		tmp = t_0 * t_3;
	}
	return tmp;
}
M_m = abs(M)
function code(c0, w, h, D, d, M_m)
	t_0 = Float64(c0 / Float64(w + w))
	t_1 = Float64(d / D) ^ 2.0
	t_2 = Float64(t_1 / w)
	t_3 = fma(sqrt(fma(Float64(Float64(c0 / h) / w), t_1, M_m)), sqrt(fma(t_2, Float64(c0 / h), Float64(-M_m))), Float64(t_2 * Float64(c0 / h)))
	tmp = 0.0
	if (c0 <= -5e-135)
		tmp = Float64(Float64(Float64(0.5 * c0) * (w ^ -1.0)) * t_3);
	elseif (c0 <= 7.5e-133)
		tmp = Float64(t_0 * Float64((1.0 ^ 0.25) * M_m));
	else
		tmp = Float64(t_0 * t_3);
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
code[c0_, w_, h_, D_, d_, M$95$m_] := Block[{t$95$0 = N[(c0 / N[(w + w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / w), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(N[(N[(c0 / h), $MachinePrecision] / w), $MachinePrecision] * t$95$1 + M$95$m), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$2 * N[(c0 / h), $MachinePrecision] + (-M$95$m)), $MachinePrecision]], $MachinePrecision] + N[(t$95$2 * N[(c0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c0, -5e-135], N[(N[(N[(0.5 * c0), $MachinePrecision] * N[Power[w, -1.0], $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[c0, 7.5e-133], N[(t$95$0 * N[(N[Power[1.0, 0.25], $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * t$95$3), $MachinePrecision]]]]]]]
\begin{array}{l}
M_m = \left|M\right|

\\
\begin{array}{l}
t_0 := \frac{c0}{w + w}\\
t_1 := {\left(\frac{d}{D}\right)}^{2}\\
t_2 := \frac{t\_1}{w}\\
t_3 := \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{h}}{w}, t\_1, M\_m\right)}, \sqrt{\mathsf{fma}\left(t\_2, \frac{c0}{h}, -M\_m\right)}, t\_2 \cdot \frac{c0}{h}\right)\\
\mathbf{if}\;c0 \leq -5 \cdot 10^{-135}:\\
\;\;\;\;\left(\left(0.5 \cdot c0\right) \cdot {w}^{-1}\right) \cdot t\_3\\

\mathbf{elif}\;c0 \leq 7.5 \cdot 10^{-133}:\\
\;\;\;\;t\_0 \cdot \left({1}^{0.25} \cdot M\_m\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c0 < -5.0000000000000002e-135

    1. Initial program 30.6%

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\left(\frac{c0}{2} \cdot \frac{1}{w}\right)} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{h}}{w}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\mathsf{fma}\left(\frac{{\left(\frac{d}{D}\right)}^{2}}{w}, \frac{c0}{h}, -M\right)}, \frac{{\left(\frac{d}{D}\right)}^{2}}{w} \cdot \frac{c0}{h}\right) \]
        6. div-invN/A

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

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

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

          \[\leadsto \left(\color{blue}{\left(\frac{1}{2} \cdot c0\right)} \cdot \frac{1}{w}\right) \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{h}}{w}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\mathsf{fma}\left(\frac{{\left(\frac{d}{D}\right)}^{2}}{w}, \frac{c0}{h}, -M\right)}, \frac{{\left(\frac{d}{D}\right)}^{2}}{w} \cdot \frac{c0}{h}\right) \]
        10. inv-powN/A

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

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

        \[\leadsto \color{blue}{\left(\left(0.5 \cdot c0\right) \cdot {w}^{-1}\right)} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{h}}{w}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\mathsf{fma}\left(\frac{{\left(\frac{d}{D}\right)}^{2}}{w}, \frac{c0}{h}, -M\right)}, \frac{{\left(\frac{d}{D}\right)}^{2}}{w} \cdot \frac{c0}{h}\right) \]
      5. Step-by-step derivation
        1. lift-pow.f64N/A

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

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

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

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

      if -5.0000000000000002e-135 < c0 < 7.4999999999999999e-133

      1. Initial program 11.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 0

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

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{-1} \cdot M\right)} \]
        2. lower-*.f64N/A

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{-1} \cdot M\right)} \]
        3. lower-sqrt.f640.0

          \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\sqrt{-1}} \cdot M\right) \]
      5. Applied rewrites0.0%

        \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{-1} \cdot M\right)} \]
      6. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \frac{c0}{\color{blue}{2 \cdot w}} \cdot \left(\sqrt{-1} \cdot M\right) \]
        2. count-2-revN/A

          \[\leadsto \frac{c0}{\color{blue}{w + w}} \cdot \left(\sqrt{-1} \cdot M\right) \]
        3. lower-+.f640.0

          \[\leadsto \frac{c0}{\color{blue}{w + w}} \cdot \left(\sqrt{-1} \cdot M\right) \]
      7. Applied rewrites0.0%

        \[\leadsto \frac{c0}{\color{blue}{w + w}} \cdot \left(\sqrt{-1} \cdot M\right) \]
      8. Step-by-step derivation
        1. Applied rewrites40.9%

          \[\leadsto \frac{c0}{w + w} \cdot \left({1}^{0.25} \cdot M\right) \]

        if 7.4999999999999999e-133 < c0

        1. Initial program 16.2%

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

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

            \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{h}}{w}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\mathsf{fma}\left(\frac{{\left(\frac{d}{D}\right)}^{2}}{w}, \frac{c0}{h}, -M\right)}, \frac{{\left(\frac{d}{D}\right)}^{2}}{w} \cdot \frac{c0}{h}\right)} \]
          3. Step-by-step derivation
            1. lift-*.f64N/A

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

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

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

            \[\leadsto \frac{c0}{\color{blue}{w + w}} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{h}}{w}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\mathsf{fma}\left(\frac{{\left(\frac{d}{D}\right)}^{2}}{w}, \frac{c0}{h}, -M\right)}, \frac{{\left(\frac{d}{D}\right)}^{2}}{w} \cdot \frac{c0}{h}\right) \]
        4. Recombined 3 regimes into one program.
        5. Final simplification41.0%

          \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \leq -5 \cdot 10^{-135}:\\ \;\;\;\;\left(\left(0.5 \cdot c0\right) \cdot {w}^{-1}\right) \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{h}}{w}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\mathsf{fma}\left(\frac{{\left(\frac{d}{D}\right)}^{2}}{w}, \frac{c0}{h}, -M\right)}, \frac{{\left(\frac{d}{D}\right)}^{2}}{w} \cdot \frac{c0}{h}\right)\\ \mathbf{elif}\;c0 \leq 7.5 \cdot 10^{-133}:\\ \;\;\;\;\frac{c0}{w + w} \cdot \left({1}^{0.25} \cdot M\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{w + w} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{h}}{w}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\mathsf{fma}\left(\frac{{\left(\frac{d}{D}\right)}^{2}}{w}, \frac{c0}{h}, -M\right)}, \frac{{\left(\frac{d}{D}\right)}^{2}}{w} \cdot \frac{c0}{h}\right)\\ \end{array} \]
        6. Add Preprocessing

        Alternative 2: 39.2% accurate, 0.3× speedup?

        \[\begin{array}{l} M_m = \left|M\right| \\ \begin{array}{l} t_0 := {\left(\frac{d}{D}\right)}^{2}\\ t_1 := \frac{t\_0}{w}\\ t_2 := \frac{c0}{w + w}\\ \mathbf{if}\;c0 \leq -5 \cdot 10^{-135} \lor \neg \left(c0 \leq 7.5 \cdot 10^{-133}\right):\\ \;\;\;\;t\_2 \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{h}}{w}, t\_0, M\_m\right)}, \sqrt{\mathsf{fma}\left(t\_1, \frac{c0}{h}, -M\_m\right)}, t\_1 \cdot \frac{c0}{h}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_2 \cdot \left({1}^{0.25} \cdot M\_m\right)\\ \end{array} \end{array} \]
        M_m = (fabs.f64 M)
        (FPCore (c0 w h D d M_m)
         :precision binary64
         (let* ((t_0 (pow (/ d D) 2.0)) (t_1 (/ t_0 w)) (t_2 (/ c0 (+ w w))))
           (if (or (<= c0 -5e-135) (not (<= c0 7.5e-133)))
             (*
              t_2
              (fma
               (sqrt (fma (/ (/ c0 h) w) t_0 M_m))
               (sqrt (fma t_1 (/ c0 h) (- M_m)))
               (* t_1 (/ c0 h))))
             (* t_2 (* (pow 1.0 0.25) M_m)))))
        M_m = fabs(M);
        double code(double c0, double w, double h, double D, double d, double M_m) {
        	double t_0 = pow((d / D), 2.0);
        	double t_1 = t_0 / w;
        	double t_2 = c0 / (w + w);
        	double tmp;
        	if ((c0 <= -5e-135) || !(c0 <= 7.5e-133)) {
        		tmp = t_2 * fma(sqrt(fma(((c0 / h) / w), t_0, M_m)), sqrt(fma(t_1, (c0 / h), -M_m)), (t_1 * (c0 / h)));
        	} else {
        		tmp = t_2 * (pow(1.0, 0.25) * M_m);
        	}
        	return tmp;
        }
        
        M_m = abs(M)
        function code(c0, w, h, D, d, M_m)
        	t_0 = Float64(d / D) ^ 2.0
        	t_1 = Float64(t_0 / w)
        	t_2 = Float64(c0 / Float64(w + w))
        	tmp = 0.0
        	if ((c0 <= -5e-135) || !(c0 <= 7.5e-133))
        		tmp = Float64(t_2 * fma(sqrt(fma(Float64(Float64(c0 / h) / w), t_0, M_m)), sqrt(fma(t_1, Float64(c0 / h), Float64(-M_m))), Float64(t_1 * Float64(c0 / h))));
        	else
        		tmp = Float64(t_2 * Float64((1.0 ^ 0.25) * M_m));
        	end
        	return tmp
        end
        
        M_m = N[Abs[M], $MachinePrecision]
        code[c0_, w_, h_, D_, d_, M$95$m_] := Block[{t$95$0 = N[Power[N[(d / D), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / w), $MachinePrecision]}, Block[{t$95$2 = N[(c0 / N[(w + w), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[c0, -5e-135], N[Not[LessEqual[c0, 7.5e-133]], $MachinePrecision]], N[(t$95$2 * N[(N[Sqrt[N[(N[(N[(c0 / h), $MachinePrecision] / w), $MachinePrecision] * t$95$0 + M$95$m), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(t$95$1 * N[(c0 / h), $MachinePrecision] + (-M$95$m)), $MachinePrecision]], $MachinePrecision] + N[(t$95$1 * N[(c0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(N[Power[1.0, 0.25], $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision]]]]]
        
        \begin{array}{l}
        M_m = \left|M\right|
        
        \\
        \begin{array}{l}
        t_0 := {\left(\frac{d}{D}\right)}^{2}\\
        t_1 := \frac{t\_0}{w}\\
        t_2 := \frac{c0}{w + w}\\
        \mathbf{if}\;c0 \leq -5 \cdot 10^{-135} \lor \neg \left(c0 \leq 7.5 \cdot 10^{-133}\right):\\
        \;\;\;\;t\_2 \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{h}}{w}, t\_0, M\_m\right)}, \sqrt{\mathsf{fma}\left(t\_1, \frac{c0}{h}, -M\_m\right)}, t\_1 \cdot \frac{c0}{h}\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_2 \cdot \left({1}^{0.25} \cdot M\_m\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if c0 < -5.0000000000000002e-135 or 7.4999999999999999e-133 < c0

          1. Initial program 23.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. Step-by-step derivation
            1. Applied rewrites38.7%

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

              \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{h}}{w}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\mathsf{fma}\left(\frac{{\left(\frac{d}{D}\right)}^{2}}{w}, \frac{c0}{h}, -M\right)}, \frac{{\left(\frac{d}{D}\right)}^{2}}{w} \cdot \frac{c0}{h}\right)} \]
            3. Step-by-step derivation
              1. lift-*.f64N/A

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

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

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

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

            if -5.0000000000000002e-135 < c0 < 7.4999999999999999e-133

            1. Initial program 11.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 0

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

                \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{-1} \cdot M\right)} \]
              2. lower-*.f64N/A

                \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{-1} \cdot M\right)} \]
              3. lower-sqrt.f640.0

                \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\sqrt{-1}} \cdot M\right) \]
            5. Applied rewrites0.0%

              \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{-1} \cdot M\right)} \]
            6. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \frac{c0}{\color{blue}{2 \cdot w}} \cdot \left(\sqrt{-1} \cdot M\right) \]
              2. count-2-revN/A

                \[\leadsto \frac{c0}{\color{blue}{w + w}} \cdot \left(\sqrt{-1} \cdot M\right) \]
              3. lower-+.f640.0

                \[\leadsto \frac{c0}{\color{blue}{w + w}} \cdot \left(\sqrt{-1} \cdot M\right) \]
            7. Applied rewrites0.0%

              \[\leadsto \frac{c0}{\color{blue}{w + w}} \cdot \left(\sqrt{-1} \cdot M\right) \]
            8. Step-by-step derivation
              1. Applied rewrites40.9%

                \[\leadsto \frac{c0}{w + w} \cdot \left({1}^{0.25} \cdot M\right) \]
            9. Recombined 2 regimes into one program.
            10. Final simplification41.0%

              \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \leq -5 \cdot 10^{-135} \lor \neg \left(c0 \leq 7.5 \cdot 10^{-133}\right):\\ \;\;\;\;\frac{c0}{w + w} \cdot \mathsf{fma}\left(\sqrt{\mathsf{fma}\left(\frac{\frac{c0}{h}}{w}, {\left(\frac{d}{D}\right)}^{2}, M\right)}, \sqrt{\mathsf{fma}\left(\frac{{\left(\frac{d}{D}\right)}^{2}}{w}, \frac{c0}{h}, -M\right)}, \frac{{\left(\frac{d}{D}\right)}^{2}}{w} \cdot \frac{c0}{h}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{w + w} \cdot \left({1}^{0.25} \cdot M\right)\\ \end{array} \]
            11. Add Preprocessing

            Alternative 3: 40.2% accurate, 0.5× speedup?

            \[\begin{array}{l} M_m = \left|M\right| \\ \begin{array}{l} t_0 := \frac{c0}{2 \cdot w}\\ t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\ \mathbf{if}\;t\_0 \cdot \left(t\_1 + \sqrt{t\_1 \cdot t\_1 - M\_m \cdot M\_m}\right) \leq \infty:\\ \;\;\;\;t\_0 \cdot \frac{2 \cdot \left(\left(d \cdot d\right) \cdot c0\right)}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{w + w} \cdot \left({1}^{0.25} \cdot M\_m\right)\\ \end{array} \end{array} \]
            M_m = (fabs.f64 M)
            (FPCore (c0 w h D d M_m)
             :precision binary64
             (let* ((t_0 (/ c0 (* 2.0 w))) (t_1 (/ (* c0 (* d d)) (* (* w h) (* D D)))))
               (if (<= (* t_0 (+ t_1 (sqrt (- (* t_1 t_1) (* M_m M_m))))) INFINITY)
                 (* t_0 (/ (* 2.0 (* (* d d) c0)) (* (* (* D D) h) w)))
                 (* (/ c0 (+ w w)) (* (pow 1.0 0.25) M_m)))))
            M_m = fabs(M);
            double code(double c0, double w, double h, double D, double d, double M_m) {
            	double t_0 = c0 / (2.0 * w);
            	double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
            	double tmp;
            	if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M_m * M_m))))) <= ((double) INFINITY)) {
            		tmp = t_0 * ((2.0 * ((d * d) * c0)) / (((D * D) * h) * w));
            	} else {
            		tmp = (c0 / (w + w)) * (pow(1.0, 0.25) * M_m);
            	}
            	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 / (2.0 * w);
            	double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
            	double tmp;
            	if ((t_0 * (t_1 + Math.sqrt(((t_1 * t_1) - (M_m * M_m))))) <= Double.POSITIVE_INFINITY) {
            		tmp = t_0 * ((2.0 * ((d * d) * c0)) / (((D * D) * h) * w));
            	} else {
            		tmp = (c0 / (w + w)) * (Math.pow(1.0, 0.25) * M_m);
            	}
            	return tmp;
            }
            
            M_m = math.fabs(M)
            def code(c0, w, h, D, d, M_m):
            	t_0 = c0 / (2.0 * w)
            	t_1 = (c0 * (d * d)) / ((w * h) * (D * D))
            	tmp = 0
            	if (t_0 * (t_1 + math.sqrt(((t_1 * t_1) - (M_m * M_m))))) <= math.inf:
            		tmp = t_0 * ((2.0 * ((d * d) * c0)) / (((D * D) * h) * w))
            	else:
            		tmp = (c0 / (w + w)) * (math.pow(1.0, 0.25) * M_m)
            	return tmp
            
            M_m = abs(M)
            function code(c0, w, h, D, d, M_m)
            	t_0 = Float64(c0 / Float64(2.0 * w))
            	t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D)))
            	tmp = 0.0
            	if (Float64(t_0 * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M_m * M_m))))) <= Inf)
            		tmp = Float64(t_0 * Float64(Float64(2.0 * Float64(Float64(d * d) * c0)) / Float64(Float64(Float64(D * D) * h) * w)));
            	else
            		tmp = Float64(Float64(c0 / Float64(w + w)) * Float64((1.0 ^ 0.25) * M_m));
            	end
            	return tmp
            end
            
            M_m = abs(M);
            function tmp_2 = code(c0, w, h, D, d, M_m)
            	t_0 = c0 / (2.0 * w);
            	t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
            	tmp = 0.0;
            	if ((t_0 * (t_1 + sqrt(((t_1 * t_1) - (M_m * M_m))))) <= Inf)
            		tmp = t_0 * ((2.0 * ((d * d) * c0)) / (((D * D) * h) * w));
            	else
            		tmp = (c0 / (w + w)) * ((1.0 ^ 0.25) * M_m);
            	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[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$0 * N[(N[(2.0 * N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c0 / N[(w + w), $MachinePrecision]), $MachinePrecision] * N[(N[Power[1.0, 0.25], $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision]]]]
            
            \begin{array}{l}
            M_m = \left|M\right|
            
            \\
            \begin{array}{l}
            t_0 := \frac{c0}{2 \cdot w}\\
            t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
            \mathbf{if}\;t\_0 \cdot \left(t\_1 + \sqrt{t\_1 \cdot t\_1 - M\_m \cdot M\_m}\right) \leq \infty:\\
            \;\;\;\;t\_0 \cdot \frac{2 \cdot \left(\left(d \cdot d\right) \cdot c0\right)}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w}\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{c0}{w + w} \cdot \left({1}^{0.25} \cdot M\_m\right)\\
            
            
            \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 70.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              1. Initial program 0.0%

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

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

                  \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{-1} \cdot M\right)} \]
                2. lower-*.f64N/A

                  \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{-1} \cdot M\right)} \]
                3. lower-sqrt.f640.0

                  \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\sqrt{-1}} \cdot M\right) \]
              5. Applied rewrites0.0%

                \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{-1} \cdot M\right)} \]
              6. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \frac{c0}{\color{blue}{2 \cdot w}} \cdot \left(\sqrt{-1} \cdot M\right) \]
                2. count-2-revN/A

                  \[\leadsto \frac{c0}{\color{blue}{w + w}} \cdot \left(\sqrt{-1} \cdot M\right) \]
                3. lower-+.f640.0

                  \[\leadsto \frac{c0}{\color{blue}{w + w}} \cdot \left(\sqrt{-1} \cdot M\right) \]
              7. Applied rewrites0.0%

                \[\leadsto \frac{c0}{\color{blue}{w + w}} \cdot \left(\sqrt{-1} \cdot M\right) \]
              8. Step-by-step derivation
                1. Applied rewrites21.2%

                  \[\leadsto \frac{c0}{w + w} \cdot \left({1}^{0.25} \cdot M\right) \]
              9. Recombined 2 regimes into one program.
              10. Add Preprocessing

              Alternative 4: 34.6% accurate, 1.8× speedup?

              \[\begin{array}{l} M_m = \left|M\right| \\ \begin{array}{l} \mathbf{if}\;M\_m \leq 1.96 \cdot 10^{-195}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\sqrt{\left(-M\_m\right) \cdot M\_m}, c0, c0 \cdot \left(\left(d \cdot \frac{d}{\left(\left(D \cdot D\right) \cdot w\right) \cdot h}\right) \cdot c0\right)\right)}{2 \cdot w}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(\left(d \cdot d\right) \cdot c0\right)}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w}\\ \end{array} \end{array} \]
              M_m = (fabs.f64 M)
              (FPCore (c0 w h D d M_m)
               :precision binary64
               (if (<= M_m 1.96e-195)
                 (/
                  (fma
                   (sqrt (* (- M_m) M_m))
                   c0
                   (* c0 (* (* d (/ d (* (* (* D D) w) h))) c0)))
                  (* 2.0 w))
                 (* (/ c0 (* 2.0 w)) (/ (* 2.0 (* (* d d) c0)) (* (* (* D D) h) w)))))
              M_m = fabs(M);
              double code(double c0, double w, double h, double D, double d, double M_m) {
              	double tmp;
              	if (M_m <= 1.96e-195) {
              		tmp = fma(sqrt((-M_m * M_m)), c0, (c0 * ((d * (d / (((D * D) * w) * h))) * c0))) / (2.0 * w);
              	} else {
              		tmp = (c0 / (2.0 * w)) * ((2.0 * ((d * d) * c0)) / (((D * D) * h) * w));
              	}
              	return tmp;
              }
              
              M_m = abs(M)
              function code(c0, w, h, D, d, M_m)
              	tmp = 0.0
              	if (M_m <= 1.96e-195)
              		tmp = Float64(fma(sqrt(Float64(Float64(-M_m) * M_m)), c0, Float64(c0 * Float64(Float64(d * Float64(d / Float64(Float64(Float64(D * D) * w) * h))) * c0))) / Float64(2.0 * w));
              	else
              		tmp = Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(2.0 * Float64(Float64(d * d) * c0)) / Float64(Float64(Float64(D * D) * h) * w)));
              	end
              	return tmp
              end
              
              M_m = N[Abs[M], $MachinePrecision]
              code[c0_, w_, h_, D_, d_, M$95$m_] := If[LessEqual[M$95$m, 1.96e-195], N[(N[(N[Sqrt[N[((-M$95$m) * M$95$m), $MachinePrecision]], $MachinePrecision] * c0 + N[(c0 * N[(N[(d * N[(d / N[(N[(N[(D * D), $MachinePrecision] * w), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(2.0 * w), $MachinePrecision]), $MachinePrecision], N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
              
              \begin{array}{l}
              M_m = \left|M\right|
              
              \\
              \begin{array}{l}
              \mathbf{if}\;M\_m \leq 1.96 \cdot 10^{-195}:\\
              \;\;\;\;\frac{\mathsf{fma}\left(\sqrt{\left(-M\_m\right) \cdot M\_m}, c0, c0 \cdot \left(\left(d \cdot \frac{d}{\left(\left(D \cdot D\right) \cdot w\right) \cdot h}\right) \cdot c0\right)\right)}{2 \cdot w}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(\left(d \cdot d\right) \cdot c0\right)}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if M < 1.96e-195

                1. Initial program 23.7%

                  \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
                2. Add Preprocessing
                3. Step-by-step derivation
                  1. lift-*.f64N/A

                    \[\leadsto \color{blue}{\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. lift-+.f64N/A

                    \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\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)} \]
                  3. +-commutativeN/A

                    \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\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} + \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \]
                  4. distribute-lft-inN/A

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

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

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

                    \[\leadsto \frac{\mathsf{fma}\left(\sqrt{\color{blue}{\mathsf{neg}\left({M}^{2}\right)}}, c0, c0 \cdot \left(\frac{{\left(\frac{d}{D}\right)}^{2}}{h \cdot w} \cdot c0\right)\right)}{2 \cdot w} \]
                  2. lower-neg.f64N/A

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

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

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

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

                    \[\leadsto \frac{\mathsf{fma}\left(\sqrt{-M \cdot M}, c0, c0 \cdot \left(\color{blue}{\frac{{\left(\frac{d}{D}\right)}^{2}}{h \cdot w}} \cdot c0\right)\right)}{2 \cdot w} \]
                  2. lift-pow.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \frac{\mathsf{fma}\left(\sqrt{-M \cdot M}, c0, c0 \cdot \left(\color{blue}{\left(d \cdot \frac{d}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \cdot c0\right)\right)}{2 \cdot w} \]
                  16. lower-*.f64N/A

                    \[\leadsto \frac{\mathsf{fma}\left(\sqrt{-M \cdot M}, c0, c0 \cdot \left(\color{blue}{\left(d \cdot \frac{d}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} \cdot c0\right)\right)}{2 \cdot w} \]
                  17. lower-/.f64N/A

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

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

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

                    \[\leadsto \frac{\mathsf{fma}\left(\sqrt{-M \cdot M}, c0, c0 \cdot \left(\left(d \cdot \frac{d}{\color{blue}{\left(\left(D \cdot D\right) \cdot w\right) \cdot h}}\right) \cdot c0\right)\right)}{2 \cdot w} \]
                  21. lower-*.f64N/A

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

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

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

                if 1.96e-195 < M

                1. Initial program 16.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 \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(2 \cdot \frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)} \]
                4. Step-by-step derivation
                  1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 1.96 \cdot 10^{-195}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\sqrt{\left(-M\right) \cdot M}, c0, c0 \cdot \left(\left(d \cdot \frac{d}{\left(\left(D \cdot D\right) \cdot w\right) \cdot h}\right) \cdot c0\right)\right)}{2 \cdot w}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(\left(d \cdot d\right) \cdot c0\right)}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w}\\ \end{array} \]
              5. Add Preprocessing

              Alternative 5: 33.0% accurate, 2.5× speedup?

              \[\begin{array}{l} M_m = \left|M\right| \\ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(\left(d \cdot d\right) \cdot c0\right)}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w} \end{array} \]
              M_m = (fabs.f64 M)
              (FPCore (c0 w h D d M_m)
               :precision binary64
               (* (/ c0 (* 2.0 w)) (/ (* 2.0 (* (* d d) c0)) (* (* (* D D) h) w))))
              M_m = fabs(M);
              double code(double c0, double w, double h, double D, double d, double M_m) {
              	return (c0 / (2.0 * w)) * ((2.0 * ((d * d) * c0)) / (((D * D) * h) * w));
              }
              
              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 = (c0 / (2.0d0 * w)) * ((2.0d0 * ((d_1 * d_1) * c0)) / (((d * d) * h) * w))
              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 (c0 / (2.0 * w)) * ((2.0 * ((d * d) * c0)) / (((D * D) * h) * w));
              }
              
              M_m = math.fabs(M)
              def code(c0, w, h, D, d, M_m):
              	return (c0 / (2.0 * w)) * ((2.0 * ((d * d) * c0)) / (((D * D) * h) * w))
              
              M_m = abs(M)
              function code(c0, w, h, D, d, M_m)
              	return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(2.0 * Float64(Float64(d * d) * c0)) / Float64(Float64(Float64(D * D) * h) * w)))
              end
              
              M_m = abs(M);
              function tmp = code(c0, w, h, D, d, M_m)
              	tmp = (c0 / (2.0 * w)) * ((2.0 * ((d * d) * c0)) / (((D * D) * h) * w));
              end
              
              M_m = N[Abs[M], $MachinePrecision]
              code[c0_, w_, h_, D_, d_, M$95$m_] := N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * N[(N[(d * d), $MachinePrecision] * c0), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
              
              \begin{array}{l}
              M_m = \left|M\right|
              
              \\
              \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(\left(d \cdot d\right) \cdot c0\right)}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w}
              \end{array}
              
              Derivation
              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 \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(2 \cdot \frac{c0 \cdot {d}^{2}}{{D}^{2} \cdot \left(h \cdot w\right)}\right)} \]
              4. Step-by-step derivation
                1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 6: 29.3% accurate, 2.6× speedup?

              \[\begin{array}{l} M_m = \left|M\right| \\ \frac{\frac{c0 \cdot c0}{D \cdot D} \cdot \frac{d \cdot d}{h \cdot w}}{w} \end{array} \]
              M_m = (fabs.f64 M)
              (FPCore (c0 w h D d M_m)
               :precision binary64
               (/ (* (/ (* c0 c0) (* D D)) (/ (* d d) (* h w))) w))
              M_m = fabs(M);
              double code(double c0, double w, double h, double D, double d, double M_m) {
              	return (((c0 * c0) / (D * D)) * ((d * d) / (h * w))) / w;
              }
              
              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 = (((c0 * c0) / (d * d)) * ((d_1 * d_1) / (h * w))) / w
              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 (((c0 * c0) / (D * D)) * ((d * d) / (h * w))) / w;
              }
              
              M_m = math.fabs(M)
              def code(c0, w, h, D, d, M_m):
              	return (((c0 * c0) / (D * D)) * ((d * d) / (h * w))) / w
              
              M_m = abs(M)
              function code(c0, w, h, D, d, M_m)
              	return Float64(Float64(Float64(Float64(c0 * c0) / Float64(D * D)) * Float64(Float64(d * d) / Float64(h * w))) / w)
              end
              
              M_m = abs(M);
              function tmp = code(c0, w, h, D, d, M_m)
              	tmp = (((c0 * c0) / (D * D)) * ((d * d) / (h * w))) / w;
              end
              
              M_m = N[Abs[M], $MachinePrecision]
              code[c0_, w_, h_, D_, d_, M$95$m_] := N[(N[(N[(N[(c0 * c0), $MachinePrecision] / N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(d * d), $MachinePrecision] / N[(h * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]
              
              \begin{array}{l}
              M_m = \left|M\right|
              
              \\
              \frac{\frac{c0 \cdot c0}{D \cdot D} \cdot \frac{d \cdot d}{h \cdot w}}{w}
              \end{array}
              
              Derivation
              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. Applied rewrites33.3%

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{\frac{c0 \cdot c0}{D \cdot D} \cdot \frac{\color{blue}{d \cdot d}}{h \cdot w}}{w} \]
                11. lower-*.f6424.1

                  \[\leadsto \frac{\frac{c0 \cdot c0}{D \cdot D} \cdot \frac{d \cdot d}{\color{blue}{h \cdot w}}}{w} \]
              6. Applied rewrites24.1%

                \[\leadsto \frac{\color{blue}{\frac{c0 \cdot c0}{D \cdot D} \cdot \frac{d \cdot d}{h \cdot w}}}{w} \]
              7. Add Preprocessing

              Alternative 7: 25.8% accurate, 3.3× speedup?

              \[\begin{array}{l} M_m = \left|M\right| \\ \left(c0 \cdot c0\right) \cdot \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \left(w \cdot w\right)} \end{array} \]
              M_m = (fabs.f64 M)
              (FPCore (c0 w h D d M_m)
               :precision binary64
               (* (* c0 c0) (/ (* d d) (* (* (* D D) h) (* w w)))))
              M_m = fabs(M);
              double code(double c0, double w, double h, double D, double d, double M_m) {
              	return (c0 * c0) * ((d * d) / (((D * D) * h) * (w * w)));
              }
              
              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 = (c0 * c0) * ((d_1 * d_1) / (((d * d) * h) * (w * w)))
              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 (c0 * c0) * ((d * d) / (((D * D) * h) * (w * w)));
              }
              
              M_m = math.fabs(M)
              def code(c0, w, h, D, d, M_m):
              	return (c0 * c0) * ((d * d) / (((D * D) * h) * (w * w)))
              
              M_m = abs(M)
              function code(c0, w, h, D, d, M_m)
              	return Float64(Float64(c0 * c0) * Float64(Float64(d * d) / Float64(Float64(Float64(D * D) * h) * Float64(w * w))))
              end
              
              M_m = abs(M);
              function tmp = code(c0, w, h, D, d, M_m)
              	tmp = (c0 * c0) * ((d * d) / (((D * D) * h) * (w * w)));
              end
              
              M_m = N[Abs[M], $MachinePrecision]
              code[c0_, w_, h_, D_, d_, M$95$m_] := N[(N[(c0 * c0), $MachinePrecision] * N[(N[(d * d), $MachinePrecision] / N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
              
              \begin{array}{l}
              M_m = \left|M\right|
              
              \\
              \left(c0 \cdot c0\right) \cdot \frac{d \cdot d}{\left(\left(D \cdot D\right) \cdot h\right) \cdot \left(w \cdot w\right)}
              \end{array}
              
              Derivation
              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. associate-/l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 8: 2.0% accurate, 3.7× speedup?

              \[\begin{array}{l} M_m = \left|M\right| \\ -4 \cdot \frac{\left(c0 \cdot c0\right) \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot h} \end{array} \]
              M_m = (fabs.f64 M)
              (FPCore (c0 w h D d M_m)
               :precision binary64
               (* -4.0 (/ (* (* c0 c0) (* d d)) (* (* D D) h))))
              M_m = fabs(M);
              double code(double c0, double w, double h, double D, double d, double M_m) {
              	return -4.0 * (((c0 * c0) * (d * d)) / ((D * D) * h));
              }
              
              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 = (-4.0d0) * (((c0 * c0) * (d_1 * d_1)) / ((d * d) * h))
              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 -4.0 * (((c0 * c0) * (d * d)) / ((D * D) * h));
              }
              
              M_m = math.fabs(M)
              def code(c0, w, h, D, d, M_m):
              	return -4.0 * (((c0 * c0) * (d * d)) / ((D * D) * h))
              
              M_m = abs(M)
              function code(c0, w, h, D, d, M_m)
              	return Float64(-4.0 * Float64(Float64(Float64(c0 * c0) * Float64(d * d)) / Float64(Float64(D * D) * h)))
              end
              
              M_m = abs(M);
              function tmp = code(c0, w, h, D, d, M_m)
              	tmp = -4.0 * (((c0 * c0) * (d * d)) / ((D * D) * h));
              end
              
              M_m = N[Abs[M], $MachinePrecision]
              code[c0_, w_, h_, D_, d_, M$95$m_] := N[(-4.0 * N[(N[(N[(c0 * c0), $MachinePrecision] * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
              
              \begin{array}{l}
              M_m = \left|M\right|
              
              \\
              -4 \cdot \frac{\left(c0 \cdot c0\right) \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot h}
              \end{array}
              
              Derivation
              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 0

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

                  \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{-1} \cdot M\right)} \]
                2. lower-*.f64N/A

                  \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{-1} \cdot M\right)} \]
                3. lower-sqrt.f640.0

                  \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\sqrt{-1}} \cdot M\right) \]
              5. Applied rewrites0.0%

                \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{-1} \cdot M\right)} \]
              6. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \frac{c0}{\color{blue}{2 \cdot w}} \cdot \left(\sqrt{-1} \cdot M\right) \]
                2. count-2-revN/A

                  \[\leadsto \frac{c0}{\color{blue}{w + w}} \cdot \left(\sqrt{-1} \cdot M\right) \]
                3. lower-+.f640.0

                  \[\leadsto \frac{c0}{\color{blue}{w + w}} \cdot \left(\sqrt{-1} \cdot M\right) \]
              7. Applied rewrites0.0%

                \[\leadsto \frac{c0}{\color{blue}{w + w}} \cdot \left(\sqrt{-1} \cdot M\right) \]
              8. Step-by-step derivation
                1. Applied rewrites0.0%

                  \[\leadsto \color{blue}{\left(\left(-2 \cdot w\right) \cdot c0\right) \cdot \left(\sqrt{-1} \cdot M\right)} \]
                2. Taylor expanded in c0 around inf

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

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

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

                    \[\leadsto -4 \cdot \frac{\color{blue}{{c0}^{2} \cdot {d}^{2}}}{{D}^{2} \cdot h} \]
                  4. unpow2N/A

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

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

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

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

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

                    \[\leadsto -4 \cdot \frac{\left(c0 \cdot c0\right) \cdot \left(d \cdot d\right)}{\color{blue}{\left(D \cdot D\right)} \cdot h} \]
                  10. lower-*.f641.8

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

                  \[\leadsto \color{blue}{-4 \cdot \frac{\left(c0 \cdot c0\right) \cdot \left(d \cdot d\right)}{\left(D \cdot D\right) \cdot h}} \]
                5. Add Preprocessing

                Alternative 9: 0.0% accurate, 5.0× speedup?

                \[\begin{array}{l} M_m = \left|M\right| \\ \left(\left(-2 \cdot w\right) \cdot c0\right) \cdot \left(\sqrt{-1} \cdot M\_m\right) \end{array} \]
                M_m = (fabs.f64 M)
                (FPCore (c0 w h D d M_m)
                 :precision binary64
                 (* (* (* -2.0 w) c0) (* (sqrt -1.0) M_m)))
                M_m = fabs(M);
                double code(double c0, double w, double h, double D, double d, double M_m) {
                	return ((-2.0 * w) * c0) * (sqrt(-1.0) * M_m);
                }
                
                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 = (((-2.0d0) * w) * c0) * (sqrt((-1.0d0)) * m_m)
                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 ((-2.0 * w) * c0) * (Math.sqrt(-1.0) * M_m);
                }
                
                M_m = math.fabs(M)
                def code(c0, w, h, D, d, M_m):
                	return ((-2.0 * w) * c0) * (math.sqrt(-1.0) * M_m)
                
                M_m = abs(M)
                function code(c0, w, h, D, d, M_m)
                	return Float64(Float64(Float64(-2.0 * w) * c0) * Float64(sqrt(-1.0) * M_m))
                end
                
                M_m = abs(M);
                function tmp = code(c0, w, h, D, d, M_m)
                	tmp = ((-2.0 * w) * c0) * (sqrt(-1.0) * M_m);
                end
                
                M_m = N[Abs[M], $MachinePrecision]
                code[c0_, w_, h_, D_, d_, M$95$m_] := N[(N[(N[(-2.0 * w), $MachinePrecision] * c0), $MachinePrecision] * N[(N[Sqrt[-1.0], $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision]
                
                \begin{array}{l}
                M_m = \left|M\right|
                
                \\
                \left(\left(-2 \cdot w\right) \cdot c0\right) \cdot \left(\sqrt{-1} \cdot M\_m\right)
                \end{array}
                
                Derivation
                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 0

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

                    \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{-1} \cdot M\right)} \]
                  2. lower-*.f64N/A

                    \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{-1} \cdot M\right)} \]
                  3. lower-sqrt.f640.0

                    \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\sqrt{-1}} \cdot M\right) \]
                5. Applied rewrites0.0%

                  \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(\sqrt{-1} \cdot M\right)} \]
                6. Step-by-step derivation
                  1. lift-*.f64N/A

                    \[\leadsto \frac{c0}{\color{blue}{2 \cdot w}} \cdot \left(\sqrt{-1} \cdot M\right) \]
                  2. count-2-revN/A

                    \[\leadsto \frac{c0}{\color{blue}{w + w}} \cdot \left(\sqrt{-1} \cdot M\right) \]
                  3. lower-+.f640.0

                    \[\leadsto \frac{c0}{\color{blue}{w + w}} \cdot \left(\sqrt{-1} \cdot M\right) \]
                7. Applied rewrites0.0%

                  \[\leadsto \frac{c0}{\color{blue}{w + w}} \cdot \left(\sqrt{-1} \cdot M\right) \]
                8. Step-by-step derivation
                  1. Applied rewrites0.0%

                    \[\leadsto \color{blue}{\left(\left(-2 \cdot w\right) \cdot c0\right) \cdot \left(\sqrt{-1} \cdot M\right)} \]
                  2. Add Preprocessing

                  Reproduce

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