Rosa's TurbineBenchmark

Percentage Accurate: 85.4% → 99.7%
Time: 11.5s
Alternatives: 15
Speedup: 1.4×

Specification

?
\[\begin{array}{l} \\ \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \end{array} \]
(FPCore (v w r)
 :precision binary64
 (-
  (-
   (+ 3.0 (/ 2.0 (* r r)))
   (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
  4.5))
double code(double v, double w, double r) {
	return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
real(8) function code(v, w, r)
    real(8), intent (in) :: v
    real(8), intent (in) :: w
    real(8), intent (in) :: r
    code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
	return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
def code(v, w, r):
	return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
function code(v, w, r)
	return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5)
end
function tmp = code(v, w, r)
	tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5
\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 15 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: 85.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \end{array} \]
(FPCore (v w r)
 :precision binary64
 (-
  (-
   (+ 3.0 (/ 2.0 (* r r)))
   (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
  4.5))
double code(double v, double w, double r) {
	return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
real(8) function code(v, w, r)
    real(8), intent (in) :: v
    real(8), intent (in) :: w
    real(8), intent (in) :: r
    code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
	return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
def code(v, w, r):
	return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
function code(v, w, r)
	return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5)
end
function tmp = code(v, w, r)
	tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5
\end{array}

Alternative 1: 99.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{0.125 \cdot \mathsf{fma}\left(-2, v, 3\right)}{\left(1 - v\right) \cdot {\left(r \cdot w\right)}^{-2}}\right) - 4.5 \end{array} \]
(FPCore (v w r)
 :precision binary64
 (-
  (-
   (+ 3.0 (/ 2.0 (* r r)))
   (/ (* 0.125 (fma -2.0 v 3.0)) (* (- 1.0 v) (pow (* r w) -2.0))))
  4.5))
double code(double v, double w, double r) {
	return ((3.0 + (2.0 / (r * r))) - ((0.125 * fma(-2.0, v, 3.0)) / ((1.0 - v) * pow((r * w), -2.0)))) - 4.5;
}
function code(v, w, r)
	return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(0.125 * fma(-2.0, v, 3.0)) / Float64(Float64(1.0 - v) * (Float64(r * w) ^ -2.0)))) - 4.5)
end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(0.125 * N[(-2.0 * v + 3.0), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 - v), $MachinePrecision] * N[Power[N[(r * w), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{0.125 \cdot \mathsf{fma}\left(-2, v, 3\right)}{\left(1 - v\right) \cdot {\left(r \cdot w\right)}^{-2}}\right) - 4.5
\end{array}
Derivation
  1. Initial program 82.5%

    \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\color{blue}{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}}{1 - v}\right) - \frac{9}{2} \]
    2. lift-*.f64N/A

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \color{blue}{\left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}}{1 - v}\right) - \frac{9}{2} \]
    3. associate-*r*N/A

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\color{blue}{\left(\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(w \cdot w\right) \cdot r\right)\right) \cdot r}}{1 - v}\right) - \frac{9}{2} \]
    4. lower-*.f64N/A

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\color{blue}{\left(\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(w \cdot w\right) \cdot r\right)\right) \cdot r}}{1 - v}\right) - \frac{9}{2} \]
  4. Applied rewrites87.7%

    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\color{blue}{\left(\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot 0.125\right) \cdot w\right) \cdot \left(w \cdot r\right)\right) \cdot r}}{1 - v}\right) - 4.5 \]
  5. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\frac{\left(\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot w\right) \cdot \left(w \cdot r\right)\right) \cdot r}{1 - v}}\right) - \frac{9}{2} \]
    2. lift-*.f64N/A

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\color{blue}{\left(\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot w\right) \cdot \left(w \cdot r\right)\right) \cdot r}}{1 - v}\right) - \frac{9}{2} \]
    3. associate-/l*N/A

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot w\right) \cdot \left(w \cdot r\right)\right) \cdot \frac{r}{1 - v}}\right) - \frac{9}{2} \]
    4. lift-*.f64N/A

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot w\right) \cdot \left(w \cdot r\right)\right)} \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
    5. lift-*.f64N/A

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\color{blue}{\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot w\right)} \cdot \left(w \cdot r\right)\right) \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
    6. associate-*l*N/A

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \left(w \cdot \left(w \cdot r\right)\right)\right)} \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
    7. lift-*.f64N/A

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \left(w \cdot \color{blue}{\left(w \cdot r\right)}\right)\right) \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
    8. associate-*l*N/A

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \color{blue}{\left(\left(w \cdot w\right) \cdot r\right)}\right) \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
    9. lift-*.f64N/A

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \left(\color{blue}{\left(w \cdot w\right)} \cdot r\right)\right) \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
    10. lift-*.f64N/A

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \color{blue}{\left(\left(w \cdot w\right) \cdot r\right)}\right) \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
    11. associate-*l*N/A

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot \frac{r}{1 - v}\right)}\right) - \frac{9}{2} \]
    12. associate-/l*N/A

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \color{blue}{\frac{\left(\left(w \cdot w\right) \cdot r\right) \cdot r}{1 - v}}\right) - \frac{9}{2} \]
  6. Applied rewrites99.7%

    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\frac{0.125 \cdot \mathsf{fma}\left(-2, v, 3\right)}{\left(1 - v\right) \cdot {\left(r \cdot w\right)}^{-2}}}\right) - 4.5 \]
  7. Add Preprocessing

Alternative 2: 92.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(w \cdot w\right) \cdot r\\ t_1 := \frac{2}{r \cdot r}\\ t_2 := \left(3 + t\_1\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(t\_0 \cdot r\right)}{1 - v}\\ \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;t\_1 + \left(\left(\left(r \cdot r\right) \cdot w\right) \cdot -0.25\right) \cdot w\\ \mathbf{elif}\;t\_2 \leq -5 \cdot 10^{+15}:\\ \;\;\;\;\left(-0.375 \cdot r\right) \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1 - 1.5\\ \end{array} \end{array} \]
(FPCore (v w r)
 :precision binary64
 (let* ((t_0 (* (* w w) r))
        (t_1 (/ 2.0 (* r r)))
        (t_2
         (-
          (+ 3.0 t_1)
          (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* t_0 r)) (- 1.0 v)))))
   (if (<= t_2 (- INFINITY))
     (+ t_1 (* (* (* (* r r) w) -0.25) w))
     (if (<= t_2 -5e+15) (* (* -0.375 r) t_0) (- t_1 1.5)))))
double code(double v, double w, double r) {
	double t_0 = (w * w) * r;
	double t_1 = 2.0 / (r * r);
	double t_2 = (3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * (t_0 * r)) / (1.0 - v));
	double tmp;
	if (t_2 <= -((double) INFINITY)) {
		tmp = t_1 + ((((r * r) * w) * -0.25) * w);
	} else if (t_2 <= -5e+15) {
		tmp = (-0.375 * r) * t_0;
	} else {
		tmp = t_1 - 1.5;
	}
	return tmp;
}
public static double code(double v, double w, double r) {
	double t_0 = (w * w) * r;
	double t_1 = 2.0 / (r * r);
	double t_2 = (3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * (t_0 * r)) / (1.0 - v));
	double tmp;
	if (t_2 <= -Double.POSITIVE_INFINITY) {
		tmp = t_1 + ((((r * r) * w) * -0.25) * w);
	} else if (t_2 <= -5e+15) {
		tmp = (-0.375 * r) * t_0;
	} else {
		tmp = t_1 - 1.5;
	}
	return tmp;
}
def code(v, w, r):
	t_0 = (w * w) * r
	t_1 = 2.0 / (r * r)
	t_2 = (3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * (t_0 * r)) / (1.0 - v))
	tmp = 0
	if t_2 <= -math.inf:
		tmp = t_1 + ((((r * r) * w) * -0.25) * w)
	elif t_2 <= -5e+15:
		tmp = (-0.375 * r) * t_0
	else:
		tmp = t_1 - 1.5
	return tmp
function code(v, w, r)
	t_0 = Float64(Float64(w * w) * r)
	t_1 = Float64(2.0 / Float64(r * r))
	t_2 = Float64(Float64(3.0 + t_1) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(t_0 * r)) / Float64(1.0 - v)))
	tmp = 0.0
	if (t_2 <= Float64(-Inf))
		tmp = Float64(t_1 + Float64(Float64(Float64(Float64(r * r) * w) * -0.25) * w));
	elseif (t_2 <= -5e+15)
		tmp = Float64(Float64(-0.375 * r) * t_0);
	else
		tmp = Float64(t_1 - 1.5);
	end
	return tmp
end
function tmp_2 = code(v, w, r)
	t_0 = (w * w) * r;
	t_1 = 2.0 / (r * r);
	t_2 = (3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * (t_0 * r)) / (1.0 - v));
	tmp = 0.0;
	if (t_2 <= -Inf)
		tmp = t_1 + ((((r * r) * w) * -0.25) * w);
	elseif (t_2 <= -5e+15)
		tmp = (-0.375 * r) * t_0;
	else
		tmp = t_1 - 1.5;
	end
	tmp_2 = tmp;
end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(3.0 + t$95$1), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(t$95$1 + N[(N[(N[(N[(r * r), $MachinePrecision] * w), $MachinePrecision] * -0.25), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -5e+15], N[(N[(-0.375 * r), $MachinePrecision] * t$95$0), $MachinePrecision], N[(t$95$1 - 1.5), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(w \cdot w\right) \cdot r\\
t_1 := \frac{2}{r \cdot r}\\
t_2 := \left(3 + t\_1\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(t\_0 \cdot r\right)}{1 - v}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1 + \left(\left(\left(r \cdot r\right) \cdot w\right) \cdot -0.25\right) \cdot w\\

\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{+15}:\\
\;\;\;\;\left(-0.375 \cdot r\right) \cdot t\_0\\

\mathbf{else}:\\
\;\;\;\;t\_1 - 1.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) < -inf.0

    1. Initial program 79.5%

      \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - \frac{9}{2}} \]
      2. lift--.f64N/A

        \[\leadsto \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right)} - \frac{9}{2} \]
      3. associate--l-N/A

        \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)} \]
      4. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right)} - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right) \]
      5. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\frac{2}{r \cdot r} + 3\right)} - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right) \]
      6. associate--l+N/A

        \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(3 - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)\right)} \]
      7. lower-+.f64N/A

        \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(3 - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)\right)} \]
      8. lower--.f64N/A

        \[\leadsto \frac{2}{r \cdot r} + \color{blue}{\left(3 - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)\right)} \]
    4. Applied rewrites98.9%

      \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\frac{{\left(w \cdot r\right)}^{2}}{1 - v}, \mathsf{fma}\left(-2, v, 3\right) \cdot 0.125, 4.5\right)\right)} \]
    5. Taylor expanded in v around inf

      \[\leadsto \frac{2}{r \cdot r} + \color{blue}{-1 \cdot \left(\frac{3}{2} + \frac{1}{4} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)} \]
    6. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{2}{r \cdot r} + -1 \cdot \color{blue}{\left(\frac{1}{4} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \frac{3}{2}\right)} \]
      2. distribute-lft-inN/A

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

        \[\leadsto \frac{2}{r \cdot r} + \left(\color{blue}{\left(-1 \cdot \frac{1}{4}\right) \cdot \left({r}^{2} \cdot {w}^{2}\right)} + -1 \cdot \frac{3}{2}\right) \]
      4. metadata-evalN/A

        \[\leadsto \frac{2}{r \cdot r} + \left(\color{blue}{\frac{-1}{4}} \cdot \left({r}^{2} \cdot {w}^{2}\right) + -1 \cdot \frac{3}{2}\right) \]
      5. associate-*r*N/A

        \[\leadsto \frac{2}{r \cdot r} + \left(\color{blue}{\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot {w}^{2}} + -1 \cdot \frac{3}{2}\right) \]
      6. unpow2N/A

        \[\leadsto \frac{2}{r \cdot r} + \left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot \color{blue}{\left(w \cdot w\right)} + -1 \cdot \frac{3}{2}\right) \]
      7. associate-*r*N/A

        \[\leadsto \frac{2}{r \cdot r} + \left(\color{blue}{\left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w\right) \cdot w} + -1 \cdot \frac{3}{2}\right) \]
      8. metadata-evalN/A

        \[\leadsto \frac{2}{r \cdot r} + \left(\left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w\right) \cdot w + \color{blue}{\frac{-3}{2}}\right) \]
      9. lower-fma.f64N/A

        \[\leadsto \frac{2}{r \cdot r} + \color{blue}{\mathsf{fma}\left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w, w, \frac{-3}{2}\right)} \]
      10. lower-*.f64N/A

        \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\color{blue}{\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w}, w, \frac{-3}{2}\right) \]
      11. unpow2N/A

        \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\left(\frac{-1}{4} \cdot \color{blue}{\left(r \cdot r\right)}\right) \cdot w, w, \frac{-3}{2}\right) \]
      12. associate-*r*N/A

        \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\color{blue}{\left(\left(\frac{-1}{4} \cdot r\right) \cdot r\right)} \cdot w, w, \frac{-3}{2}\right) \]
      13. lower-*.f64N/A

        \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\color{blue}{\left(\left(\frac{-1}{4} \cdot r\right) \cdot r\right)} \cdot w, w, \frac{-3}{2}\right) \]
      14. lower-*.f6492.7

        \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\left(\color{blue}{\left(-0.25 \cdot r\right)} \cdot r\right) \cdot w, w, -1.5\right) \]
    7. Applied rewrites92.7%

      \[\leadsto \frac{2}{r \cdot r} + \color{blue}{\mathsf{fma}\left(\left(\left(-0.25 \cdot r\right) \cdot r\right) \cdot w, w, -1.5\right)} \]
    8. Taylor expanded in w around inf

      \[\leadsto \frac{2}{r \cdot r} + \frac{-1}{4} \cdot \color{blue}{\left({r}^{2} \cdot {w}^{2}\right)} \]
    9. Step-by-step derivation
      1. Applied rewrites92.7%

        \[\leadsto \frac{2}{r \cdot r} + \left(\left(\left(r \cdot r\right) \cdot w\right) \cdot -0.25\right) \cdot \color{blue}{w} \]

      if -inf.0 < (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) < -5e15

      1. Initial program 99.2%

        \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
      2. Add Preprocessing
      3. Taylor expanded in v around 0

        \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)} \]
      4. Step-by-step derivation
        1. sub-negN/A

          \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} + \left(\mathsf{neg}\left(\left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right)\right)} \]
        2. +-commutativeN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right)\right) + 2 \cdot \frac{1}{{r}^{2}}} \]
        3. +-commutativeN/A

          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \frac{3}{2}\right)}\right)\right) + 2 \cdot \frac{1}{{r}^{2}} \]
        4. distribute-neg-inN/A

          \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right) + \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right)} + 2 \cdot \frac{1}{{r}^{2}} \]
        5. distribute-lft-neg-inN/A

          \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right)} + \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right) + 2 \cdot \frac{1}{{r}^{2}} \]
        6. metadata-evalN/A

          \[\leadsto \left(\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right) + \color{blue}{\frac{-3}{2}}\right) + 2 \cdot \frac{1}{{r}^{2}} \]
        7. associate-+l+N/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right) + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right)} \]
        8. metadata-evalN/A

          \[\leadsto \color{blue}{\frac{-3}{8}} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
        9. *-commutativeN/A

          \[\leadsto \frac{-3}{8} \cdot \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
        10. associate-*r*N/A

          \[\leadsto \color{blue}{\left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2}} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
        11. +-commutativeN/A

          \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2}\right)} \]
        12. metadata-evalN/A

          \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \left(2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)}\right) \]
        13. sub-negN/A

          \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
        14. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-3}{8} \cdot {w}^{2}, {r}^{2}, 2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
      5. Applied rewrites51.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-0.375 \cdot \left(w \cdot w\right), r \cdot r, \frac{2}{r \cdot r} - 1.5\right)} \]
      6. Step-by-step derivation
        1. Applied rewrites51.9%

          \[\leadsto \mathsf{fma}\left(\left(-0.375 \cdot w\right) \cdot w, \color{blue}{r} \cdot r, \frac{2}{r \cdot r} - 1.5\right) \]
        2. Taylor expanded in w around inf

          \[\leadsto \frac{-3}{8} \cdot \color{blue}{\left({r}^{2} \cdot {w}^{2}\right)} \]
        3. Step-by-step derivation
          1. Applied rewrites51.8%

            \[\leadsto \left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w\right) \cdot \color{blue}{w} \]
          2. Step-by-step derivation
            1. Applied rewrites67.5%

              \[\leadsto \left(-0.375 \cdot r\right) \cdot \left(\left(w \cdot w\right) \cdot \color{blue}{r}\right) \]

            if -5e15 < (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v)))

            1. Initial program 81.5%

              \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
            2. Add Preprocessing
            3. Taylor expanded in w around 0

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

                \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}} \]
              2. associate-*r/N/A

                \[\leadsto \color{blue}{\frac{2 \cdot 1}{{r}^{2}}} - \frac{3}{2} \]
              3. metadata-evalN/A

                \[\leadsto \frac{\color{blue}{2}}{{r}^{2}} - \frac{3}{2} \]
              4. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{2}{{r}^{2}}} - \frac{3}{2} \]
              5. unpow2N/A

                \[\leadsto \frac{2}{\color{blue}{r \cdot r}} - \frac{3}{2} \]
              6. lower-*.f6493.5

                \[\leadsto \frac{2}{\color{blue}{r \cdot r}} - 1.5 \]
            5. Applied rewrites93.5%

              \[\leadsto \color{blue}{\frac{2}{r \cdot r} - 1.5} \]
          3. Recombined 3 regimes into one program.
          4. Final simplification90.7%

            \[\leadsto \begin{array}{l} \mathbf{if}\;\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} \leq -\infty:\\ \;\;\;\;\frac{2}{r \cdot r} + \left(\left(\left(r \cdot r\right) \cdot w\right) \cdot -0.25\right) \cdot w\\ \mathbf{elif}\;\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} \leq -5 \cdot 10^{+15}:\\ \;\;\;\;\left(-0.375 \cdot r\right) \cdot \left(\left(w \cdot w\right) \cdot r\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{r \cdot r} - 1.5\\ \end{array} \]
          5. Add Preprocessing

          Alternative 3: 99.7% accurate, 0.5× speedup?

          \[\begin{array}{l} \\ \frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\frac{{\left(w \cdot r\right)}^{2}}{1 - v}, \mathsf{fma}\left(-2, v, 3\right) \cdot 0.125, 4.5\right)\right) \end{array} \]
          (FPCore (v w r)
           :precision binary64
           (+
            (/ 2.0 (* r r))
            (-
             3.0
             (fma (/ (pow (* w r) 2.0) (- 1.0 v)) (* (fma -2.0 v 3.0) 0.125) 4.5))))
          double code(double v, double w, double r) {
          	return (2.0 / (r * r)) + (3.0 - fma((pow((w * r), 2.0) / (1.0 - v)), (fma(-2.0, v, 3.0) * 0.125), 4.5));
          }
          
          function code(v, w, r)
          	return Float64(Float64(2.0 / Float64(r * r)) + Float64(3.0 - fma(Float64((Float64(w * r) ^ 2.0) / Float64(1.0 - v)), Float64(fma(-2.0, v, 3.0) * 0.125), 4.5)))
          end
          
          code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(3.0 - N[(N[(N[Power[N[(w * r), $MachinePrecision], 2.0], $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(N[(-2.0 * v + 3.0), $MachinePrecision] * 0.125), $MachinePrecision] + 4.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
          
          \begin{array}{l}
          
          \\
          \frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\frac{{\left(w \cdot r\right)}^{2}}{1 - v}, \mathsf{fma}\left(-2, v, 3\right) \cdot 0.125, 4.5\right)\right)
          \end{array}
          
          Derivation
          1. Initial program 82.5%

            \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - \frac{9}{2}} \]
            2. lift--.f64N/A

              \[\leadsto \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right)} - \frac{9}{2} \]
            3. associate--l-N/A

              \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)} \]
            4. lift-+.f64N/A

              \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right)} - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right) \]
            5. +-commutativeN/A

              \[\leadsto \color{blue}{\left(\frac{2}{r \cdot r} + 3\right)} - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right) \]
            6. associate--l+N/A

              \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(3 - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)\right)} \]
            7. lower-+.f64N/A

              \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(3 - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)\right)} \]
            8. lower--.f64N/A

              \[\leadsto \frac{2}{r \cdot r} + \color{blue}{\left(3 - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)\right)} \]
          4. Applied rewrites99.4%

            \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\frac{{\left(w \cdot r\right)}^{2}}{1 - v}, \mathsf{fma}\left(-2, v, 3\right) \cdot 0.125, 4.5\right)\right)} \]
          5. Add Preprocessing

          Alternative 4: 90.0% accurate, 0.8× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ \mathbf{if}\;\left(3 + t\_0\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} \leq -5 \cdot 10^{+15}:\\ \;\;\;\;\left(\left(-0.375 \cdot w\right) \cdot r\right) \cdot \left(w \cdot r\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0 - 1.5\\ \end{array} \end{array} \]
          (FPCore (v w r)
           :precision binary64
           (let* ((t_0 (/ 2.0 (* r r))))
             (if (<=
                  (-
                   (+ 3.0 t_0)
                   (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
                  -5e+15)
               (* (* (* -0.375 w) r) (* w r))
               (- t_0 1.5))))
          double code(double v, double w, double r) {
          	double t_0 = 2.0 / (r * r);
          	double tmp;
          	if (((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) <= -5e+15) {
          		tmp = ((-0.375 * w) * r) * (w * r);
          	} else {
          		tmp = t_0 - 1.5;
          	}
          	return tmp;
          }
          
          real(8) function code(v, w, r)
              real(8), intent (in) :: v
              real(8), intent (in) :: w
              real(8), intent (in) :: r
              real(8) :: t_0
              real(8) :: tmp
              t_0 = 2.0d0 / (r * r)
              if (((3.0d0 + t_0) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) <= (-5d+15)) then
                  tmp = (((-0.375d0) * w) * r) * (w * r)
              else
                  tmp = t_0 - 1.5d0
              end if
              code = tmp
          end function
          
          public static double code(double v, double w, double r) {
          	double t_0 = 2.0 / (r * r);
          	double tmp;
          	if (((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) <= -5e+15) {
          		tmp = ((-0.375 * w) * r) * (w * r);
          	} else {
          		tmp = t_0 - 1.5;
          	}
          	return tmp;
          }
          
          def code(v, w, r):
          	t_0 = 2.0 / (r * r)
          	tmp = 0
          	if ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) <= -5e+15:
          		tmp = ((-0.375 * w) * r) * (w * r)
          	else:
          		tmp = t_0 - 1.5
          	return tmp
          
          function code(v, w, r)
          	t_0 = Float64(2.0 / Float64(r * r))
          	tmp = 0.0
          	if (Float64(Float64(3.0 + t_0) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) <= -5e+15)
          		tmp = Float64(Float64(Float64(-0.375 * w) * r) * Float64(w * r));
          	else
          		tmp = Float64(t_0 - 1.5);
          	end
          	return tmp
          end
          
          function tmp_2 = code(v, w, r)
          	t_0 = 2.0 / (r * r);
          	tmp = 0.0;
          	if (((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) <= -5e+15)
          		tmp = ((-0.375 * w) * r) * (w * r);
          	else
          		tmp = t_0 - 1.5;
          	end
          	tmp_2 = tmp;
          end
          
          code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e+15], N[(N[(N[(-0.375 * w), $MachinePrecision] * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - 1.5), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \frac{2}{r \cdot r}\\
          \mathbf{if}\;\left(3 + t\_0\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} \leq -5 \cdot 10^{+15}:\\
          \;\;\;\;\left(\left(-0.375 \cdot w\right) \cdot r\right) \cdot \left(w \cdot r\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0 - 1.5\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) < -5e15

            1. Initial program 83.8%

              \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
            2. Add Preprocessing
            3. Taylor expanded in v around 0

              \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)} \]
            4. Step-by-step derivation
              1. sub-negN/A

                \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} + \left(\mathsf{neg}\left(\left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right)\right)} \]
              2. +-commutativeN/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right)\right) + 2 \cdot \frac{1}{{r}^{2}}} \]
              3. +-commutativeN/A

                \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \frac{3}{2}\right)}\right)\right) + 2 \cdot \frac{1}{{r}^{2}} \]
              4. distribute-neg-inN/A

                \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right) + \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right)} + 2 \cdot \frac{1}{{r}^{2}} \]
              5. distribute-lft-neg-inN/A

                \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right)} + \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right) + 2 \cdot \frac{1}{{r}^{2}} \]
              6. metadata-evalN/A

                \[\leadsto \left(\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right) + \color{blue}{\frac{-3}{2}}\right) + 2 \cdot \frac{1}{{r}^{2}} \]
              7. associate-+l+N/A

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right) + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right)} \]
              8. metadata-evalN/A

                \[\leadsto \color{blue}{\frac{-3}{8}} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
              9. *-commutativeN/A

                \[\leadsto \frac{-3}{8} \cdot \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
              10. associate-*r*N/A

                \[\leadsto \color{blue}{\left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2}} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
              11. +-commutativeN/A

                \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2}\right)} \]
              12. metadata-evalN/A

                \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \left(2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)}\right) \]
              13. sub-negN/A

                \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
              14. lower-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-3}{8} \cdot {w}^{2}, {r}^{2}, 2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
            5. Applied rewrites74.9%

              \[\leadsto \color{blue}{\mathsf{fma}\left(-0.375 \cdot \left(w \cdot w\right), r \cdot r, \frac{2}{r \cdot r} - 1.5\right)} \]
            6. Step-by-step derivation
              1. Applied rewrites74.9%

                \[\leadsto \mathsf{fma}\left(\left(-0.375 \cdot w\right) \cdot w, \color{blue}{r} \cdot r, \frac{2}{r \cdot r} - 1.5\right) \]
              2. Taylor expanded in w around inf

                \[\leadsto \frac{-3}{8} \cdot \color{blue}{\left({r}^{2} \cdot {w}^{2}\right)} \]
              3. Step-by-step derivation
                1. Applied rewrites76.3%

                  \[\leadsto \left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w\right) \cdot \color{blue}{w} \]
                2. Step-by-step derivation
                  1. Applied rewrites80.2%

                    \[\leadsto \left(\left(-0.375 \cdot w\right) \cdot r\right) \cdot \left(w \cdot \color{blue}{r}\right) \]

                  if -5e15 < (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v)))

                  1. Initial program 81.5%

                    \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                  2. Add Preprocessing
                  3. Taylor expanded in w around 0

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

                      \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}} \]
                    2. associate-*r/N/A

                      \[\leadsto \color{blue}{\frac{2 \cdot 1}{{r}^{2}}} - \frac{3}{2} \]
                    3. metadata-evalN/A

                      \[\leadsto \frac{\color{blue}{2}}{{r}^{2}} - \frac{3}{2} \]
                    4. lower-/.f64N/A

                      \[\leadsto \color{blue}{\frac{2}{{r}^{2}}} - \frac{3}{2} \]
                    5. unpow2N/A

                      \[\leadsto \frac{2}{\color{blue}{r \cdot r}} - \frac{3}{2} \]
                    6. lower-*.f6493.5

                      \[\leadsto \frac{2}{\color{blue}{r \cdot r}} - 1.5 \]
                  5. Applied rewrites93.5%

                    \[\leadsto \color{blue}{\frac{2}{r \cdot r} - 1.5} \]
                3. Recombined 2 regimes into one program.
                4. Final simplification87.6%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} \leq -5 \cdot 10^{+15}:\\ \;\;\;\;\left(\left(-0.375 \cdot w\right) \cdot r\right) \cdot \left(w \cdot r\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{r \cdot r} - 1.5\\ \end{array} \]
                5. Add Preprocessing

                Alternative 5: 89.0% accurate, 0.8× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ \mathbf{if}\;\left(3 + t\_0\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} \leq -5 \cdot 10^{+15}:\\ \;\;\;\;\left(\left(-0.375 \cdot r\right) \cdot \left(w \cdot r\right)\right) \cdot w\\ \mathbf{else}:\\ \;\;\;\;t\_0 - 1.5\\ \end{array} \end{array} \]
                (FPCore (v w r)
                 :precision binary64
                 (let* ((t_0 (/ 2.0 (* r r))))
                   (if (<=
                        (-
                         (+ 3.0 t_0)
                         (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
                        -5e+15)
                     (* (* (* -0.375 r) (* w r)) w)
                     (- t_0 1.5))))
                double code(double v, double w, double r) {
                	double t_0 = 2.0 / (r * r);
                	double tmp;
                	if (((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) <= -5e+15) {
                		tmp = ((-0.375 * r) * (w * r)) * w;
                	} else {
                		tmp = t_0 - 1.5;
                	}
                	return tmp;
                }
                
                real(8) function code(v, w, r)
                    real(8), intent (in) :: v
                    real(8), intent (in) :: w
                    real(8), intent (in) :: r
                    real(8) :: t_0
                    real(8) :: tmp
                    t_0 = 2.0d0 / (r * r)
                    if (((3.0d0 + t_0) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) <= (-5d+15)) then
                        tmp = (((-0.375d0) * r) * (w * r)) * w
                    else
                        tmp = t_0 - 1.5d0
                    end if
                    code = tmp
                end function
                
                public static double code(double v, double w, double r) {
                	double t_0 = 2.0 / (r * r);
                	double tmp;
                	if (((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) <= -5e+15) {
                		tmp = ((-0.375 * r) * (w * r)) * w;
                	} else {
                		tmp = t_0 - 1.5;
                	}
                	return tmp;
                }
                
                def code(v, w, r):
                	t_0 = 2.0 / (r * r)
                	tmp = 0
                	if ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) <= -5e+15:
                		tmp = ((-0.375 * r) * (w * r)) * w
                	else:
                		tmp = t_0 - 1.5
                	return tmp
                
                function code(v, w, r)
                	t_0 = Float64(2.0 / Float64(r * r))
                	tmp = 0.0
                	if (Float64(Float64(3.0 + t_0) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) <= -5e+15)
                		tmp = Float64(Float64(Float64(-0.375 * r) * Float64(w * r)) * w);
                	else
                		tmp = Float64(t_0 - 1.5);
                	end
                	return tmp
                end
                
                function tmp_2 = code(v, w, r)
                	t_0 = 2.0 / (r * r);
                	tmp = 0.0;
                	if (((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) <= -5e+15)
                		tmp = ((-0.375 * r) * (w * r)) * w;
                	else
                		tmp = t_0 - 1.5;
                	end
                	tmp_2 = tmp;
                end
                
                code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e+15], N[(N[(N[(-0.375 * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision] * w), $MachinePrecision], N[(t$95$0 - 1.5), $MachinePrecision]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := \frac{2}{r \cdot r}\\
                \mathbf{if}\;\left(3 + t\_0\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} \leq -5 \cdot 10^{+15}:\\
                \;\;\;\;\left(\left(-0.375 \cdot r\right) \cdot \left(w \cdot r\right)\right) \cdot w\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_0 - 1.5\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) < -5e15

                  1. Initial program 83.8%

                    \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                  2. Add Preprocessing
                  3. Taylor expanded in v around 0

                    \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)} \]
                  4. Step-by-step derivation
                    1. sub-negN/A

                      \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} + \left(\mathsf{neg}\left(\left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right)\right)} \]
                    2. +-commutativeN/A

                      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right)\right) + 2 \cdot \frac{1}{{r}^{2}}} \]
                    3. +-commutativeN/A

                      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \frac{3}{2}\right)}\right)\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                    4. distribute-neg-inN/A

                      \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right) + \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right)} + 2 \cdot \frac{1}{{r}^{2}} \]
                    5. distribute-lft-neg-inN/A

                      \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right)} + \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                    6. metadata-evalN/A

                      \[\leadsto \left(\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right) + \color{blue}{\frac{-3}{2}}\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                    7. associate-+l+N/A

                      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right) + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right)} \]
                    8. metadata-evalN/A

                      \[\leadsto \color{blue}{\frac{-3}{8}} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                    9. *-commutativeN/A

                      \[\leadsto \frac{-3}{8} \cdot \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                    10. associate-*r*N/A

                      \[\leadsto \color{blue}{\left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2}} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                    11. +-commutativeN/A

                      \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2}\right)} \]
                    12. metadata-evalN/A

                      \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \left(2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)}\right) \]
                    13. sub-negN/A

                      \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
                    14. lower-fma.f64N/A

                      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-3}{8} \cdot {w}^{2}, {r}^{2}, 2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
                  5. Applied rewrites74.9%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(-0.375 \cdot \left(w \cdot w\right), r \cdot r, \frac{2}{r \cdot r} - 1.5\right)} \]
                  6. Step-by-step derivation
                    1. Applied rewrites74.9%

                      \[\leadsto \mathsf{fma}\left(\left(-0.375 \cdot w\right) \cdot w, \color{blue}{r} \cdot r, \frac{2}{r \cdot r} - 1.5\right) \]
                    2. Taylor expanded in w around inf

                      \[\leadsto \frac{-3}{8} \cdot \color{blue}{\left({r}^{2} \cdot {w}^{2}\right)} \]
                    3. Step-by-step derivation
                      1. Applied rewrites76.3%

                        \[\leadsto \left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w\right) \cdot \color{blue}{w} \]
                      2. Step-by-step derivation
                        1. Applied rewrites79.0%

                          \[\leadsto \left(\left(-0.375 \cdot r\right) \cdot \left(w \cdot r\right)\right) \cdot w \]

                        if -5e15 < (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v)))

                        1. Initial program 81.5%

                          \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                        2. Add Preprocessing
                        3. Taylor expanded in w around 0

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

                            \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}} \]
                          2. associate-*r/N/A

                            \[\leadsto \color{blue}{\frac{2 \cdot 1}{{r}^{2}}} - \frac{3}{2} \]
                          3. metadata-evalN/A

                            \[\leadsto \frac{\color{blue}{2}}{{r}^{2}} - \frac{3}{2} \]
                          4. lower-/.f64N/A

                            \[\leadsto \color{blue}{\frac{2}{{r}^{2}}} - \frac{3}{2} \]
                          5. unpow2N/A

                            \[\leadsto \frac{2}{\color{blue}{r \cdot r}} - \frac{3}{2} \]
                          6. lower-*.f6493.5

                            \[\leadsto \frac{2}{\color{blue}{r \cdot r}} - 1.5 \]
                        5. Applied rewrites93.5%

                          \[\leadsto \color{blue}{\frac{2}{r \cdot r} - 1.5} \]
                      3. Recombined 2 regimes into one program.
                      4. Final simplification87.1%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} \leq -5 \cdot 10^{+15}:\\ \;\;\;\;\left(\left(-0.375 \cdot r\right) \cdot \left(w \cdot r\right)\right) \cdot w\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{r \cdot r} - 1.5\\ \end{array} \]
                      5. Add Preprocessing

                      Alternative 6: 89.1% accurate, 0.8× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(w \cdot w\right) \cdot r\\ t_1 := \frac{2}{r \cdot r}\\ \mathbf{if}\;\left(3 + t\_1\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(t\_0 \cdot r\right)}{1 - v} \leq -5 \cdot 10^{+15}:\\ \;\;\;\;\left(-0.375 \cdot r\right) \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1 - 1.5\\ \end{array} \end{array} \]
                      (FPCore (v w r)
                       :precision binary64
                       (let* ((t_0 (* (* w w) r)) (t_1 (/ 2.0 (* r r))))
                         (if (<=
                              (- (+ 3.0 t_1) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* t_0 r)) (- 1.0 v)))
                              -5e+15)
                           (* (* -0.375 r) t_0)
                           (- t_1 1.5))))
                      double code(double v, double w, double r) {
                      	double t_0 = (w * w) * r;
                      	double t_1 = 2.0 / (r * r);
                      	double tmp;
                      	if (((3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * (t_0 * r)) / (1.0 - v))) <= -5e+15) {
                      		tmp = (-0.375 * r) * t_0;
                      	} else {
                      		tmp = t_1 - 1.5;
                      	}
                      	return tmp;
                      }
                      
                      real(8) function code(v, w, r)
                          real(8), intent (in) :: v
                          real(8), intent (in) :: w
                          real(8), intent (in) :: r
                          real(8) :: t_0
                          real(8) :: t_1
                          real(8) :: tmp
                          t_0 = (w * w) * r
                          t_1 = 2.0d0 / (r * r)
                          if (((3.0d0 + t_1) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (t_0 * r)) / (1.0d0 - v))) <= (-5d+15)) then
                              tmp = ((-0.375d0) * r) * t_0
                          else
                              tmp = t_1 - 1.5d0
                          end if
                          code = tmp
                      end function
                      
                      public static double code(double v, double w, double r) {
                      	double t_0 = (w * w) * r;
                      	double t_1 = 2.0 / (r * r);
                      	double tmp;
                      	if (((3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * (t_0 * r)) / (1.0 - v))) <= -5e+15) {
                      		tmp = (-0.375 * r) * t_0;
                      	} else {
                      		tmp = t_1 - 1.5;
                      	}
                      	return tmp;
                      }
                      
                      def code(v, w, r):
                      	t_0 = (w * w) * r
                      	t_1 = 2.0 / (r * r)
                      	tmp = 0
                      	if ((3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * (t_0 * r)) / (1.0 - v))) <= -5e+15:
                      		tmp = (-0.375 * r) * t_0
                      	else:
                      		tmp = t_1 - 1.5
                      	return tmp
                      
                      function code(v, w, r)
                      	t_0 = Float64(Float64(w * w) * r)
                      	t_1 = Float64(2.0 / Float64(r * r))
                      	tmp = 0.0
                      	if (Float64(Float64(3.0 + t_1) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(t_0 * r)) / Float64(1.0 - v))) <= -5e+15)
                      		tmp = Float64(Float64(-0.375 * r) * t_0);
                      	else
                      		tmp = Float64(t_1 - 1.5);
                      	end
                      	return tmp
                      end
                      
                      function tmp_2 = code(v, w, r)
                      	t_0 = (w * w) * r;
                      	t_1 = 2.0 / (r * r);
                      	tmp = 0.0;
                      	if (((3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * (t_0 * r)) / (1.0 - v))) <= -5e+15)
                      		tmp = (-0.375 * r) * t_0;
                      	else
                      		tmp = t_1 - 1.5;
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      code[v_, w_, r_] := Block[{t$95$0 = N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(3.0 + t$95$1), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e+15], N[(N[(-0.375 * r), $MachinePrecision] * t$95$0), $MachinePrecision], N[(t$95$1 - 1.5), $MachinePrecision]]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      t_0 := \left(w \cdot w\right) \cdot r\\
                      t_1 := \frac{2}{r \cdot r}\\
                      \mathbf{if}\;\left(3 + t\_1\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(t\_0 \cdot r\right)}{1 - v} \leq -5 \cdot 10^{+15}:\\
                      \;\;\;\;\left(-0.375 \cdot r\right) \cdot t\_0\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;t\_1 - 1.5\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) < -5e15

                        1. Initial program 83.8%

                          \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                        2. Add Preprocessing
                        3. Taylor expanded in v around 0

                          \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)} \]
                        4. Step-by-step derivation
                          1. sub-negN/A

                            \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} + \left(\mathsf{neg}\left(\left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right)\right)} \]
                          2. +-commutativeN/A

                            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right)\right) + 2 \cdot \frac{1}{{r}^{2}}} \]
                          3. +-commutativeN/A

                            \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \frac{3}{2}\right)}\right)\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                          4. distribute-neg-inN/A

                            \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right) + \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right)} + 2 \cdot \frac{1}{{r}^{2}} \]
                          5. distribute-lft-neg-inN/A

                            \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right)} + \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                          6. metadata-evalN/A

                            \[\leadsto \left(\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right) + \color{blue}{\frac{-3}{2}}\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                          7. associate-+l+N/A

                            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right) + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right)} \]
                          8. metadata-evalN/A

                            \[\leadsto \color{blue}{\frac{-3}{8}} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                          9. *-commutativeN/A

                            \[\leadsto \frac{-3}{8} \cdot \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                          10. associate-*r*N/A

                            \[\leadsto \color{blue}{\left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2}} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                          11. +-commutativeN/A

                            \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2}\right)} \]
                          12. metadata-evalN/A

                            \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \left(2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)}\right) \]
                          13. sub-negN/A

                            \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
                          14. lower-fma.f64N/A

                            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-3}{8} \cdot {w}^{2}, {r}^{2}, 2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
                        5. Applied rewrites74.9%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(-0.375 \cdot \left(w \cdot w\right), r \cdot r, \frac{2}{r \cdot r} - 1.5\right)} \]
                        6. Step-by-step derivation
                          1. Applied rewrites74.9%

                            \[\leadsto \mathsf{fma}\left(\left(-0.375 \cdot w\right) \cdot w, \color{blue}{r} \cdot r, \frac{2}{r \cdot r} - 1.5\right) \]
                          2. Taylor expanded in w around inf

                            \[\leadsto \frac{-3}{8} \cdot \color{blue}{\left({r}^{2} \cdot {w}^{2}\right)} \]
                          3. Step-by-step derivation
                            1. Applied rewrites76.3%

                              \[\leadsto \left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w\right) \cdot \color{blue}{w} \]
                            2. Step-by-step derivation
                              1. Applied rewrites77.9%

                                \[\leadsto \left(-0.375 \cdot r\right) \cdot \left(\left(w \cdot w\right) \cdot \color{blue}{r}\right) \]

                              if -5e15 < (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v)))

                              1. Initial program 81.5%

                                \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                              2. Add Preprocessing
                              3. Taylor expanded in w around 0

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

                                  \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}} \]
                                2. associate-*r/N/A

                                  \[\leadsto \color{blue}{\frac{2 \cdot 1}{{r}^{2}}} - \frac{3}{2} \]
                                3. metadata-evalN/A

                                  \[\leadsto \frac{\color{blue}{2}}{{r}^{2}} - \frac{3}{2} \]
                                4. lower-/.f64N/A

                                  \[\leadsto \color{blue}{\frac{2}{{r}^{2}}} - \frac{3}{2} \]
                                5. unpow2N/A

                                  \[\leadsto \frac{2}{\color{blue}{r \cdot r}} - \frac{3}{2} \]
                                6. lower-*.f6493.5

                                  \[\leadsto \frac{2}{\color{blue}{r \cdot r}} - 1.5 \]
                              5. Applied rewrites93.5%

                                \[\leadsto \color{blue}{\frac{2}{r \cdot r} - 1.5} \]
                            3. Recombined 2 regimes into one program.
                            4. Final simplification86.6%

                              \[\leadsto \begin{array}{l} \mathbf{if}\;\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} \leq -5 \cdot 10^{+15}:\\ \;\;\;\;\left(-0.375 \cdot r\right) \cdot \left(\left(w \cdot w\right) \cdot r\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{r \cdot r} - 1.5\\ \end{array} \]
                            5. Add Preprocessing

                            Alternative 7: 88.1% accurate, 0.8× speedup?

                            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ \mathbf{if}\;\left(3 + t\_0\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} \leq -5 \cdot 10^{+15}:\\ \;\;\;\;\left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w\right) \cdot w\\ \mathbf{else}:\\ \;\;\;\;t\_0 - 1.5\\ \end{array} \end{array} \]
                            (FPCore (v w r)
                             :precision binary64
                             (let* ((t_0 (/ 2.0 (* r r))))
                               (if (<=
                                    (-
                                     (+ 3.0 t_0)
                                     (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
                                    -5e+15)
                                 (* (* (* -0.375 (* r r)) w) w)
                                 (- t_0 1.5))))
                            double code(double v, double w, double r) {
                            	double t_0 = 2.0 / (r * r);
                            	double tmp;
                            	if (((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) <= -5e+15) {
                            		tmp = ((-0.375 * (r * r)) * w) * w;
                            	} else {
                            		tmp = t_0 - 1.5;
                            	}
                            	return tmp;
                            }
                            
                            real(8) function code(v, w, r)
                                real(8), intent (in) :: v
                                real(8), intent (in) :: w
                                real(8), intent (in) :: r
                                real(8) :: t_0
                                real(8) :: tmp
                                t_0 = 2.0d0 / (r * r)
                                if (((3.0d0 + t_0) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) <= (-5d+15)) then
                                    tmp = (((-0.375d0) * (r * r)) * w) * w
                                else
                                    tmp = t_0 - 1.5d0
                                end if
                                code = tmp
                            end function
                            
                            public static double code(double v, double w, double r) {
                            	double t_0 = 2.0 / (r * r);
                            	double tmp;
                            	if (((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) <= -5e+15) {
                            		tmp = ((-0.375 * (r * r)) * w) * w;
                            	} else {
                            		tmp = t_0 - 1.5;
                            	}
                            	return tmp;
                            }
                            
                            def code(v, w, r):
                            	t_0 = 2.0 / (r * r)
                            	tmp = 0
                            	if ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) <= -5e+15:
                            		tmp = ((-0.375 * (r * r)) * w) * w
                            	else:
                            		tmp = t_0 - 1.5
                            	return tmp
                            
                            function code(v, w, r)
                            	t_0 = Float64(2.0 / Float64(r * r))
                            	tmp = 0.0
                            	if (Float64(Float64(3.0 + t_0) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) <= -5e+15)
                            		tmp = Float64(Float64(Float64(-0.375 * Float64(r * r)) * w) * w);
                            	else
                            		tmp = Float64(t_0 - 1.5);
                            	end
                            	return tmp
                            end
                            
                            function tmp_2 = code(v, w, r)
                            	t_0 = 2.0 / (r * r);
                            	tmp = 0.0;
                            	if (((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) <= -5e+15)
                            		tmp = ((-0.375 * (r * r)) * w) * w;
                            	else
                            		tmp = t_0 - 1.5;
                            	end
                            	tmp_2 = tmp;
                            end
                            
                            code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e+15], N[(N[(N[(-0.375 * N[(r * r), $MachinePrecision]), $MachinePrecision] * w), $MachinePrecision] * w), $MachinePrecision], N[(t$95$0 - 1.5), $MachinePrecision]]]
                            
                            \begin{array}{l}
                            
                            \\
                            \begin{array}{l}
                            t_0 := \frac{2}{r \cdot r}\\
                            \mathbf{if}\;\left(3 + t\_0\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} \leq -5 \cdot 10^{+15}:\\
                            \;\;\;\;\left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w\right) \cdot w\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;t\_0 - 1.5\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) < -5e15

                              1. Initial program 83.8%

                                \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                              2. Add Preprocessing
                              3. Taylor expanded in v around 0

                                \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)} \]
                              4. Step-by-step derivation
                                1. sub-negN/A

                                  \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} + \left(\mathsf{neg}\left(\left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right)\right)} \]
                                2. +-commutativeN/A

                                  \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right)\right) + 2 \cdot \frac{1}{{r}^{2}}} \]
                                3. +-commutativeN/A

                                  \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \frac{3}{2}\right)}\right)\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                                4. distribute-neg-inN/A

                                  \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right) + \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right)} + 2 \cdot \frac{1}{{r}^{2}} \]
                                5. distribute-lft-neg-inN/A

                                  \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right)} + \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                                6. metadata-evalN/A

                                  \[\leadsto \left(\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right) + \color{blue}{\frac{-3}{2}}\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                                7. associate-+l+N/A

                                  \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right) + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right)} \]
                                8. metadata-evalN/A

                                  \[\leadsto \color{blue}{\frac{-3}{8}} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                                9. *-commutativeN/A

                                  \[\leadsto \frac{-3}{8} \cdot \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                                10. associate-*r*N/A

                                  \[\leadsto \color{blue}{\left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2}} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                                11. +-commutativeN/A

                                  \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2}\right)} \]
                                12. metadata-evalN/A

                                  \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \left(2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)}\right) \]
                                13. sub-negN/A

                                  \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
                                14. lower-fma.f64N/A

                                  \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-3}{8} \cdot {w}^{2}, {r}^{2}, 2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
                              5. Applied rewrites74.9%

                                \[\leadsto \color{blue}{\mathsf{fma}\left(-0.375 \cdot \left(w \cdot w\right), r \cdot r, \frac{2}{r \cdot r} - 1.5\right)} \]
                              6. Taylor expanded in w around inf

                                \[\leadsto \frac{-3}{8} \cdot \color{blue}{\left({r}^{2} \cdot {w}^{2}\right)} \]
                              7. Step-by-step derivation
                                1. Applied rewrites76.3%

                                  \[\leadsto \left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w\right) \cdot \color{blue}{w} \]

                                if -5e15 < (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v)))

                                1. Initial program 81.5%

                                  \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                                2. Add Preprocessing
                                3. Taylor expanded in w around 0

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

                                    \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}} \]
                                  2. associate-*r/N/A

                                    \[\leadsto \color{blue}{\frac{2 \cdot 1}{{r}^{2}}} - \frac{3}{2} \]
                                  3. metadata-evalN/A

                                    \[\leadsto \frac{\color{blue}{2}}{{r}^{2}} - \frac{3}{2} \]
                                  4. lower-/.f64N/A

                                    \[\leadsto \color{blue}{\frac{2}{{r}^{2}}} - \frac{3}{2} \]
                                  5. unpow2N/A

                                    \[\leadsto \frac{2}{\color{blue}{r \cdot r}} - \frac{3}{2} \]
                                  6. lower-*.f6493.5

                                    \[\leadsto \frac{2}{\color{blue}{r \cdot r}} - 1.5 \]
                                5. Applied rewrites93.5%

                                  \[\leadsto \color{blue}{\frac{2}{r \cdot r} - 1.5} \]
                              8. Recombined 2 regimes into one program.
                              9. Add Preprocessing

                              Alternative 8: 97.1% accurate, 1.0× speedup?

                              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ \mathbf{if}\;r \leq 7.2 \cdot 10^{+194}:\\ \;\;\;\;\left(\left(3 + t\_0\right) - \left(\left(\left(\frac{r}{1 - v} \cdot w\right) \cdot r\right) \cdot \mathsf{fma}\left(v, -0.25, 0.375\right)\right) \cdot w\right) - 4.5\\ \mathbf{else}:\\ \;\;\;\;t\_0 + \mathsf{fma}\left(w \cdot \left(-0.25 \cdot r\right), w \cdot r, -1.5\right)\\ \end{array} \end{array} \]
                              (FPCore (v w r)
                               :precision binary64
                               (let* ((t_0 (/ 2.0 (* r r))))
                                 (if (<= r 7.2e+194)
                                   (-
                                    (- (+ 3.0 t_0) (* (* (* (* (/ r (- 1.0 v)) w) r) (fma v -0.25 0.375)) w))
                                    4.5)
                                   (+ t_0 (fma (* w (* -0.25 r)) (* w r) -1.5)))))
                              double code(double v, double w, double r) {
                              	double t_0 = 2.0 / (r * r);
                              	double tmp;
                              	if (r <= 7.2e+194) {
                              		tmp = ((3.0 + t_0) - (((((r / (1.0 - v)) * w) * r) * fma(v, -0.25, 0.375)) * w)) - 4.5;
                              	} else {
                              		tmp = t_0 + fma((w * (-0.25 * r)), (w * r), -1.5);
                              	}
                              	return tmp;
                              }
                              
                              function code(v, w, r)
                              	t_0 = Float64(2.0 / Float64(r * r))
                              	tmp = 0.0
                              	if (r <= 7.2e+194)
                              		tmp = Float64(Float64(Float64(3.0 + t_0) - Float64(Float64(Float64(Float64(Float64(r / Float64(1.0 - v)) * w) * r) * fma(v, -0.25, 0.375)) * w)) - 4.5);
                              	else
                              		tmp = Float64(t_0 + fma(Float64(w * Float64(-0.25 * r)), Float64(w * r), -1.5));
                              	end
                              	return tmp
                              end
                              
                              code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 7.2e+194], N[(N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(N[(N[(N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * w), $MachinePrecision] * r), $MachinePrecision] * N[(v * -0.25 + 0.375), $MachinePrecision]), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(t$95$0 + N[(N[(w * N[(-0.25 * r), $MachinePrecision]), $MachinePrecision] * N[(w * r), $MachinePrecision] + -1.5), $MachinePrecision]), $MachinePrecision]]]
                              
                              \begin{array}{l}
                              
                              \\
                              \begin{array}{l}
                              t_0 := \frac{2}{r \cdot r}\\
                              \mathbf{if}\;r \leq 7.2 \cdot 10^{+194}:\\
                              \;\;\;\;\left(\left(3 + t\_0\right) - \left(\left(\left(\frac{r}{1 - v} \cdot w\right) \cdot r\right) \cdot \mathsf{fma}\left(v, -0.25, 0.375\right)\right) \cdot w\right) - 4.5\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;t\_0 + \mathsf{fma}\left(w \cdot \left(-0.25 \cdot r\right), w \cdot r, -1.5\right)\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 2 regimes
                              2. if r < 7.19999999999999999e194

                                1. Initial program 82.9%

                                  \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                                2. Add Preprocessing
                                3. Step-by-step derivation
                                  1. lift-*.f64N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\color{blue}{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}}{1 - v}\right) - \frac{9}{2} \]
                                  2. lift-*.f64N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \color{blue}{\left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}}{1 - v}\right) - \frac{9}{2} \]
                                  3. associate-*r*N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\color{blue}{\left(\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(w \cdot w\right) \cdot r\right)\right) \cdot r}}{1 - v}\right) - \frac{9}{2} \]
                                  4. lower-*.f64N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\color{blue}{\left(\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(w \cdot w\right) \cdot r\right)\right) \cdot r}}{1 - v}\right) - \frac{9}{2} \]
                                4. Applied rewrites87.6%

                                  \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\color{blue}{\left(\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot 0.125\right) \cdot w\right) \cdot \left(w \cdot r\right)\right) \cdot r}}{1 - v}\right) - 4.5 \]
                                5. Step-by-step derivation
                                  1. lift-/.f64N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\frac{\left(\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot w\right) \cdot \left(w \cdot r\right)\right) \cdot r}{1 - v}}\right) - \frac{9}{2} \]
                                  2. lift-*.f64N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\color{blue}{\left(\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot w\right) \cdot \left(w \cdot r\right)\right) \cdot r}}{1 - v}\right) - \frac{9}{2} \]
                                  3. associate-/l*N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot w\right) \cdot \left(w \cdot r\right)\right) \cdot \frac{r}{1 - v}}\right) - \frac{9}{2} \]
                                  4. lift-*.f64N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot w\right) \cdot \left(w \cdot r\right)\right)} \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
                                  5. lift-*.f64N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\color{blue}{\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot w\right)} \cdot \left(w \cdot r\right)\right) \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
                                  6. associate-*l*N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \left(w \cdot \left(w \cdot r\right)\right)\right)} \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
                                  7. lift-*.f64N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \left(w \cdot \color{blue}{\left(w \cdot r\right)}\right)\right) \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
                                  8. associate-*l*N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \color{blue}{\left(\left(w \cdot w\right) \cdot r\right)}\right) \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
                                  9. lift-*.f64N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \left(\color{blue}{\left(w \cdot w\right)} \cdot r\right)\right) \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
                                  10. lift-*.f64N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \color{blue}{\left(\left(w \cdot w\right) \cdot r\right)}\right) \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
                                  11. associate-*l*N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot \frac{r}{1 - v}\right)}\right) - \frac{9}{2} \]
                                  12. associate-/l*N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \color{blue}{\frac{\left(\left(w \cdot w\right) \cdot r\right) \cdot r}{1 - v}}\right) - \frac{9}{2} \]
                                6. Applied rewrites99.7%

                                  \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\frac{0.125 \cdot \mathsf{fma}\left(-2, v, 3\right)}{\left(1 - v\right) \cdot {\left(r \cdot w\right)}^{-2}}}\right) - 4.5 \]
                                7. Applied rewrites91.9%

                                  \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\mathsf{fma}\left(-0.25, v, 0.375\right) \cdot w\right) \cdot \left(\left(w \cdot r\right) \cdot \frac{r}{1 - v}\right)}\right) - 4.5 \]
                                8. Step-by-step derivation
                                  1. lift-*.f64N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\mathsf{fma}\left(\frac{-1}{4}, v, \frac{3}{8}\right) \cdot w\right) \cdot \left(\left(w \cdot r\right) \cdot \frac{r}{1 - v}\right)}\right) - \frac{9}{2} \]
                                  2. *-commutativeN/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\left(w \cdot r\right) \cdot \frac{r}{1 - v}\right) \cdot \left(\mathsf{fma}\left(\frac{-1}{4}, v, \frac{3}{8}\right) \cdot w\right)}\right) - \frac{9}{2} \]
                                  3. lift-*.f64N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(w \cdot r\right) \cdot \frac{r}{1 - v}\right) \cdot \color{blue}{\left(\mathsf{fma}\left(\frac{-1}{4}, v, \frac{3}{8}\right) \cdot w\right)}\right) - \frac{9}{2} \]
                                  4. associate-*r*N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\left(\left(w \cdot r\right) \cdot \frac{r}{1 - v}\right) \cdot \mathsf{fma}\left(\frac{-1}{4}, v, \frac{3}{8}\right)\right) \cdot w}\right) - \frac{9}{2} \]
                                  5. lower-*.f64N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\left(\left(w \cdot r\right) \cdot \frac{r}{1 - v}\right) \cdot \mathsf{fma}\left(\frac{-1}{4}, v, \frac{3}{8}\right)\right) \cdot w}\right) - \frac{9}{2} \]
                                  6. lower-*.f6498.2

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\left(\left(w \cdot r\right) \cdot \frac{r}{1 - v}\right) \cdot \mathsf{fma}\left(-0.25, v, 0.375\right)\right)} \cdot w\right) - 4.5 \]
                                  7. lift-*.f64N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(\color{blue}{\left(w \cdot r\right)} \cdot \frac{r}{1 - v}\right) \cdot \mathsf{fma}\left(\frac{-1}{4}, v, \frac{3}{8}\right)\right) \cdot w\right) - \frac{9}{2} \]
                                  8. lift-*.f64N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\color{blue}{\left(\left(w \cdot r\right) \cdot \frac{r}{1 - v}\right)} \cdot \mathsf{fma}\left(\frac{-1}{4}, v, \frac{3}{8}\right)\right) \cdot w\right) - \frac{9}{2} \]
                                  9. *-commutativeN/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\color{blue}{\left(\frac{r}{1 - v} \cdot \left(w \cdot r\right)\right)} \cdot \mathsf{fma}\left(\frac{-1}{4}, v, \frac{3}{8}\right)\right) \cdot w\right) - \frac{9}{2} \]
                                  10. associate-*r*N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\color{blue}{\left(\left(\frac{r}{1 - v} \cdot w\right) \cdot r\right)} \cdot \mathsf{fma}\left(\frac{-1}{4}, v, \frac{3}{8}\right)\right) \cdot w\right) - \frac{9}{2} \]
                                  11. lower-*.f64N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\color{blue}{\left(\left(\frac{r}{1 - v} \cdot w\right) \cdot r\right)} \cdot \mathsf{fma}\left(\frac{-1}{4}, v, \frac{3}{8}\right)\right) \cdot w\right) - \frac{9}{2} \]
                                  12. lower-*.f6498.2

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(\color{blue}{\left(\frac{r}{1 - v} \cdot w\right)} \cdot r\right) \cdot \mathsf{fma}\left(-0.25, v, 0.375\right)\right) \cdot w\right) - 4.5 \]
                                  13. lift-fma.f64N/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(\left(\frac{r}{1 - v} \cdot w\right) \cdot r\right) \cdot \color{blue}{\left(\frac{-1}{4} \cdot v + \frac{3}{8}\right)}\right) \cdot w\right) - \frac{9}{2} \]
                                  14. *-commutativeN/A

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(\left(\frac{r}{1 - v} \cdot w\right) \cdot r\right) \cdot \left(\color{blue}{v \cdot \frac{-1}{4}} + \frac{3}{8}\right)\right) \cdot w\right) - \frac{9}{2} \]
                                  15. lower-fma.f6498.2

                                    \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(\left(\frac{r}{1 - v} \cdot w\right) \cdot r\right) \cdot \color{blue}{\mathsf{fma}\left(v, -0.25, 0.375\right)}\right) \cdot w\right) - 4.5 \]
                                9. Applied rewrites98.2%

                                  \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\left(\left(\frac{r}{1 - v} \cdot w\right) \cdot r\right) \cdot \mathsf{fma}\left(v, -0.25, 0.375\right)\right) \cdot w}\right) - 4.5 \]

                                if 7.19999999999999999e194 < r

                                1. Initial program 77.0%

                                  \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                                2. Add Preprocessing
                                3. Step-by-step derivation
                                  1. lift--.f64N/A

                                    \[\leadsto \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - \frac{9}{2}} \]
                                  2. lift--.f64N/A

                                    \[\leadsto \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right)} - \frac{9}{2} \]
                                  3. associate--l-N/A

                                    \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)} \]
                                  4. lift-+.f64N/A

                                    \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right)} - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right) \]
                                  5. +-commutativeN/A

                                    \[\leadsto \color{blue}{\left(\frac{2}{r \cdot r} + 3\right)} - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right) \]
                                  6. associate--l+N/A

                                    \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(3 - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)\right)} \]
                                  7. lower-+.f64N/A

                                    \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(3 - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)\right)} \]
                                  8. lower--.f64N/A

                                    \[\leadsto \frac{2}{r \cdot r} + \color{blue}{\left(3 - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)\right)} \]
                                4. Applied rewrites99.8%

                                  \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\frac{{\left(w \cdot r\right)}^{2}}{1 - v}, \mathsf{fma}\left(-2, v, 3\right) \cdot 0.125, 4.5\right)\right)} \]
                                5. Taylor expanded in v around inf

                                  \[\leadsto \frac{2}{r \cdot r} + \color{blue}{-1 \cdot \left(\frac{3}{2} + \frac{1}{4} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)} \]
                                6. Step-by-step derivation
                                  1. +-commutativeN/A

                                    \[\leadsto \frac{2}{r \cdot r} + -1 \cdot \color{blue}{\left(\frac{1}{4} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \frac{3}{2}\right)} \]
                                  2. distribute-lft-inN/A

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

                                    \[\leadsto \frac{2}{r \cdot r} + \left(\color{blue}{\left(-1 \cdot \frac{1}{4}\right) \cdot \left({r}^{2} \cdot {w}^{2}\right)} + -1 \cdot \frac{3}{2}\right) \]
                                  4. metadata-evalN/A

                                    \[\leadsto \frac{2}{r \cdot r} + \left(\color{blue}{\frac{-1}{4}} \cdot \left({r}^{2} \cdot {w}^{2}\right) + -1 \cdot \frac{3}{2}\right) \]
                                  5. associate-*r*N/A

                                    \[\leadsto \frac{2}{r \cdot r} + \left(\color{blue}{\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot {w}^{2}} + -1 \cdot \frac{3}{2}\right) \]
                                  6. unpow2N/A

                                    \[\leadsto \frac{2}{r \cdot r} + \left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot \color{blue}{\left(w \cdot w\right)} + -1 \cdot \frac{3}{2}\right) \]
                                  7. associate-*r*N/A

                                    \[\leadsto \frac{2}{r \cdot r} + \left(\color{blue}{\left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w\right) \cdot w} + -1 \cdot \frac{3}{2}\right) \]
                                  8. metadata-evalN/A

                                    \[\leadsto \frac{2}{r \cdot r} + \left(\left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w\right) \cdot w + \color{blue}{\frac{-3}{2}}\right) \]
                                  9. lower-fma.f64N/A

                                    \[\leadsto \frac{2}{r \cdot r} + \color{blue}{\mathsf{fma}\left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w, w, \frac{-3}{2}\right)} \]
                                  10. lower-*.f64N/A

                                    \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\color{blue}{\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w}, w, \frac{-3}{2}\right) \]
                                  11. unpow2N/A

                                    \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\left(\frac{-1}{4} \cdot \color{blue}{\left(r \cdot r\right)}\right) \cdot w, w, \frac{-3}{2}\right) \]
                                  12. associate-*r*N/A

                                    \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\color{blue}{\left(\left(\frac{-1}{4} \cdot r\right) \cdot r\right)} \cdot w, w, \frac{-3}{2}\right) \]
                                  13. lower-*.f64N/A

                                    \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\color{blue}{\left(\left(\frac{-1}{4} \cdot r\right) \cdot r\right)} \cdot w, w, \frac{-3}{2}\right) \]
                                  14. lower-*.f6470.2

                                    \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\left(\color{blue}{\left(-0.25 \cdot r\right)} \cdot r\right) \cdot w, w, -1.5\right) \]
                                7. Applied rewrites70.2%

                                  \[\leadsto \frac{2}{r \cdot r} + \color{blue}{\mathsf{fma}\left(\left(\left(-0.25 \cdot r\right) \cdot r\right) \cdot w, w, -1.5\right)} \]
                                8. Step-by-step derivation
                                  1. Applied rewrites94.8%

                                    \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(w \cdot \left(-0.25 \cdot r\right), \color{blue}{w \cdot r}, -1.5\right) \]
                                9. Recombined 2 regimes into one program.
                                10. Add Preprocessing

                                Alternative 9: 99.7% accurate, 1.1× speedup?

                                \[\begin{array}{l} \\ \frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\left(r \cdot w\right) \cdot \frac{r \cdot w}{1 - v}, \mathsf{fma}\left(-2, v, 3\right) \cdot 0.125, 4.5\right)\right) \end{array} \]
                                (FPCore (v w r)
                                 :precision binary64
                                 (+
                                  (/ 2.0 (* r r))
                                  (-
                                   3.0
                                   (fma (* (* r w) (/ (* r w) (- 1.0 v))) (* (fma -2.0 v 3.0) 0.125) 4.5))))
                                double code(double v, double w, double r) {
                                	return (2.0 / (r * r)) + (3.0 - fma(((r * w) * ((r * w) / (1.0 - v))), (fma(-2.0, v, 3.0) * 0.125), 4.5));
                                }
                                
                                function code(v, w, r)
                                	return Float64(Float64(2.0 / Float64(r * r)) + Float64(3.0 - fma(Float64(Float64(r * w) * Float64(Float64(r * w) / Float64(1.0 - v))), Float64(fma(-2.0, v, 3.0) * 0.125), 4.5)))
                                end
                                
                                code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(3.0 - N[(N[(N[(r * w), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(-2.0 * v + 3.0), $MachinePrecision] * 0.125), $MachinePrecision] + 4.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                                
                                \begin{array}{l}
                                
                                \\
                                \frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\left(r \cdot w\right) \cdot \frac{r \cdot w}{1 - v}, \mathsf{fma}\left(-2, v, 3\right) \cdot 0.125, 4.5\right)\right)
                                \end{array}
                                
                                Derivation
                                1. Initial program 82.5%

                                  \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                                2. Add Preprocessing
                                3. Step-by-step derivation
                                  1. lift--.f64N/A

                                    \[\leadsto \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - \frac{9}{2}} \]
                                  2. lift--.f64N/A

                                    \[\leadsto \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right)} - \frac{9}{2} \]
                                  3. associate--l-N/A

                                    \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)} \]
                                  4. lift-+.f64N/A

                                    \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right)} - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right) \]
                                  5. +-commutativeN/A

                                    \[\leadsto \color{blue}{\left(\frac{2}{r \cdot r} + 3\right)} - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right) \]
                                  6. associate--l+N/A

                                    \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(3 - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)\right)} \]
                                  7. lower-+.f64N/A

                                    \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(3 - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)\right)} \]
                                  8. lower--.f64N/A

                                    \[\leadsto \frac{2}{r \cdot r} + \color{blue}{\left(3 - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)\right)} \]
                                4. Applied rewrites99.4%

                                  \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\frac{{\left(w \cdot r\right)}^{2}}{1 - v}, \mathsf{fma}\left(-2, v, 3\right) \cdot 0.125, 4.5\right)\right)} \]
                                5. Step-by-step derivation
                                  1. lift-/.f64N/A

                                    \[\leadsto \frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\color{blue}{\frac{{\left(w \cdot r\right)}^{2}}{1 - v}}, \mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}, \frac{9}{2}\right)\right) \]
                                  2. lift-pow.f64N/A

                                    \[\leadsto \frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\frac{\color{blue}{{\left(w \cdot r\right)}^{2}}}{1 - v}, \mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}, \frac{9}{2}\right)\right) \]
                                  3. unpow2N/A

                                    \[\leadsto \frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\frac{\color{blue}{\left(w \cdot r\right) \cdot \left(w \cdot r\right)}}{1 - v}, \mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}, \frac{9}{2}\right)\right) \]
                                  4. associate-/l*N/A

                                    \[\leadsto \frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\color{blue}{\left(w \cdot r\right) \cdot \frac{w \cdot r}{1 - v}}, \mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}, \frac{9}{2}\right)\right) \]
                                  5. lower-*.f64N/A

                                    \[\leadsto \frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\color{blue}{\left(w \cdot r\right) \cdot \frac{w \cdot r}{1 - v}}, \mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}, \frac{9}{2}\right)\right) \]
                                  6. lift-*.f64N/A

                                    \[\leadsto \frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\color{blue}{\left(w \cdot r\right)} \cdot \frac{w \cdot r}{1 - v}, \mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}, \frac{9}{2}\right)\right) \]
                                  7. *-commutativeN/A

                                    \[\leadsto \frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\color{blue}{\left(r \cdot w\right)} \cdot \frac{w \cdot r}{1 - v}, \mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}, \frac{9}{2}\right)\right) \]
                                  8. lower-*.f64N/A

                                    \[\leadsto \frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\color{blue}{\left(r \cdot w\right)} \cdot \frac{w \cdot r}{1 - v}, \mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}, \frac{9}{2}\right)\right) \]
                                  9. lower-/.f6499.4

                                    \[\leadsto \frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\left(r \cdot w\right) \cdot \color{blue}{\frac{w \cdot r}{1 - v}}, \mathsf{fma}\left(-2, v, 3\right) \cdot 0.125, 4.5\right)\right) \]
                                  10. lift-*.f64N/A

                                    \[\leadsto \frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\left(r \cdot w\right) \cdot \frac{\color{blue}{w \cdot r}}{1 - v}, \mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}, \frac{9}{2}\right)\right) \]
                                  11. *-commutativeN/A

                                    \[\leadsto \frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\left(r \cdot w\right) \cdot \frac{\color{blue}{r \cdot w}}{1 - v}, \mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}, \frac{9}{2}\right)\right) \]
                                  12. lower-*.f6499.4

                                    \[\leadsto \frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\left(r \cdot w\right) \cdot \frac{\color{blue}{r \cdot w}}{1 - v}, \mathsf{fma}\left(-2, v, 3\right) \cdot 0.125, 4.5\right)\right) \]
                                6. Applied rewrites99.4%

                                  \[\leadsto \frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\color{blue}{\left(r \cdot w\right) \cdot \frac{r \cdot w}{1 - v}}, \mathsf{fma}\left(-2, v, 3\right) \cdot 0.125, 4.5\right)\right) \]
                                7. Add Preprocessing

                                Alternative 10: 94.8% accurate, 1.4× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ \mathbf{if}\;v \leq -26000000 \lor \neg \left(v \leq 5 \cdot 10^{-110}\right):\\ \;\;\;\;t\_0 + \mathsf{fma}\left(w \cdot \left(-0.25 \cdot r\right), w \cdot r, -1.5\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w, w, t\_0 - 1.5\right)\\ \end{array} \end{array} \]
                                (FPCore (v w r)
                                 :precision binary64
                                 (let* ((t_0 (/ 2.0 (* r r))))
                                   (if (or (<= v -26000000.0) (not (<= v 5e-110)))
                                     (+ t_0 (fma (* w (* -0.25 r)) (* w r) -1.5))
                                     (fma (* (* -0.375 (* r r)) w) w (- t_0 1.5)))))
                                double code(double v, double w, double r) {
                                	double t_0 = 2.0 / (r * r);
                                	double tmp;
                                	if ((v <= -26000000.0) || !(v <= 5e-110)) {
                                		tmp = t_0 + fma((w * (-0.25 * r)), (w * r), -1.5);
                                	} else {
                                		tmp = fma(((-0.375 * (r * r)) * w), w, (t_0 - 1.5));
                                	}
                                	return tmp;
                                }
                                
                                function code(v, w, r)
                                	t_0 = Float64(2.0 / Float64(r * r))
                                	tmp = 0.0
                                	if ((v <= -26000000.0) || !(v <= 5e-110))
                                		tmp = Float64(t_0 + fma(Float64(w * Float64(-0.25 * r)), Float64(w * r), -1.5));
                                	else
                                		tmp = fma(Float64(Float64(-0.375 * Float64(r * r)) * w), w, Float64(t_0 - 1.5));
                                	end
                                	return tmp
                                end
                                
                                code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -26000000.0], N[Not[LessEqual[v, 5e-110]], $MachinePrecision]], N[(t$95$0 + N[(N[(w * N[(-0.25 * r), $MachinePrecision]), $MachinePrecision] * N[(w * r), $MachinePrecision] + -1.5), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-0.375 * N[(r * r), $MachinePrecision]), $MachinePrecision] * w), $MachinePrecision] * w + N[(t$95$0 - 1.5), $MachinePrecision]), $MachinePrecision]]]
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                t_0 := \frac{2}{r \cdot r}\\
                                \mathbf{if}\;v \leq -26000000 \lor \neg \left(v \leq 5 \cdot 10^{-110}\right):\\
                                \;\;\;\;t\_0 + \mathsf{fma}\left(w \cdot \left(-0.25 \cdot r\right), w \cdot r, -1.5\right)\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;\mathsf{fma}\left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w, w, t\_0 - 1.5\right)\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if v < -2.6e7 or 5e-110 < v

                                  1. Initial program 77.1%

                                    \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                                  2. Add Preprocessing
                                  3. Step-by-step derivation
                                    1. lift--.f64N/A

                                      \[\leadsto \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - \frac{9}{2}} \]
                                    2. lift--.f64N/A

                                      \[\leadsto \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right)} - \frac{9}{2} \]
                                    3. associate--l-N/A

                                      \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)} \]
                                    4. lift-+.f64N/A

                                      \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right)} - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right) \]
                                    5. +-commutativeN/A

                                      \[\leadsto \color{blue}{\left(\frac{2}{r \cdot r} + 3\right)} - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right) \]
                                    6. associate--l+N/A

                                      \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(3 - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)\right)} \]
                                    7. lower-+.f64N/A

                                      \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(3 - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)\right)} \]
                                    8. lower--.f64N/A

                                      \[\leadsto \frac{2}{r \cdot r} + \color{blue}{\left(3 - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)\right)} \]
                                  4. Applied rewrites99.7%

                                    \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\frac{{\left(w \cdot r\right)}^{2}}{1 - v}, \mathsf{fma}\left(-2, v, 3\right) \cdot 0.125, 4.5\right)\right)} \]
                                  5. Taylor expanded in v around inf

                                    \[\leadsto \frac{2}{r \cdot r} + \color{blue}{-1 \cdot \left(\frac{3}{2} + \frac{1}{4} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)} \]
                                  6. Step-by-step derivation
                                    1. +-commutativeN/A

                                      \[\leadsto \frac{2}{r \cdot r} + -1 \cdot \color{blue}{\left(\frac{1}{4} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \frac{3}{2}\right)} \]
                                    2. distribute-lft-inN/A

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

                                      \[\leadsto \frac{2}{r \cdot r} + \left(\color{blue}{\left(-1 \cdot \frac{1}{4}\right) \cdot \left({r}^{2} \cdot {w}^{2}\right)} + -1 \cdot \frac{3}{2}\right) \]
                                    4. metadata-evalN/A

                                      \[\leadsto \frac{2}{r \cdot r} + \left(\color{blue}{\frac{-1}{4}} \cdot \left({r}^{2} \cdot {w}^{2}\right) + -1 \cdot \frac{3}{2}\right) \]
                                    5. associate-*r*N/A

                                      \[\leadsto \frac{2}{r \cdot r} + \left(\color{blue}{\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot {w}^{2}} + -1 \cdot \frac{3}{2}\right) \]
                                    6. unpow2N/A

                                      \[\leadsto \frac{2}{r \cdot r} + \left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot \color{blue}{\left(w \cdot w\right)} + -1 \cdot \frac{3}{2}\right) \]
                                    7. associate-*r*N/A

                                      \[\leadsto \frac{2}{r \cdot r} + \left(\color{blue}{\left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w\right) \cdot w} + -1 \cdot \frac{3}{2}\right) \]
                                    8. metadata-evalN/A

                                      \[\leadsto \frac{2}{r \cdot r} + \left(\left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w\right) \cdot w + \color{blue}{\frac{-3}{2}}\right) \]
                                    9. lower-fma.f64N/A

                                      \[\leadsto \frac{2}{r \cdot r} + \color{blue}{\mathsf{fma}\left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w, w, \frac{-3}{2}\right)} \]
                                    10. lower-*.f64N/A

                                      \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\color{blue}{\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w}, w, \frac{-3}{2}\right) \]
                                    11. unpow2N/A

                                      \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\left(\frac{-1}{4} \cdot \color{blue}{\left(r \cdot r\right)}\right) \cdot w, w, \frac{-3}{2}\right) \]
                                    12. associate-*r*N/A

                                      \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\color{blue}{\left(\left(\frac{-1}{4} \cdot r\right) \cdot r\right)} \cdot w, w, \frac{-3}{2}\right) \]
                                    13. lower-*.f64N/A

                                      \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\color{blue}{\left(\left(\frac{-1}{4} \cdot r\right) \cdot r\right)} \cdot w, w, \frac{-3}{2}\right) \]
                                    14. lower-*.f6487.7

                                      \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\left(\color{blue}{\left(-0.25 \cdot r\right)} \cdot r\right) \cdot w, w, -1.5\right) \]
                                  7. Applied rewrites87.7%

                                    \[\leadsto \frac{2}{r \cdot r} + \color{blue}{\mathsf{fma}\left(\left(\left(-0.25 \cdot r\right) \cdot r\right) \cdot w, w, -1.5\right)} \]
                                  8. Step-by-step derivation
                                    1. Applied rewrites98.3%

                                      \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(w \cdot \left(-0.25 \cdot r\right), \color{blue}{w \cdot r}, -1.5\right) \]

                                    if -2.6e7 < v < 5e-110

                                    1. Initial program 90.5%

                                      \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                                    2. Add Preprocessing
                                    3. Taylor expanded in v around 0

                                      \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)} \]
                                    4. Step-by-step derivation
                                      1. sub-negN/A

                                        \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} + \left(\mathsf{neg}\left(\left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right)\right)} \]
                                      2. +-commutativeN/A

                                        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right)\right) + 2 \cdot \frac{1}{{r}^{2}}} \]
                                      3. +-commutativeN/A

                                        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \frac{3}{2}\right)}\right)\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                                      4. distribute-neg-inN/A

                                        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right) + \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right)} + 2 \cdot \frac{1}{{r}^{2}} \]
                                      5. distribute-lft-neg-inN/A

                                        \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right)} + \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                                      6. metadata-evalN/A

                                        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right) + \color{blue}{\frac{-3}{2}}\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                                      7. associate-+l+N/A

                                        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right) + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right)} \]
                                      8. metadata-evalN/A

                                        \[\leadsto \color{blue}{\frac{-3}{8}} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                                      9. *-commutativeN/A

                                        \[\leadsto \frac{-3}{8} \cdot \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                                      10. associate-*r*N/A

                                        \[\leadsto \color{blue}{\left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2}} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                                      11. +-commutativeN/A

                                        \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2}\right)} \]
                                      12. metadata-evalN/A

                                        \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \left(2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)}\right) \]
                                      13. sub-negN/A

                                        \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
                                      14. lower-fma.f64N/A

                                        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-3}{8} \cdot {w}^{2}, {r}^{2}, 2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
                                    5. Applied rewrites87.7%

                                      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.375 \cdot \left(w \cdot w\right), r \cdot r, \frac{2}{r \cdot r} - 1.5\right)} \]
                                    6. Taylor expanded in w around 0

                                      \[\leadsto \left(\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + 2 \cdot \frac{1}{{r}^{2}}\right) - \color{blue}{\frac{3}{2}} \]
                                    7. Step-by-step derivation
                                      1. Applied rewrites96.0%

                                        \[\leadsto \mathsf{fma}\left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w, \color{blue}{w}, \frac{2}{r \cdot r} - 1.5\right) \]
                                    8. Recombined 2 regimes into one program.
                                    9. Final simplification97.4%

                                      \[\leadsto \begin{array}{l} \mathbf{if}\;v \leq -26000000 \lor \neg \left(v \leq 5 \cdot 10^{-110}\right):\\ \;\;\;\;\frac{2}{r \cdot r} + \mathsf{fma}\left(w \cdot \left(-0.25 \cdot r\right), w \cdot r, -1.5\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w, w, \frac{2}{r \cdot r} - 1.5\right)\\ \end{array} \]
                                    10. Add Preprocessing

                                    Alternative 11: 90.0% accurate, 1.4× speedup?

                                    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{r \cdot r} - 1.5\\ \mathbf{if}\;v \leq -2.6 \cdot 10^{+91} \lor \neg \left(v \leq 4 \cdot 10^{-76}\right):\\ \;\;\;\;\mathsf{fma}\left(\left(-0.25 \cdot \left(r \cdot r\right)\right) \cdot w, w, t\_0\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w, w, t\_0\right)\\ \end{array} \end{array} \]
                                    (FPCore (v w r)
                                     :precision binary64
                                     (let* ((t_0 (- (/ 2.0 (* r r)) 1.5)))
                                       (if (or (<= v -2.6e+91) (not (<= v 4e-76)))
                                         (fma (* (* -0.25 (* r r)) w) w t_0)
                                         (fma (* (* -0.375 (* r r)) w) w t_0))))
                                    double code(double v, double w, double r) {
                                    	double t_0 = (2.0 / (r * r)) - 1.5;
                                    	double tmp;
                                    	if ((v <= -2.6e+91) || !(v <= 4e-76)) {
                                    		tmp = fma(((-0.25 * (r * r)) * w), w, t_0);
                                    	} else {
                                    		tmp = fma(((-0.375 * (r * r)) * w), w, t_0);
                                    	}
                                    	return tmp;
                                    }
                                    
                                    function code(v, w, r)
                                    	t_0 = Float64(Float64(2.0 / Float64(r * r)) - 1.5)
                                    	tmp = 0.0
                                    	if ((v <= -2.6e+91) || !(v <= 4e-76))
                                    		tmp = fma(Float64(Float64(-0.25 * Float64(r * r)) * w), w, t_0);
                                    	else
                                    		tmp = fma(Float64(Float64(-0.375 * Float64(r * r)) * w), w, t_0);
                                    	end
                                    	return tmp
                                    end
                                    
                                    code[v_, w_, r_] := Block[{t$95$0 = N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]}, If[Or[LessEqual[v, -2.6e+91], N[Not[LessEqual[v, 4e-76]], $MachinePrecision]], N[(N[(N[(-0.25 * N[(r * r), $MachinePrecision]), $MachinePrecision] * w), $MachinePrecision] * w + t$95$0), $MachinePrecision], N[(N[(N[(-0.375 * N[(r * r), $MachinePrecision]), $MachinePrecision] * w), $MachinePrecision] * w + t$95$0), $MachinePrecision]]]
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    \begin{array}{l}
                                    t_0 := \frac{2}{r \cdot r} - 1.5\\
                                    \mathbf{if}\;v \leq -2.6 \cdot 10^{+91} \lor \neg \left(v \leq 4 \cdot 10^{-76}\right):\\
                                    \;\;\;\;\mathsf{fma}\left(\left(-0.25 \cdot \left(r \cdot r\right)\right) \cdot w, w, t\_0\right)\\
                                    
                                    \mathbf{else}:\\
                                    \;\;\;\;\mathsf{fma}\left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w, w, t\_0\right)\\
                                    
                                    
                                    \end{array}
                                    \end{array}
                                    
                                    Derivation
                                    1. Split input into 2 regimes
                                    2. if v < -2.6e91 or 3.99999999999999971e-76 < v

                                      1. Initial program 75.0%

                                        \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                                      2. Add Preprocessing
                                      3. Taylor expanded in v around inf

                                        \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \left(\frac{3}{2} + \frac{1}{4} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)} \]
                                      4. Step-by-step derivation
                                        1. sub-negN/A

                                          \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} + \left(\mathsf{neg}\left(\left(\frac{3}{2} + \frac{1}{4} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right)\right)} \]
                                        2. +-commutativeN/A

                                          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\frac{3}{2} + \frac{1}{4} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right)\right) + 2 \cdot \frac{1}{{r}^{2}}} \]
                                        3. +-commutativeN/A

                                          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\frac{1}{4} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \frac{3}{2}\right)}\right)\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                                        4. distribute-neg-inN/A

                                          \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\frac{1}{4} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right) + \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right)} + 2 \cdot \frac{1}{{r}^{2}} \]
                                        5. metadata-evalN/A

                                          \[\leadsto \left(\left(\mathsf{neg}\left(\frac{1}{4} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right) + \color{blue}{\frac{-3}{2}}\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                                        6. associate-+l+N/A

                                          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{4} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right) + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right)} \]
                                        7. distribute-lft-neg-inN/A

                                          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right)} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                                        8. metadata-evalN/A

                                          \[\leadsto \color{blue}{\frac{-1}{4}} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                                        9. associate-*r*N/A

                                          \[\leadsto \color{blue}{\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot {w}^{2}} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                                        10. unpow2N/A

                                          \[\leadsto \left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot \color{blue}{\left(w \cdot w\right)} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                                        11. associate-*r*N/A

                                          \[\leadsto \color{blue}{\left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w\right) \cdot w} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                                        12. +-commutativeN/A

                                          \[\leadsto \left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w\right) \cdot w + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2}\right)} \]
                                        13. metadata-evalN/A

                                          \[\leadsto \left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w\right) \cdot w + \left(2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)}\right) \]
                                        14. sub-negN/A

                                          \[\leadsto \left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w\right) \cdot w + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
                                        15. lower-fma.f64N/A

                                          \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w, w, 2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
                                      5. Applied rewrites87.6%

                                        \[\leadsto \color{blue}{\mathsf{fma}\left(\left(-0.25 \cdot \left(r \cdot r\right)\right) \cdot w, w, \frac{2}{r \cdot r} - 1.5\right)} \]

                                      if -2.6e91 < v < 3.99999999999999971e-76

                                      1. Initial program 90.0%

                                        \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                                      2. Add Preprocessing
                                      3. Taylor expanded in v around 0

                                        \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)} \]
                                      4. Step-by-step derivation
                                        1. sub-negN/A

                                          \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} + \left(\mathsf{neg}\left(\left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right)\right)} \]
                                        2. +-commutativeN/A

                                          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right)\right) + 2 \cdot \frac{1}{{r}^{2}}} \]
                                        3. +-commutativeN/A

                                          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \frac{3}{2}\right)}\right)\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                                        4. distribute-neg-inN/A

                                          \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right) + \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right)} + 2 \cdot \frac{1}{{r}^{2}} \]
                                        5. distribute-lft-neg-inN/A

                                          \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right)} + \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                                        6. metadata-evalN/A

                                          \[\leadsto \left(\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right) + \color{blue}{\frac{-3}{2}}\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                                        7. associate-+l+N/A

                                          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right) + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right)} \]
                                        8. metadata-evalN/A

                                          \[\leadsto \color{blue}{\frac{-3}{8}} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                                        9. *-commutativeN/A

                                          \[\leadsto \frac{-3}{8} \cdot \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                                        10. associate-*r*N/A

                                          \[\leadsto \color{blue}{\left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2}} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                                        11. +-commutativeN/A

                                          \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2}\right)} \]
                                        12. metadata-evalN/A

                                          \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \left(2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)}\right) \]
                                        13. sub-negN/A

                                          \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
                                        14. lower-fma.f64N/A

                                          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-3}{8} \cdot {w}^{2}, {r}^{2}, 2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
                                      5. Applied rewrites85.5%

                                        \[\leadsto \color{blue}{\mathsf{fma}\left(-0.375 \cdot \left(w \cdot w\right), r \cdot r, \frac{2}{r \cdot r} - 1.5\right)} \]
                                      6. Taylor expanded in w around 0

                                        \[\leadsto \left(\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + 2 \cdot \frac{1}{{r}^{2}}\right) - \color{blue}{\frac{3}{2}} \]
                                      7. Step-by-step derivation
                                        1. Applied rewrites94.5%

                                          \[\leadsto \mathsf{fma}\left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w, \color{blue}{w}, \frac{2}{r \cdot r} - 1.5\right) \]
                                      8. Recombined 2 regimes into one program.
                                      9. Final simplification91.1%

                                        \[\leadsto \begin{array}{l} \mathbf{if}\;v \leq -2.6 \cdot 10^{+91} \lor \neg \left(v \leq 4 \cdot 10^{-76}\right):\\ \;\;\;\;\mathsf{fma}\left(\left(-0.25 \cdot \left(r \cdot r\right)\right) \cdot w, w, \frac{2}{r \cdot r} - 1.5\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w, w, \frac{2}{r \cdot r} - 1.5\right)\\ \end{array} \]
                                      10. Add Preprocessing

                                      Alternative 12: 92.1% accurate, 1.4× speedup?

                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;r \leq 15000:\\ \;\;\;\;\mathsf{fma}\left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w, w, \frac{2}{r \cdot r} - 1.5\right)\\ \mathbf{else}:\\ \;\;\;\;\left(3 - \left(\mathsf{fma}\left(-0.25, v, 0.375\right) \cdot w\right) \cdot \left(\left(w \cdot r\right) \cdot \frac{r}{1 - v}\right)\right) - 4.5\\ \end{array} \end{array} \]
                                      (FPCore (v w r)
                                       :precision binary64
                                       (if (<= r 15000.0)
                                         (fma (* (* -0.375 (* r r)) w) w (- (/ 2.0 (* r r)) 1.5))
                                         (- (- 3.0 (* (* (fma -0.25 v 0.375) w) (* (* w r) (/ r (- 1.0 v))))) 4.5)))
                                      double code(double v, double w, double r) {
                                      	double tmp;
                                      	if (r <= 15000.0) {
                                      		tmp = fma(((-0.375 * (r * r)) * w), w, ((2.0 / (r * r)) - 1.5));
                                      	} else {
                                      		tmp = (3.0 - ((fma(-0.25, v, 0.375) * w) * ((w * r) * (r / (1.0 - v))))) - 4.5;
                                      	}
                                      	return tmp;
                                      }
                                      
                                      function code(v, w, r)
                                      	tmp = 0.0
                                      	if (r <= 15000.0)
                                      		tmp = fma(Float64(Float64(-0.375 * Float64(r * r)) * w), w, Float64(Float64(2.0 / Float64(r * r)) - 1.5));
                                      	else
                                      		tmp = Float64(Float64(3.0 - Float64(Float64(fma(-0.25, v, 0.375) * w) * Float64(Float64(w * r) * Float64(r / Float64(1.0 - v))))) - 4.5);
                                      	end
                                      	return tmp
                                      end
                                      
                                      code[v_, w_, r_] := If[LessEqual[r, 15000.0], N[(N[(N[(-0.375 * N[(r * r), $MachinePrecision]), $MachinePrecision] * w), $MachinePrecision] * w + N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision], N[(N[(3.0 - N[(N[(N[(-0.25 * v + 0.375), $MachinePrecision] * w), $MachinePrecision] * N[(N[(w * r), $MachinePrecision] * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
                                      
                                      \begin{array}{l}
                                      
                                      \\
                                      \begin{array}{l}
                                      \mathbf{if}\;r \leq 15000:\\
                                      \;\;\;\;\mathsf{fma}\left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w, w, \frac{2}{r \cdot r} - 1.5\right)\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;\left(3 - \left(\mathsf{fma}\left(-0.25, v, 0.375\right) \cdot w\right) \cdot \left(\left(w \cdot r\right) \cdot \frac{r}{1 - v}\right)\right) - 4.5\\
                                      
                                      
                                      \end{array}
                                      \end{array}
                                      
                                      Derivation
                                      1. Split input into 2 regimes
                                      2. if r < 15000

                                        1. Initial program 80.4%

                                          \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                                        2. Add Preprocessing
                                        3. Taylor expanded in v around 0

                                          \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)} \]
                                        4. Step-by-step derivation
                                          1. sub-negN/A

                                            \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} + \left(\mathsf{neg}\left(\left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right)\right)} \]
                                          2. +-commutativeN/A

                                            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right)\right) + 2 \cdot \frac{1}{{r}^{2}}} \]
                                          3. +-commutativeN/A

                                            \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \frac{3}{2}\right)}\right)\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                                          4. distribute-neg-inN/A

                                            \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right) + \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right)} + 2 \cdot \frac{1}{{r}^{2}} \]
                                          5. distribute-lft-neg-inN/A

                                            \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right)} + \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                                          6. metadata-evalN/A

                                            \[\leadsto \left(\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right) + \color{blue}{\frac{-3}{2}}\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                                          7. associate-+l+N/A

                                            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right) + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right)} \]
                                          8. metadata-evalN/A

                                            \[\leadsto \color{blue}{\frac{-3}{8}} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                                          9. *-commutativeN/A

                                            \[\leadsto \frac{-3}{8} \cdot \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                                          10. associate-*r*N/A

                                            \[\leadsto \color{blue}{\left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2}} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                                          11. +-commutativeN/A

                                            \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2}\right)} \]
                                          12. metadata-evalN/A

                                            \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \left(2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)}\right) \]
                                          13. sub-negN/A

                                            \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
                                          14. lower-fma.f64N/A

                                            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-3}{8} \cdot {w}^{2}, {r}^{2}, 2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
                                        5. Applied rewrites76.2%

                                          \[\leadsto \color{blue}{\mathsf{fma}\left(-0.375 \cdot \left(w \cdot w\right), r \cdot r, \frac{2}{r \cdot r} - 1.5\right)} \]
                                        6. Taylor expanded in w around 0

                                          \[\leadsto \left(\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + 2 \cdot \frac{1}{{r}^{2}}\right) - \color{blue}{\frac{3}{2}} \]
                                        7. Step-by-step derivation
                                          1. Applied rewrites89.7%

                                            \[\leadsto \mathsf{fma}\left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w, \color{blue}{w}, \frac{2}{r \cdot r} - 1.5\right) \]

                                          if 15000 < r

                                          1. Initial program 90.9%

                                            \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                                          2. Add Preprocessing
                                          3. Step-by-step derivation
                                            1. lift-*.f64N/A

                                              \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\color{blue}{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}}{1 - v}\right) - \frac{9}{2} \]
                                            2. lift-*.f64N/A

                                              \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \color{blue}{\left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}}{1 - v}\right) - \frac{9}{2} \]
                                            3. associate-*r*N/A

                                              \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\color{blue}{\left(\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(w \cdot w\right) \cdot r\right)\right) \cdot r}}{1 - v}\right) - \frac{9}{2} \]
                                            4. lower-*.f64N/A

                                              \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\color{blue}{\left(\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(w \cdot w\right) \cdot r\right)\right) \cdot r}}{1 - v}\right) - \frac{9}{2} \]
                                          4. Applied rewrites96.1%

                                            \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\color{blue}{\left(\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot 0.125\right) \cdot w\right) \cdot \left(w \cdot r\right)\right) \cdot r}}{1 - v}\right) - 4.5 \]
                                          5. Step-by-step derivation
                                            1. lift-/.f64N/A

                                              \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\frac{\left(\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot w\right) \cdot \left(w \cdot r\right)\right) \cdot r}{1 - v}}\right) - \frac{9}{2} \]
                                            2. lift-*.f64N/A

                                              \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\color{blue}{\left(\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot w\right) \cdot \left(w \cdot r\right)\right) \cdot r}}{1 - v}\right) - \frac{9}{2} \]
                                            3. associate-/l*N/A

                                              \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot w\right) \cdot \left(w \cdot r\right)\right) \cdot \frac{r}{1 - v}}\right) - \frac{9}{2} \]
                                            4. lift-*.f64N/A

                                              \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot w\right) \cdot \left(w \cdot r\right)\right)} \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
                                            5. lift-*.f64N/A

                                              \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\color{blue}{\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot w\right)} \cdot \left(w \cdot r\right)\right) \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
                                            6. associate-*l*N/A

                                              \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \left(w \cdot \left(w \cdot r\right)\right)\right)} \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
                                            7. lift-*.f64N/A

                                              \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \left(w \cdot \color{blue}{\left(w \cdot r\right)}\right)\right) \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
                                            8. associate-*l*N/A

                                              \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \color{blue}{\left(\left(w \cdot w\right) \cdot r\right)}\right) \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
                                            9. lift-*.f64N/A

                                              \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \left(\color{blue}{\left(w \cdot w\right)} \cdot r\right)\right) \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
                                            10. lift-*.f64N/A

                                              \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \color{blue}{\left(\left(w \cdot w\right) \cdot r\right)}\right) \cdot \frac{r}{1 - v}\right) - \frac{9}{2} \]
                                            11. associate-*l*N/A

                                              \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot \frac{r}{1 - v}\right)}\right) - \frac{9}{2} \]
                                            12. associate-/l*N/A

                                              \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\mathsf{fma}\left(-2, v, 3\right) \cdot \frac{1}{8}\right) \cdot \color{blue}{\frac{\left(\left(w \cdot w\right) \cdot r\right) \cdot r}{1 - v}}\right) - \frac{9}{2} \]
                                          6. Applied rewrites99.6%

                                            \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\frac{0.125 \cdot \mathsf{fma}\left(-2, v, 3\right)}{\left(1 - v\right) \cdot {\left(r \cdot w\right)}^{-2}}}\right) - 4.5 \]
                                          7. Applied rewrites97.8%

                                            \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\mathsf{fma}\left(-0.25, v, 0.375\right) \cdot w\right) \cdot \left(\left(w \cdot r\right) \cdot \frac{r}{1 - v}\right)}\right) - 4.5 \]
                                          8. Taylor expanded in r around inf

                                            \[\leadsto \left(\color{blue}{3} - \left(\mathsf{fma}\left(\frac{-1}{4}, v, \frac{3}{8}\right) \cdot w\right) \cdot \left(\left(w \cdot r\right) \cdot \frac{r}{1 - v}\right)\right) - \frac{9}{2} \]
                                          9. Step-by-step derivation
                                            1. Applied rewrites97.1%

                                              \[\leadsto \left(\color{blue}{3} - \left(\mathsf{fma}\left(-0.25, v, 0.375\right) \cdot w\right) \cdot \left(\left(w \cdot r\right) \cdot \frac{r}{1 - v}\right)\right) - 4.5 \]
                                          10. Recombined 2 regimes into one program.
                                          11. Add Preprocessing

                                          Alternative 13: 91.9% accurate, 1.4× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ \mathbf{if}\;w \cdot w \leq 5 \cdot 10^{+43}:\\ \;\;\;\;t\_0 + \mathsf{fma}\left(-0.25 \cdot r, \left(w \cdot w\right) \cdot r, -1.5\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w, w, t\_0 - 1.5\right)\\ \end{array} \end{array} \]
                                          (FPCore (v w r)
                                           :precision binary64
                                           (let* ((t_0 (/ 2.0 (* r r))))
                                             (if (<= (* w w) 5e+43)
                                               (+ t_0 (fma (* -0.25 r) (* (* w w) r) -1.5))
                                               (fma (* (* -0.375 (* r r)) w) w (- t_0 1.5)))))
                                          double code(double v, double w, double r) {
                                          	double t_0 = 2.0 / (r * r);
                                          	double tmp;
                                          	if ((w * w) <= 5e+43) {
                                          		tmp = t_0 + fma((-0.25 * r), ((w * w) * r), -1.5);
                                          	} else {
                                          		tmp = fma(((-0.375 * (r * r)) * w), w, (t_0 - 1.5));
                                          	}
                                          	return tmp;
                                          }
                                          
                                          function code(v, w, r)
                                          	t_0 = Float64(2.0 / Float64(r * r))
                                          	tmp = 0.0
                                          	if (Float64(w * w) <= 5e+43)
                                          		tmp = Float64(t_0 + fma(Float64(-0.25 * r), Float64(Float64(w * w) * r), -1.5));
                                          	else
                                          		tmp = fma(Float64(Float64(-0.375 * Float64(r * r)) * w), w, Float64(t_0 - 1.5));
                                          	end
                                          	return tmp
                                          end
                                          
                                          code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(w * w), $MachinePrecision], 5e+43], N[(t$95$0 + N[(N[(-0.25 * r), $MachinePrecision] * N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] + -1.5), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-0.375 * N[(r * r), $MachinePrecision]), $MachinePrecision] * w), $MachinePrecision] * w + N[(t$95$0 - 1.5), $MachinePrecision]), $MachinePrecision]]]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          t_0 := \frac{2}{r \cdot r}\\
                                          \mathbf{if}\;w \cdot w \leq 5 \cdot 10^{+43}:\\
                                          \;\;\;\;t\_0 + \mathsf{fma}\left(-0.25 \cdot r, \left(w \cdot w\right) \cdot r, -1.5\right)\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;\mathsf{fma}\left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w, w, t\_0 - 1.5\right)\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if (*.f64 w w) < 5.0000000000000004e43

                                            1. Initial program 90.5%

                                              \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                                            2. Add Preprocessing
                                            3. Step-by-step derivation
                                              1. lift--.f64N/A

                                                \[\leadsto \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - \frac{9}{2}} \]
                                              2. lift--.f64N/A

                                                \[\leadsto \color{blue}{\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right)} - \frac{9}{2} \]
                                              3. associate--l-N/A

                                                \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)} \]
                                              4. lift-+.f64N/A

                                                \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right)} - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right) \]
                                              5. +-commutativeN/A

                                                \[\leadsto \color{blue}{\left(\frac{2}{r \cdot r} + 3\right)} - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right) \]
                                              6. associate--l+N/A

                                                \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(3 - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)\right)} \]
                                              7. lower-+.f64N/A

                                                \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(3 - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)\right)} \]
                                              8. lower--.f64N/A

                                                \[\leadsto \frac{2}{r \cdot r} + \color{blue}{\left(3 - \left(\frac{\left(\frac{1}{8} \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v} + \frac{9}{2}\right)\right)} \]
                                            4. Applied rewrites99.7%

                                              \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\frac{{\left(w \cdot r\right)}^{2}}{1 - v}, \mathsf{fma}\left(-2, v, 3\right) \cdot 0.125, 4.5\right)\right)} \]
                                            5. Taylor expanded in v around inf

                                              \[\leadsto \frac{2}{r \cdot r} + \color{blue}{-1 \cdot \left(\frac{3}{2} + \frac{1}{4} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)} \]
                                            6. Step-by-step derivation
                                              1. +-commutativeN/A

                                                \[\leadsto \frac{2}{r \cdot r} + -1 \cdot \color{blue}{\left(\frac{1}{4} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \frac{3}{2}\right)} \]
                                              2. distribute-lft-inN/A

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

                                                \[\leadsto \frac{2}{r \cdot r} + \left(\color{blue}{\left(-1 \cdot \frac{1}{4}\right) \cdot \left({r}^{2} \cdot {w}^{2}\right)} + -1 \cdot \frac{3}{2}\right) \]
                                              4. metadata-evalN/A

                                                \[\leadsto \frac{2}{r \cdot r} + \left(\color{blue}{\frac{-1}{4}} \cdot \left({r}^{2} \cdot {w}^{2}\right) + -1 \cdot \frac{3}{2}\right) \]
                                              5. associate-*r*N/A

                                                \[\leadsto \frac{2}{r \cdot r} + \left(\color{blue}{\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot {w}^{2}} + -1 \cdot \frac{3}{2}\right) \]
                                              6. unpow2N/A

                                                \[\leadsto \frac{2}{r \cdot r} + \left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot \color{blue}{\left(w \cdot w\right)} + -1 \cdot \frac{3}{2}\right) \]
                                              7. associate-*r*N/A

                                                \[\leadsto \frac{2}{r \cdot r} + \left(\color{blue}{\left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w\right) \cdot w} + -1 \cdot \frac{3}{2}\right) \]
                                              8. metadata-evalN/A

                                                \[\leadsto \frac{2}{r \cdot r} + \left(\left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w\right) \cdot w + \color{blue}{\frac{-3}{2}}\right) \]
                                              9. lower-fma.f64N/A

                                                \[\leadsto \frac{2}{r \cdot r} + \color{blue}{\mathsf{fma}\left(\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w, w, \frac{-3}{2}\right)} \]
                                              10. lower-*.f64N/A

                                                \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\color{blue}{\left(\frac{-1}{4} \cdot {r}^{2}\right) \cdot w}, w, \frac{-3}{2}\right) \]
                                              11. unpow2N/A

                                                \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\left(\frac{-1}{4} \cdot \color{blue}{\left(r \cdot r\right)}\right) \cdot w, w, \frac{-3}{2}\right) \]
                                              12. associate-*r*N/A

                                                \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\color{blue}{\left(\left(\frac{-1}{4} \cdot r\right) \cdot r\right)} \cdot w, w, \frac{-3}{2}\right) \]
                                              13. lower-*.f64N/A

                                                \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\color{blue}{\left(\left(\frac{-1}{4} \cdot r\right) \cdot r\right)} \cdot w, w, \frac{-3}{2}\right) \]
                                              14. lower-*.f6480.2

                                                \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\left(\color{blue}{\left(-0.25 \cdot r\right)} \cdot r\right) \cdot w, w, -1.5\right) \]
                                            7. Applied rewrites80.2%

                                              \[\leadsto \frac{2}{r \cdot r} + \color{blue}{\mathsf{fma}\left(\left(\left(-0.25 \cdot r\right) \cdot r\right) \cdot w, w, -1.5\right)} \]
                                            8. Step-by-step derivation
                                              1. Applied rewrites88.4%

                                                \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(-0.25 \cdot r, \color{blue}{\left(w \cdot w\right) \cdot r}, -1.5\right) \]

                                              if 5.0000000000000004e43 < (*.f64 w w)

                                              1. Initial program 73.2%

                                                \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                                              2. Add Preprocessing
                                              3. Taylor expanded in v around 0

                                                \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)} \]
                                              4. Step-by-step derivation
                                                1. sub-negN/A

                                                  \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} + \left(\mathsf{neg}\left(\left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right)\right)} \]
                                                2. +-commutativeN/A

                                                  \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right)\right) + 2 \cdot \frac{1}{{r}^{2}}} \]
                                                3. +-commutativeN/A

                                                  \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \frac{3}{2}\right)}\right)\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                                                4. distribute-neg-inN/A

                                                  \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right) + \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right)} + 2 \cdot \frac{1}{{r}^{2}} \]
                                                5. distribute-lft-neg-inN/A

                                                  \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right)} + \left(\mathsf{neg}\left(\frac{3}{2}\right)\right)\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                                                6. metadata-evalN/A

                                                  \[\leadsto \left(\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right) + \color{blue}{\frac{-3}{2}}\right) + 2 \cdot \frac{1}{{r}^{2}} \]
                                                7. associate-+l+N/A

                                                  \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right) + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right)} \]
                                                8. metadata-evalN/A

                                                  \[\leadsto \color{blue}{\frac{-3}{8}} \cdot \left({r}^{2} \cdot {w}^{2}\right) + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                                                9. *-commutativeN/A

                                                  \[\leadsto \frac{-3}{8} \cdot \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                                                10. associate-*r*N/A

                                                  \[\leadsto \color{blue}{\left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2}} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                                                11. +-commutativeN/A

                                                  \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} + \frac{-3}{2}\right)} \]
                                                12. metadata-evalN/A

                                                  \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \left(2 \cdot \frac{1}{{r}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{3}{2}\right)\right)}\right) \]
                                                13. sub-negN/A

                                                  \[\leadsto \left(\frac{-3}{8} \cdot {w}^{2}\right) \cdot {r}^{2} + \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
                                                14. lower-fma.f64N/A

                                                  \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-3}{8} \cdot {w}^{2}, {r}^{2}, 2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}\right)} \]
                                              5. Applied rewrites73.1%

                                                \[\leadsto \color{blue}{\mathsf{fma}\left(-0.375 \cdot \left(w \cdot w\right), r \cdot r, \frac{2}{r \cdot r} - 1.5\right)} \]
                                              6. Taylor expanded in w around 0

                                                \[\leadsto \left(\frac{-3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right) + 2 \cdot \frac{1}{{r}^{2}}\right) - \color{blue}{\frac{3}{2}} \]
                                              7. Step-by-step derivation
                                                1. Applied rewrites96.4%

                                                  \[\leadsto \mathsf{fma}\left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w, \color{blue}{w}, \frac{2}{r \cdot r} - 1.5\right) \]
                                              8. Recombined 2 regimes into one program.
                                              9. Add Preprocessing

                                              Alternative 14: 57.0% accurate, 3.7× speedup?

                                              \[\begin{array}{l} \\ \frac{2}{r \cdot r} - 1.5 \end{array} \]
                                              (FPCore (v w r) :precision binary64 (- (/ 2.0 (* r r)) 1.5))
                                              double code(double v, double w, double r) {
                                              	return (2.0 / (r * r)) - 1.5;
                                              }
                                              
                                              real(8) function code(v, w, r)
                                                  real(8), intent (in) :: v
                                                  real(8), intent (in) :: w
                                                  real(8), intent (in) :: r
                                                  code = (2.0d0 / (r * r)) - 1.5d0
                                              end function
                                              
                                              public static double code(double v, double w, double r) {
                                              	return (2.0 / (r * r)) - 1.5;
                                              }
                                              
                                              def code(v, w, r):
                                              	return (2.0 / (r * r)) - 1.5
                                              
                                              function code(v, w, r)
                                              	return Float64(Float64(2.0 / Float64(r * r)) - 1.5)
                                              end
                                              
                                              function tmp = code(v, w, r)
                                              	tmp = (2.0 / (r * r)) - 1.5;
                                              end
                                              
                                              code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]
                                              
                                              \begin{array}{l}
                                              
                                              \\
                                              \frac{2}{r \cdot r} - 1.5
                                              \end{array}
                                              
                                              Derivation
                                              1. Initial program 82.5%

                                                \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                                              2. Add Preprocessing
                                              3. Taylor expanded in w around 0

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

                                                  \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}} \]
                                                2. associate-*r/N/A

                                                  \[\leadsto \color{blue}{\frac{2 \cdot 1}{{r}^{2}}} - \frac{3}{2} \]
                                                3. metadata-evalN/A

                                                  \[\leadsto \frac{\color{blue}{2}}{{r}^{2}} - \frac{3}{2} \]
                                                4. lower-/.f64N/A

                                                  \[\leadsto \color{blue}{\frac{2}{{r}^{2}}} - \frac{3}{2} \]
                                                5. unpow2N/A

                                                  \[\leadsto \frac{2}{\color{blue}{r \cdot r}} - \frac{3}{2} \]
                                                6. lower-*.f6456.2

                                                  \[\leadsto \frac{2}{\color{blue}{r \cdot r}} - 1.5 \]
                                              5. Applied rewrites56.2%

                                                \[\leadsto \color{blue}{\frac{2}{r \cdot r} - 1.5} \]
                                              6. Add Preprocessing

                                              Alternative 15: 44.3% accurate, 4.3× speedup?

                                              \[\begin{array}{l} \\ \frac{2}{r \cdot r} \end{array} \]
                                              (FPCore (v w r) :precision binary64 (/ 2.0 (* r r)))
                                              double code(double v, double w, double r) {
                                              	return 2.0 / (r * r);
                                              }
                                              
                                              real(8) function code(v, w, r)
                                                  real(8), intent (in) :: v
                                                  real(8), intent (in) :: w
                                                  real(8), intent (in) :: r
                                                  code = 2.0d0 / (r * r)
                                              end function
                                              
                                              public static double code(double v, double w, double r) {
                                              	return 2.0 / (r * r);
                                              }
                                              
                                              def code(v, w, r):
                                              	return 2.0 / (r * r)
                                              
                                              function code(v, w, r)
                                              	return Float64(2.0 / Float64(r * r))
                                              end
                                              
                                              function tmp = code(v, w, r)
                                              	tmp = 2.0 / (r * r);
                                              end
                                              
                                              code[v_, w_, r_] := N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]
                                              
                                              \begin{array}{l}
                                              
                                              \\
                                              \frac{2}{r \cdot r}
                                              \end{array}
                                              
                                              Derivation
                                              1. Initial program 82.5%

                                                \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                                              2. Add Preprocessing
                                              3. Taylor expanded in r around 0

                                                \[\leadsto \color{blue}{\frac{2}{{r}^{2}}} \]
                                              4. Step-by-step derivation
                                                1. lower-/.f64N/A

                                                  \[\leadsto \color{blue}{\frac{2}{{r}^{2}}} \]
                                                2. unpow2N/A

                                                  \[\leadsto \frac{2}{\color{blue}{r \cdot r}} \]
                                                3. lower-*.f6443.6

                                                  \[\leadsto \frac{2}{\color{blue}{r \cdot r}} \]
                                              5. Applied rewrites43.6%

                                                \[\leadsto \color{blue}{\frac{2}{r \cdot r}} \]
                                              6. Add Preprocessing

                                              Reproduce

                                              ?
                                              herbie shell --seed 2024322 
                                              (FPCore (v w r)
                                                :name "Rosa's TurbineBenchmark"
                                                :precision binary64
                                                (- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))