Henrywood and Agarwal, Equation (13)

Percentage Accurate: 24.7% → 47.0%
Time: 19.6s
Alternatives: 12
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 12 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.7% 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: 47.0% accurate, 1.1× speedup?

\[\begin{array}{l} M_m = \left|M\right| \\ \begin{array}{l} t_0 := \frac{\left(D \cdot M\_m\right) \cdot h}{d}\\ \mathbf{if}\;M\_m \leq 5.5 \cdot 10^{-121}:\\ \;\;\;\;0\\ \mathbf{elif}\;M\_m \leq 7.5 \cdot 10^{+170}:\\ \;\;\;\;\frac{\mathsf{fma}\left(t\_0, -0.25 \cdot t\_0, \left(\frac{c0}{D} \cdot \frac{d}{w}\right) \cdot \frac{\frac{d}{w} \cdot c0}{D}\right)}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w}}{w}\\ \end{array} \end{array} \]
M_m = (fabs.f64 M)
(FPCore (c0 w h D d M_m)
 :precision binary64
 (let* ((t_0 (/ (* (* D M_m) h) d)))
   (if (<= M_m 5.5e-121)
     0.0
     (if (<= M_m 7.5e+170)
       (/
        (fma t_0 (* -0.25 t_0) (* (* (/ c0 D) (/ d w)) (/ (* (/ d w) c0) D)))
        h)
       (/ (/ (* (* d c0) (* d c0)) (* (* (* D D) h) w)) w)))))
M_m = fabs(M);
double code(double c0, double w, double h, double D, double d, double M_m) {
	double t_0 = ((D * M_m) * h) / d;
	double tmp;
	if (M_m <= 5.5e-121) {
		tmp = 0.0;
	} else if (M_m <= 7.5e+170) {
		tmp = fma(t_0, (-0.25 * t_0), (((c0 / D) * (d / w)) * (((d / w) * c0) / D))) / h;
	} else {
		tmp = (((d * c0) * (d * c0)) / (((D * D) * h) * w)) / w;
	}
	return tmp;
}
M_m = abs(M)
function code(c0, w, h, D, d, M_m)
	t_0 = Float64(Float64(Float64(D * M_m) * h) / d)
	tmp = 0.0
	if (M_m <= 5.5e-121)
		tmp = 0.0;
	elseif (M_m <= 7.5e+170)
		tmp = Float64(fma(t_0, Float64(-0.25 * t_0), Float64(Float64(Float64(c0 / D) * Float64(d / w)) * Float64(Float64(Float64(d / w) * c0) / D))) / h);
	else
		tmp = Float64(Float64(Float64(Float64(d * c0) * Float64(d * c0)) / Float64(Float64(Float64(D * D) * h) * w)) / w);
	end
	return tmp
end
M_m = N[Abs[M], $MachinePrecision]
code[c0_, w_, h_, D_, d_, M$95$m_] := Block[{t$95$0 = N[(N[(N[(D * M$95$m), $MachinePrecision] * h), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[M$95$m, 5.5e-121], 0.0, If[LessEqual[M$95$m, 7.5e+170], N[(N[(t$95$0 * N[(-0.25 * t$95$0), $MachinePrecision] + N[(N[(N[(c0 / D), $MachinePrecision] * N[(d / w), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(d / w), $MachinePrecision] * c0), $MachinePrecision] / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[(d * c0), $MachinePrecision] * N[(d * c0), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|

\\
\begin{array}{l}
t_0 := \frac{\left(D \cdot M\_m\right) \cdot h}{d}\\
\mathbf{if}\;M\_m \leq 5.5 \cdot 10^{-121}:\\
\;\;\;\;0\\

\mathbf{elif}\;M\_m \leq 7.5 \cdot 10^{+170}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_0, -0.25 \cdot t\_0, \left(\frac{c0}{D} \cdot \frac{d}{w}\right) \cdot \frac{\frac{d}{w} \cdot c0}{D}\right)}{h}\\

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


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

    1. Initial program 22.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-eval37.7

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

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

    if 5.50000000000000031e-121 < M < 7.5000000000000002e170

    1. Initial program 23.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 h around 0

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(M \cdot D\right) \cdot h}{d}, \frac{\left(M \cdot D\right) \cdot h}{d} \cdot -0.25, {\left(\frac{d}{w}\right)}^{2} \cdot {\left(\frac{c0}{D}\right)}^{2}\right)}{h} \]
      2. Step-by-step derivation
        1. Applied rewrites56.6%

          \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(M \cdot D\right) \cdot h}{d}, \frac{\left(M \cdot D\right) \cdot h}{d} \cdot -0.25, \left(\frac{c0}{D} \cdot \frac{d}{w}\right) \cdot \left(\frac{c0}{D} \cdot \frac{d}{w}\right)\right)}{h} \]
        2. Step-by-step derivation
          1. Applied rewrites56.7%

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

          if 7.5000000000000002e170 < 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. Applied rewrites38.1%

            \[\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{\frac{h \cdot w}{c0}}{{\left(\frac{d}{D}\right)}^{2}}\right)}^{-2}\right)}\right) \cdot \left(c0 \cdot 0.5\right)}{w}} \]
          4. Taylor expanded in w around 0

            \[\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 5.5 \cdot 10^{-121}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 7.5 \cdot 10^{+170}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{\left(D \cdot M\right) \cdot h}{d}, -0.25 \cdot \frac{\left(D \cdot M\right) \cdot h}{d}, \left(\frac{c0}{D} \cdot \frac{d}{w}\right) \cdot \frac{\frac{d}{w} \cdot c0}{D}\right)}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w}}{w}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 2: 55.1% accurate, 0.7× speedup?

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

            \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
          2. Add Preprocessing
          3. Applied rewrites65.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{0} \]
          8. Recombined 2 regimes into one program.
          9. Final simplification47.9%

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

          Alternative 3: 55.7% accurate, 0.7× speedup?

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

              \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
            2. Add Preprocessing
            3. Applied rewrites65.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 4: 51.7% accurate, 0.7× speedup?

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

                  \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
                2. Add Preprocessing
                3. Applied rewrites65.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{0} \]
                8. Recombined 2 regimes into one program.
                9. Final simplification45.5%

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

                Alternative 5: 47.0% accurate, 1.1× speedup?

                \[\begin{array}{l} M_m = \left|M\right| \\ \begin{array}{l} t_0 := \frac{\left(D \cdot M\_m\right) \cdot h}{d}\\ t_1 := \frac{c0}{D} \cdot \frac{d}{w}\\ \mathbf{if}\;M\_m \leq 5.5 \cdot 10^{-121}:\\ \;\;\;\;0\\ \mathbf{elif}\;M\_m \leq 1.05 \cdot 10^{+170}:\\ \;\;\;\;\frac{\mathsf{fma}\left(t\_0, -0.25 \cdot t\_0, t\_1 \cdot t\_1\right)}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w}}{w}\\ \end{array} \end{array} \]
                M_m = (fabs.f64 M)
                (FPCore (c0 w h D d M_m)
                 :precision binary64
                 (let* ((t_0 (/ (* (* D M_m) h) d)) (t_1 (* (/ c0 D) (/ d w))))
                   (if (<= M_m 5.5e-121)
                     0.0
                     (if (<= M_m 1.05e+170)
                       (/ (fma t_0 (* -0.25 t_0) (* t_1 t_1)) h)
                       (/ (/ (* (* d c0) (* d c0)) (* (* (* D D) h) w)) w)))))
                M_m = fabs(M);
                double code(double c0, double w, double h, double D, double d, double M_m) {
                	double t_0 = ((D * M_m) * h) / d;
                	double t_1 = (c0 / D) * (d / w);
                	double tmp;
                	if (M_m <= 5.5e-121) {
                		tmp = 0.0;
                	} else if (M_m <= 1.05e+170) {
                		tmp = fma(t_0, (-0.25 * t_0), (t_1 * t_1)) / h;
                	} else {
                		tmp = (((d * c0) * (d * c0)) / (((D * D) * h) * w)) / w;
                	}
                	return tmp;
                }
                
                M_m = abs(M)
                function code(c0, w, h, D, d, M_m)
                	t_0 = Float64(Float64(Float64(D * M_m) * h) / d)
                	t_1 = Float64(Float64(c0 / D) * Float64(d / w))
                	tmp = 0.0
                	if (M_m <= 5.5e-121)
                		tmp = 0.0;
                	elseif (M_m <= 1.05e+170)
                		tmp = Float64(fma(t_0, Float64(-0.25 * t_0), Float64(t_1 * t_1)) / h);
                	else
                		tmp = Float64(Float64(Float64(Float64(d * c0) * Float64(d * c0)) / Float64(Float64(Float64(D * D) * h) * w)) / w);
                	end
                	return tmp
                end
                
                M_m = N[Abs[M], $MachinePrecision]
                code[c0_, w_, h_, D_, d_, M$95$m_] := Block[{t$95$0 = N[(N[(N[(D * M$95$m), $MachinePrecision] * h), $MachinePrecision] / d), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 / D), $MachinePrecision] * N[(d / w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M$95$m, 5.5e-121], 0.0, If[LessEqual[M$95$m, 1.05e+170], N[(N[(t$95$0 * N[(-0.25 * t$95$0), $MachinePrecision] + N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[(d * c0), $MachinePrecision] * N[(d * c0), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]]]]]
                
                \begin{array}{l}
                M_m = \left|M\right|
                
                \\
                \begin{array}{l}
                t_0 := \frac{\left(D \cdot M\_m\right) \cdot h}{d}\\
                t_1 := \frac{c0}{D} \cdot \frac{d}{w}\\
                \mathbf{if}\;M\_m \leq 5.5 \cdot 10^{-121}:\\
                \;\;\;\;0\\
                
                \mathbf{elif}\;M\_m \leq 1.05 \cdot 10^{+170}:\\
                \;\;\;\;\frac{\mathsf{fma}\left(t\_0, -0.25 \cdot t\_0, t\_1 \cdot t\_1\right)}{h}\\
                
                \mathbf{else}:\\
                \;\;\;\;\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w}}{w}\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if M < 5.50000000000000031e-121

                  1. Initial program 22.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-eval37.7

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

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

                  if 5.50000000000000031e-121 < M < 1.04999999999999999e170

                  1. Initial program 23.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 h around 0

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

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

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

                      \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(M \cdot D\right) \cdot h}{d}, \frac{\left(M \cdot D\right) \cdot h}{d} \cdot -0.25, {\left(\frac{d}{w}\right)}^{2} \cdot {\left(\frac{c0}{D}\right)}^{2}\right)}{h} \]
                    2. Step-by-step derivation
                      1. Applied rewrites56.6%

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

                      if 1.04999999999999999e170 < 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. Applied rewrites38.1%

                        \[\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{\frac{h \cdot w}{c0}}{{\left(\frac{d}{D}\right)}^{2}}\right)}^{-2}\right)}\right) \cdot \left(c0 \cdot 0.5\right)}{w}} \]
                      4. Taylor expanded in w around 0

                        \[\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 5.5 \cdot 10^{-121}:\\ \;\;\;\;0\\ \mathbf{elif}\;M \leq 1.05 \cdot 10^{+170}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{\left(D \cdot M\right) \cdot h}{d}, -0.25 \cdot \frac{\left(D \cdot M\right) \cdot h}{d}, \left(\frac{c0}{D} \cdot \frac{d}{w}\right) \cdot \left(\frac{c0}{D} \cdot \frac{d}{w}\right)\right)}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w}}{w}\\ \end{array} \]
                    5. Add Preprocessing

                    Alternative 6: 46.5% accurate, 1.2× speedup?

                    \[\begin{array}{l} M_m = \left|M\right| \\ \begin{array}{l} t_0 := \frac{\left(D \cdot M\_m\right) \cdot h}{d}\\ \mathbf{if}\;M\_m \leq 6 \cdot 10^{-121}:\\ \;\;\;\;0\\ \mathbf{elif}\;M\_m \leq 7.5 \cdot 10^{+170}:\\ \;\;\;\;\frac{\mathsf{fma}\left(t\_0, -0.25 \cdot t\_0, \left(\frac{c0}{D \cdot w} \cdot d\right) \cdot \left(\frac{c0}{D} \cdot \frac{d}{w}\right)\right)}{h}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w}}{w}\\ \end{array} \end{array} \]
                    M_m = (fabs.f64 M)
                    (FPCore (c0 w h D d M_m)
                     :precision binary64
                     (let* ((t_0 (/ (* (* D M_m) h) d)))
                       (if (<= M_m 6e-121)
                         0.0
                         (if (<= M_m 7.5e+170)
                           (/
                            (fma t_0 (* -0.25 t_0) (* (* (/ c0 (* D w)) d) (* (/ c0 D) (/ d w))))
                            h)
                           (/ (/ (* (* d c0) (* d c0)) (* (* (* D D) h) w)) w)))))
                    M_m = fabs(M);
                    double code(double c0, double w, double h, double D, double d, double M_m) {
                    	double t_0 = ((D * M_m) * h) / d;
                    	double tmp;
                    	if (M_m <= 6e-121) {
                    		tmp = 0.0;
                    	} else if (M_m <= 7.5e+170) {
                    		tmp = fma(t_0, (-0.25 * t_0), (((c0 / (D * w)) * d) * ((c0 / D) * (d / w)))) / h;
                    	} else {
                    		tmp = (((d * c0) * (d * c0)) / (((D * D) * h) * w)) / w;
                    	}
                    	return tmp;
                    }
                    
                    M_m = abs(M)
                    function code(c0, w, h, D, d, M_m)
                    	t_0 = Float64(Float64(Float64(D * M_m) * h) / d)
                    	tmp = 0.0
                    	if (M_m <= 6e-121)
                    		tmp = 0.0;
                    	elseif (M_m <= 7.5e+170)
                    		tmp = Float64(fma(t_0, Float64(-0.25 * t_0), Float64(Float64(Float64(c0 / Float64(D * w)) * d) * Float64(Float64(c0 / D) * Float64(d / w)))) / h);
                    	else
                    		tmp = Float64(Float64(Float64(Float64(d * c0) * Float64(d * c0)) / Float64(Float64(Float64(D * D) * h) * w)) / w);
                    	end
                    	return tmp
                    end
                    
                    M_m = N[Abs[M], $MachinePrecision]
                    code[c0_, w_, h_, D_, d_, M$95$m_] := Block[{t$95$0 = N[(N[(N[(D * M$95$m), $MachinePrecision] * h), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[M$95$m, 6e-121], 0.0, If[LessEqual[M$95$m, 7.5e+170], N[(N[(t$95$0 * N[(-0.25 * t$95$0), $MachinePrecision] + N[(N[(N[(c0 / N[(D * w), $MachinePrecision]), $MachinePrecision] * d), $MachinePrecision] * N[(N[(c0 / D), $MachinePrecision] * N[(d / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[(d * c0), $MachinePrecision] * N[(d * c0), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]]]]
                    
                    \begin{array}{l}
                    M_m = \left|M\right|
                    
                    \\
                    \begin{array}{l}
                    t_0 := \frac{\left(D \cdot M\_m\right) \cdot h}{d}\\
                    \mathbf{if}\;M\_m \leq 6 \cdot 10^{-121}:\\
                    \;\;\;\;0\\
                    
                    \mathbf{elif}\;M\_m \leq 7.5 \cdot 10^{+170}:\\
                    \;\;\;\;\frac{\mathsf{fma}\left(t\_0, -0.25 \cdot t\_0, \left(\frac{c0}{D \cdot w} \cdot d\right) \cdot \left(\frac{c0}{D} \cdot \frac{d}{w}\right)\right)}{h}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w}}{w}\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 3 regimes
                    2. if M < 5.9999999999999999e-121

                      1. Initial program 22.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-eval37.7

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

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

                      if 5.9999999999999999e-121 < M < 7.5000000000000002e170

                      1. Initial program 23.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 h around 0

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

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

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

                          \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(M \cdot D\right) \cdot h}{d}, \frac{\left(M \cdot D\right) \cdot h}{d} \cdot -0.25, {\left(\frac{d}{w}\right)}^{2} \cdot {\left(\frac{c0}{D}\right)}^{2}\right)}{h} \]
                        2. Step-by-step derivation
                          1. Applied rewrites56.6%

                            \[\leadsto \frac{\mathsf{fma}\left(\frac{\left(M \cdot D\right) \cdot h}{d}, \frac{\left(M \cdot D\right) \cdot h}{d} \cdot -0.25, \left(\frac{c0}{D} \cdot \frac{d}{w}\right) \cdot \left(\frac{c0}{D} \cdot \frac{d}{w}\right)\right)}{h} \]
                          2. Step-by-step derivation
                            1. Applied rewrites54.7%

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

                            if 7.5000000000000002e170 < 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. Applied rewrites38.1%

                              \[\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{\frac{h \cdot w}{c0}}{{\left(\frac{d}{D}\right)}^{2}}\right)}^{-2}\right)}\right) \cdot \left(c0 \cdot 0.5\right)}{w}} \]
                            4. Taylor expanded in w around 0

                              \[\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          Alternative 7: 46.3% accurate, 2.2× speedup?

                          \[\begin{array}{l} M_m = \left|M\right| \\ \begin{array}{l} \mathbf{if}\;M\_m \leq 2.1 \cdot 10^{-123}:\\ \;\;\;\;0\\ \mathbf{elif}\;M\_m \leq 2 \cdot 10^{+164}:\\ \;\;\;\;\left(\left(\frac{d}{\left(h \cdot w\right) \cdot D} \cdot \frac{c0}{D}\right) \cdot \frac{d}{w}\right) \cdot c0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w}}{w}\\ \end{array} \end{array} \]
                          M_m = (fabs.f64 M)
                          (FPCore (c0 w h D d M_m)
                           :precision binary64
                           (if (<= M_m 2.1e-123)
                             0.0
                             (if (<= M_m 2e+164)
                               (* (* (* (/ d (* (* h w) D)) (/ c0 D)) (/ d w)) c0)
                               (/ (/ (* (* d c0) (* d c0)) (* (* (* D D) h) w)) 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 <= 2.1e-123) {
                          		tmp = 0.0;
                          	} else if (M_m <= 2e+164) {
                          		tmp = (((d / ((h * w) * D)) * (c0 / D)) * (d / w)) * c0;
                          	} else {
                          		tmp = (((d * c0) * (d * c0)) / (((D * D) * h) * w)) / w;
                          	}
                          	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) :: tmp
                              if (m_m <= 2.1d-123) then
                                  tmp = 0.0d0
                              else if (m_m <= 2d+164) then
                                  tmp = (((d_1 / ((h * w) * d)) * (c0 / d)) * (d_1 / w)) * c0
                              else
                                  tmp = (((d_1 * c0) * (d_1 * c0)) / (((d * d) * h) * w)) / w
                              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 tmp;
                          	if (M_m <= 2.1e-123) {
                          		tmp = 0.0;
                          	} else if (M_m <= 2e+164) {
                          		tmp = (((d / ((h * w) * D)) * (c0 / D)) * (d / w)) * c0;
                          	} else {
                          		tmp = (((d * c0) * (d * c0)) / (((D * D) * h) * w)) / w;
                          	}
                          	return tmp;
                          }
                          
                          M_m = math.fabs(M)
                          def code(c0, w, h, D, d, M_m):
                          	tmp = 0
                          	if M_m <= 2.1e-123:
                          		tmp = 0.0
                          	elif M_m <= 2e+164:
                          		tmp = (((d / ((h * w) * D)) * (c0 / D)) * (d / w)) * c0
                          	else:
                          		tmp = (((d * c0) * (d * c0)) / (((D * D) * h) * w)) / w
                          	return tmp
                          
                          M_m = abs(M)
                          function code(c0, w, h, D, d, M_m)
                          	tmp = 0.0
                          	if (M_m <= 2.1e-123)
                          		tmp = 0.0;
                          	elseif (M_m <= 2e+164)
                          		tmp = Float64(Float64(Float64(Float64(d / Float64(Float64(h * w) * D)) * Float64(c0 / D)) * Float64(d / w)) * c0);
                          	else
                          		tmp = Float64(Float64(Float64(Float64(d * c0) * Float64(d * c0)) / Float64(Float64(Float64(D * D) * h) * w)) / w);
                          	end
                          	return tmp
                          end
                          
                          M_m = abs(M);
                          function tmp_2 = code(c0, w, h, D, d, M_m)
                          	tmp = 0.0;
                          	if (M_m <= 2.1e-123)
                          		tmp = 0.0;
                          	elseif (M_m <= 2e+164)
                          		tmp = (((d / ((h * w) * D)) * (c0 / D)) * (d / w)) * c0;
                          	else
                          		tmp = (((d * c0) * (d * c0)) / (((D * D) * h) * w)) / w;
                          	end
                          	tmp_2 = tmp;
                          end
                          
                          M_m = N[Abs[M], $MachinePrecision]
                          code[c0_, w_, h_, D_, d_, M$95$m_] := If[LessEqual[M$95$m, 2.1e-123], 0.0, If[LessEqual[M$95$m, 2e+164], N[(N[(N[(N[(d / N[(N[(h * w), $MachinePrecision] * D), $MachinePrecision]), $MachinePrecision] * N[(c0 / D), $MachinePrecision]), $MachinePrecision] * N[(d / w), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], N[(N[(N[(N[(d * c0), $MachinePrecision] * N[(d * c0), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(D * D), $MachinePrecision] * h), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision] / w), $MachinePrecision]]]
                          
                          \begin{array}{l}
                          M_m = \left|M\right|
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;M\_m \leq 2.1 \cdot 10^{-123}:\\
                          \;\;\;\;0\\
                          
                          \mathbf{elif}\;M\_m \leq 2 \cdot 10^{+164}:\\
                          \;\;\;\;\left(\left(\frac{d}{\left(h \cdot w\right) \cdot D} \cdot \frac{c0}{D}\right) \cdot \frac{d}{w}\right) \cdot c0\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{\left(\left(D \cdot D\right) \cdot h\right) \cdot w}}{w}\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 3 regimes
                          2. if M < 2.0999999999999999e-123

                            1. Initial program 22.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-eval37.7

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

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

                            if 2.0999999999999999e-123 < M < 2e164

                            1. Initial program 24.8%

                              \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
                            2. Add Preprocessing
                            3. Applied rewrites37.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                if 2e164 < 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. Applied rewrites33.8%

                                  \[\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{\frac{h \cdot w}{c0}}{{\left(\frac{d}{D}\right)}^{2}}\right)}^{-2}\right)}\right) \cdot \left(c0 \cdot 0.5\right)}{w}} \]
                                4. Taylor expanded in w around 0

                                  \[\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. lower-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              Alternative 8: 47.1% accurate, 2.2× speedup?

                              \[\begin{array}{l} M_m = \left|M\right| \\ \begin{array}{l} \mathbf{if}\;M\_m \leq 4.5 \cdot 10^{-195}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\frac{d}{D}}{w} \cdot \frac{\frac{d \cdot c0}{h}}{D \cdot w}\right) \cdot c0\\ \end{array} \end{array} \]
                              M_m = (fabs.f64 M)
                              (FPCore (c0 w h D d M_m)
                               :precision binary64
                               (if (<= M_m 4.5e-195)
                                 0.0
                                 (* (* (/ (/ d D) w) (/ (/ (* d c0) h) (* D w))) c0)))
                              M_m = fabs(M);
                              double code(double c0, double w, double h, double D, double d, double M_m) {
                              	double tmp;
                              	if (M_m <= 4.5e-195) {
                              		tmp = 0.0;
                              	} else {
                              		tmp = (((d / D) / w) * (((d * c0) / h) / (D * w))) * c0;
                              	}
                              	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) :: tmp
                                  if (m_m <= 4.5d-195) then
                                      tmp = 0.0d0
                                  else
                                      tmp = (((d_1 / d) / w) * (((d_1 * c0) / h) / (d * w))) * c0
                                  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 tmp;
                              	if (M_m <= 4.5e-195) {
                              		tmp = 0.0;
                              	} else {
                              		tmp = (((d / D) / w) * (((d * c0) / h) / (D * w))) * c0;
                              	}
                              	return tmp;
                              }
                              
                              M_m = math.fabs(M)
                              def code(c0, w, h, D, d, M_m):
                              	tmp = 0
                              	if M_m <= 4.5e-195:
                              		tmp = 0.0
                              	else:
                              		tmp = (((d / D) / w) * (((d * c0) / h) / (D * w))) * c0
                              	return tmp
                              
                              M_m = abs(M)
                              function code(c0, w, h, D, d, M_m)
                              	tmp = 0.0
                              	if (M_m <= 4.5e-195)
                              		tmp = 0.0;
                              	else
                              		tmp = Float64(Float64(Float64(Float64(d / D) / w) * Float64(Float64(Float64(d * c0) / h) / Float64(D * w))) * c0);
                              	end
                              	return tmp
                              end
                              
                              M_m = abs(M);
                              function tmp_2 = code(c0, w, h, D, d, M_m)
                              	tmp = 0.0;
                              	if (M_m <= 4.5e-195)
                              		tmp = 0.0;
                              	else
                              		tmp = (((d / D) / w) * (((d * c0) / h) / (D * w))) * c0;
                              	end
                              	tmp_2 = tmp;
                              end
                              
                              M_m = N[Abs[M], $MachinePrecision]
                              code[c0_, w_, h_, D_, d_, M$95$m_] := If[LessEqual[M$95$m, 4.5e-195], 0.0, N[(N[(N[(N[(d / D), $MachinePrecision] / w), $MachinePrecision] * N[(N[(N[(d * c0), $MachinePrecision] / h), $MachinePrecision] / N[(D * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision]]
                              
                              \begin{array}{l}
                              M_m = \left|M\right|
                              
                              \\
                              \begin{array}{l}
                              \mathbf{if}\;M\_m \leq 4.5 \cdot 10^{-195}:\\
                              \;\;\;\;0\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;\left(\frac{\frac{d}{D}}{w} \cdot \frac{\frac{d \cdot c0}{h}}{D \cdot w}\right) \cdot c0\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 2 regimes
                              2. if M < 4.5e-195

                                1. Initial program 23.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 \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-eval36.2

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

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

                                if 4.5e-195 < M

                                1. Initial program 17.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  Alternative 9: 46.5% accurate, 2.4× speedup?

                                  \[\begin{array}{l} M_m = \left|M\right| \\ \begin{array}{l} \mathbf{if}\;M\_m \leq 3.2 \cdot 10^{-184}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{d \cdot c0}{h} \cdot d}{D \cdot w}}{D \cdot w} \cdot c0\\ \end{array} \end{array} \]
                                  M_m = (fabs.f64 M)
                                  (FPCore (c0 w h D d M_m)
                                   :precision binary64
                                   (if (<= M_m 3.2e-184)
                                     0.0
                                     (* (/ (/ (* (/ (* d c0) h) d) (* D w)) (* D w)) c0)))
                                  M_m = fabs(M);
                                  double code(double c0, double w, double h, double D, double d, double M_m) {
                                  	double tmp;
                                  	if (M_m <= 3.2e-184) {
                                  		tmp = 0.0;
                                  	} else {
                                  		tmp = (((((d * c0) / h) * d) / (D * w)) / (D * w)) * c0;
                                  	}
                                  	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) :: tmp
                                      if (m_m <= 3.2d-184) then
                                          tmp = 0.0d0
                                      else
                                          tmp = (((((d_1 * c0) / h) * d_1) / (d * w)) / (d * w)) * c0
                                      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 tmp;
                                  	if (M_m <= 3.2e-184) {
                                  		tmp = 0.0;
                                  	} else {
                                  		tmp = (((((d * c0) / h) * d) / (D * w)) / (D * w)) * c0;
                                  	}
                                  	return tmp;
                                  }
                                  
                                  M_m = math.fabs(M)
                                  def code(c0, w, h, D, d, M_m):
                                  	tmp = 0
                                  	if M_m <= 3.2e-184:
                                  		tmp = 0.0
                                  	else:
                                  		tmp = (((((d * c0) / h) * d) / (D * w)) / (D * w)) * c0
                                  	return tmp
                                  
                                  M_m = abs(M)
                                  function code(c0, w, h, D, d, M_m)
                                  	tmp = 0.0
                                  	if (M_m <= 3.2e-184)
                                  		tmp = 0.0;
                                  	else
                                  		tmp = Float64(Float64(Float64(Float64(Float64(Float64(d * c0) / h) * d) / Float64(D * w)) / Float64(D * w)) * c0);
                                  	end
                                  	return tmp
                                  end
                                  
                                  M_m = abs(M);
                                  function tmp_2 = code(c0, w, h, D, d, M_m)
                                  	tmp = 0.0;
                                  	if (M_m <= 3.2e-184)
                                  		tmp = 0.0;
                                  	else
                                  		tmp = (((((d * c0) / h) * d) / (D * w)) / (D * w)) * c0;
                                  	end
                                  	tmp_2 = tmp;
                                  end
                                  
                                  M_m = N[Abs[M], $MachinePrecision]
                                  code[c0_, w_, h_, D_, d_, M$95$m_] := If[LessEqual[M$95$m, 3.2e-184], 0.0, N[(N[(N[(N[(N[(N[(d * c0), $MachinePrecision] / h), $MachinePrecision] * d), $MachinePrecision] / N[(D * w), $MachinePrecision]), $MachinePrecision] / N[(D * w), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision]]
                                  
                                  \begin{array}{l}
                                  M_m = \left|M\right|
                                  
                                  \\
                                  \begin{array}{l}
                                  \mathbf{if}\;M\_m \leq 3.2 \cdot 10^{-184}:\\
                                  \;\;\;\;0\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;\frac{\frac{\frac{d \cdot c0}{h} \cdot d}{D \cdot w}}{D \cdot w} \cdot c0\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 2 regimes
                                  2. if M < 3.2e-184

                                    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. 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-eval36.6

                                        \[\leadsto \color{blue}{0} \]
                                    5. Applied rewrites36.6%

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

                                    if 3.2e-184 < M

                                    1. Initial program 15.8%

                                      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right) \]
                                    2. Add Preprocessing
                                    3. Applied rewrites36.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                        \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq 3.2 \cdot 10^{-184}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{d \cdot c0}{h} \cdot d}{D \cdot w}}{D \cdot w} \cdot c0\\ \end{array} \]
                                      5. Add Preprocessing

                                      Alternative 10: 46.1% accurate, 2.4× speedup?

                                      \[\begin{array}{l} M_m = \left|M\right| \\ \begin{array}{l} \mathbf{if}\;M\_m \cdot M\_m \leq 6 \cdot 10^{-242}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{d}{\left(D \cdot h\right) \cdot \left(D \cdot w\right)} \cdot \left(\frac{d}{w} \cdot c0\right)\right) \cdot c0\\ \end{array} \end{array} \]
                                      M_m = (fabs.f64 M)
                                      (FPCore (c0 w h D d M_m)
                                       :precision binary64
                                       (if (<= (* M_m M_m) 6e-242)
                                         0.0
                                         (* (* (/ d (* (* D h) (* D w))) (* (/ d w) c0)) c0)))
                                      M_m = fabs(M);
                                      double code(double c0, double w, double h, double D, double d, double M_m) {
                                      	double tmp;
                                      	if ((M_m * M_m) <= 6e-242) {
                                      		tmp = 0.0;
                                      	} else {
                                      		tmp = ((d / ((D * h) * (D * w))) * ((d / w) * c0)) * c0;
                                      	}
                                      	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) :: tmp
                                          if ((m_m * m_m) <= 6d-242) then
                                              tmp = 0.0d0
                                          else
                                              tmp = ((d_1 / ((d * h) * (d * w))) * ((d_1 / w) * c0)) * c0
                                          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 tmp;
                                      	if ((M_m * M_m) <= 6e-242) {
                                      		tmp = 0.0;
                                      	} else {
                                      		tmp = ((d / ((D * h) * (D * w))) * ((d / w) * c0)) * c0;
                                      	}
                                      	return tmp;
                                      }
                                      
                                      M_m = math.fabs(M)
                                      def code(c0, w, h, D, d, M_m):
                                      	tmp = 0
                                      	if (M_m * M_m) <= 6e-242:
                                      		tmp = 0.0
                                      	else:
                                      		tmp = ((d / ((D * h) * (D * w))) * ((d / w) * c0)) * c0
                                      	return tmp
                                      
                                      M_m = abs(M)
                                      function code(c0, w, h, D, d, M_m)
                                      	tmp = 0.0
                                      	if (Float64(M_m * M_m) <= 6e-242)
                                      		tmp = 0.0;
                                      	else
                                      		tmp = Float64(Float64(Float64(d / Float64(Float64(D * h) * Float64(D * w))) * Float64(Float64(d / w) * c0)) * c0);
                                      	end
                                      	return tmp
                                      end
                                      
                                      M_m = abs(M);
                                      function tmp_2 = code(c0, w, h, D, d, M_m)
                                      	tmp = 0.0;
                                      	if ((M_m * M_m) <= 6e-242)
                                      		tmp = 0.0;
                                      	else
                                      		tmp = ((d / ((D * h) * (D * w))) * ((d / w) * c0)) * c0;
                                      	end
                                      	tmp_2 = tmp;
                                      end
                                      
                                      M_m = N[Abs[M], $MachinePrecision]
                                      code[c0_, w_, h_, D_, d_, M$95$m_] := If[LessEqual[N[(M$95$m * M$95$m), $MachinePrecision], 6e-242], 0.0, N[(N[(N[(d / N[(N[(D * h), $MachinePrecision] * N[(D * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(d / w), $MachinePrecision] * c0), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision]]
                                      
                                      \begin{array}{l}
                                      M_m = \left|M\right|
                                      
                                      \\
                                      \begin{array}{l}
                                      \mathbf{if}\;M\_m \cdot M\_m \leq 6 \cdot 10^{-242}:\\
                                      \;\;\;\;0\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;\left(\frac{d}{\left(D \cdot h\right) \cdot \left(D \cdot w\right)} \cdot \left(\frac{d}{w} \cdot c0\right)\right) \cdot c0\\
                                      
                                      
                                      \end{array}
                                      \end{array}
                                      
                                      Derivation
                                      1. Split input into 2 regimes
                                      2. if (*.f64 M M) < 6e-242

                                        1. Initial program 26.5%

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

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

                                            \[\leadsto \frac{-1}{2} \cdot \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-eval54.5

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

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

                                        if 6e-242 < (*.f64 M M)

                                        1. Initial program 18.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. Applied rewrites34.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                        Alternative 11: 46.1% accurate, 2.6× speedup?

                                        \[\begin{array}{l} M_m = \left|M\right| \\ \begin{array}{l} \mathbf{if}\;M\_m \leq 6 \cdot 10^{-121}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{d \cdot c0}{\left(D \cdot h\right) \cdot \left(D \cdot w\right)} \cdot \frac{d}{w}\right) \cdot c0\\ \end{array} \end{array} \]
                                        M_m = (fabs.f64 M)
                                        (FPCore (c0 w h D d M_m)
                                         :precision binary64
                                         (if (<= M_m 6e-121) 0.0 (* (* (/ (* d c0) (* (* D h) (* D w))) (/ d w)) c0)))
                                        M_m = fabs(M);
                                        double code(double c0, double w, double h, double D, double d, double M_m) {
                                        	double tmp;
                                        	if (M_m <= 6e-121) {
                                        		tmp = 0.0;
                                        	} else {
                                        		tmp = (((d * c0) / ((D * h) * (D * w))) * (d / w)) * c0;
                                        	}
                                        	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) :: tmp
                                            if (m_m <= 6d-121) then
                                                tmp = 0.0d0
                                            else
                                                tmp = (((d_1 * c0) / ((d * h) * (d * w))) * (d_1 / w)) * c0
                                            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 tmp;
                                        	if (M_m <= 6e-121) {
                                        		tmp = 0.0;
                                        	} else {
                                        		tmp = (((d * c0) / ((D * h) * (D * w))) * (d / w)) * c0;
                                        	}
                                        	return tmp;
                                        }
                                        
                                        M_m = math.fabs(M)
                                        def code(c0, w, h, D, d, M_m):
                                        	tmp = 0
                                        	if M_m <= 6e-121:
                                        		tmp = 0.0
                                        	else:
                                        		tmp = (((d * c0) / ((D * h) * (D * w))) * (d / w)) * c0
                                        	return tmp
                                        
                                        M_m = abs(M)
                                        function code(c0, w, h, D, d, M_m)
                                        	tmp = 0.0
                                        	if (M_m <= 6e-121)
                                        		tmp = 0.0;
                                        	else
                                        		tmp = Float64(Float64(Float64(Float64(d * c0) / Float64(Float64(D * h) * Float64(D * w))) * Float64(d / w)) * c0);
                                        	end
                                        	return tmp
                                        end
                                        
                                        M_m = abs(M);
                                        function tmp_2 = code(c0, w, h, D, d, M_m)
                                        	tmp = 0.0;
                                        	if (M_m <= 6e-121)
                                        		tmp = 0.0;
                                        	else
                                        		tmp = (((d * c0) / ((D * h) * (D * w))) * (d / w)) * c0;
                                        	end
                                        	tmp_2 = tmp;
                                        end
                                        
                                        M_m = N[Abs[M], $MachinePrecision]
                                        code[c0_, w_, h_, D_, d_, M$95$m_] := If[LessEqual[M$95$m, 6e-121], 0.0, N[(N[(N[(N[(d * c0), $MachinePrecision] / N[(N[(D * h), $MachinePrecision] * N[(D * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / w), $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision]]
                                        
                                        \begin{array}{l}
                                        M_m = \left|M\right|
                                        
                                        \\
                                        \begin{array}{l}
                                        \mathbf{if}\;M\_m \leq 6 \cdot 10^{-121}:\\
                                        \;\;\;\;0\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;\left(\frac{d \cdot c0}{\left(D \cdot h\right) \cdot \left(D \cdot w\right)} \cdot \frac{d}{w}\right) \cdot c0\\
                                        
                                        
                                        \end{array}
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 2 regimes
                                        2. if M < 5.9999999999999999e-121

                                          1. Initial program 22.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-eval37.7

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

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

                                          if 5.9999999999999999e-121 < M

                                          1. Initial program 16.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. Applied rewrites36.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                          Alternative 12: 34.4% 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 21.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 \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-eval31.3

                                              \[\leadsto \color{blue}{0} \]
                                          5. Applied rewrites31.3%

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

                                          Reproduce

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