Rosa's TurbineBenchmark

Percentage Accurate: 85.5% → 99.3%
Time: 11.9s
Alternatives: 13
Speedup: 1.7×

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;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(v, w, r)
use fmin_fmax_functions
    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}

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

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

Initial Program: 85.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \end{array} \]
(FPCore (v w r)
 :precision binary64
 (-
  (-
   (+ 3.0 (/ 2.0 (* r r)))
   (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
  4.5))
double code(double v, double w, double r) {
	return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(v, w, r)
use fmin_fmax_functions
    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.3% accurate, 1.0× speedup?

\[\begin{array}{l} r_m = \left|r\right| \\ \begin{array}{l} t_0 := \frac{r\_m}{1 - v}\\ \mathbf{if}\;r\_m \leq 100000000:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(v, 2, -3\right), 0.125 \cdot \left(w \cdot \left(r\_m \cdot \left(w \cdot t\_0\right)\right)\right), \frac{2}{r\_m \cdot r\_m} - 1.5\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(v, 2, -3\right), 0.125 \cdot \left(\left(\left(w \cdot r\_m\right) \cdot w\right) \cdot t\_0\right), -1.5\right)\\ \end{array} \end{array} \]
r_m = (fabs.f64 r)
(FPCore (v w r_m)
 :precision binary64
 (let* ((t_0 (/ r_m (- 1.0 v))))
   (if (<= r_m 100000000.0)
     (fma
      (fma v 2.0 -3.0)
      (* 0.125 (* w (* r_m (* w t_0))))
      (- (/ 2.0 (* r_m r_m)) 1.5))
     (fma (fma v 2.0 -3.0) (* 0.125 (* (* (* w r_m) w) t_0)) -1.5))))
r_m = fabs(r);
double code(double v, double w, double r_m) {
	double t_0 = r_m / (1.0 - v);
	double tmp;
	if (r_m <= 100000000.0) {
		tmp = fma(fma(v, 2.0, -3.0), (0.125 * (w * (r_m * (w * t_0)))), ((2.0 / (r_m * r_m)) - 1.5));
	} else {
		tmp = fma(fma(v, 2.0, -3.0), (0.125 * (((w * r_m) * w) * t_0)), -1.5);
	}
	return tmp;
}
r_m = abs(r)
function code(v, w, r_m)
	t_0 = Float64(r_m / Float64(1.0 - v))
	tmp = 0.0
	if (r_m <= 100000000.0)
		tmp = fma(fma(v, 2.0, -3.0), Float64(0.125 * Float64(w * Float64(r_m * Float64(w * t_0)))), Float64(Float64(2.0 / Float64(r_m * r_m)) - 1.5));
	else
		tmp = fma(fma(v, 2.0, -3.0), Float64(0.125 * Float64(Float64(Float64(w * r_m) * w) * t_0)), -1.5);
	end
	return tmp
end
r_m = N[Abs[r], $MachinePrecision]
code[v_, w_, r$95$m_] := Block[{t$95$0 = N[(r$95$m / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r$95$m, 100000000.0], N[(N[(v * 2.0 + -3.0), $MachinePrecision] * N[(0.125 * N[(w * N[(r$95$m * N[(w * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 / N[(r$95$m * r$95$m), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision], N[(N[(v * 2.0 + -3.0), $MachinePrecision] * N[(0.125 * N[(N[(N[(w * r$95$m), $MachinePrecision] * w), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision]]]
\begin{array}{l}
r_m = \left|r\right|

\\
\begin{array}{l}
t_0 := \frac{r\_m}{1 - v}\\
\mathbf{if}\;r\_m \leq 100000000:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(v, 2, -3\right), 0.125 \cdot \left(w \cdot \left(r\_m \cdot \left(w \cdot t\_0\right)\right)\right), \frac{2}{r\_m \cdot r\_m} - 1.5\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(v, 2, -3\right), 0.125 \cdot \left(\left(\left(w \cdot r\_m\right) \cdot w\right) \cdot t\_0\right), -1.5\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if r < 1e8

    1. Initial program 81.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. Applied rewrites93.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1e8 < r

    1. Initial program 89.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. Applied rewrites99.8%

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

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

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

    Alternative 2: 98.4% accurate, 1.3× speedup?

    \[\begin{array}{l} r_m = \left|r\right| \\ \begin{array}{l} \mathbf{if}\;r\_m \leq 65000000000:\\ \;\;\;\;\mathsf{fma}\left(\left(-0.25 \cdot \left(r\_m \cdot r\_m\right)\right) \cdot w, w, \frac{\frac{2}{r\_m}}{r\_m} - 1.5\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(v, 2, -3\right), 0.125 \cdot \left(\left(\left(w \cdot r\_m\right) \cdot w\right) \cdot \frac{r\_m}{1 - v}\right), -1.5\right)\\ \end{array} \end{array} \]
    r_m = (fabs.f64 r)
    (FPCore (v w r_m)
     :precision binary64
     (if (<= r_m 65000000000.0)
       (fma (* (* -0.25 (* r_m r_m)) w) w (- (/ (/ 2.0 r_m) r_m) 1.5))
       (fma
        (fma v 2.0 -3.0)
        (* 0.125 (* (* (* w r_m) w) (/ r_m (- 1.0 v))))
        -1.5)))
    r_m = fabs(r);
    double code(double v, double w, double r_m) {
    	double tmp;
    	if (r_m <= 65000000000.0) {
    		tmp = fma(((-0.25 * (r_m * r_m)) * w), w, (((2.0 / r_m) / r_m) - 1.5));
    	} else {
    		tmp = fma(fma(v, 2.0, -3.0), (0.125 * (((w * r_m) * w) * (r_m / (1.0 - v)))), -1.5);
    	}
    	return tmp;
    }
    
    r_m = abs(r)
    function code(v, w, r_m)
    	tmp = 0.0
    	if (r_m <= 65000000000.0)
    		tmp = fma(Float64(Float64(-0.25 * Float64(r_m * r_m)) * w), w, Float64(Float64(Float64(2.0 / r_m) / r_m) - 1.5));
    	else
    		tmp = fma(fma(v, 2.0, -3.0), Float64(0.125 * Float64(Float64(Float64(w * r_m) * w) * Float64(r_m / Float64(1.0 - v)))), -1.5);
    	end
    	return tmp
    end
    
    r_m = N[Abs[r], $MachinePrecision]
    code[v_, w_, r$95$m_] := If[LessEqual[r$95$m, 65000000000.0], N[(N[(N[(-0.25 * N[(r$95$m * r$95$m), $MachinePrecision]), $MachinePrecision] * w), $MachinePrecision] * w + N[(N[(N[(2.0 / r$95$m), $MachinePrecision] / r$95$m), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision], N[(N[(v * 2.0 + -3.0), $MachinePrecision] * N[(0.125 * N[(N[(N[(w * r$95$m), $MachinePrecision] * w), $MachinePrecision] * N[(r$95$m / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision]]
    
    \begin{array}{l}
    r_m = \left|r\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;r\_m \leq 65000000000:\\
    \;\;\;\;\mathsf{fma}\left(\left(-0.25 \cdot \left(r\_m \cdot r\_m\right)\right) \cdot w, w, \frac{\frac{2}{r\_m}}{r\_m} - 1.5\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(v, 2, -3\right), 0.125 \cdot \left(\left(\left(w \cdot r\_m\right) \cdot w\right) \cdot \frac{r\_m}{1 - v}\right), -1.5\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if r < 6.5e10

      1. Initial program 81.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. 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)} \]
      3. Applied rewrites97.1%

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

          \[\leadsto \mathsf{fma}\left(\left(\frac{-1}{4} \cdot \left(r \cdot r\right)\right) \cdot w, w, \frac{2}{r \cdot r} - \frac{3}{2}\right) \]
        2. lift-/.f64N/A

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

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

          \[\leadsto \mathsf{fma}\left(\left(\frac{-1}{4} \cdot \left(r \cdot r\right)\right) \cdot w, w, \frac{\frac{2}{r}}{r} - \frac{3}{2}\right) \]
        5. lift-/.f6497.1

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

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

      if 6.5e10 < r

      1. Initial program 89.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. Applied rewrites99.8%

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

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

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

      Alternative 3: 96.8% accurate, 0.4× speedup?

      \[\begin{array}{l} r_m = \left|r\right| \\ \begin{array}{l} t_0 := \frac{2}{r\_m \cdot r\_m}\\ t_1 := \left(\left(3 + t\_0\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\_m\right) \cdot r\_m\right)}{1 - v}\right) - 4.5\\ t_2 := \mathsf{fma}\left(\left(-0.25 \cdot r\_m\right) \cdot \left(r\_m \cdot w\right), w, t\_0 - 1.5\right)\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq -5 \cdot 10^{+47}:\\ \;\;\;\;\left(\mathsf{fma}\left(0.25, v, -0.375\right) \cdot r\_m\right) \cdot \left(w \cdot \left(\frac{r\_m}{1 - v} \cdot w\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
      r_m = (fabs.f64 r)
      (FPCore (v w r_m)
       :precision binary64
       (let* ((t_0 (/ 2.0 (* r_m r_m)))
              (t_1
               (-
                (-
                 (+ 3.0 t_0)
                 (/
                  (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r_m) r_m))
                  (- 1.0 v)))
                4.5))
              (t_2 (fma (* (* -0.25 r_m) (* r_m w)) w (- t_0 1.5))))
         (if (<= t_1 (- INFINITY))
           t_2
           (if (<= t_1 -5e+47)
             (* (* (fma 0.25 v -0.375) r_m) (* w (* (/ r_m (- 1.0 v)) w)))
             t_2))))
      r_m = fabs(r);
      double code(double v, double w, double r_m) {
      	double t_0 = 2.0 / (r_m * r_m);
      	double t_1 = ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r_m) * r_m)) / (1.0 - v))) - 4.5;
      	double t_2 = fma(((-0.25 * r_m) * (r_m * w)), w, (t_0 - 1.5));
      	double tmp;
      	if (t_1 <= -((double) INFINITY)) {
      		tmp = t_2;
      	} else if (t_1 <= -5e+47) {
      		tmp = (fma(0.25, v, -0.375) * r_m) * (w * ((r_m / (1.0 - v)) * w));
      	} else {
      		tmp = t_2;
      	}
      	return tmp;
      }
      
      r_m = abs(r)
      function code(v, w, r_m)
      	t_0 = Float64(2.0 / Float64(r_m * r_m))
      	t_1 = Float64(Float64(Float64(3.0 + t_0) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r_m) * r_m)) / Float64(1.0 - v))) - 4.5)
      	t_2 = fma(Float64(Float64(-0.25 * r_m) * Float64(r_m * w)), w, Float64(t_0 - 1.5))
      	tmp = 0.0
      	if (t_1 <= Float64(-Inf))
      		tmp = t_2;
      	elseif (t_1 <= -5e+47)
      		tmp = Float64(Float64(fma(0.25, v, -0.375) * r_m) * Float64(w * Float64(Float64(r_m / Float64(1.0 - v)) * w)));
      	else
      		tmp = t_2;
      	end
      	return tmp
      end
      
      r_m = N[Abs[r], $MachinePrecision]
      code[v_, w_, r$95$m_] := Block[{t$95$0 = N[(2.0 / N[(r$95$m * r$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r$95$m), $MachinePrecision] * r$95$m), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(-0.25 * r$95$m), $MachinePrecision] * N[(r$95$m * w), $MachinePrecision]), $MachinePrecision] * w + N[(t$95$0 - 1.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$2, If[LessEqual[t$95$1, -5e+47], N[(N[(N[(0.25 * v + -0.375), $MachinePrecision] * r$95$m), $MachinePrecision] * N[(w * N[(N[(r$95$m / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
      
      \begin{array}{l}
      r_m = \left|r\right|
      
      \\
      \begin{array}{l}
      t_0 := \frac{2}{r\_m \cdot r\_m}\\
      t_1 := \left(\left(3 + t\_0\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\_m\right) \cdot r\_m\right)}{1 - v}\right) - 4.5\\
      t_2 := \mathsf{fma}\left(\left(-0.25 \cdot r\_m\right) \cdot \left(r\_m \cdot w\right), w, t\_0 - 1.5\right)\\
      \mathbf{if}\;t\_1 \leq -\infty:\\
      \;\;\;\;t\_2\\
      
      \mathbf{elif}\;t\_1 \leq -5 \cdot 10^{+47}:\\
      \;\;\;\;\left(\mathsf{fma}\left(0.25, v, -0.375\right) \cdot r\_m\right) \cdot \left(w \cdot \left(\frac{r\_m}{1 - v} \cdot w\right)\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_2\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (-.f64 (-.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))) #s(literal 9/2 binary64)) < -inf.0 or -5.00000000000000022e47 < (-.f64 (-.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))) #s(literal 9/2 binary64))

        1. Initial program 84.6%

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\left(\frac{-1}{4} \cdot r\right) \cdot \left(r \cdot w\right), w, \frac{2}{r \cdot r} - \frac{3}{2}\right) \]
          10. lower-*.f6495.9

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

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

        if -inf.0 < (-.f64 (-.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))) #s(literal 9/2 binary64)) < -5.00000000000000022e47

        1. Initial program 98.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. Applied rewrites99.3%

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

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

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

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

      Alternative 4: 95.8% accurate, 0.4× speedup?

      \[\begin{array}{l} r_m = \left|r\right| \\ \begin{array}{l} t_0 := \frac{2}{r\_m \cdot r\_m}\\ t_1 := \left(\left(3 + t\_0\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\_m\right) \cdot r\_m\right)}{1 - v}\right) - 4.5\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;\left(3 - \left(\left(r\_m \cdot w\right) \cdot \left(r\_m \cdot w\right)\right) \cdot 0.25\right) - 4.5\\ \mathbf{elif}\;t\_1 \leq -5 \cdot 10^{+47}:\\ \;\;\;\;\left(\mathsf{fma}\left(0.25, v, -0.375\right) \cdot r\_m\right) \cdot \left(w \cdot \left(\frac{r\_m}{1 - v} \cdot w\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0 - 1.5\\ \end{array} \end{array} \]
      r_m = (fabs.f64 r)
      (FPCore (v w r_m)
       :precision binary64
       (let* ((t_0 (/ 2.0 (* r_m r_m)))
              (t_1
               (-
                (-
                 (+ 3.0 t_0)
                 (/
                  (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r_m) r_m))
                  (- 1.0 v)))
                4.5)))
         (if (<= t_1 (- INFINITY))
           (- (- 3.0 (* (* (* r_m w) (* r_m w)) 0.25)) 4.5)
           (if (<= t_1 -5e+47)
             (* (* (fma 0.25 v -0.375) r_m) (* w (* (/ r_m (- 1.0 v)) w)))
             (- t_0 1.5)))))
      r_m = fabs(r);
      double code(double v, double w, double r_m) {
      	double t_0 = 2.0 / (r_m * r_m);
      	double t_1 = ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r_m) * r_m)) / (1.0 - v))) - 4.5;
      	double tmp;
      	if (t_1 <= -((double) INFINITY)) {
      		tmp = (3.0 - (((r_m * w) * (r_m * w)) * 0.25)) - 4.5;
      	} else if (t_1 <= -5e+47) {
      		tmp = (fma(0.25, v, -0.375) * r_m) * (w * ((r_m / (1.0 - v)) * w));
      	} else {
      		tmp = t_0 - 1.5;
      	}
      	return tmp;
      }
      
      r_m = abs(r)
      function code(v, w, r_m)
      	t_0 = Float64(2.0 / Float64(r_m * r_m))
      	t_1 = Float64(Float64(Float64(3.0 + t_0) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r_m) * r_m)) / Float64(1.0 - v))) - 4.5)
      	tmp = 0.0
      	if (t_1 <= Float64(-Inf))
      		tmp = Float64(Float64(3.0 - Float64(Float64(Float64(r_m * w) * Float64(r_m * w)) * 0.25)) - 4.5);
      	elseif (t_1 <= -5e+47)
      		tmp = Float64(Float64(fma(0.25, v, -0.375) * r_m) * Float64(w * Float64(Float64(r_m / Float64(1.0 - v)) * w)));
      	else
      		tmp = Float64(t_0 - 1.5);
      	end
      	return tmp
      end
      
      r_m = N[Abs[r], $MachinePrecision]
      code[v_, w_, r$95$m_] := Block[{t$95$0 = N[(2.0 / N[(r$95$m * r$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r$95$m), $MachinePrecision] * r$95$m), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(3.0 - N[(N[(N[(r$95$m * w), $MachinePrecision] * N[(r$95$m * w), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[t$95$1, -5e+47], N[(N[(N[(0.25 * v + -0.375), $MachinePrecision] * r$95$m), $MachinePrecision] * N[(w * N[(N[(r$95$m / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - 1.5), $MachinePrecision]]]]]
      
      \begin{array}{l}
      r_m = \left|r\right|
      
      \\
      \begin{array}{l}
      t_0 := \frac{2}{r\_m \cdot r\_m}\\
      t_1 := \left(\left(3 + t\_0\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\_m\right) \cdot r\_m\right)}{1 - v}\right) - 4.5\\
      \mathbf{if}\;t\_1 \leq -\infty:\\
      \;\;\;\;\left(3 - \left(\left(r\_m \cdot w\right) \cdot \left(r\_m \cdot w\right)\right) \cdot 0.25\right) - 4.5\\
      
      \mathbf{elif}\;t\_1 \leq -5 \cdot 10^{+47}:\\
      \;\;\;\;\left(\mathsf{fma}\left(0.25, v, -0.375\right) \cdot r\_m\right) \cdot \left(w \cdot \left(\frac{r\_m}{1 - v} \cdot w\right)\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0 - 1.5\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if (-.f64 (-.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))) #s(literal 9/2 binary64)) < -inf.0

        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. Taylor expanded in r around inf

          \[\leadsto \left(\color{blue}{3} - \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. Step-by-step derivation
          1. Applied rewrites83.0%

            \[\leadsto \left(\color{blue}{3} - \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. Taylor expanded in v around inf

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

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

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

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

              \[\leadsto \left(3 - \left(\frac{1}{4} \cdot \left(r \cdot r\right)\right) \cdot {w}^{2}\right) - \frac{9}{2} \]
            5. lift-*.f64N/A

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

              \[\leadsto \left(3 - \left(\frac{1}{4} \cdot \left(r \cdot r\right)\right) \cdot \left(w \cdot \color{blue}{w}\right)\right) - \frac{9}{2} \]
            7. lift-*.f6487.9

              \[\leadsto \left(3 - \left(0.25 \cdot \left(r \cdot r\right)\right) \cdot \left(w \cdot \color{blue}{w}\right)\right) - 4.5 \]
          4. Applied rewrites87.9%

            \[\leadsto \left(3 - \color{blue}{\left(0.25 \cdot \left(r \cdot r\right)\right) \cdot \left(w \cdot w\right)}\right) - 4.5 \]
          5. Step-by-step derivation
            1. lift-*.f64N/A

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

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

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

              \[\leadsto \left(3 - \left(\frac{1}{4} \cdot {r}^{2}\right) \cdot \left(w \cdot w\right)\right) - \frac{9}{2} \]
            5. lift-*.f64N/A

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

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

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

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

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

              \[\leadsto \left(3 - {\left(r \cdot w\right)}^{2} \cdot \frac{1}{4}\right) - \frac{9}{2} \]
            11. pow2N/A

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

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

              \[\leadsto \left(3 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot \frac{1}{4}\right) - \frac{9}{2} \]
            14. lower-*.f6493.4

              \[\leadsto \left(3 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.25\right) - 4.5 \]
          6. Applied rewrites93.4%

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

          if -inf.0 < (-.f64 (-.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))) #s(literal 9/2 binary64)) < -5.00000000000000022e47

          1. Initial program 98.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. Applied rewrites99.3%

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

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

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

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

          if -5.00000000000000022e47 < (-.f64 (-.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))) #s(literal 9/2 binary64))

          1. Initial program 85.5%

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

            \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}} \]
          3. Applied rewrites93.1%

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

        Alternative 5: 93.4% accurate, 1.3× speedup?

        \[\begin{array}{l} r_m = \left|r\right| \\ \begin{array}{l} \mathbf{if}\;r\_m \leq 65000000000:\\ \;\;\;\;\mathsf{fma}\left(\left(-0.25 \cdot \left(r\_m \cdot r\_m\right)\right) \cdot w, w, \frac{\frac{2}{r\_m}}{r\_m} - 1.5\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(v, 2, -3\right), 0.125 \cdot \left(w \cdot \left(r\_m \cdot \left(w \cdot \frac{r\_m}{1 - v}\right)\right)\right), -1.5\right)\\ \end{array} \end{array} \]
        r_m = (fabs.f64 r)
        (FPCore (v w r_m)
         :precision binary64
         (if (<= r_m 65000000000.0)
           (fma (* (* -0.25 (* r_m r_m)) w) w (- (/ (/ 2.0 r_m) r_m) 1.5))
           (fma
            (fma v 2.0 -3.0)
            (* 0.125 (* w (* r_m (* w (/ r_m (- 1.0 v))))))
            -1.5)))
        r_m = fabs(r);
        double code(double v, double w, double r_m) {
        	double tmp;
        	if (r_m <= 65000000000.0) {
        		tmp = fma(((-0.25 * (r_m * r_m)) * w), w, (((2.0 / r_m) / r_m) - 1.5));
        	} else {
        		tmp = fma(fma(v, 2.0, -3.0), (0.125 * (w * (r_m * (w * (r_m / (1.0 - v)))))), -1.5);
        	}
        	return tmp;
        }
        
        r_m = abs(r)
        function code(v, w, r_m)
        	tmp = 0.0
        	if (r_m <= 65000000000.0)
        		tmp = fma(Float64(Float64(-0.25 * Float64(r_m * r_m)) * w), w, Float64(Float64(Float64(2.0 / r_m) / r_m) - 1.5));
        	else
        		tmp = fma(fma(v, 2.0, -3.0), Float64(0.125 * Float64(w * Float64(r_m * Float64(w * Float64(r_m / Float64(1.0 - v)))))), -1.5);
        	end
        	return tmp
        end
        
        r_m = N[Abs[r], $MachinePrecision]
        code[v_, w_, r$95$m_] := If[LessEqual[r$95$m, 65000000000.0], N[(N[(N[(-0.25 * N[(r$95$m * r$95$m), $MachinePrecision]), $MachinePrecision] * w), $MachinePrecision] * w + N[(N[(N[(2.0 / r$95$m), $MachinePrecision] / r$95$m), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision], N[(N[(v * 2.0 + -3.0), $MachinePrecision] * N[(0.125 * N[(w * N[(r$95$m * N[(w * N[(r$95$m / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision]]
        
        \begin{array}{l}
        r_m = \left|r\right|
        
        \\
        \begin{array}{l}
        \mathbf{if}\;r\_m \leq 65000000000:\\
        \;\;\;\;\mathsf{fma}\left(\left(-0.25 \cdot \left(r\_m \cdot r\_m\right)\right) \cdot w, w, \frac{\frac{2}{r\_m}}{r\_m} - 1.5\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(v, 2, -3\right), 0.125 \cdot \left(w \cdot \left(r\_m \cdot \left(w \cdot \frac{r\_m}{1 - v}\right)\right)\right), -1.5\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if r < 6.5e10

          1. Initial program 81.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. 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)} \]
          3. Applied rewrites97.1%

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

              \[\leadsto \mathsf{fma}\left(\left(\frac{-1}{4} \cdot \left(r \cdot r\right)\right) \cdot w, w, \frac{2}{r \cdot r} - \frac{3}{2}\right) \]
            2. lift-/.f64N/A

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

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

              \[\leadsto \mathsf{fma}\left(\left(\frac{-1}{4} \cdot \left(r \cdot r\right)\right) \cdot w, w, \frac{\frac{2}{r}}{r} - \frac{3}{2}\right) \]
            5. lift-/.f6497.1

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

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

          if 6.5e10 < r

          1. Initial program 89.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. Applied rewrites99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 6: 92.5% accurate, 1.7× speedup?

          \[\begin{array}{l} r_m = \left|r\right| \\ \begin{array}{l} \mathbf{if}\;r\_m \leq 105000000:\\ \;\;\;\;\mathsf{fma}\left(\left(-0.25 \cdot \left(r\_m \cdot r\_m\right)\right) \cdot w, w, \frac{2}{r\_m \cdot r\_m}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(3 - r\_m \cdot \left(w \cdot \left(\left(w \cdot r\_m\right) \cdot 0.25\right)\right)\right) - 4.5\\ \end{array} \end{array} \]
          r_m = (fabs.f64 r)
          (FPCore (v w r_m)
           :precision binary64
           (if (<= r_m 105000000.0)
             (fma (* (* -0.25 (* r_m r_m)) w) w (/ 2.0 (* r_m r_m)))
             (- (- 3.0 (* r_m (* w (* (* w r_m) 0.25)))) 4.5)))
          r_m = fabs(r);
          double code(double v, double w, double r_m) {
          	double tmp;
          	if (r_m <= 105000000.0) {
          		tmp = fma(((-0.25 * (r_m * r_m)) * w), w, (2.0 / (r_m * r_m)));
          	} else {
          		tmp = (3.0 - (r_m * (w * ((w * r_m) * 0.25)))) - 4.5;
          	}
          	return tmp;
          }
          
          r_m = abs(r)
          function code(v, w, r_m)
          	tmp = 0.0
          	if (r_m <= 105000000.0)
          		tmp = fma(Float64(Float64(-0.25 * Float64(r_m * r_m)) * w), w, Float64(2.0 / Float64(r_m * r_m)));
          	else
          		tmp = Float64(Float64(3.0 - Float64(r_m * Float64(w * Float64(Float64(w * r_m) * 0.25)))) - 4.5);
          	end
          	return tmp
          end
          
          r_m = N[Abs[r], $MachinePrecision]
          code[v_, w_, r$95$m_] := If[LessEqual[r$95$m, 105000000.0], N[(N[(N[(-0.25 * N[(r$95$m * r$95$m), $MachinePrecision]), $MachinePrecision] * w), $MachinePrecision] * w + N[(2.0 / N[(r$95$m * r$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(3.0 - N[(r$95$m * N[(w * N[(N[(w * r$95$m), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
          
          \begin{array}{l}
          r_m = \left|r\right|
          
          \\
          \begin{array}{l}
          \mathbf{if}\;r\_m \leq 105000000:\\
          \;\;\;\;\mathsf{fma}\left(\left(-0.25 \cdot \left(r\_m \cdot r\_m\right)\right) \cdot w, w, \frac{2}{r\_m \cdot r\_m}\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;\left(3 - r\_m \cdot \left(w \cdot \left(\left(w \cdot r\_m\right) \cdot 0.25\right)\right)\right) - 4.5\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if r < 1.05e8

            1. Initial program 81.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. 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)} \]
            3. Applied rewrites97.1%

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

              \[\leadsto \mathsf{fma}\left(\left(\frac{-1}{4} \cdot \left(r \cdot r\right)\right) \cdot w, w, \frac{2}{{r}^{2}}\right) \]
            5. Step-by-step derivation
              1. pow2N/A

                \[\leadsto \mathsf{fma}\left(\left(\frac{-1}{4} \cdot \left(r \cdot r\right)\right) \cdot w, w, \frac{2}{r \cdot r}\right) \]
              2. lift-/.f64N/A

                \[\leadsto \mathsf{fma}\left(\left(\frac{-1}{4} \cdot \left(r \cdot r\right)\right) \cdot w, w, \frac{2}{r \cdot r}\right) \]
              3. lift-*.f6495.5

                \[\leadsto \mathsf{fma}\left(\left(-0.25 \cdot \left(r \cdot r\right)\right) \cdot w, w, \frac{2}{r \cdot r}\right) \]
            6. Applied rewrites95.5%

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

            if 1.05e8 < r

            1. Initial program 89.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. Taylor expanded in r around inf

              \[\leadsto \left(\color{blue}{3} - \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. Step-by-step derivation
              1. Applied rewrites89.4%

                \[\leadsto \left(\color{blue}{3} - \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. Taylor expanded in v around inf

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

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

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

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

                  \[\leadsto \left(3 - \left(\frac{1}{4} \cdot \left(r \cdot r\right)\right) \cdot {w}^{2}\right) - \frac{9}{2} \]
                5. lift-*.f64N/A

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

                  \[\leadsto \left(3 - \left(\frac{1}{4} \cdot \left(r \cdot r\right)\right) \cdot \left(w \cdot \color{blue}{w}\right)\right) - \frac{9}{2} \]
                7. lift-*.f6476.6

                  \[\leadsto \left(3 - \left(0.25 \cdot \left(r \cdot r\right)\right) \cdot \left(w \cdot \color{blue}{w}\right)\right) - 4.5 \]
              4. Applied rewrites76.6%

                \[\leadsto \left(3 - \color{blue}{\left(0.25 \cdot \left(r \cdot r\right)\right) \cdot \left(w \cdot w\right)}\right) - 4.5 \]
              5. Step-by-step derivation
                1. lift-*.f64N/A

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

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

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

                  \[\leadsto \left(3 - \left(\frac{1}{4} \cdot {r}^{2}\right) \cdot \left(w \cdot w\right)\right) - \frac{9}{2} \]
                5. lift-*.f64N/A

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

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

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

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

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

                  \[\leadsto \left(3 - {\left(r \cdot w\right)}^{2} \cdot \frac{1}{4}\right) - \frac{9}{2} \]
                11. pow2N/A

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

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

                  \[\leadsto \left(3 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot \frac{1}{4}\right) - \frac{9}{2} \]
                14. lower-*.f6489.3

                  \[\leadsto \left(3 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.25\right) - 4.5 \]
              6. Applied rewrites89.3%

                \[\leadsto \left(3 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot \color{blue}{0.25}\right) - 4.5 \]
              7. Step-by-step derivation
                1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \left(3 - r \cdot \left(w \cdot \left(\left(w \cdot r\right) \cdot \frac{1}{4}\right)\right)\right) - \frac{9}{2} \]
                13. lower-*.f6489.4

                  \[\leadsto \left(3 - r \cdot \left(w \cdot \left(\left(w \cdot r\right) \cdot 0.25\right)\right)\right) - 4.5 \]
              8. Applied rewrites89.4%

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

            Alternative 7: 91.4% accurate, 0.7× speedup?

            \[\begin{array}{l} r_m = \left|r\right| \\ \begin{array}{l} t_0 := \frac{2}{r\_m \cdot r\_m}\\ \mathbf{if}\;\left(\left(3 + t\_0\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\_m\right) \cdot r\_m\right)}{1 - v}\right) - 4.5 \leq -1:\\ \;\;\;\;\left(3 - \left(\left(r\_m \cdot w\right) \cdot \left(r\_m \cdot w\right)\right) \cdot 0.25\right) - 4.5\\ \mathbf{else}:\\ \;\;\;\;t\_0 - 1.5\\ \end{array} \end{array} \]
            r_m = (fabs.f64 r)
            (FPCore (v w r_m)
             :precision binary64
             (let* ((t_0 (/ 2.0 (* r_m r_m))))
               (if (<=
                    (-
                     (-
                      (+ 3.0 t_0)
                      (/
                       (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r_m) r_m))
                       (- 1.0 v)))
                     4.5)
                    -1.0)
                 (- (- 3.0 (* (* (* r_m w) (* r_m w)) 0.25)) 4.5)
                 (- t_0 1.5))))
            r_m = fabs(r);
            double code(double v, double w, double r_m) {
            	double t_0 = 2.0 / (r_m * r_m);
            	double tmp;
            	if ((((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r_m) * r_m)) / (1.0 - v))) - 4.5) <= -1.0) {
            		tmp = (3.0 - (((r_m * w) * (r_m * w)) * 0.25)) - 4.5;
            	} else {
            		tmp = t_0 - 1.5;
            	}
            	return tmp;
            }
            
            r_m =     private
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(v, w, r_m)
            use fmin_fmax_functions
                real(8), intent (in) :: v
                real(8), intent (in) :: w
                real(8), intent (in) :: r_m
                real(8) :: t_0
                real(8) :: tmp
                t_0 = 2.0d0 / (r_m * r_m)
                if ((((3.0d0 + t_0) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r_m) * r_m)) / (1.0d0 - v))) - 4.5d0) <= (-1.0d0)) then
                    tmp = (3.0d0 - (((r_m * w) * (r_m * w)) * 0.25d0)) - 4.5d0
                else
                    tmp = t_0 - 1.5d0
                end if
                code = tmp
            end function
            
            r_m = Math.abs(r);
            public static double code(double v, double w, double r_m) {
            	double t_0 = 2.0 / (r_m * r_m);
            	double tmp;
            	if ((((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r_m) * r_m)) / (1.0 - v))) - 4.5) <= -1.0) {
            		tmp = (3.0 - (((r_m * w) * (r_m * w)) * 0.25)) - 4.5;
            	} else {
            		tmp = t_0 - 1.5;
            	}
            	return tmp;
            }
            
            r_m = math.fabs(r)
            def code(v, w, r_m):
            	t_0 = 2.0 / (r_m * r_m)
            	tmp = 0
            	if (((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r_m) * r_m)) / (1.0 - v))) - 4.5) <= -1.0:
            		tmp = (3.0 - (((r_m * w) * (r_m * w)) * 0.25)) - 4.5
            	else:
            		tmp = t_0 - 1.5
            	return tmp
            
            r_m = abs(r)
            function code(v, w, r_m)
            	t_0 = Float64(2.0 / Float64(r_m * r_m))
            	tmp = 0.0
            	if (Float64(Float64(Float64(3.0 + t_0) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r_m) * r_m)) / Float64(1.0 - v))) - 4.5) <= -1.0)
            		tmp = Float64(Float64(3.0 - Float64(Float64(Float64(r_m * w) * Float64(r_m * w)) * 0.25)) - 4.5);
            	else
            		tmp = Float64(t_0 - 1.5);
            	end
            	return tmp
            end
            
            r_m = abs(r);
            function tmp_2 = code(v, w, r_m)
            	t_0 = 2.0 / (r_m * r_m);
            	tmp = 0.0;
            	if ((((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r_m) * r_m)) / (1.0 - v))) - 4.5) <= -1.0)
            		tmp = (3.0 - (((r_m * w) * (r_m * w)) * 0.25)) - 4.5;
            	else
            		tmp = t_0 - 1.5;
            	end
            	tmp_2 = tmp;
            end
            
            r_m = N[Abs[r], $MachinePrecision]
            code[v_, w_, r$95$m_] := Block[{t$95$0 = N[(2.0 / N[(r$95$m * r$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r$95$m), $MachinePrecision] * r$95$m), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], -1.0], N[(N[(3.0 - N[(N[(N[(r$95$m * w), $MachinePrecision] * N[(r$95$m * w), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(t$95$0 - 1.5), $MachinePrecision]]]
            
            \begin{array}{l}
            r_m = \left|r\right|
            
            \\
            \begin{array}{l}
            t_0 := \frac{2}{r\_m \cdot r\_m}\\
            \mathbf{if}\;\left(\left(3 + t\_0\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\_m\right) \cdot r\_m\right)}{1 - v}\right) - 4.5 \leq -1:\\
            \;\;\;\;\left(3 - \left(\left(r\_m \cdot w\right) \cdot \left(r\_m \cdot w\right)\right) \cdot 0.25\right) - 4.5\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0 - 1.5\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (-.f64 (-.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))) #s(literal 9/2 binary64)) < -1

              1. Initial program 85.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. Taylor expanded in r around inf

                \[\leadsto \left(\color{blue}{3} - \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. Step-by-step derivation
                1. Applied rewrites84.5%

                  \[\leadsto \left(\color{blue}{3} - \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. Taylor expanded in v around inf

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

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

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

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

                    \[\leadsto \left(3 - \left(\frac{1}{4} \cdot \left(r \cdot r\right)\right) \cdot {w}^{2}\right) - \frac{9}{2} \]
                  5. lift-*.f64N/A

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

                    \[\leadsto \left(3 - \left(\frac{1}{4} \cdot \left(r \cdot r\right)\right) \cdot \left(w \cdot \color{blue}{w}\right)\right) - \frac{9}{2} \]
                  7. lift-*.f6473.0

                    \[\leadsto \left(3 - \left(0.25 \cdot \left(r \cdot r\right)\right) \cdot \left(w \cdot \color{blue}{w}\right)\right) - 4.5 \]
                4. Applied rewrites73.0%

                  \[\leadsto \left(3 - \color{blue}{\left(0.25 \cdot \left(r \cdot r\right)\right) \cdot \left(w \cdot w\right)}\right) - 4.5 \]
                5. Step-by-step derivation
                  1. lift-*.f64N/A

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

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

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

                    \[\leadsto \left(3 - \left(\frac{1}{4} \cdot {r}^{2}\right) \cdot \left(w \cdot w\right)\right) - \frac{9}{2} \]
                  5. lift-*.f64N/A

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

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

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

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

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

                    \[\leadsto \left(3 - {\left(r \cdot w\right)}^{2} \cdot \frac{1}{4}\right) - \frac{9}{2} \]
                  11. pow2N/A

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

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

                    \[\leadsto \left(3 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot \frac{1}{4}\right) - \frac{9}{2} \]
                  14. lower-*.f6485.4

                    \[\leadsto \left(3 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.25\right) - 4.5 \]
                6. Applied rewrites85.4%

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

                if -1 < (-.f64 (-.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))) #s(literal 9/2 binary64))

                1. Initial program 86.2%

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

                  \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}} \]
                3. Applied rewrites99.7%

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

              Alternative 8: 90.8% accurate, 0.7× speedup?

              \[\begin{array}{l} r_m = \left|r\right| \\ \begin{array}{l} t_0 := \frac{2}{r\_m \cdot r\_m}\\ \mathbf{if}\;\left(\left(3 + t\_0\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\_m\right) \cdot r\_m\right)}{1 - v}\right) - 4.5 \leq -1:\\ \;\;\;\;\left(3 - r\_m \cdot \left(w \cdot \left(\left(w \cdot r\_m\right) \cdot 0.25\right)\right)\right) - 4.5\\ \mathbf{else}:\\ \;\;\;\;t\_0 - 1.5\\ \end{array} \end{array} \]
              r_m = (fabs.f64 r)
              (FPCore (v w r_m)
               :precision binary64
               (let* ((t_0 (/ 2.0 (* r_m r_m))))
                 (if (<=
                      (-
                       (-
                        (+ 3.0 t_0)
                        (/
                         (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r_m) r_m))
                         (- 1.0 v)))
                       4.5)
                      -1.0)
                   (- (- 3.0 (* r_m (* w (* (* w r_m) 0.25)))) 4.5)
                   (- t_0 1.5))))
              r_m = fabs(r);
              double code(double v, double w, double r_m) {
              	double t_0 = 2.0 / (r_m * r_m);
              	double tmp;
              	if ((((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r_m) * r_m)) / (1.0 - v))) - 4.5) <= -1.0) {
              		tmp = (3.0 - (r_m * (w * ((w * r_m) * 0.25)))) - 4.5;
              	} else {
              		tmp = t_0 - 1.5;
              	}
              	return tmp;
              }
              
              r_m =     private
              module fmin_fmax_functions
                  implicit none
                  private
                  public fmax
                  public fmin
              
                  interface fmax
                      module procedure fmax88
                      module procedure fmax44
                      module procedure fmax84
                      module procedure fmax48
                  end interface
                  interface fmin
                      module procedure fmin88
                      module procedure fmin44
                      module procedure fmin84
                      module procedure fmin48
                  end interface
              contains
                  real(8) function fmax88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmax44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmax84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmax48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                  end function
                  real(8) function fmin88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmin44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmin84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmin48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                  end function
              end module
              
              real(8) function code(v, w, r_m)
              use fmin_fmax_functions
                  real(8), intent (in) :: v
                  real(8), intent (in) :: w
                  real(8), intent (in) :: r_m
                  real(8) :: t_0
                  real(8) :: tmp
                  t_0 = 2.0d0 / (r_m * r_m)
                  if ((((3.0d0 + t_0) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r_m) * r_m)) / (1.0d0 - v))) - 4.5d0) <= (-1.0d0)) then
                      tmp = (3.0d0 - (r_m * (w * ((w * r_m) * 0.25d0)))) - 4.5d0
                  else
                      tmp = t_0 - 1.5d0
                  end if
                  code = tmp
              end function
              
              r_m = Math.abs(r);
              public static double code(double v, double w, double r_m) {
              	double t_0 = 2.0 / (r_m * r_m);
              	double tmp;
              	if ((((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r_m) * r_m)) / (1.0 - v))) - 4.5) <= -1.0) {
              		tmp = (3.0 - (r_m * (w * ((w * r_m) * 0.25)))) - 4.5;
              	} else {
              		tmp = t_0 - 1.5;
              	}
              	return tmp;
              }
              
              r_m = math.fabs(r)
              def code(v, w, r_m):
              	t_0 = 2.0 / (r_m * r_m)
              	tmp = 0
              	if (((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r_m) * r_m)) / (1.0 - v))) - 4.5) <= -1.0:
              		tmp = (3.0 - (r_m * (w * ((w * r_m) * 0.25)))) - 4.5
              	else:
              		tmp = t_0 - 1.5
              	return tmp
              
              r_m = abs(r)
              function code(v, w, r_m)
              	t_0 = Float64(2.0 / Float64(r_m * r_m))
              	tmp = 0.0
              	if (Float64(Float64(Float64(3.0 + t_0) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r_m) * r_m)) / Float64(1.0 - v))) - 4.5) <= -1.0)
              		tmp = Float64(Float64(3.0 - Float64(r_m * Float64(w * Float64(Float64(w * r_m) * 0.25)))) - 4.5);
              	else
              		tmp = Float64(t_0 - 1.5);
              	end
              	return tmp
              end
              
              r_m = abs(r);
              function tmp_2 = code(v, w, r_m)
              	t_0 = 2.0 / (r_m * r_m);
              	tmp = 0.0;
              	if ((((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r_m) * r_m)) / (1.0 - v))) - 4.5) <= -1.0)
              		tmp = (3.0 - (r_m * (w * ((w * r_m) * 0.25)))) - 4.5;
              	else
              		tmp = t_0 - 1.5;
              	end
              	tmp_2 = tmp;
              end
              
              r_m = N[Abs[r], $MachinePrecision]
              code[v_, w_, r$95$m_] := Block[{t$95$0 = N[(2.0 / N[(r$95$m * r$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r$95$m), $MachinePrecision] * r$95$m), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], -1.0], N[(N[(3.0 - N[(r$95$m * N[(w * N[(N[(w * r$95$m), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(t$95$0 - 1.5), $MachinePrecision]]]
              
              \begin{array}{l}
              r_m = \left|r\right|
              
              \\
              \begin{array}{l}
              t_0 := \frac{2}{r\_m \cdot r\_m}\\
              \mathbf{if}\;\left(\left(3 + t\_0\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\_m\right) \cdot r\_m\right)}{1 - v}\right) - 4.5 \leq -1:\\
              \;\;\;\;\left(3 - r\_m \cdot \left(w \cdot \left(\left(w \cdot r\_m\right) \cdot 0.25\right)\right)\right) - 4.5\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_0 - 1.5\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (-.f64 (-.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))) #s(literal 9/2 binary64)) < -1

                1. Initial program 85.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. Taylor expanded in r around inf

                  \[\leadsto \left(\color{blue}{3} - \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. Step-by-step derivation
                  1. Applied rewrites84.5%

                    \[\leadsto \left(\color{blue}{3} - \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. Taylor expanded in v around inf

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

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

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

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

                      \[\leadsto \left(3 - \left(\frac{1}{4} \cdot \left(r \cdot r\right)\right) \cdot {w}^{2}\right) - \frac{9}{2} \]
                    5. lift-*.f64N/A

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

                      \[\leadsto \left(3 - \left(\frac{1}{4} \cdot \left(r \cdot r\right)\right) \cdot \left(w \cdot \color{blue}{w}\right)\right) - \frac{9}{2} \]
                    7. lift-*.f6473.0

                      \[\leadsto \left(3 - \left(0.25 \cdot \left(r \cdot r\right)\right) \cdot \left(w \cdot \color{blue}{w}\right)\right) - 4.5 \]
                  4. Applied rewrites73.0%

                    \[\leadsto \left(3 - \color{blue}{\left(0.25 \cdot \left(r \cdot r\right)\right) \cdot \left(w \cdot w\right)}\right) - 4.5 \]
                  5. Step-by-step derivation
                    1. lift-*.f64N/A

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

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

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

                      \[\leadsto \left(3 - \left(\frac{1}{4} \cdot {r}^{2}\right) \cdot \left(w \cdot w\right)\right) - \frac{9}{2} \]
                    5. lift-*.f64N/A

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

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

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

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

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

                      \[\leadsto \left(3 - {\left(r \cdot w\right)}^{2} \cdot \frac{1}{4}\right) - \frac{9}{2} \]
                    11. pow2N/A

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

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

                      \[\leadsto \left(3 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot \frac{1}{4}\right) - \frac{9}{2} \]
                    14. lower-*.f6485.4

                      \[\leadsto \left(3 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.25\right) - 4.5 \]
                  6. Applied rewrites85.4%

                    \[\leadsto \left(3 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot \color{blue}{0.25}\right) - 4.5 \]
                  7. Step-by-step derivation
                    1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \left(3 - r \cdot \left(w \cdot \left(\left(w \cdot r\right) \cdot \frac{1}{4}\right)\right)\right) - \frac{9}{2} \]
                    13. lower-*.f6484.5

                      \[\leadsto \left(3 - r \cdot \left(w \cdot \left(\left(w \cdot r\right) \cdot 0.25\right)\right)\right) - 4.5 \]
                  8. Applied rewrites84.5%

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

                  if -1 < (-.f64 (-.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))) #s(literal 9/2 binary64))

                  1. Initial program 86.2%

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

                    \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}} \]
                  3. Applied rewrites99.7%

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

                Alternative 9: 88.5% accurate, 0.7× speedup?

                \[\begin{array}{l} r_m = \left|r\right| \\ \begin{array}{l} t_0 := \left(w \cdot w\right) \cdot r\_m\\ t_1 := \frac{2}{r\_m \cdot r\_m}\\ \mathbf{if}\;\left(\left(3 + t\_1\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(t\_0 \cdot r\_m\right)}{1 - v}\right) - 4.5 \leq -5 \cdot 10^{+47}:\\ \;\;\;\;\left(-0.25 \cdot r\_m\right) \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1 - 1.5\\ \end{array} \end{array} \]
                r_m = (fabs.f64 r)
                (FPCore (v w r_m)
                 :precision binary64
                 (let* ((t_0 (* (* w w) r_m)) (t_1 (/ 2.0 (* r_m r_m))))
                   (if (<=
                        (-
                         (-
                          (+ 3.0 t_1)
                          (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* t_0 r_m)) (- 1.0 v)))
                         4.5)
                        -5e+47)
                     (* (* -0.25 r_m) t_0)
                     (- t_1 1.5))))
                r_m = fabs(r);
                double code(double v, double w, double r_m) {
                	double t_0 = (w * w) * r_m;
                	double t_1 = 2.0 / (r_m * r_m);
                	double tmp;
                	if ((((3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * (t_0 * r_m)) / (1.0 - v))) - 4.5) <= -5e+47) {
                		tmp = (-0.25 * r_m) * t_0;
                	} else {
                		tmp = t_1 - 1.5;
                	}
                	return tmp;
                }
                
                r_m =     private
                module fmin_fmax_functions
                    implicit none
                    private
                    public fmax
                    public fmin
                
                    interface fmax
                        module procedure fmax88
                        module procedure fmax44
                        module procedure fmax84
                        module procedure fmax48
                    end interface
                    interface fmin
                        module procedure fmin88
                        module procedure fmin44
                        module procedure fmin84
                        module procedure fmin48
                    end interface
                contains
                    real(8) function fmax88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmax44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmax84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmax48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                    end function
                    real(8) function fmin88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmin44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmin84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmin48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                    end function
                end module
                
                real(8) function code(v, w, r_m)
                use fmin_fmax_functions
                    real(8), intent (in) :: v
                    real(8), intent (in) :: w
                    real(8), intent (in) :: r_m
                    real(8) :: t_0
                    real(8) :: t_1
                    real(8) :: tmp
                    t_0 = (w * w) * r_m
                    t_1 = 2.0d0 / (r_m * r_m)
                    if ((((3.0d0 + t_1) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (t_0 * r_m)) / (1.0d0 - v))) - 4.5d0) <= (-5d+47)) then
                        tmp = ((-0.25d0) * r_m) * t_0
                    else
                        tmp = t_1 - 1.5d0
                    end if
                    code = tmp
                end function
                
                r_m = Math.abs(r);
                public static double code(double v, double w, double r_m) {
                	double t_0 = (w * w) * r_m;
                	double t_1 = 2.0 / (r_m * r_m);
                	double tmp;
                	if ((((3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * (t_0 * r_m)) / (1.0 - v))) - 4.5) <= -5e+47) {
                		tmp = (-0.25 * r_m) * t_0;
                	} else {
                		tmp = t_1 - 1.5;
                	}
                	return tmp;
                }
                
                r_m = math.fabs(r)
                def code(v, w, r_m):
                	t_0 = (w * w) * r_m
                	t_1 = 2.0 / (r_m * r_m)
                	tmp = 0
                	if (((3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * (t_0 * r_m)) / (1.0 - v))) - 4.5) <= -5e+47:
                		tmp = (-0.25 * r_m) * t_0
                	else:
                		tmp = t_1 - 1.5
                	return tmp
                
                r_m = abs(r)
                function code(v, w, r_m)
                	t_0 = Float64(Float64(w * w) * r_m)
                	t_1 = Float64(2.0 / Float64(r_m * r_m))
                	tmp = 0.0
                	if (Float64(Float64(Float64(3.0 + t_1) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(t_0 * r_m)) / Float64(1.0 - v))) - 4.5) <= -5e+47)
                		tmp = Float64(Float64(-0.25 * r_m) * t_0);
                	else
                		tmp = Float64(t_1 - 1.5);
                	end
                	return tmp
                end
                
                r_m = abs(r);
                function tmp_2 = code(v, w, r_m)
                	t_0 = (w * w) * r_m;
                	t_1 = 2.0 / (r_m * r_m);
                	tmp = 0.0;
                	if ((((3.0 + t_1) - (((0.125 * (3.0 - (2.0 * v))) * (t_0 * r_m)) / (1.0 - v))) - 4.5) <= -5e+47)
                		tmp = (-0.25 * r_m) * t_0;
                	else
                		tmp = t_1 - 1.5;
                	end
                	tmp_2 = tmp;
                end
                
                r_m = N[Abs[r], $MachinePrecision]
                code[v_, w_, r$95$m_] := Block[{t$95$0 = N[(N[(w * w), $MachinePrecision] * r$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r$95$m * r$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(3.0 + t$95$1), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * r$95$m), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], -5e+47], N[(N[(-0.25 * r$95$m), $MachinePrecision] * t$95$0), $MachinePrecision], N[(t$95$1 - 1.5), $MachinePrecision]]]]
                
                \begin{array}{l}
                r_m = \left|r\right|
                
                \\
                \begin{array}{l}
                t_0 := \left(w \cdot w\right) \cdot r\_m\\
                t_1 := \frac{2}{r\_m \cdot r\_m}\\
                \mathbf{if}\;\left(\left(3 + t\_1\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(t\_0 \cdot r\_m\right)}{1 - v}\right) - 4.5 \leq -5 \cdot 10^{+47}:\\
                \;\;\;\;\left(-0.25 \cdot r\_m\right) \cdot t\_0\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_1 - 1.5\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if (-.f64 (-.f64 (+.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))) #s(literal 9/2 binary64)) < -5.00000000000000022e47

                  1. Initial program 85.6%

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

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

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

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

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

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

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

                      \[\leadsto \left(\frac{-1}{4} \cdot r\right) \cdot \left(r \cdot \left(w \cdot w\right)\right) \]
                    6. associate-*l*N/A

                      \[\leadsto \left(\frac{-1}{4} \cdot r\right) \cdot \left(\left(r \cdot w\right) \cdot w\right) \]
                    7. *-commutativeN/A

                      \[\leadsto \left(\frac{-1}{4} \cdot r\right) \cdot \left(\left(w \cdot r\right) \cdot w\right) \]
                    8. lift-*.f64N/A

                      \[\leadsto \left(\frac{-1}{4} \cdot r\right) \cdot \left(\left(w \cdot r\right) \cdot w\right) \]
                    9. lift-*.f64N/A

                      \[\leadsto \left(\frac{-1}{4} \cdot r\right) \cdot \left(\left(w \cdot r\right) \cdot w\right) \]
                    10. lower-*.f64N/A

                      \[\leadsto \left(\frac{-1}{4} \cdot r\right) \cdot \left(\left(w \cdot r\right) \cdot \color{blue}{w}\right) \]
                    11. lower-*.f6482.9

                      \[\leadsto \left(-0.25 \cdot r\right) \cdot \left(\left(w \cdot r\right) \cdot w\right) \]
                    12. lift-*.f64N/A

                      \[\leadsto \left(\frac{-1}{4} \cdot r\right) \cdot \left(\left(w \cdot r\right) \cdot w\right) \]
                    13. lift-*.f64N/A

                      \[\leadsto \left(\frac{-1}{4} \cdot r\right) \cdot \left(\left(w \cdot r\right) \cdot w\right) \]
                    14. *-commutativeN/A

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

                      \[\leadsto \left(\frac{-1}{4} \cdot r\right) \cdot \left(\left(w \cdot w\right) \cdot r\right) \]
                    16. lift-*.f64N/A

                      \[\leadsto \left(\frac{-1}{4} \cdot r\right) \cdot \left(\left(w \cdot w\right) \cdot r\right) \]
                    17. lift-*.f6481.9

                      \[\leadsto \left(-0.25 \cdot r\right) \cdot \left(\left(w \cdot w\right) \cdot r\right) \]
                  6. Applied rewrites81.9%

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

                  if -5.00000000000000022e47 < (-.f64 (-.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))) #s(literal 9/2 binary64))

                  1. Initial program 85.5%

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

                    \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}} \]
                  3. Applied rewrites93.1%

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

                Alternative 10: 57.2% accurate, 4.2× speedup?

                \[\begin{array}{l} r_m = \left|r\right| \\ \frac{2}{r\_m \cdot r\_m} - 1.5 \end{array} \]
                r_m = (fabs.f64 r)
                (FPCore (v w r_m) :precision binary64 (- (/ 2.0 (* r_m r_m)) 1.5))
                r_m = fabs(r);
                double code(double v, double w, double r_m) {
                	return (2.0 / (r_m * r_m)) - 1.5;
                }
                
                r_m =     private
                module fmin_fmax_functions
                    implicit none
                    private
                    public fmax
                    public fmin
                
                    interface fmax
                        module procedure fmax88
                        module procedure fmax44
                        module procedure fmax84
                        module procedure fmax48
                    end interface
                    interface fmin
                        module procedure fmin88
                        module procedure fmin44
                        module procedure fmin84
                        module procedure fmin48
                    end interface
                contains
                    real(8) function fmax88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmax44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmax84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmax48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                    end function
                    real(8) function fmin88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmin44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmin84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmin48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                    end function
                end module
                
                real(8) function code(v, w, r_m)
                use fmin_fmax_functions
                    real(8), intent (in) :: v
                    real(8), intent (in) :: w
                    real(8), intent (in) :: r_m
                    code = (2.0d0 / (r_m * r_m)) - 1.5d0
                end function
                
                r_m = Math.abs(r);
                public static double code(double v, double w, double r_m) {
                	return (2.0 / (r_m * r_m)) - 1.5;
                }
                
                r_m = math.fabs(r)
                def code(v, w, r_m):
                	return (2.0 / (r_m * r_m)) - 1.5
                
                r_m = abs(r)
                function code(v, w, r_m)
                	return Float64(Float64(2.0 / Float64(r_m * r_m)) - 1.5)
                end
                
                r_m = abs(r);
                function tmp = code(v, w, r_m)
                	tmp = (2.0 / (r_m * r_m)) - 1.5;
                end
                
                r_m = N[Abs[r], $MachinePrecision]
                code[v_, w_, r$95$m_] := N[(N[(2.0 / N[(r$95$m * r$95$m), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]
                
                \begin{array}{l}
                r_m = \left|r\right|
                
                \\
                \frac{2}{r\_m \cdot r\_m} - 1.5
                \end{array}
                
                Derivation
                1. Initial program 85.5%

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

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

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

                Alternative 11: 56.7% accurate, 3.6× speedup?

                \[\begin{array}{l} r_m = \left|r\right| \\ \begin{array}{l} \mathbf{if}\;r\_m \leq 1.15:\\ \;\;\;\;\frac{\frac{2}{r\_m}}{r\_m}\\ \mathbf{else}:\\ \;\;\;\;-1.5\\ \end{array} \end{array} \]
                r_m = (fabs.f64 r)
                (FPCore (v w r_m)
                 :precision binary64
                 (if (<= r_m 1.15) (/ (/ 2.0 r_m) r_m) -1.5))
                r_m = fabs(r);
                double code(double v, double w, double r_m) {
                	double tmp;
                	if (r_m <= 1.15) {
                		tmp = (2.0 / r_m) / r_m;
                	} else {
                		tmp = -1.5;
                	}
                	return tmp;
                }
                
                r_m =     private
                module fmin_fmax_functions
                    implicit none
                    private
                    public fmax
                    public fmin
                
                    interface fmax
                        module procedure fmax88
                        module procedure fmax44
                        module procedure fmax84
                        module procedure fmax48
                    end interface
                    interface fmin
                        module procedure fmin88
                        module procedure fmin44
                        module procedure fmin84
                        module procedure fmin48
                    end interface
                contains
                    real(8) function fmax88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmax44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmax84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmax48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                    end function
                    real(8) function fmin88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmin44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmin84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmin48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                    end function
                end module
                
                real(8) function code(v, w, r_m)
                use fmin_fmax_functions
                    real(8), intent (in) :: v
                    real(8), intent (in) :: w
                    real(8), intent (in) :: r_m
                    real(8) :: tmp
                    if (r_m <= 1.15d0) then
                        tmp = (2.0d0 / r_m) / r_m
                    else
                        tmp = -1.5d0
                    end if
                    code = tmp
                end function
                
                r_m = Math.abs(r);
                public static double code(double v, double w, double r_m) {
                	double tmp;
                	if (r_m <= 1.15) {
                		tmp = (2.0 / r_m) / r_m;
                	} else {
                		tmp = -1.5;
                	}
                	return tmp;
                }
                
                r_m = math.fabs(r)
                def code(v, w, r_m):
                	tmp = 0
                	if r_m <= 1.15:
                		tmp = (2.0 / r_m) / r_m
                	else:
                		tmp = -1.5
                	return tmp
                
                r_m = abs(r)
                function code(v, w, r_m)
                	tmp = 0.0
                	if (r_m <= 1.15)
                		tmp = Float64(Float64(2.0 / r_m) / r_m);
                	else
                		tmp = -1.5;
                	end
                	return tmp
                end
                
                r_m = abs(r);
                function tmp_2 = code(v, w, r_m)
                	tmp = 0.0;
                	if (r_m <= 1.15)
                		tmp = (2.0 / r_m) / r_m;
                	else
                		tmp = -1.5;
                	end
                	tmp_2 = tmp;
                end
                
                r_m = N[Abs[r], $MachinePrecision]
                code[v_, w_, r$95$m_] := If[LessEqual[r$95$m, 1.15], N[(N[(2.0 / r$95$m), $MachinePrecision] / r$95$m), $MachinePrecision], -1.5]
                
                \begin{array}{l}
                r_m = \left|r\right|
                
                \\
                \begin{array}{l}
                \mathbf{if}\;r\_m \leq 1.15:\\
                \;\;\;\;\frac{\frac{2}{r\_m}}{r\_m}\\
                
                \mathbf{else}:\\
                \;\;\;\;-1.5\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if r < 1.1499999999999999

                  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. Taylor expanded in r around 0

                    \[\leadsto \color{blue}{\frac{2}{{r}^{2}}} \]
                  3. Applied rewrites86.7%

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

                      \[\leadsto \frac{2}{r \cdot \color{blue}{r}} \]
                    2. lift-/.f64N/A

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

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

                      \[\leadsto \frac{\frac{2}{r}}{\color{blue}{r}} \]
                    5. lift-/.f6486.7

                      \[\leadsto \frac{\frac{2}{r}}{r} \]
                  5. Applied rewrites86.7%

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

                  if 1.1499999999999999 < r

                  1. Initial program 89.5%

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

                    \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}} \]
                  3. Applied rewrites27.7%

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

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

                      \[\leadsto -1.5 \]
                  6. Recombined 2 regimes into one program.
                  7. Add Preprocessing

                  Alternative 12: 56.7% accurate, 3.7× speedup?

                  \[\begin{array}{l} r_m = \left|r\right| \\ \begin{array}{l} \mathbf{if}\;r\_m \leq 1.15:\\ \;\;\;\;\frac{2}{r\_m \cdot r\_m}\\ \mathbf{else}:\\ \;\;\;\;-1.5\\ \end{array} \end{array} \]
                  r_m = (fabs.f64 r)
                  (FPCore (v w r_m)
                   :precision binary64
                   (if (<= r_m 1.15) (/ 2.0 (* r_m r_m)) -1.5))
                  r_m = fabs(r);
                  double code(double v, double w, double r_m) {
                  	double tmp;
                  	if (r_m <= 1.15) {
                  		tmp = 2.0 / (r_m * r_m);
                  	} else {
                  		tmp = -1.5;
                  	}
                  	return tmp;
                  }
                  
                  r_m =     private
                  module fmin_fmax_functions
                      implicit none
                      private
                      public fmax
                      public fmin
                  
                      interface fmax
                          module procedure fmax88
                          module procedure fmax44
                          module procedure fmax84
                          module procedure fmax48
                      end interface
                      interface fmin
                          module procedure fmin88
                          module procedure fmin44
                          module procedure fmin84
                          module procedure fmin48
                      end interface
                  contains
                      real(8) function fmax88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmax44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmax84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmax48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                      end function
                      real(8) function fmin88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmin44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmin84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmin48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                      end function
                  end module
                  
                  real(8) function code(v, w, r_m)
                  use fmin_fmax_functions
                      real(8), intent (in) :: v
                      real(8), intent (in) :: w
                      real(8), intent (in) :: r_m
                      real(8) :: tmp
                      if (r_m <= 1.15d0) then
                          tmp = 2.0d0 / (r_m * r_m)
                      else
                          tmp = -1.5d0
                      end if
                      code = tmp
                  end function
                  
                  r_m = Math.abs(r);
                  public static double code(double v, double w, double r_m) {
                  	double tmp;
                  	if (r_m <= 1.15) {
                  		tmp = 2.0 / (r_m * r_m);
                  	} else {
                  		tmp = -1.5;
                  	}
                  	return tmp;
                  }
                  
                  r_m = math.fabs(r)
                  def code(v, w, r_m):
                  	tmp = 0
                  	if r_m <= 1.15:
                  		tmp = 2.0 / (r_m * r_m)
                  	else:
                  		tmp = -1.5
                  	return tmp
                  
                  r_m = abs(r)
                  function code(v, w, r_m)
                  	tmp = 0.0
                  	if (r_m <= 1.15)
                  		tmp = Float64(2.0 / Float64(r_m * r_m));
                  	else
                  		tmp = -1.5;
                  	end
                  	return tmp
                  end
                  
                  r_m = abs(r);
                  function tmp_2 = code(v, w, r_m)
                  	tmp = 0.0;
                  	if (r_m <= 1.15)
                  		tmp = 2.0 / (r_m * r_m);
                  	else
                  		tmp = -1.5;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  r_m = N[Abs[r], $MachinePrecision]
                  code[v_, w_, r$95$m_] := If[LessEqual[r$95$m, 1.15], N[(2.0 / N[(r$95$m * r$95$m), $MachinePrecision]), $MachinePrecision], -1.5]
                  
                  \begin{array}{l}
                  r_m = \left|r\right|
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;r\_m \leq 1.15:\\
                  \;\;\;\;\frac{2}{r\_m \cdot r\_m}\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;-1.5\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if r < 1.1499999999999999

                    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. Taylor expanded in r around 0

                      \[\leadsto \color{blue}{\frac{2}{{r}^{2}}} \]
                    3. Applied rewrites86.7%

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

                    if 1.1499999999999999 < r

                    1. Initial program 89.5%

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

                      \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - \frac{3}{2}} \]
                    3. Applied rewrites27.7%

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

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

                        \[\leadsto -1.5 \]
                    6. Recombined 2 regimes into one program.
                    7. Add Preprocessing

                    Alternative 13: 14.3% accurate, 41.6× speedup?

                    \[\begin{array}{l} r_m = \left|r\right| \\ -1.5 \end{array} \]
                    r_m = (fabs.f64 r)
                    (FPCore (v w r_m) :precision binary64 -1.5)
                    r_m = fabs(r);
                    double code(double v, double w, double r_m) {
                    	return -1.5;
                    }
                    
                    r_m =     private
                    module fmin_fmax_functions
                        implicit none
                        private
                        public fmax
                        public fmin
                    
                        interface fmax
                            module procedure fmax88
                            module procedure fmax44
                            module procedure fmax84
                            module procedure fmax48
                        end interface
                        interface fmin
                            module procedure fmin88
                            module procedure fmin44
                            module procedure fmin84
                            module procedure fmin48
                        end interface
                    contains
                        real(8) function fmax88(x, y) result (res)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                        end function
                        real(4) function fmax44(x, y) result (res)
                            real(4), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                        end function
                        real(8) function fmax84(x, y) result(res)
                            real(8), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                        end function
                        real(8) function fmax48(x, y) result(res)
                            real(4), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                        end function
                        real(8) function fmin88(x, y) result (res)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                        end function
                        real(4) function fmin44(x, y) result (res)
                            real(4), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                        end function
                        real(8) function fmin84(x, y) result(res)
                            real(8), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                        end function
                        real(8) function fmin48(x, y) result(res)
                            real(4), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                        end function
                    end module
                    
                    real(8) function code(v, w, r_m)
                    use fmin_fmax_functions
                        real(8), intent (in) :: v
                        real(8), intent (in) :: w
                        real(8), intent (in) :: r_m
                        code = -1.5d0
                    end function
                    
                    r_m = Math.abs(r);
                    public static double code(double v, double w, double r_m) {
                    	return -1.5;
                    }
                    
                    r_m = math.fabs(r)
                    def code(v, w, r_m):
                    	return -1.5
                    
                    r_m = abs(r)
                    function code(v, w, r_m)
                    	return -1.5
                    end
                    
                    r_m = abs(r);
                    function tmp = code(v, w, r_m)
                    	tmp = -1.5;
                    end
                    
                    r_m = N[Abs[r], $MachinePrecision]
                    code[v_, w_, r$95$m_] := -1.5
                    
                    \begin{array}{l}
                    r_m = \left|r\right|
                    
                    \\
                    -1.5
                    \end{array}
                    
                    Derivation
                    1. Initial program 85.5%

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

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

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

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

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

                      Reproduce

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