Rosa's TurbineBenchmark

Percentage Accurate: 84.8% → 98.0%
Time: 10.9s
Alternatives: 10
Speedup: 1.8×

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 10 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.8% 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: 98.0% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(w \cdot r\right) \cdot \left(w \cdot r\right)\\ t_1 := \frac{2}{r \cdot r} - 1.5\\ \mathbf{if}\;v \leq -1.05 \cdot 10^{+83}:\\ \;\;\;\;\mathsf{fma}\left(-0.25, \left(\left(w \cdot r\right) \cdot w\right) \cdot r, t\_1\right)\\ \mathbf{elif}\;v \leq 1.1 \cdot 10^{-40}:\\ \;\;\;\;\mathsf{fma}\left(-0.375, t\_0, t\_1\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.25, t\_0, t\_1\right)\\ \end{array} \end{array} \]
(FPCore (v w r)
 :precision binary64
 (let* ((t_0 (* (* w r) (* w r))) (t_1 (- (/ 2.0 (* r r)) 1.5)))
   (if (<= v -1.05e+83)
     (fma -0.25 (* (* (* w r) w) r) t_1)
     (if (<= v 1.1e-40) (fma -0.375 t_0 t_1) (fma -0.25 t_0 t_1)))))
double code(double v, double w, double r) {
	double t_0 = (w * r) * (w * r);
	double t_1 = (2.0 / (r * r)) - 1.5;
	double tmp;
	if (v <= -1.05e+83) {
		tmp = fma(-0.25, (((w * r) * w) * r), t_1);
	} else if (v <= 1.1e-40) {
		tmp = fma(-0.375, t_0, t_1);
	} else {
		tmp = fma(-0.25, t_0, t_1);
	}
	return tmp;
}
function code(v, w, r)
	t_0 = Float64(Float64(w * r) * Float64(w * r))
	t_1 = Float64(Float64(2.0 / Float64(r * r)) - 1.5)
	tmp = 0.0
	if (v <= -1.05e+83)
		tmp = fma(-0.25, Float64(Float64(Float64(w * r) * w) * r), t_1);
	elseif (v <= 1.1e-40)
		tmp = fma(-0.375, t_0, t_1);
	else
		tmp = fma(-0.25, t_0, t_1);
	end
	return tmp
end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(w * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]}, If[LessEqual[v, -1.05e+83], N[(-0.25 * N[(N[(N[(w * r), $MachinePrecision] * w), $MachinePrecision] * r), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[v, 1.1e-40], N[(-0.375 * t$95$0 + t$95$1), $MachinePrecision], N[(-0.25 * t$95$0 + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;v \leq 1.1 \cdot 10^{-40}:\\
\;\;\;\;\mathsf{fma}\left(-0.375, t\_0, t\_1\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.25, t\_0, t\_1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if v < -1.05000000000000001e83

    1. Initial program 90.9%

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

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

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

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

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

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

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

      if -1.05000000000000001e83 < v < 1.10000000000000004e-40

      1. Initial program 87.3%

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

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

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

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

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

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

          \[\leadsto \left(\left(\mathsf{neg}\left(\frac{3}{8} \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{3}{8} \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{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right)} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
        8. metadata-evalN/A

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

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

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

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

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

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

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

        if 1.10000000000000004e-40 < v

        1. Initial program 76.8%

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

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

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

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

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

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

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

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

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

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

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

        Alternative 2: 88.1% accurate, 0.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ \mathbf{if}\;\left(3 + t\_0\right) - \frac{\left(\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 -1 \cdot 10^{+14}:\\ \;\;\;\;\left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w\right) \cdot w\\ \mathbf{else}:\\ \;\;\;\;t\_0 - 1.5\\ \end{array} \end{array} \]
        (FPCore (v w r)
         :precision binary64
         (let* ((t_0 (/ 2.0 (* r r))))
           (if (<=
                (-
                 (+ 3.0 t_0)
                 (/ (* (* (* (* w w) r) r) (* (- 3.0 (* v 2.0)) 0.125)) (- 1.0 v)))
                -1e+14)
             (* (* (* -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))) <= -1e+14) {
        		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))) <= (-1d+14)) 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))) <= -1e+14) {
        		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))) <= -1e+14:
        		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))) <= -1e+14)
        		tmp = Float64(Float64(Float64(-0.375 * Float64(r * r)) * w) * w);
        	else
        		tmp = Float64(t_0 - 1.5);
        	end
        	return tmp
        end
        
        function tmp_2 = code(v, w, r)
        	t_0 = 2.0 / (r * r);
        	tmp = 0.0;
        	if (((3.0 + t_0) - (((((w * w) * r) * r) * ((3.0 - (v * 2.0)) * 0.125)) / (1.0 - v))) <= -1e+14)
        		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], -1e+14], N[(N[(N[(-0.375 * N[(r * r), $MachinePrecision]), $MachinePrecision] * w), $MachinePrecision] * w), $MachinePrecision], N[(t$95$0 - 1.5), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \frac{2}{r \cdot r}\\
        \mathbf{if}\;\left(3 + t\_0\right) - \frac{\left(\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 -1 \cdot 10^{+14}:\\
        \;\;\;\;\left(\left(-0.375 \cdot \left(r \cdot r\right)\right) \cdot w\right) \cdot w\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0 - 1.5\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) < -1e14

          1. Initial program 86.7%

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

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

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

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

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

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

              \[\leadsto \left(\left(\mathsf{neg}\left(\frac{3}{8} \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{3}{8} \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{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right)} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
            8. metadata-evalN/A

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

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

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

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

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

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

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

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

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

            1. Initial program 83.7%

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

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

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

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

          Alternative 3: 99.7% accurate, 1.1× speedup?

          \[\begin{array}{l} \\ \left(3 - \mathsf{fma}\left(\frac{\left(w \cdot r\right) \cdot \left(w \cdot r\right)}{1 - v}, 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) (* w r)) (- 1.0 v)) (* 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) * (w * r)) / (1.0 - v)), (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(w * r)) / Float64(1.0 - v)), 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[(w * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $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{\left(w \cdot r\right) \cdot \left(w \cdot r\right)}{1 - v}, 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 85.1%

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

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

              \[\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 0.125, 4.5\right)\right) \]
            4. lift-*.f64N/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) \]
            5. *-commutativeN/A

              \[\leadsto \frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\frac{\color{blue}{\left(r \cdot w\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) \]
            6. lower-*.f6499.8

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

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

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

          Alternative 4: 98.1% accurate, 1.1× speedup?

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

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

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

              \[\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 0.125, 4.5\right)\right) \]
            4. lift-*.f64N/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) \]
            5. *-commutativeN/A

              \[\leadsto \frac{2}{r \cdot r} + \left(3 - \mathsf{fma}\left(\frac{\color{blue}{\left(r \cdot w\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) \]
            6. lower-*.f6499.8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 5: 98.4% accurate, 1.4× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(w \cdot r\right) \cdot \left(w \cdot r\right)\\ t_1 := \frac{2}{r \cdot r} - 1.5\\ t_2 := \mathsf{fma}\left(-0.25, t\_0, t\_1\right)\\ \mathbf{if}\;v \leq -1.05 \cdot 10^{+83}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;v \leq 1.1 \cdot 10^{-40}:\\ \;\;\;\;\mathsf{fma}\left(-0.375, t\_0, t\_1\right)\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
          (FPCore (v w r)
           :precision binary64
           (let* ((t_0 (* (* w r) (* w r)))
                  (t_1 (- (/ 2.0 (* r r)) 1.5))
                  (t_2 (fma -0.25 t_0 t_1)))
             (if (<= v -1.05e+83) t_2 (if (<= v 1.1e-40) (fma -0.375 t_0 t_1) t_2))))
          double code(double v, double w, double r) {
          	double t_0 = (w * r) * (w * r);
          	double t_1 = (2.0 / (r * r)) - 1.5;
          	double t_2 = fma(-0.25, t_0, t_1);
          	double tmp;
          	if (v <= -1.05e+83) {
          		tmp = t_2;
          	} else if (v <= 1.1e-40) {
          		tmp = fma(-0.375, t_0, t_1);
          	} else {
          		tmp = t_2;
          	}
          	return tmp;
          }
          
          function code(v, w, r)
          	t_0 = Float64(Float64(w * r) * Float64(w * r))
          	t_1 = Float64(Float64(2.0 / Float64(r * r)) - 1.5)
          	t_2 = fma(-0.25, t_0, t_1)
          	tmp = 0.0
          	if (v <= -1.05e+83)
          		tmp = t_2;
          	elseif (v <= 1.1e-40)
          		tmp = fma(-0.375, t_0, t_1);
          	else
          		tmp = t_2;
          	end
          	return tmp
          end
          
          code[v_, w_, r_] := Block[{t$95$0 = N[(N[(w * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]}, Block[{t$95$2 = N[(-0.25 * t$95$0 + t$95$1), $MachinePrecision]}, If[LessEqual[v, -1.05e+83], t$95$2, If[LessEqual[v, 1.1e-40], N[(-0.375 * t$95$0 + t$95$1), $MachinePrecision], t$95$2]]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \left(w \cdot r\right) \cdot \left(w \cdot r\right)\\
          t_1 := \frac{2}{r \cdot r} - 1.5\\
          t_2 := \mathsf{fma}\left(-0.25, t\_0, t\_1\right)\\
          \mathbf{if}\;v \leq -1.05 \cdot 10^{+83}:\\
          \;\;\;\;t\_2\\
          
          \mathbf{elif}\;v \leq 1.1 \cdot 10^{-40}:\\
          \;\;\;\;\mathsf{fma}\left(-0.375, t\_0, t\_1\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_2\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if v < -1.05000000000000001e83 or 1.10000000000000004e-40 < v

            1. Initial program 82.8%

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

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

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

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

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

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

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

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

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

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

              if -1.05000000000000001e83 < v < 1.10000000000000004e-40

              1. Initial program 87.3%

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

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

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

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

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

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

                  \[\leadsto \left(\left(\mathsf{neg}\left(\frac{3}{8} \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{3}{8} \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{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right)} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                8. metadata-evalN/A

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

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

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

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

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

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

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

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

              Alternative 6: 97.1% accurate, 1.4× speedup?

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

                1. Initial program 82.0%

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

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

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

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

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

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

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

                  if -2.65000000000000003e101 < v < 5.1999999999999996e68

                  1. Initial program 87.3%

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

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

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

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

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

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

                      \[\leadsto \left(\left(\mathsf{neg}\left(\frac{3}{8} \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{3}{8} \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{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right)} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                    8. metadata-evalN/A

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

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

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

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

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

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

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

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

                  Alternative 7: 93.4% accurate, 1.8× speedup?

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

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

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

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

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

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

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

                      \[\leadsto \left(\left(\mathsf{neg}\left(\frac{3}{8} \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{3}{8} \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{3}{8}\right)\right) \cdot \left({r}^{2} \cdot {w}^{2}\right)} + \left(\frac{-3}{2} + 2 \cdot \frac{1}{{r}^{2}}\right) \]
                    8. metadata-evalN/A

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

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

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

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

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

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

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

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

                    Alternative 8: 50.7% accurate, 3.2× speedup?

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

                      1. Initial program 80.7%

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

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

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

                      if 1.1499999999999999 < r

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

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

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

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

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

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

                          \[\leadsto \left(\frac{2}{\color{blue}{r \cdot r}} + 3\right) - \frac{9}{2} \]
                        7. lower-*.f6434.3

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

                        \[\leadsto \color{blue}{\left(\frac{2}{r \cdot r} + 3\right)} - 4.5 \]
                      6. Taylor expanded in r around inf

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

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

                      Alternative 9: 57.3% 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 85.1%

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

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

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

                      Alternative 10: 13.8% accurate, 18.3× speedup?

                      \[\begin{array}{l} \\ 3 - 4.5 \end{array} \]
                      (FPCore (v w r) :precision binary64 (- 3.0 4.5))
                      double code(double v, double w, double r) {
                      	return 3.0 - 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 - 4.5d0
                      end function
                      
                      public static double code(double v, double w, double r) {
                      	return 3.0 - 4.5;
                      }
                      
                      def code(v, w, r):
                      	return 3.0 - 4.5
                      
                      function code(v, w, r)
                      	return Float64(3.0 - 4.5)
                      end
                      
                      function tmp = code(v, w, r)
                      	tmp = 3.0 - 4.5;
                      end
                      
                      code[v_, w_, r_] := N[(3.0 - 4.5), $MachinePrecision]
                      
                      \begin{array}{l}
                      
                      \\
                      3 - 4.5
                      \end{array}
                      
                      Derivation
                      1. Initial program 85.1%

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

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

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

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

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

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

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

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

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

                        \[\leadsto \color{blue}{\left(\frac{2}{r \cdot r} + 3\right)} - 4.5 \]
                      6. Taylor expanded in r around inf

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

                          \[\leadsto 3 - 4.5 \]
                        2. Add Preprocessing

                        Reproduce

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