Rosa's TurbineBenchmark

Percentage Accurate: 84.5% → 97.7%
Time: 13.3s
Alternatives: 14
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 14 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.5% 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: 97.7% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ t_1 := \mathsf{fma}\left(w \cdot -0.25, r \cdot \left(r \cdot w\right), t\_0 + -1.5\right)\\ \mathbf{if}\;v \leq -2.05 \cdot 10^{+29}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;v \leq 0.2:\\ \;\;\;\;t\_0 - \mathsf{fma}\left(r \cdot w, r \cdot \left(w \cdot 0.375\right), 1.5\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (v w r)
 :precision binary64
 (let* ((t_0 (/ 2.0 (* r r)))
        (t_1 (fma (* w -0.25) (* r (* r w)) (+ t_0 -1.5))))
   (if (<= v -2.05e+29)
     t_1
     (if (<= v 0.2) (- t_0 (fma (* r w) (* r (* w 0.375)) 1.5)) t_1))))
double code(double v, double w, double r) {
	double t_0 = 2.0 / (r * r);
	double t_1 = fma((w * -0.25), (r * (r * w)), (t_0 + -1.5));
	double tmp;
	if (v <= -2.05e+29) {
		tmp = t_1;
	} else if (v <= 0.2) {
		tmp = t_0 - fma((r * w), (r * (w * 0.375)), 1.5);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(v, w, r)
	t_0 = Float64(2.0 / Float64(r * r))
	t_1 = fma(Float64(w * -0.25), Float64(r * Float64(r * w)), Float64(t_0 + -1.5))
	tmp = 0.0
	if (v <= -2.05e+29)
		tmp = t_1;
	elseif (v <= 0.2)
		tmp = Float64(t_0 - fma(Float64(r * w), Float64(r * Float64(w * 0.375)), 1.5));
	else
		tmp = t_1;
	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[(w * -0.25), $MachinePrecision] * N[(r * N[(r * w), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 + -1.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, -2.05e+29], t$95$1, If[LessEqual[v, 0.2], N[(t$95$0 - N[(N[(r * w), $MachinePrecision] * N[(r * N[(w * 0.375), $MachinePrecision]), $MachinePrecision] + 1.5), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \mathsf{fma}\left(w \cdot -0.25, r \cdot \left(r \cdot w\right), t\_0 + -1.5\right)\\
\mathbf{if}\;v \leq -2.05 \cdot 10^{+29}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;v \leq 0.2:\\
\;\;\;\;t\_0 - \mathsf{fma}\left(r \cdot w, r \cdot \left(w \cdot 0.375\right), 1.5\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if v < -2.0500000000000002e29 or 0.20000000000000001 < v

    1. Initial program 79.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 rewrites89.6%

      \[\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 rewrites99.0%

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

      if -2.0500000000000002e29 < v < 0.20000000000000001

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{2}{r \cdot r} - \left(\color{blue}{{w}^{2} \cdot \left(\frac{3}{8} \cdot {r}^{2}\right)} + \frac{3}{2}\right) \]
        10. 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)} \]
        11. unpow2N/A

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

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

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

          \[\leadsto \frac{2}{r \cdot r} - \mathsf{fma}\left(w \cdot w, \frac{3}{8} \cdot \color{blue}{\left(r \cdot r\right)}, \frac{3}{2}\right) \]
        15. lower-*.f6476.5

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

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

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

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

        Alternative 2: 91.3% 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(r \cdot \left(w \cdot w\right)\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^{+22}:\\ \;\;\;\;t\_0 - \left(w \cdot w\right) \cdot \left(\left(r \cdot r\right) \cdot 0.375\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 (* r (* w w)))) (+ v -1.0)))))
           (if (<= t_1 (- INFINITY))
             (+ -1.5 (fma (* w (* (* r r) -0.25)) w t_0))
             (if (<= t_1 -1e+22) (- t_0 (* (* w w) (* (* r r) 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 * (r * (w * w)))) / (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+22) {
        		tmp = t_0 - ((w * w) * ((r * r) * 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(r * Float64(w * w)))) / 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+22)
        		tmp = Float64(t_0 - Float64(Float64(w * w) * Float64(Float64(r * r) * 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[(r * N[(w * w), $MachinePrecision]), $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+22], N[(t$95$0 - N[(N[(w * w), $MachinePrecision] * N[(N[(r * r), $MachinePrecision] * 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(r \cdot \left(w \cdot w\right)\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^{+22}:\\
        \;\;\;\;t\_0 - \left(w \cdot w\right) \cdot \left(\left(r \cdot r\right) \cdot 0.375\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 79.4%

            \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
          2. Add Preprocessing
          3. Taylor expanded in v around 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 rewrites96.8%

            \[\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))) < -1e22

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{2}{r \cdot r} - \left(\color{blue}{{w}^{2} \cdot \left(\frac{3}{8} \cdot {r}^{2}\right)} + \frac{3}{2}\right) \]
            10. 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)} \]
            11. unpow2N/A

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

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

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

              \[\leadsto \frac{2}{r \cdot r} - \mathsf{fma}\left(w \cdot w, \frac{3}{8} \cdot \color{blue}{\left(r \cdot r\right)}, \frac{3}{2}\right) \]
            15. lower-*.f6458.0

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

            \[\leadsto \color{blue}{\frac{2}{r \cdot r} - \mathsf{fma}\left(w \cdot w, 0.375 \cdot \left(r \cdot r\right), 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 rewrites58.0%

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

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

            1. Initial program 81.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 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-*.f6495.1

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

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

            \[\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(r \cdot \left(w \cdot w\right)\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(r \cdot \left(w \cdot w\right)\right)\right)}{v + -1} \leq -1 \cdot 10^{+22}:\\ \;\;\;\;\frac{2}{r \cdot r} - \left(w \cdot w\right) \cdot \left(\left(r \cdot r\right) \cdot 0.375\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{r \cdot r} + -1.5\\ \end{array} \]
          10. Add Preprocessing

          Alternative 3: 89.6% 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(r \cdot \left(w \cdot w\right)\right)\right)}{v + -1}\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(w \cdot \left(\left(r \cdot r\right) \cdot -0.25\right), w, -1.5\right)\\ \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+22}:\\ \;\;\;\;t\_0 - \left(w \cdot w\right) \cdot \left(\left(r \cdot r\right) \cdot 0.375\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 (* r (* w w)))) (+ v -1.0)))))
             (if (<= t_1 (- INFINITY))
               (fma (* w (* (* r r) -0.25)) w -1.5)
               (if (<= t_1 -1e+22) (- t_0 (* (* w w) (* (* r r) 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 * (r * (w * w)))) / (v + -1.0));
          	double tmp;
          	if (t_1 <= -((double) INFINITY)) {
          		tmp = fma((w * ((r * r) * -0.25)), w, -1.5);
          	} else if (t_1 <= -1e+22) {
          		tmp = t_0 - ((w * w) * ((r * r) * 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(r * Float64(w * w)))) / Float64(v + -1.0)))
          	tmp = 0.0
          	if (t_1 <= Float64(-Inf))
          		tmp = fma(Float64(w * Float64(Float64(r * r) * -0.25)), w, -1.5);
          	elseif (t_1 <= -1e+22)
          		tmp = Float64(t_0 - Float64(Float64(w * w) * Float64(Float64(r * r) * 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[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(w * N[(N[(r * r), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision] * w + -1.5), $MachinePrecision], If[LessEqual[t$95$1, -1e+22], N[(t$95$0 - N[(N[(w * w), $MachinePrecision] * N[(N[(r * r), $MachinePrecision] * 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(r \cdot \left(w \cdot w\right)\right)\right)}{v + -1}\\
          \mathbf{if}\;t\_1 \leq -\infty:\\
          \;\;\;\;\mathsf{fma}\left(w \cdot \left(\left(r \cdot r\right) \cdot -0.25\right), w, -1.5\right)\\
          
          \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+22}:\\
          \;\;\;\;t\_0 - \left(w \cdot w\right) \cdot \left(\left(r \cdot r\right) \cdot 0.375\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 79.4%

              \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
            2. Add Preprocessing
            3. Taylor expanded in v around 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 rewrites96.8%

              \[\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 w around inf

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

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

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

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

                    \[\leadsto \mathsf{fma}\left(w \cdot \left(\left(r \cdot r\right) \cdot -0.25\right), w, -1.5\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))) < -1e22

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

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{2}{r \cdot r} - \left(\color{blue}{{w}^{2} \cdot \left(\frac{3}{8} \cdot {r}^{2}\right)} + \frac{3}{2}\right) \]
                    10. 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)} \]
                    11. unpow2N/A

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

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

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

                      \[\leadsto \frac{2}{r \cdot r} - \mathsf{fma}\left(w \cdot w, \frac{3}{8} \cdot \color{blue}{\left(r \cdot r\right)}, \frac{3}{2}\right) \]
                    15. lower-*.f6458.0

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

                    \[\leadsto \color{blue}{\frac{2}{r \cdot r} - \mathsf{fma}\left(w \cdot w, 0.375 \cdot \left(r \cdot r\right), 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 rewrites58.0%

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

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

                    1. Initial program 81.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 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-*.f6495.1

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

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

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

                  Alternative 4: 89.6% 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(r \cdot \left(w \cdot w\right)\right)\right)}{v + -1}\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(w \cdot \left(\left(r \cdot r\right) \cdot -0.25\right), w, -1.5\right)\\ \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+22}:\\ \;\;\;\;\left(r \cdot r\right) \cdot \left(\left(w \cdot w\right) \cdot -0.375\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 (* r (* w w)))) (+ v -1.0)))))
                     (if (<= t_1 (- INFINITY))
                       (fma (* w (* (* r r) -0.25)) w -1.5)
                       (if (<= t_1 -1e+22) (* (* r r) (* (* w 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 * (r * (w * w)))) / (v + -1.0));
                  	double tmp;
                  	if (t_1 <= -((double) INFINITY)) {
                  		tmp = fma((w * ((r * r) * -0.25)), w, -1.5);
                  	} else if (t_1 <= -1e+22) {
                  		tmp = (r * r) * ((w * 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(r * Float64(w * w)))) / Float64(v + -1.0)))
                  	tmp = 0.0
                  	if (t_1 <= Float64(-Inf))
                  		tmp = fma(Float64(w * Float64(Float64(r * r) * -0.25)), w, -1.5);
                  	elseif (t_1 <= -1e+22)
                  		tmp = Float64(Float64(r * r) * Float64(Float64(w * 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[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(w * N[(N[(r * r), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision] * w + -1.5), $MachinePrecision], If[LessEqual[t$95$1, -1e+22], N[(N[(r * r), $MachinePrecision] * N[(N[(w * w), $MachinePrecision] * -0.375), $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(r \cdot \left(w \cdot w\right)\right)\right)}{v + -1}\\
                  \mathbf{if}\;t\_1 \leq -\infty:\\
                  \;\;\;\;\mathsf{fma}\left(w \cdot \left(\left(r \cdot r\right) \cdot -0.25\right), w, -1.5\right)\\
                  
                  \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+22}:\\
                  \;\;\;\;\left(r \cdot r\right) \cdot \left(\left(w \cdot w\right) \cdot -0.375\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 79.4%

                      \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                    2. Add Preprocessing
                    3. Taylor expanded in v around 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 rewrites96.8%

                      \[\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 w around inf

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(w \cdot \left(\left(r \cdot r\right) \cdot -0.25\right), w, -1.5\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))) < -1e22

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

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

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

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

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

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

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

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

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

                              \[\leadsto \frac{2}{r \cdot r} - \left(\color{blue}{{w}^{2} \cdot \left(\frac{3}{8} \cdot {r}^{2}\right)} + \frac{3}{2}\right) \]
                            10. 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)} \]
                            11. unpow2N/A

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

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

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

                              \[\leadsto \frac{2}{r \cdot r} - \mathsf{fma}\left(w \cdot w, \frac{3}{8} \cdot \color{blue}{\left(r \cdot r\right)}, \frac{3}{2}\right) \]
                            15. lower-*.f6458.0

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

                            \[\leadsto \color{blue}{\frac{2}{r \cdot r} - \mathsf{fma}\left(w \cdot w, 0.375 \cdot \left(r \cdot r\right), 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 rewrites57.8%

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

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

                            1. Initial program 81.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 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-*.f6495.1

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

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

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

                          Alternative 5: 88.7% 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(r \cdot \left(w \cdot w\right)\right)\right)}{v + -1}\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;\left(r \cdot r\right) \cdot \left(-0.25 \cdot \left(w \cdot w\right)\right)\\ \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+22}:\\ \;\;\;\;\left(r \cdot r\right) \cdot \left(\left(w \cdot w\right) \cdot -0.375\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 (* r (* w w)))) (+ v -1.0)))))
                             (if (<= t_1 (- INFINITY))
                               (* (* r r) (* -0.25 (* w w)))
                               (if (<= t_1 -1e+22) (* (* r r) (* (* w 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 * (r * (w * w)))) / (v + -1.0));
                          	double tmp;
                          	if (t_1 <= -((double) INFINITY)) {
                          		tmp = (r * r) * (-0.25 * (w * w));
                          	} else if (t_1 <= -1e+22) {
                          		tmp = (r * r) * ((w * w) * -0.375);
                          	} else {
                          		tmp = t_0 + -1.5;
                          	}
                          	return tmp;
                          }
                          
                          public static 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 * (r * (w * w)))) / (v + -1.0));
                          	double tmp;
                          	if (t_1 <= -Double.POSITIVE_INFINITY) {
                          		tmp = (r * r) * (-0.25 * (w * w));
                          	} else if (t_1 <= -1e+22) {
                          		tmp = (r * r) * ((w * w) * -0.375);
                          	} else {
                          		tmp = t_0 + -1.5;
                          	}
                          	return tmp;
                          }
                          
                          def code(v, w, r):
                          	t_0 = 2.0 / (r * r)
                          	t_1 = (3.0 + t_0) + (((0.125 * (3.0 - (2.0 * v))) * (r * (r * (w * w)))) / (v + -1.0))
                          	tmp = 0
                          	if t_1 <= -math.inf:
                          		tmp = (r * r) * (-0.25 * (w * w))
                          	elif t_1 <= -1e+22:
                          		tmp = (r * r) * ((w * 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(r * Float64(w * w)))) / Float64(v + -1.0)))
                          	tmp = 0.0
                          	if (t_1 <= Float64(-Inf))
                          		tmp = Float64(Float64(r * r) * Float64(-0.25 * Float64(w * w)));
                          	elseif (t_1 <= -1e+22)
                          		tmp = Float64(Float64(r * r) * Float64(Float64(w * w) * -0.375));
                          	else
                          		tmp = Float64(t_0 + -1.5);
                          	end
                          	return tmp
                          end
                          
                          function tmp_2 = code(v, w, r)
                          	t_0 = 2.0 / (r * r);
                          	t_1 = (3.0 + t_0) + (((0.125 * (3.0 - (2.0 * v))) * (r * (r * (w * w)))) / (v + -1.0));
                          	tmp = 0.0;
                          	if (t_1 <= -Inf)
                          		tmp = (r * r) * (-0.25 * (w * w));
                          	elseif (t_1 <= -1e+22)
                          		tmp = (r * r) * ((w * w) * -0.375);
                          	else
                          		tmp = t_0 + -1.5;
                          	end
                          	tmp_2 = tmp;
                          end
                          
                          code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, 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[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(r * r), $MachinePrecision] * N[(-0.25 * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -1e+22], N[(N[(r * r), $MachinePrecision] * N[(N[(w * w), $MachinePrecision] * -0.375), $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(r \cdot \left(w \cdot w\right)\right)\right)}{v + -1}\\
                          \mathbf{if}\;t\_1 \leq -\infty:\\
                          \;\;\;\;\left(r \cdot r\right) \cdot \left(-0.25 \cdot \left(w \cdot w\right)\right)\\
                          
                          \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+22}:\\
                          \;\;\;\;\left(r \cdot r\right) \cdot \left(\left(w \cdot w\right) \cdot -0.375\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 79.4%

                              \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                            2. Add Preprocessing
                            3. Taylor expanded in v around 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 rewrites96.8%

                              \[\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.3%

                                \[\leadsto \left(r \cdot r\right) \cdot \color{blue}{\left(-0.25 \cdot \left(w \cdot w\right)\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))) < -1e22

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \frac{2}{r \cdot r} - \left(\color{blue}{{w}^{2} \cdot \left(\frac{3}{8} \cdot {r}^{2}\right)} + \frac{3}{2}\right) \]
                                10. 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)} \]
                                11. unpow2N/A

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

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

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

                                  \[\leadsto \frac{2}{r \cdot r} - \mathsf{fma}\left(w \cdot w, \frac{3}{8} \cdot \color{blue}{\left(r \cdot r\right)}, \frac{3}{2}\right) \]
                                15. lower-*.f6458.0

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

                                \[\leadsto \color{blue}{\frac{2}{r \cdot r} - \mathsf{fma}\left(w \cdot w, 0.375 \cdot \left(r \cdot r\right), 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 rewrites57.8%

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

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

                                1. Initial program 81.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 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-*.f6495.1

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

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

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

                              Alternative 6: 94.6% accurate, 0.6× speedup?

                              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ \mathbf{if}\;\left(3 + t\_0\right) + \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)}{v + -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{else}:\\ \;\;\;\;t\_0 - \mathsf{fma}\left(r \cdot w, r \cdot \left(w \cdot 0.375\right), 1.5\right)\\ \end{array} \end{array} \]
                              (FPCore (v w r)
                               :precision binary64
                               (let* ((t_0 (/ 2.0 (* r r))))
                                 (if (<=
                                      (+
                                       (+ 3.0 t_0)
                                       (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* r (* r (* w w)))) (+ v -1.0)))
                                      (- INFINITY))
                                   (+ -1.5 (fma (* w (* (* r r) -0.25)) w t_0))
                                   (- t_0 (fma (* r w) (* r (* w 0.375)) 1.5)))))
                              double code(double v, double w, double r) {
                              	double t_0 = 2.0 / (r * r);
                              	double tmp;
                              	if (((3.0 + t_0) + (((0.125 * (3.0 - (2.0 * v))) * (r * (r * (w * w)))) / (v + -1.0))) <= -((double) INFINITY)) {
                              		tmp = -1.5 + fma((w * ((r * r) * -0.25)), w, t_0);
                              	} else {
                              		tmp = t_0 - fma((r * w), (r * (w * 0.375)), 1.5);
                              	}
                              	return tmp;
                              }
                              
                              function code(v, w, r)
                              	t_0 = Float64(2.0 / Float64(r * r))
                              	tmp = 0.0
                              	if (Float64(Float64(3.0 + t_0) + Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(r * Float64(r * Float64(w * w)))) / Float64(v + -1.0))) <= Float64(-Inf))
                              		tmp = Float64(-1.5 + fma(Float64(w * Float64(Float64(r * r) * -0.25)), w, t_0));
                              	else
                              		tmp = Float64(t_0 - fma(Float64(r * w), Float64(r * Float64(w * 0.375)), 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[(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[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(-1.5 + N[(N[(w * N[(N[(r * r), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision] * w + t$95$0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - N[(N[(r * w), $MachinePrecision] * N[(r * N[(w * 0.375), $MachinePrecision]), $MachinePrecision] + 1.5), $MachinePrecision]), $MachinePrecision]]]
                              
                              \begin{array}{l}
                              
                              \\
                              \begin{array}{l}
                              t_0 := \frac{2}{r \cdot r}\\
                              \mathbf{if}\;\left(3 + t\_0\right) + \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)}{v + -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{else}:\\
                              \;\;\;\;t\_0 - \mathsf{fma}\left(r \cdot w, r \cdot \left(w \cdot 0.375\right), 1.5\right)\\
                              
                              
                              \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

                                1. Initial program 79.4%

                                  \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                                2. Add Preprocessing
                                3. Taylor expanded in v around 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 rewrites96.8%

                                  \[\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)))

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

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

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

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

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

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

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

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

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

                                    \[\leadsto \frac{2}{r \cdot r} - \left(\color{blue}{{w}^{2} \cdot \left(\frac{3}{8} \cdot {r}^{2}\right)} + \frac{3}{2}\right) \]
                                  10. 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)} \]
                                  11. unpow2N/A

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

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

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

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

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

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

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

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

                                    \[\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(r \cdot \left(w \cdot w\right)\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{else}:\\ \;\;\;\;\frac{2}{r \cdot r} - \mathsf{fma}\left(r \cdot w, r \cdot \left(w \cdot 0.375\right), 1.5\right)\\ \end{array} \]
                                  5. Add Preprocessing

                                  Alternative 7: 87.0% accurate, 0.8× speedup?

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

                                    1. Initial program 83.8%

                                      \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                                    2. Add Preprocessing
                                    3. Taylor expanded in v around 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 rewrites82.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. 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 rewrites75.6%

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

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

                                      1. Initial program 81.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 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-*.f6495.1

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

                                        \[\leadsto \color{blue}{-1.5 + \frac{2}{r \cdot r}} \]
                                    8. Recombined 2 regimes into one program.
                                    9. Final simplification87.0%

                                      \[\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(r \cdot \left(w \cdot w\right)\right)\right)}{v + -1} \leq -1 \cdot 10^{+22}:\\ \;\;\;\;\left(r \cdot r\right) \cdot \left(-0.25 \cdot \left(w \cdot w\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{r \cdot r} + -1.5\\ \end{array} \]
                                    10. Add Preprocessing

                                    Alternative 8: 96.7% accurate, 1.1× speedup?

                                    \[\begin{array}{l} \\ \left(3 + \frac{2}{r \cdot r}\right) - \mathsf{fma}\left(w, \frac{r \cdot \left(r \cdot w\right)}{1 - v} \cdot \mathsf{fma}\left(v, -0.25, 0.375\right), 4.5\right) \end{array} \]
                                    (FPCore (v w r)
                                     :precision binary64
                                     (-
                                      (+ 3.0 (/ 2.0 (* r r)))
                                      (fma w (* (/ (* r (* r w)) (- 1.0 v)) (fma v -0.25 0.375)) 4.5)))
                                    double code(double v, double w, double r) {
                                    	return (3.0 + (2.0 / (r * r))) - fma(w, (((r * (r * w)) / (1.0 - v)) * fma(v, -0.25, 0.375)), 4.5);
                                    }
                                    
                                    function code(v, w, r)
                                    	return Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - fma(w, Float64(Float64(Float64(r * Float64(r * w)) / Float64(1.0 - v)) * fma(v, -0.25, 0.375)), 4.5))
                                    end
                                    
                                    code[v_, w_, r_] := N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(w * N[(N[(N[(r * N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(v * -0.25 + 0.375), $MachinePrecision]), $MachinePrecision] + 4.5), $MachinePrecision]), $MachinePrecision]
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    \left(3 + \frac{2}{r \cdot r}\right) - \mathsf{fma}\left(w, \frac{r \cdot \left(r \cdot w\right)}{1 - v} \cdot \mathsf{fma}\left(v, -0.25, 0.375\right), 4.5\right)
                                    \end{array}
                                    
                                    Derivation
                                    1. Initial program 82.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. 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 rewrites96.5%

                                      \[\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. Step-by-step derivation
                                      1. lift-fma.f64N/A

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

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

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

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

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

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

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

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

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

                                    Alternative 9: 95.0% accurate, 1.3× speedup?

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

                                      1. Initial program 81.9%

                                        \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                                      2. Add Preprocessing
                                      3. 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 rewrites87.4%

                                        \[\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.0%

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

                                        if 8 < r

                                        1. Initial program 83.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.7%

                                          \[\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.7%

                                            \[\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. Add Preprocessing

                                        Alternative 10: 88.1% accurate, 1.4× speedup?

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

                                          1. Initial program 92.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-*.f6488.2

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

                                            \[\leadsto \color{blue}{-1.5 + \frac{2}{r \cdot r}} \]
                                          6. Step-by-step derivation
                                            1. Applied rewrites88.2%

                                              \[\leadsto -1.5 + \frac{\frac{2}{r}}{\color{blue}{r}} \]

                                            if 5.00000000000000021e-216 < (*.f64 w w)

                                            1. Initial program 76.4%

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

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

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

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

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

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

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

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

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

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

                                                \[\leadsto \frac{2}{r \cdot r} - \left(\color{blue}{{w}^{2} \cdot \left(\frac{3}{8} \cdot {r}^{2}\right)} + \frac{3}{2}\right) \]
                                              10. 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)} \]
                                              11. unpow2N/A

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

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

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

                                                \[\leadsto \frac{2}{r \cdot r} - \mathsf{fma}\left(w \cdot w, \frac{3}{8} \cdot \color{blue}{\left(r \cdot r\right)}, \frac{3}{2}\right) \]
                                              15. lower-*.f6473.5

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

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

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

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

                                                  \[\leadsto \frac{2}{r \cdot r} - w \cdot \color{blue}{\left(w \cdot \left(\left(r \cdot r\right) \cdot 0.375\right)\right)} \]
                                              4. Recombined 2 regimes into one program.
                                              5. Add Preprocessing

                                              Alternative 11: 87.2% accurate, 1.6× speedup?

                                              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ \mathbf{if}\;w \leq 1.22 \cdot 10^{+21}:\\ \;\;\;\;t\_0 + \mathsf{fma}\left(r \cdot \left(r \cdot \left(w \cdot w\right)\right), -0.375, -1.5\right)\\ \mathbf{else}:\\ \;\;\;\;-1.5 + \mathsf{fma}\left(w \cdot \left(\left(r \cdot r\right) \cdot -0.25\right), w, t\_0\right)\\ \end{array} \end{array} \]
                                              (FPCore (v w r)
                                               :precision binary64
                                               (let* ((t_0 (/ 2.0 (* r r))))
                                                 (if (<= w 1.22e+21)
                                                   (+ t_0 (fma (* r (* r (* w w))) -0.375 -1.5))
                                                   (+ -1.5 (fma (* w (* (* r r) -0.25)) w t_0)))))
                                              double code(double v, double w, double r) {
                                              	double t_0 = 2.0 / (r * r);
                                              	double tmp;
                                              	if (w <= 1.22e+21) {
                                              		tmp = t_0 + fma((r * (r * (w * w))), -0.375, -1.5);
                                              	} else {
                                              		tmp = -1.5 + fma((w * ((r * 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 (w <= 1.22e+21)
                                              		tmp = Float64(t_0 + fma(Float64(r * Float64(r * Float64(w * w))), -0.375, -1.5));
                                              	else
                                              		tmp = Float64(-1.5 + fma(Float64(w * Float64(Float64(r * 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[w, 1.22e+21], N[(t$95$0 + N[(N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.375 + -1.5), $MachinePrecision]), $MachinePrecision], N[(-1.5 + N[(N[(w * N[(N[(r * r), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision] * w + t$95$0), $MachinePrecision]), $MachinePrecision]]]
                                              
                                              \begin{array}{l}
                                              
                                              \\
                                              \begin{array}{l}
                                              t_0 := \frac{2}{r \cdot r}\\
                                              \mathbf{if}\;w \leq 1.22 \cdot 10^{+21}:\\
                                              \;\;\;\;t\_0 + \mathsf{fma}\left(r \cdot \left(r \cdot \left(w \cdot w\right)\right), -0.375, -1.5\right)\\
                                              
                                              \mathbf{else}:\\
                                              \;\;\;\;-1.5 + \mathsf{fma}\left(w \cdot \left(\left(r \cdot r\right) \cdot -0.25\right), w, t\_0\right)\\
                                              
                                              
                                              \end{array}
                                              \end{array}
                                              
                                              Derivation
                                              1. Split input into 2 regimes
                                              2. if w < 1.22e21

                                                1. Initial program 85.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}{\left(\frac{-1}{8} \cdot \left(v \cdot \left(-2 \cdot \left({r}^{2} \cdot {w}^{2}\right) - -3 \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)\right) + 2 \cdot \frac{1}{{r}^{2}}\right) - \left(\frac{3}{2} + \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)} \]
                                                4. Step-by-step derivation
                                                  1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

                                                  \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(r \cdot \left(r \cdot \left(w \cdot w\right)\right), \frac{-3}{8}, \frac{-3}{2}\right) \]
                                                7. Step-by-step derivation
                                                  1. Applied rewrites82.9%

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

                                                  if 1.22e21 < w

                                                  1. Initial program 69.5%

                                                    \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                                                  2. Add Preprocessing
                                                  3. Taylor expanded in v around 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 rewrites94.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)} \]
                                                8. Recombined 2 regimes into one program.
                                                9. Final simplification85.1%

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

                                                Alternative 12: 50.2% accurate, 3.2× speedup?

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

                                                  1. Initial program 81.9%

                                                    \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
                                                  2. Add Preprocessing
                                                  3. 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-*.f6457.3

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

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

                                                  if 1.15999999999999992 < r

                                                  1. Initial program 83.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 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-*.f6429.3

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

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

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

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

                                                  Alternative 13: 57.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 82.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 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-*.f6458.6

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

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

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

                                                  Alternative 14: 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 82.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 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-*.f6458.6

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

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

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

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

                                                    Reproduce

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