Rosa's TurbineBenchmark

Percentage Accurate: 84.6% → 99.1%
Time: 12.4s
Alternatives: 12
Speedup: 1.6×

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

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

Initial Program: 84.6% 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.1% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ \mathbf{if}\;w \cdot w \leq 5 \cdot 10^{+300}:\\ \;\;\;\;\left(3 + t\_0\right) - \mathsf{fma}\left(0.125 \cdot \mathsf{fma}\left(v, -2, 3\right), \left(w \cdot \left(w \cdot r\right)\right) \cdot \frac{r}{1 - v}, 4.5\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(w \cdot \left(\left(r \cdot r\right) \cdot -0.375\right), 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+300)
     (-
      (+ 3.0 t_0)
      (fma (* 0.125 (fma v -2.0 3.0)) (* (* w (* w r)) (/ r (- 1.0 v))) 4.5))
     (fma (* w (* (* r r) -0.375)) 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+300) {
		tmp = (3.0 + t_0) - fma((0.125 * fma(v, -2.0, 3.0)), ((w * (w * r)) * (r / (1.0 - v))), 4.5);
	} else {
		tmp = fma((w * ((r * r) * -0.375)), 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+300)
		tmp = Float64(Float64(3.0 + t_0) - fma(Float64(0.125 * fma(v, -2.0, 3.0)), Float64(Float64(w * Float64(w * r)) * Float64(r / Float64(1.0 - v))), 4.5));
	else
		tmp = fma(Float64(w * Float64(Float64(r * r) * -0.375)), 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+300], N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(0.125 * N[(v * -2.0 + 3.0), $MachinePrecision]), $MachinePrecision] * N[(N[(w * N[(w * r), $MachinePrecision]), $MachinePrecision] * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 4.5), $MachinePrecision]), $MachinePrecision], N[(N[(w * N[(N[(r * r), $MachinePrecision] * -0.375), $MachinePrecision]), $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^{+300}:\\
\;\;\;\;\left(3 + t\_0\right) - \mathsf{fma}\left(0.125 \cdot \mathsf{fma}\left(v, -2, 3\right), \left(w \cdot \left(w \cdot r\right)\right) \cdot \frac{r}{1 - v}, 4.5\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(w \cdot \left(\left(r \cdot r\right) \cdot -0.375\right), w, t\_0 + -1.5\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 w w) < 5.00000000000000026e300

    1. Initial program 93.7%

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

        \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\color{blue}{\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. lift-*.f64N/A

        \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\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} + \frac{9}{2}\right) \]
      7. associate-/l*N/A

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

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

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

    if 5.00000000000000026e300 < (*.f64 w w)

    1. Initial program 59.3%

      \[\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. lower-+.f64N/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)} \]
      3. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{2 \cdot 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) \]
      4. metadata-evalN/A

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

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

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

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

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

        \[\leadsto \frac{2}{r \cdot r} + \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)} \]
      10. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

    Alternative 2: 94.8% accurate, 0.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := r \cdot \left(\left(w \cdot w\right) \cdot r\right)\\ 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 t\_0}{v + -1}\\ t_3 := -1.5 + \mathsf{fma}\left(r \cdot \left(w \cdot \left(r \cdot -0.25\right)\right), w, t\_1\right)\\ \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_2 \leq -1 \cdot 10^{+98}:\\ \;\;\;\;\frac{t\_0 \cdot \mathsf{fma}\left(v, 0.25, -0.375\right)}{1 - v}\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
    (FPCore (v w r)
     :precision binary64
     (let* ((t_0 (* r (* (* w w) r)))
            (t_1 (/ 2.0 (* r r)))
            (t_2
             (+ (+ 3.0 t_1) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) t_0) (+ v -1.0))))
            (t_3 (+ -1.5 (fma (* r (* w (* r -0.25))) w t_1))))
       (if (<= t_2 (- INFINITY))
         t_3
         (if (<= t_2 -1e+98) (/ (* t_0 (fma v 0.25 -0.375)) (- 1.0 v)) t_3))))
    double code(double v, double w, double r) {
    	double t_0 = r * ((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) / (v + -1.0));
    	double t_3 = -1.5 + fma((r * (w * (r * -0.25))), w, t_1);
    	double tmp;
    	if (t_2 <= -((double) INFINITY)) {
    		tmp = t_3;
    	} else if (t_2 <= -1e+98) {
    		tmp = (t_0 * fma(v, 0.25, -0.375)) / (1.0 - v);
    	} else {
    		tmp = t_3;
    	}
    	return tmp;
    }
    
    function code(v, w, r)
    	t_0 = Float64(r * 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))) * t_0) / Float64(v + -1.0)))
    	t_3 = Float64(-1.5 + fma(Float64(r * Float64(w * Float64(r * -0.25))), w, t_1))
    	tmp = 0.0
    	if (t_2 <= Float64(-Inf))
    		tmp = t_3;
    	elseif (t_2 <= -1e+98)
    		tmp = Float64(Float64(t_0 * fma(v, 0.25, -0.375)) / Float64(1.0 - v));
    	else
    		tmp = t_3;
    	end
    	return tmp
    end
    
    code[v_, w_, r_] := Block[{t$95$0 = N[(r * N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision]), $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] * t$95$0), $MachinePrecision] / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(-1.5 + N[(N[(r * N[(w * N[(r * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * w + t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$3, If[LessEqual[t$95$2, -1e+98], N[(N[(t$95$0 * N[(v * 0.25 + -0.375), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := r \cdot \left(\left(w \cdot w\right) \cdot r\right)\\
    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 t\_0}{v + -1}\\
    t_3 := -1.5 + \mathsf{fma}\left(r \cdot \left(w \cdot \left(r \cdot -0.25\right)\right), w, t\_1\right)\\
    \mathbf{if}\;t\_2 \leq -\infty:\\
    \;\;\;\;t\_3\\
    
    \mathbf{elif}\;t\_2 \leq -1 \cdot 10^{+98}:\\
    \;\;\;\;\frac{t\_0 \cdot \mathsf{fma}\left(v, 0.25, -0.375\right)}{1 - v}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_3\\
    
    
    \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))) < -inf.0 or -9.99999999999999998e97 < (-.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 85.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. 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. distribute-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        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))) < -9.99999999999999998e97

        1. Initial program 99.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 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-*.f641.4

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

          \[\leadsto \color{blue}{\frac{2}{r \cdot r}} \]
        6. Taylor expanded in r around inf

          \[\leadsto \color{blue}{\frac{-1}{8} \cdot \frac{{r}^{2} \cdot \left({w}^{2} \cdot \left(3 - 2 \cdot v\right)\right)}{1 - v}} \]
        7. Step-by-step derivation
          1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\left(\frac{-1}{8} \cdot \left(r \cdot r\right)\right) \cdot \left(w \cdot \color{blue}{\left(w \cdot \left(3 - 2 \cdot v\right)\right)}\right)}{1 - v} \]
          12. cancel-sign-sub-invN/A

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

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

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

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

            \[\leadsto \frac{\left(\frac{-1}{8} \cdot \left(r \cdot r\right)\right) \cdot \left(w \cdot \left(w \cdot \color{blue}{\mathsf{fma}\left(v, -2, 3\right)}\right)\right)}{1 - v} \]
          17. lower--.f6471.7

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

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

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

            \[\leadsto \frac{\left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right) \cdot \mathsf{fma}\left(v, 0.25, -0.375\right)}{\color{blue}{1} - v} \]
        11. Recombined 2 regimes into one program.
        12. Final simplification97.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(r \cdot \left(\left(w \cdot w\right) \cdot r\right)\right)}{v + -1} \leq -\infty:\\ \;\;\;\;-1.5 + \mathsf{fma}\left(r \cdot \left(w \cdot \left(r \cdot -0.25\right)\right), w, \frac{2}{r \cdot r}\right)\\ \mathbf{elif}\;\left(3 + \frac{2}{r \cdot r}\right) + \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot r\right)\right)}{v + -1} \leq -1 \cdot 10^{+98}:\\ \;\;\;\;\frac{\left(r \cdot \left(\left(w \cdot w\right) \cdot r\right)\right) \cdot \mathsf{fma}\left(v, 0.25, -0.375\right)}{1 - v}\\ \mathbf{else}:\\ \;\;\;\;-1.5 + \mathsf{fma}\left(r \cdot \left(w \cdot \left(r \cdot -0.25\right)\right), w, \frac{2}{r \cdot r}\right)\\ \end{array} \]
        13. Add Preprocessing

        Alternative 3: 92.1% accurate, 0.4× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ t_1 := \left(3 + t\_0\right) + \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot r\right)\right)}{v + -1}\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;-1.5 + \mathsf{fma}\left(w \cdot \left(\left(r \cdot r\right) \cdot -0.25\right), w, t\_0\right)\\ \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+37}:\\ \;\;\;\;\left(w \cdot r\right) \cdot \left(r \cdot \left(w \cdot -0.375\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0 + -1.5\\ \end{array} \end{array} \]
        (FPCore (v w r)
         :precision binary64
         (let* ((t_0 (/ 2.0 (* r r)))
                (t_1
                 (+
                  (+ 3.0 t_0)
                  (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* r (* (* w w) r))) (+ v -1.0)))))
           (if (<= t_1 (- INFINITY))
             (+ -1.5 (fma (* w (* (* r r) -0.25)) w t_0))
             (if (<= t_1 -1e+37) (* (* w r) (* r (* w -0.375))) (+ t_0 -1.5)))))
        double code(double v, double w, double r) {
        	double t_0 = 2.0 / (r * r);
        	double t_1 = (3.0 + t_0) + (((0.125 * (3.0 - (2.0 * v))) * (r * ((w * w) * r))) / (v + -1.0));
        	double tmp;
        	if (t_1 <= -((double) INFINITY)) {
        		tmp = -1.5 + fma((w * ((r * r) * -0.25)), w, t_0);
        	} else if (t_1 <= -1e+37) {
        		tmp = (w * r) * (r * (w * -0.375));
        	} else {
        		tmp = t_0 + -1.5;
        	}
        	return tmp;
        }
        
        function code(v, w, r)
        	t_0 = Float64(2.0 / Float64(r * r))
        	t_1 = Float64(Float64(3.0 + t_0) + Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(r * Float64(Float64(w * w) * r))) / Float64(v + -1.0)))
        	tmp = 0.0
        	if (t_1 <= Float64(-Inf))
        		tmp = Float64(-1.5 + fma(Float64(w * Float64(Float64(r * r) * -0.25)), w, t_0));
        	elseif (t_1 <= -1e+37)
        		tmp = Float64(Float64(w * r) * Float64(r * Float64(w * -0.375)));
        	else
        		tmp = 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]}, Block[{t$95$1 = N[(N[(3.0 + t$95$0), $MachinePrecision] + N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(r * N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(-1.5 + N[(N[(w * N[(N[(r * r), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision] * w + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -1e+37], N[(N[(w * r), $MachinePrecision] * N[(r * N[(w * -0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + -1.5), $MachinePrecision]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \frac{2}{r \cdot r}\\
        t_1 := \left(3 + t\_0\right) + \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot r\right)\right)}{v + -1}\\
        \mathbf{if}\;t\_1 \leq -\infty:\\
        \;\;\;\;-1.5 + \mathsf{fma}\left(w \cdot \left(\left(r \cdot r\right) \cdot -0.25\right), w, t\_0\right)\\
        
        \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+37}:\\
        \;\;\;\;\left(w \cdot r\right) \cdot \left(r \cdot \left(w \cdot -0.375\right)\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0 + -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 78.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 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. distribute-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          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))) < -9.99999999999999954e36

          1. Initial program 99.3%

            \[\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. lower-+.f64N/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)} \]
            3. associate-*r/N/A

              \[\leadsto \color{blue}{\frac{2 \cdot 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) \]
            4. metadata-evalN/A

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

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

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

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

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

              \[\leadsto \frac{2}{r \cdot r} + \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)} \]
            10. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

              if -9.99999999999999954e36 < (-.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 88.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. sub-negN/A

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

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

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

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

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

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

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

                  \[\leadsto \frac{-3}{2} + \frac{2}{\color{blue}{r \cdot r}} \]
                9. lower-*.f6497.9

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

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

              \[\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(r \cdot \left(\left(w \cdot w\right) \cdot r\right)\right)}{v + -1} \leq -\infty:\\ \;\;\;\;-1.5 + \mathsf{fma}\left(w \cdot \left(\left(r \cdot r\right) \cdot -0.25\right), w, \frac{2}{r \cdot r}\right)\\ \mathbf{elif}\;\left(3 + \frac{2}{r \cdot r}\right) + \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot r\right)\right)}{v + -1} \leq -1 \cdot 10^{+37}:\\ \;\;\;\;\left(w \cdot r\right) \cdot \left(r \cdot \left(w \cdot -0.375\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{r \cdot r} + -1.5\\ \end{array} \]
            5. Add Preprocessing

            Alternative 4: 90.8% 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(r \cdot t\_0\right)}{v + -1}\\ \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;r \cdot \left(-0.25 \cdot t\_0\right)\\ \mathbf{elif}\;t\_2 \leq -1 \cdot 10^{+37}:\\ \;\;\;\;\left(w \cdot r\right) \cdot \left(r \cdot \left(w \cdot -0.375\right)\right)\\ \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))) (* r t_0)) (+ v -1.0)))))
               (if (<= t_2 (- INFINITY))
                 (* r (* -0.25 t_0))
                 (if (<= t_2 -1e+37) (* (* w r) (* r (* w -0.375))) (+ 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))) * (r * t_0)) / (v + -1.0));
            	double tmp;
            	if (t_2 <= -((double) INFINITY)) {
            		tmp = r * (-0.25 * t_0);
            	} else if (t_2 <= -1e+37) {
            		tmp = (w * r) * (r * (w * -0.375));
            	} 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))) * (r * t_0)) / (v + -1.0));
            	double tmp;
            	if (t_2 <= -Double.POSITIVE_INFINITY) {
            		tmp = r * (-0.25 * t_0);
            	} else if (t_2 <= -1e+37) {
            		tmp = (w * r) * (r * (w * -0.375));
            	} 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))) * (r * t_0)) / (v + -1.0))
            	tmp = 0
            	if t_2 <= -math.inf:
            		tmp = r * (-0.25 * t_0)
            	elif t_2 <= -1e+37:
            		tmp = (w * r) * (r * (w * -0.375))
            	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(r * t_0)) / Float64(v + -1.0)))
            	tmp = 0.0
            	if (t_2 <= Float64(-Inf))
            		tmp = Float64(r * Float64(-0.25 * t_0));
            	elseif (t_2 <= -1e+37)
            		tmp = Float64(Float64(w * r) * Float64(r * Float64(w * -0.375)));
            	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))) * (r * t_0)) / (v + -1.0));
            	tmp = 0.0;
            	if (t_2 <= -Inf)
            		tmp = r * (-0.25 * t_0);
            	elseif (t_2 <= -1e+37)
            		tmp = (w * r) * (r * (w * -0.375));
            	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[(r * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(r * N[(-0.25 * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -1e+37], N[(N[(w * r), $MachinePrecision] * N[(r * N[(w * -0.375), $MachinePrecision]), $MachinePrecision]), $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(r \cdot t\_0\right)}{v + -1}\\
            \mathbf{if}\;t\_2 \leq -\infty:\\
            \;\;\;\;r \cdot \left(-0.25 \cdot t\_0\right)\\
            
            \mathbf{elif}\;t\_2 \leq -1 \cdot 10^{+37}:\\
            \;\;\;\;\left(w \cdot r\right) \cdot \left(r \cdot \left(w \cdot -0.375\right)\right)\\
            
            \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 78.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 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. distribute-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                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))) < -9.99999999999999954e36

                1. Initial program 99.3%

                  \[\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. lower-+.f64N/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)} \]
                  3. associate-*r/N/A

                    \[\leadsto \color{blue}{\frac{2 \cdot 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) \]
                  4. metadata-evalN/A

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

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

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

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

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

                    \[\leadsto \frac{2}{r \cdot r} + \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)} \]
                  10. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

                    if -9.99999999999999954e36 < (-.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 88.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. sub-negN/A

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

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

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

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

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

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

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

                        \[\leadsto \frac{-3}{2} + \frac{2}{\color{blue}{r \cdot r}} \]
                      9. lower-*.f6497.9

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

                      \[\leadsto \color{blue}{-1.5 + \frac{2}{r \cdot r}} \]
                  3. Recombined 3 regimes into one program.
                  4. Final simplification93.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(r \cdot \left(\left(w \cdot w\right) \cdot r\right)\right)}{v + -1} \leq -\infty:\\ \;\;\;\;r \cdot \left(-0.25 \cdot \left(\left(w \cdot w\right) \cdot r\right)\right)\\ \mathbf{elif}\;\left(3 + \frac{2}{r \cdot r}\right) + \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot r\right)\right)}{v + -1} \leq -1 \cdot 10^{+37}:\\ \;\;\;\;\left(w \cdot r\right) \cdot \left(r \cdot \left(w \cdot -0.375\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{r \cdot r} + -1.5\\ \end{array} \]
                  5. Add Preprocessing

                  Alternative 5: 90.8% 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(r \cdot t\_0\right)}{v + -1}\\ \mathbf{if}\;t\_2 \leq -\infty:\\ \;\;\;\;r \cdot \left(-0.25 \cdot t\_0\right)\\ \mathbf{elif}\;t\_2 \leq -1 \cdot 10^{+37}:\\ \;\;\;\;r \cdot \left(w \cdot \left(r \cdot \left(w \cdot -0.375\right)\right)\right)\\ \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))) (* r t_0)) (+ v -1.0)))))
                     (if (<= t_2 (- INFINITY))
                       (* r (* -0.25 t_0))
                       (if (<= t_2 -1e+37) (* r (* w (* r (* w -0.375)))) (+ 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))) * (r * t_0)) / (v + -1.0));
                  	double tmp;
                  	if (t_2 <= -((double) INFINITY)) {
                  		tmp = r * (-0.25 * t_0);
                  	} else if (t_2 <= -1e+37) {
                  		tmp = r * (w * (r * (w * -0.375)));
                  	} 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))) * (r * t_0)) / (v + -1.0));
                  	double tmp;
                  	if (t_2 <= -Double.POSITIVE_INFINITY) {
                  		tmp = r * (-0.25 * t_0);
                  	} else if (t_2 <= -1e+37) {
                  		tmp = r * (w * (r * (w * -0.375)));
                  	} 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))) * (r * t_0)) / (v + -1.0))
                  	tmp = 0
                  	if t_2 <= -math.inf:
                  		tmp = r * (-0.25 * t_0)
                  	elif t_2 <= -1e+37:
                  		tmp = r * (w * (r * (w * -0.375)))
                  	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(r * t_0)) / Float64(v + -1.0)))
                  	tmp = 0.0
                  	if (t_2 <= Float64(-Inf))
                  		tmp = Float64(r * Float64(-0.25 * t_0));
                  	elseif (t_2 <= -1e+37)
                  		tmp = Float64(r * Float64(w * Float64(r * Float64(w * -0.375))));
                  	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))) * (r * t_0)) / (v + -1.0));
                  	tmp = 0.0;
                  	if (t_2 <= -Inf)
                  		tmp = r * (-0.25 * t_0);
                  	elseif (t_2 <= -1e+37)
                  		tmp = r * (w * (r * (w * -0.375)));
                  	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[(r * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(r * N[(-0.25 * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -1e+37], N[(r * N[(w * N[(r * N[(w * -0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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(r \cdot t\_0\right)}{v + -1}\\
                  \mathbf{if}\;t\_2 \leq -\infty:\\
                  \;\;\;\;r \cdot \left(-0.25 \cdot t\_0\right)\\
                  
                  \mathbf{elif}\;t\_2 \leq -1 \cdot 10^{+37}:\\
                  \;\;\;\;r \cdot \left(w \cdot \left(r \cdot \left(w \cdot -0.375\right)\right)\right)\\
                  
                  \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 78.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 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. distribute-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      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))) < -9.99999999999999954e36

                      1. Initial program 99.3%

                        \[\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. lower-+.f64N/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)} \]
                        3. associate-*r/N/A

                          \[\leadsto \color{blue}{\frac{2 \cdot 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) \]
                        4. metadata-evalN/A

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

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

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

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

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

                          \[\leadsto \frac{2}{r \cdot r} + \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)} \]
                        10. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

                          if -9.99999999999999954e36 < (-.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 88.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. sub-negN/A

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

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

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

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

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

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

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

                              \[\leadsto \frac{-3}{2} + \frac{2}{\color{blue}{r \cdot r}} \]
                            9. lower-*.f6497.9

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

                            \[\leadsto \color{blue}{-1.5 + \frac{2}{r \cdot r}} \]
                        3. Recombined 3 regimes into one program.
                        4. Final simplification93.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(r \cdot \left(\left(w \cdot w\right) \cdot r\right)\right)}{v + -1} \leq -\infty:\\ \;\;\;\;r \cdot \left(-0.25 \cdot \left(\left(w \cdot w\right) \cdot r\right)\right)\\ \mathbf{elif}\;\left(3 + \frac{2}{r \cdot r}\right) + \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot r\right)\right)}{v + -1} \leq -1 \cdot 10^{+37}:\\ \;\;\;\;r \cdot \left(w \cdot \left(r \cdot \left(w \cdot -0.375\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{r \cdot r} + -1.5\\ \end{array} \]
                        5. Add Preprocessing

                        Alternative 6: 88.6% 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(r \cdot t\_0\right)}{v + -1} \leq -1 \cdot 10^{+37}:\\ \;\;\;\;r \cdot \left(-0.25 \cdot t\_0\right)\\ \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))) (* r t_0)) (+ v -1.0)))
                                -1e+37)
                             (* r (* -0.25 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))) * (r * t_0)) / (v + -1.0))) <= -1e+37) {
                        		tmp = r * (-0.25 * 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))) * (r * t_0)) / (v + (-1.0d0)))) <= (-1d+37)) then
                                tmp = r * ((-0.25d0) * 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))) * (r * t_0)) / (v + -1.0))) <= -1e+37) {
                        		tmp = r * (-0.25 * 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))) * (r * t_0)) / (v + -1.0))) <= -1e+37:
                        		tmp = r * (-0.25 * 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(r * t_0)) / Float64(v + -1.0))) <= -1e+37)
                        		tmp = Float64(r * Float64(-0.25 * 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))) * (r * t_0)) / (v + -1.0))) <= -1e+37)
                        		tmp = r * (-0.25 * 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[(r * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1e+37], N[(r * N[(-0.25 * t$95$0), $MachinePrecision]), $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(r \cdot t\_0\right)}{v + -1} \leq -1 \cdot 10^{+37}:\\
                        \;\;\;\;r \cdot \left(-0.25 \cdot t\_0\right)\\
                        
                        \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))) < -9.99999999999999954e36

                          1. Initial program 82.7%

                            \[\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. distribute-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            if -9.99999999999999954e36 < (-.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 88.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. sub-negN/A

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

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

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

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

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

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

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

                                \[\leadsto \frac{-3}{2} + \frac{2}{\color{blue}{r \cdot r}} \]
                              9. lower-*.f6497.9

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

                              \[\leadsto \color{blue}{-1.5 + \frac{2}{r \cdot r}} \]
                          8. Recombined 2 regimes into one program.
                          9. Final simplification90.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(r \cdot \left(\left(w \cdot w\right) \cdot r\right)\right)}{v + -1} \leq -1 \cdot 10^{+37}:\\ \;\;\;\;r \cdot \left(-0.25 \cdot \left(\left(w \cdot w\right) \cdot r\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{r \cdot r} + -1.5\\ \end{array} \]
                          10. Add Preprocessing

                          Alternative 7: 92.3% accurate, 1.3× speedup?

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

                            1. Initial program 84.3%

                              \[\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. lower-+.f64N/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)} \]
                              3. associate-*r/N/A

                                \[\leadsto \color{blue}{\frac{2 \cdot 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) \]
                              4. metadata-evalN/A

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

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

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

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

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

                                \[\leadsto \frac{2}{r \cdot r} + \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)} \]
                              10. associate-*r*N/A

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

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

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

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

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

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

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

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

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

                              if 4600 < r

                              1. Initial program 93.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. lower--.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. lift-/.f64N/A

                                  \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\color{blue}{\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. lift-*.f64N/A

                                  \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\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} + \frac{9}{2}\right) \]
                                7. associate-/l*N/A

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

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

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

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

                                  \[\leadsto \color{blue}{3} - \mathsf{fma}\left(0.125 \cdot \mathsf{fma}\left(v, -2, 3\right), \left(w \cdot \left(r \cdot w\right)\right) \cdot \frac{r}{1 - v}, 4.5\right) \]
                              7. Recombined 2 regimes into one program.
                              8. Final simplification92.5%

                                \[\leadsto \begin{array}{l} \mathbf{if}\;r \leq 4600:\\ \;\;\;\;\mathsf{fma}\left(w \cdot \left(\left(r \cdot r\right) \cdot -0.375\right), w, \frac{2}{r \cdot r} + -1.5\right)\\ \mathbf{else}:\\ \;\;\;\;3 - \mathsf{fma}\left(0.125 \cdot \mathsf{fma}\left(v, -2, 3\right), \left(w \cdot \left(w \cdot r\right)\right) \cdot \frac{r}{1 - v}, 4.5\right)\\ \end{array} \]
                              9. Add Preprocessing

                              Alternative 8: 95.5% accurate, 1.6× speedup?

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

                                1. Initial program 88.7%

                                  \[\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. lower-+.f64N/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)} \]
                                  3. associate-*r/N/A

                                    \[\leadsto \color{blue}{\frac{2 \cdot 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) \]
                                  4. metadata-evalN/A

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

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

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

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

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

                                    \[\leadsto \frac{2}{r \cdot r} + \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)} \]
                                  10. associate-*r*N/A

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

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

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

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

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

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

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

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

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

                                  if 1 < v

                                  1. Initial program 79.6%

                                    \[\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. distribute-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto -1.5 + \mathsf{fma}\left(\left(w \cdot \left(r \cdot -0.25\right)\right) \cdot r, w, \frac{2}{r \cdot r}\right) \]
                                  7. Recombined 2 regimes into one program.
                                  8. Final simplification96.4%

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

                                  Alternative 9: 91.3% accurate, 1.6× speedup?

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

                                    1. Initial program 87.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 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. distribute-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      if 0.52000000000000002 < w

                                      1. Initial program 82.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. lower-+.f64N/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)} \]
                                        3. associate-*r/N/A

                                          \[\leadsto \color{blue}{\frac{2 \cdot 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) \]
                                        4. metadata-evalN/A

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

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

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

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

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

                                          \[\leadsto \frac{2}{r \cdot r} + \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)} \]
                                        10. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

                                            \[\leadsto \frac{2}{r \cdot r} + \left(\left(r \cdot r\right) \cdot w\right) \cdot \left(w \cdot \color{blue}{-0.375}\right) \]
                                        3. Recombined 2 regimes into one program.
                                        4. Final simplification93.7%

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

                                        Alternative 10: 51.2% accurate, 3.2× speedup?

                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;r \leq 1.15:\\ \;\;\;\;\frac{2}{r \cdot r}\\ \mathbf{else}:\\ \;\;\;\;-1.5\\ \end{array} \end{array} \]
                                        (FPCore (v w r) :precision binary64 (if (<= r 1.15) (/ 2.0 (* r r)) -1.5))
                                        double code(double v, double w, double r) {
                                        	double tmp;
                                        	if (r <= 1.15) {
                                        		tmp = 2.0 / (r * r);
                                        	} else {
                                        		tmp = -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) :: tmp
                                            if (r <= 1.15d0) then
                                                tmp = 2.0d0 / (r * r)
                                            else
                                                tmp = -1.5d0
                                            end if
                                            code = tmp
                                        end function
                                        
                                        public static double code(double v, double w, double r) {
                                        	double tmp;
                                        	if (r <= 1.15) {
                                        		tmp = 2.0 / (r * r);
                                        	} else {
                                        		tmp = -1.5;
                                        	}
                                        	return tmp;
                                        }
                                        
                                        def code(v, w, r):
                                        	tmp = 0
                                        	if r <= 1.15:
                                        		tmp = 2.0 / (r * r)
                                        	else:
                                        		tmp = -1.5
                                        	return tmp
                                        
                                        function code(v, w, r)
                                        	tmp = 0.0
                                        	if (r <= 1.15)
                                        		tmp = Float64(2.0 / Float64(r * r));
                                        	else
                                        		tmp = -1.5;
                                        	end
                                        	return tmp
                                        end
                                        
                                        function tmp_2 = code(v, w, r)
                                        	tmp = 0.0;
                                        	if (r <= 1.15)
                                        		tmp = 2.0 / (r * r);
                                        	else
                                        		tmp = -1.5;
                                        	end
                                        	tmp_2 = tmp;
                                        end
                                        
                                        code[v_, w_, r_] := If[LessEqual[r, 1.15], N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision], -1.5]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \begin{array}{l}
                                        \mathbf{if}\;r \leq 1.15:\\
                                        \;\;\;\;\frac{2}{r \cdot r}\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;-1.5\\
                                        
                                        
                                        \end{array}
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 2 regimes
                                        2. if r < 1.1499999999999999

                                          1. Initial program 84.3%

                                            \[\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-*.f6464.5

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

                                            \[\leadsto \color{blue}{\frac{2}{r \cdot r}} \]

                                          if 1.1499999999999999 < r

                                          1. Initial program 93.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 r around 0

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

                                              \[\leadsto \color{blue}{\frac{2 + \frac{-3}{2} \cdot {r}^{2}}{{r}^{2}}} \]
                                            2. +-commutativeN/A

                                              \[\leadsto \frac{\color{blue}{\frac{-3}{2} \cdot {r}^{2} + 2}}{{r}^{2}} \]
                                            3. *-commutativeN/A

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

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

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

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

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

                                              \[\leadsto \frac{\mathsf{fma}\left(r, r \cdot \frac{-3}{2}, 2\right)}{\color{blue}{r \cdot r}} \]
                                            9. lower-*.f6417.6

                                              \[\leadsto \frac{\mathsf{fma}\left(r, r \cdot -1.5, 2\right)}{\color{blue}{r \cdot r}} \]
                                          5. Applied rewrites17.6%

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

                                            \[\leadsto \frac{-3}{2} \]
                                          7. Step-by-step derivation
                                            1. Applied rewrites21.2%

                                              \[\leadsto -1.5 \]
                                          8. Recombined 2 regimes into one program.
                                          9. Add Preprocessing

                                          Alternative 11: 58.1% 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 86.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 w around 0

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

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

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

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

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

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

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

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

                                              \[\leadsto \frac{-3}{2} + \frac{2}{\color{blue}{r \cdot r}} \]
                                            9. lower-*.f6462.9

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

                                            \[\leadsto \color{blue}{-1.5 + \frac{2}{r \cdot r}} \]
                                          6. Final simplification62.9%

                                            \[\leadsto \frac{2}{r \cdot r} + -1.5 \]
                                          7. Add Preprocessing

                                          Alternative 12: 14.0% accurate, 73.0× speedup?

                                          \[\begin{array}{l} \\ -1.5 \end{array} \]
                                          (FPCore (v w r) :precision binary64 -1.5)
                                          double code(double v, double w, double r) {
                                          	return -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 = -1.5d0
                                          end function
                                          
                                          public static double code(double v, double w, double r) {
                                          	return -1.5;
                                          }
                                          
                                          def code(v, w, r):
                                          	return -1.5
                                          
                                          function code(v, w, r)
                                          	return -1.5
                                          end
                                          
                                          function tmp = code(v, w, r)
                                          	tmp = -1.5;
                                          end
                                          
                                          code[v_, w_, r_] := -1.5
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          -1.5
                                          \end{array}
                                          
                                          Derivation
                                          1. Initial program 86.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 r around 0

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

                                              \[\leadsto \color{blue}{\frac{2 + \frac{-3}{2} \cdot {r}^{2}}{{r}^{2}}} \]
                                            2. +-commutativeN/A

                                              \[\leadsto \frac{\color{blue}{\frac{-3}{2} \cdot {r}^{2} + 2}}{{r}^{2}} \]
                                            3. *-commutativeN/A

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

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

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

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

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

                                              \[\leadsto \frac{\mathsf{fma}\left(r, r \cdot \frac{-3}{2}, 2\right)}{\color{blue}{r \cdot r}} \]
                                            9. lower-*.f6459.1

                                              \[\leadsto \frac{\mathsf{fma}\left(r, r \cdot -1.5, 2\right)}{\color{blue}{r \cdot r}} \]
                                          5. Applied rewrites59.1%

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

                                            \[\leadsto \frac{-3}{2} \]
                                          7. Step-by-step derivation
                                            1. Applied rewrites12.2%

                                              \[\leadsto -1.5 \]
                                            2. Add Preprocessing

                                            Reproduce

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