Rosa's TurbineBenchmark

Percentage Accurate: 84.2% → 99.7%
Time: 10.1s
Alternatives: 12
Speedup: 1.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 84.2% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 93.7% accurate, 0.4× speedup?

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

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

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

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


\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 80.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\left(r \cdot r\right) \cdot -0.25\right) \cdot w, w, \frac{2}{r \cdot r} - 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))) < -5e64

    1. Initial program 93.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -5e64 < (-.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.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. Step-by-step derivation
          1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{2}{r \cdot r} + \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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\left(r \cdot w\right) \cdot \left(-0.25 \cdot r\right), w, -1.5\right) \]
        9. Recombined 3 regimes into one program.
        10. Final simplification95.3%

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

        Alternative 3: 92.7% accurate, 0.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(\left(\left(r \cdot r\right) \cdot -0.25\right) \cdot w, w, \frac{2}{r \cdot r} - 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))) < -5e5

          1. Initial program 95.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 inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              if -5e5 < (-.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.0%

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

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

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

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

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

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

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

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

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

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

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

              1. Initial program 83.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 w around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \left(\left(\left(r \cdot r\right) \cdot -0.25\right) \cdot w\right) \cdot \color{blue}{w} \]
                2. Taylor expanded in v around 0

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

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

                  if -5e5 < (-.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.0%

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

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

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

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

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

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

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

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

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

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

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

                  1. Initial program 83.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 w around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      if -5e5 < (-.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.0%

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

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

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

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

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

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

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

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

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

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

                    Alternative 6: 99.0% accurate, 0.9× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ t_1 := \left(3 - \mathsf{fma}\left(\frac{w \cdot r}{1 - v} \cdot \left(w \cdot r\right), -0.25 \cdot v, 4.5\right)\right) + t\_0\\ \mathbf{if}\;v \leq -1.5:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;v \leq 3.3 \cdot 10^{-15}:\\ \;\;\;\;\left(\left(3 + t\_0\right) - \frac{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right) \cdot \left(3 \cdot 0.125\right)}{1 - v}\right) - 4.5\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                    (FPCore (v w r)
                     :precision binary64
                     (let* ((t_0 (/ 2.0 (* r r)))
                            (t_1
                             (+
                              (- 3.0 (fma (* (/ (* w r) (- 1.0 v)) (* w r)) (* -0.25 v) 4.5))
                              t_0)))
                       (if (<= v -1.5)
                         t_1
                         (if (<= v 3.3e-15)
                           (-
                            (- (+ 3.0 t_0) (/ (* (* (* w r) (* w r)) (* 3.0 0.125)) (- 1.0 v)))
                            4.5)
                           t_1))))
                    double code(double v, double w, double r) {
                    	double t_0 = 2.0 / (r * r);
                    	double t_1 = (3.0 - fma((((w * r) / (1.0 - v)) * (w * r)), (-0.25 * v), 4.5)) + t_0;
                    	double tmp;
                    	if (v <= -1.5) {
                    		tmp = t_1;
                    	} else if (v <= 3.3e-15) {
                    		tmp = ((3.0 + t_0) - ((((w * r) * (w * r)) * (3.0 * 0.125)) / (1.0 - v))) - 4.5;
                    	} else {
                    		tmp = t_1;
                    	}
                    	return tmp;
                    }
                    
                    function code(v, w, r)
                    	t_0 = Float64(2.0 / Float64(r * r))
                    	t_1 = Float64(Float64(3.0 - fma(Float64(Float64(Float64(w * r) / Float64(1.0 - v)) * Float64(w * r)), Float64(-0.25 * v), 4.5)) + t_0)
                    	tmp = 0.0
                    	if (v <= -1.5)
                    		tmp = t_1;
                    	elseif (v <= 3.3e-15)
                    		tmp = Float64(Float64(Float64(3.0 + t_0) - Float64(Float64(Float64(Float64(w * r) * Float64(w * r)) * Float64(3.0 * 0.125)) / Float64(1.0 - v))) - 4.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[(3.0 - N[(N[(N[(N[(w * r), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision] * N[(-0.25 * v), $MachinePrecision] + 4.5), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]}, If[LessEqual[v, -1.5], t$95$1, If[LessEqual[v, 3.3e-15], N[(N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(N[(N[(w * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision] * N[(3.0 * 0.125), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], t$95$1]]]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    t_0 := \frac{2}{r \cdot r}\\
                    t_1 := \left(3 - \mathsf{fma}\left(\frac{w \cdot r}{1 - v} \cdot \left(w \cdot r\right), -0.25 \cdot v, 4.5\right)\right) + t\_0\\
                    \mathbf{if}\;v \leq -1.5:\\
                    \;\;\;\;t\_1\\
                    
                    \mathbf{elif}\;v \leq 3.3 \cdot 10^{-15}:\\
                    \;\;\;\;\left(\left(3 + t\_0\right) - \frac{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right) \cdot \left(3 \cdot 0.125\right)}{1 - v}\right) - 4.5\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;t\_1\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if v < -1.5 or 3.3e-15 < 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. Step-by-step derivation
                        1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      if -1.5 < v < 3.3e-15

                      1. Initial program 85.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

                      Alternative 7: 97.7% accurate, 1.0× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ t_1 := \left(3 - \mathsf{fma}\left(\frac{w \cdot r}{1 - v} \cdot \left(w \cdot r\right), -0.25 \cdot v, 4.5\right)\right) + t\_0\\ \mathbf{if}\;v \leq -1.62:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;v \leq 3.3 \cdot 10^{-15}:\\ \;\;\;\;\left(\mathsf{fma}\left(\left(\left(w \cdot r\right) \cdot r\right) \cdot w, -0.125 \cdot v - 0.375, 3\right) + t\_0\right) - 4.5\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                      (FPCore (v w r)
                       :precision binary64
                       (let* ((t_0 (/ 2.0 (* r r)))
                              (t_1
                               (+
                                (- 3.0 (fma (* (/ (* w r) (- 1.0 v)) (* w r)) (* -0.25 v) 4.5))
                                t_0)))
                         (if (<= v -1.62)
                           t_1
                           (if (<= v 3.3e-15)
                             (- (+ (fma (* (* (* w r) r) w) (- (* -0.125 v) 0.375) 3.0) t_0) 4.5)
                             t_1))))
                      double code(double v, double w, double r) {
                      	double t_0 = 2.0 / (r * r);
                      	double t_1 = (3.0 - fma((((w * r) / (1.0 - v)) * (w * r)), (-0.25 * v), 4.5)) + t_0;
                      	double tmp;
                      	if (v <= -1.62) {
                      		tmp = t_1;
                      	} else if (v <= 3.3e-15) {
                      		tmp = (fma((((w * r) * r) * w), ((-0.125 * v) - 0.375), 3.0) + t_0) - 4.5;
                      	} else {
                      		tmp = t_1;
                      	}
                      	return tmp;
                      }
                      
                      function code(v, w, r)
                      	t_0 = Float64(2.0 / Float64(r * r))
                      	t_1 = Float64(Float64(3.0 - fma(Float64(Float64(Float64(w * r) / Float64(1.0 - v)) * Float64(w * r)), Float64(-0.25 * v), 4.5)) + t_0)
                      	tmp = 0.0
                      	if (v <= -1.62)
                      		tmp = t_1;
                      	elseif (v <= 3.3e-15)
                      		tmp = Float64(Float64(fma(Float64(Float64(Float64(w * r) * r) * w), Float64(Float64(-0.125 * v) - 0.375), 3.0) + t_0) - 4.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[(3.0 - N[(N[(N[(N[(w * r), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision] * N[(-0.25 * v), $MachinePrecision] + 4.5), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]}, If[LessEqual[v, -1.62], t$95$1, If[LessEqual[v, 3.3e-15], N[(N[(N[(N[(N[(N[(w * r), $MachinePrecision] * r), $MachinePrecision] * w), $MachinePrecision] * N[(N[(-0.125 * v), $MachinePrecision] - 0.375), $MachinePrecision] + 3.0), $MachinePrecision] + t$95$0), $MachinePrecision] - 4.5), $MachinePrecision], t$95$1]]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      t_0 := \frac{2}{r \cdot r}\\
                      t_1 := \left(3 - \mathsf{fma}\left(\frac{w \cdot r}{1 - v} \cdot \left(w \cdot r\right), -0.25 \cdot v, 4.5\right)\right) + t\_0\\
                      \mathbf{if}\;v \leq -1.62:\\
                      \;\;\;\;t\_1\\
                      
                      \mathbf{elif}\;v \leq 3.3 \cdot 10^{-15}:\\
                      \;\;\;\;\left(\mathsf{fma}\left(\left(\left(w \cdot r\right) \cdot r\right) \cdot w, -0.125 \cdot v - 0.375, 3\right) + t\_0\right) - 4.5\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;t\_1\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if v < -1.6200000000000001 or 3.3e-15 < 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. Step-by-step derivation
                          1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        if -1.6200000000000001 < v < 3.3e-15

                        1. Initial program 85.2%

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

                          \[\leadsto \color{blue}{\left(\left(3 + \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)\right) - \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)} - \frac{9}{2} \]
                        4. Step-by-step derivation
                          1. associate--l+N/A

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

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

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

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

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

                            \[\leadsto \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} + \left(\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) - \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right) + 3\right)\right)} - \frac{9}{2} \]
                        5. Applied rewrites96.4%

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

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

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

                        Alternative 8: 96.7% accurate, 1.1× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ t_1 := \mathsf{fma}\left(\left(-0.25 \cdot r\right) \cdot \left(w \cdot r\right), w, -1.5\right) + t\_0\\ \mathbf{if}\;v \leq -1.15:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;v \leq 3.3 \cdot 10^{-15}:\\ \;\;\;\;\left(\mathsf{fma}\left(\left(\left(w \cdot r\right) \cdot r\right) \cdot w, -0.125 \cdot v - 0.375, 3\right) + t\_0\right) - 4.5\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                        (FPCore (v w r)
                         :precision binary64
                         (let* ((t_0 (/ 2.0 (* r r)))
                                (t_1 (+ (fma (* (* -0.25 r) (* w r)) w -1.5) t_0)))
                           (if (<= v -1.15)
                             t_1
                             (if (<= v 3.3e-15)
                               (- (+ (fma (* (* (* w r) r) w) (- (* -0.125 v) 0.375) 3.0) t_0) 4.5)
                               t_1))))
                        double code(double v, double w, double r) {
                        	double t_0 = 2.0 / (r * r);
                        	double t_1 = fma(((-0.25 * r) * (w * r)), w, -1.5) + t_0;
                        	double tmp;
                        	if (v <= -1.15) {
                        		tmp = t_1;
                        	} else if (v <= 3.3e-15) {
                        		tmp = (fma((((w * r) * r) * w), ((-0.125 * v) - 0.375), 3.0) + t_0) - 4.5;
                        	} else {
                        		tmp = t_1;
                        	}
                        	return tmp;
                        }
                        
                        function code(v, w, r)
                        	t_0 = Float64(2.0 / Float64(r * r))
                        	t_1 = Float64(fma(Float64(Float64(-0.25 * r) * Float64(w * r)), w, -1.5) + t_0)
                        	tmp = 0.0
                        	if (v <= -1.15)
                        		tmp = t_1;
                        	elseif (v <= 3.3e-15)
                        		tmp = Float64(Float64(fma(Float64(Float64(Float64(w * r) * r) * w), Float64(Float64(-0.125 * v) - 0.375), 3.0) + t_0) - 4.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[(N[(N[(-0.25 * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision] * w + -1.5), $MachinePrecision] + t$95$0), $MachinePrecision]}, If[LessEqual[v, -1.15], t$95$1, If[LessEqual[v, 3.3e-15], N[(N[(N[(N[(N[(N[(w * r), $MachinePrecision] * r), $MachinePrecision] * w), $MachinePrecision] * N[(N[(-0.125 * v), $MachinePrecision] - 0.375), $MachinePrecision] + 3.0), $MachinePrecision] + t$95$0), $MachinePrecision] - 4.5), $MachinePrecision], t$95$1]]]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        t_0 := \frac{2}{r \cdot r}\\
                        t_1 := \mathsf{fma}\left(\left(-0.25 \cdot r\right) \cdot \left(w \cdot r\right), w, -1.5\right) + t\_0\\
                        \mathbf{if}\;v \leq -1.15:\\
                        \;\;\;\;t\_1\\
                        
                        \mathbf{elif}\;v \leq 3.3 \cdot 10^{-15}:\\
                        \;\;\;\;\left(\mathsf{fma}\left(\left(\left(w \cdot r\right) \cdot r\right) \cdot w, -0.125 \cdot v - 0.375, 3\right) + t\_0\right) - 4.5\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;t\_1\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if v < -1.1499999999999999 or 3.3e-15 < 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. Step-by-step derivation
                            1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto \frac{2}{r \cdot r} + \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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            if -1.1499999999999999 < v < 3.3e-15

                            1. Initial program 85.2%

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

                              \[\leadsto \color{blue}{\left(\left(3 + \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)\right) - \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)} - \frac{9}{2} \]
                            4. Step-by-step derivation
                              1. associate--l+N/A

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

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

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

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

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

                                \[\leadsto \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} + \left(\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) - \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right) + 3\right)\right)} - \frac{9}{2} \]
                            5. Applied rewrites96.4%

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

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

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

                            Alternative 9: 89.8% accurate, 1.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(\color{blue}{\left(r \cdot r\right)} \cdot 0.375\right) \cdot w\right) \cdot w\right) - 4.5 \]
                              5. Applied rewrites94.6%

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

                              if 2.90000000000000019e-15 < v

                              1. Initial program 81.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. Step-by-step derivation
                                1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \frac{2}{r \cdot r} + \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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\left(r \cdot w\right) \cdot \left(-0.25 \cdot r\right), w, -1.5\right) \]
                              9. Recombined 2 regimes into one program.
                              10. Final simplification95.6%

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

                              Alternative 10: 89.8% accurate, 1.5× speedup?

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

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

                                  \[\leadsto \color{blue}{\left(\left(3 + \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)\right) - \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right)} - \frac{9}{2} \]
                                4. Step-by-step derivation
                                  1. associate--l+N/A

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

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

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

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

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

                                    \[\leadsto \color{blue}{\left(2 \cdot \frac{1}{{r}^{2}} + \left(\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) - \frac{3}{8} \cdot \left({r}^{2} \cdot {w}^{2}\right)\right) + 3\right)\right)} - \frac{9}{2} \]
                                5. Applied rewrites84.9%

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

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

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

                                  if 2.90000000000000019e-15 < v

                                  1. Initial program 81.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. Step-by-step derivation
                                    1. lift--.f64N/A

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \frac{2}{r \cdot r} + \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. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \frac{2}{r \cdot r} + \mathsf{fma}\left(\left(r \cdot w\right) \cdot \left(-0.25 \cdot r\right), w, -1.5\right) \]
                                  9. Recombined 2 regimes into one program.
                                  10. Final simplification95.6%

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

                                  Alternative 11: 56.6% 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 83.0%

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

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

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

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

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

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

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

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

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

                                  Alternative 12: 43.7% accurate, 4.3× speedup?

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

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

                                    \[\leadsto \color{blue}{\frac{2}{{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-*.f6450.0

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

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

                                  Reproduce

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