Rosa's TurbineBenchmark

Percentage Accurate: 84.3% → 98.4%
Time: 5.3s
Alternatives: 13
Speedup: 1.8×

Specification

?
\[\begin{array}{l} \\ \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \end{array} \]
(FPCore (v w r)
 :precision binary64
 (-
  (-
   (+ 3.0 (/ 2.0 (* r r)))
   (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
  4.5))
double code(double v, double w, double r) {
	return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
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: 84.3% 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: 98.4% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_2 \leq -1:\\
\;\;\;\;\left(3 - \frac{t\_1 \cdot \left(\left(w \cdot \left(w \cdot r\right)\right) \cdot r\right)}{1 - v}\right) - 4.5\\

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {r}^{-2} \cdot 2 - \mathsf{fma}\left(\frac{1}{4}, \left(w \cdot r\right) \cdot \left(\color{blue}{w} \cdot r\right), \frac{3}{2}\right) \]
      6. lift-*.f6499.9

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 91.3%

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

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

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

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

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

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

      \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\color{blue}{\left(w \cdot \left(w \cdot r\right)\right)} \cdot r\right)}{1 - v}\right) - 4.5 \]
    5. 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(w \cdot \left(w \cdot r\right)\right) \cdot r\right)}{1 - v}\right) - \frac{9}{2} \]
    6. Step-by-step derivation
      1. Applied rewrites98.0%

        \[\leadsto \left(\color{blue}{3} - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(w \cdot \left(w \cdot r\right)\right) \cdot r\right)}{1 - v}\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.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto {r}^{-2} \cdot 2 - \mathsf{fma}\left(\frac{1}{4}, \left(w \cdot r\right) \cdot \left(\color{blue}{w} \cdot r\right), \frac{3}{2}\right) \]
        6. lift-*.f64100.0

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{2}{r \cdot r} - \mathsf{fma}\left(\color{blue}{\frac{1}{4}}, \left(w \cdot r\right) \cdot \left(w \cdot r\right), \frac{3}{2}\right) \]
        10. lift-*.f6499.7

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

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

        \[\leadsto \frac{2}{r \cdot r} - \frac{3}{2} \]
      11. Step-by-step derivation
        1. Applied rewrites99.7%

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

      Alternative 2: 98.0% accurate, 0.2× speedup?

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

        1. Initial program 81.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto {r}^{-2} \cdot 2 - \mathsf{fma}\left(\frac{1}{4}, \frac{1}{{\left(w \cdot r\right)}^{\color{blue}{-2}}}, \frac{3}{2}\right) \]
          7. lift-*.f64100.0

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

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

        1. Initial program 88.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 3: 98.4% accurate, 0.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto {r}^{-2} \cdot 2 - \mathsf{fma}\left(\frac{1}{4}, \left(w \cdot r\right) \cdot \left(\color{blue}{w} \cdot r\right), \frac{3}{2}\right) \]
          6. lift-*.f6499.9

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        1. Initial program 91.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \color{blue}{\left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)}}{1 - v}\right) - 4.5 \]
        5. 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(r \cdot w\right) \cdot \left(r \cdot w\right)\right)}{1 - v}\right) - \frac{9}{2} \]
        6. Step-by-step derivation
          1. Applied rewrites97.9%

            \[\leadsto \left(\color{blue}{3} - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)}{1 - v}\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.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto {r}^{-2} \cdot 2 - \mathsf{fma}\left(\frac{1}{4}, \left(w \cdot r\right) \cdot \left(\color{blue}{w} \cdot r\right), \frac{3}{2}\right) \]
            6. lift-*.f64100.0

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{2}{r \cdot r} - \mathsf{fma}\left(\color{blue}{\frac{1}{4}}, \left(w \cdot r\right) \cdot \left(w \cdot r\right), \frac{3}{2}\right) \]
            10. lift-*.f6499.7

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

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

            \[\leadsto \frac{2}{r \cdot r} - \frac{3}{2} \]
          11. Step-by-step derivation
            1. Applied rewrites99.7%

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

          Alternative 4: 98.0% accurate, 0.3× speedup?

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

            1. Initial program 81.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto {r}^{-2} \cdot 2 - \mathsf{fma}\left(\frac{1}{4}, \left(w \cdot r\right) \cdot \left(\color{blue}{w} \cdot r\right), \frac{3}{2}\right) \]
              6. lift-*.f6499.9

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

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

            1. Initial program 88.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 5: 98.4% accurate, 0.4× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto {r}^{-2} \cdot 2 - \mathsf{fma}\left(\frac{1}{4}, \left(w \cdot r\right) \cdot \left(\color{blue}{w} \cdot r\right), \frac{3}{2}\right) \]
              6. lift-*.f6499.9

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            1. Initial program 91.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \color{blue}{\left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)}}{1 - v}\right) - 4.5 \]
            5. 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(r \cdot w\right) \cdot \left(r \cdot w\right)\right)}{1 - v}\right) - \frac{9}{2} \]
            6. Step-by-step derivation
              1. Applied rewrites97.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto {r}^{-2} \cdot 2 - \mathsf{fma}\left(\frac{1}{4}, \left(w \cdot r\right) \cdot \left(\color{blue}{w} \cdot r\right), \frac{3}{2}\right) \]
                6. lift-*.f64100.0

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{2}{r \cdot r} - \mathsf{fma}\left(\color{blue}{\frac{1}{4}}, \left(w \cdot r\right) \cdot \left(w \cdot r\right), \frac{3}{2}\right) \]
                10. lift-*.f6499.7

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

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

                \[\leadsto \frac{2}{r \cdot r} - \frac{3}{2} \]
              11. Step-by-step derivation
                1. Applied rewrites99.7%

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

              Alternative 6: 98.0% accurate, 0.5× speedup?

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

                1. Initial program 81.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto {r}^{-2} \cdot 2 - \mathsf{fma}\left(\frac{1}{4}, \left(w \cdot r\right) \cdot \left(\color{blue}{w} \cdot r\right), \frac{3}{2}\right) \]
                  6. lift-*.f6499.9

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                1. Initial program 88.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 7: 98.0% accurate, 0.5× speedup?

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

                1. Initial program 81.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto {r}^{-2} \cdot 2 - \mathsf{fma}\left(\frac{1}{4}, \left(w \cdot r\right) \cdot \left(\color{blue}{w} \cdot r\right), \frac{3}{2}\right) \]
                  6. lift-*.f6499.9

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                1. Initial program 88.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 8: 72.6% accurate, 0.7× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ \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\right) \cdot r\right)}{1 - v}\right) - 4.5 \leq -1 \cdot 10^{+161}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(r \cdot r, -1.5, 2\right)}{r}}{r}\\ \mathbf{else}:\\ \;\;\;\;t\_0 - 1.5\\ \end{array} \end{array} \]
              (FPCore (v w r)
               :precision binary64
               (let* ((t_0 (/ 2.0 (* r r))))
                 (if (<=
                      (-
                       (-
                        (+ 3.0 t_0)
                        (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
                       4.5)
                      -1e+161)
                   (/ (/ (fma (* r r) -1.5 2.0) r) r)
                   (- t_0 1.5))))
              double code(double v, double w, double r) {
              	double t_0 = 2.0 / (r * r);
              	double tmp;
              	if ((((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -1e+161) {
              		tmp = (fma((r * r), -1.5, 2.0) / r) / r;
              	} else {
              		tmp = t_0 - 1.5;
              	}
              	return tmp;
              }
              
              function code(v, w, r)
              	t_0 = Float64(2.0 / Float64(r * r))
              	tmp = 0.0
              	if (Float64(Float64(Float64(3.0 + t_0) - 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) <= -1e+161)
              		tmp = Float64(Float64(fma(Float64(r * r), -1.5, 2.0) / r) / r);
              	else
              		tmp = Float64(t_0 - 1.5);
              	end
              	return tmp
              end
              
              code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, 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), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], -1e+161], N[(N[(N[(N[(r * r), $MachinePrecision] * -1.5 + 2.0), $MachinePrecision] / r), $MachinePrecision] / r), $MachinePrecision], N[(t$95$0 - 1.5), $MachinePrecision]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \frac{2}{r \cdot r}\\
              \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\right) \cdot r\right)}{1 - v}\right) - 4.5 \leq -1 \cdot 10^{+161}:\\
              \;\;\;\;\frac{\frac{\mathsf{fma}\left(r \cdot r, -1.5, 2\right)}{r}}{r}\\
              
              \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)) < -1e161

                1. Initial program 83.6%

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

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

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

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

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

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

                    \[\leadsto \frac{\mathsf{fma}\left(\frac{-3}{2}, r \cdot r, 2\right)}{{r}^{2}} \]
                  6. pow2N/A

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

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

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

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

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

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

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

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

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

                    \[\leadsto \frac{\frac{\frac{-3}{2} \cdot \left(r \cdot r\right) + 2}{r}}{r} \]
                  8. pow2N/A

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

                    \[\leadsto \frac{\frac{{r}^{2} \cdot \frac{-3}{2} + 2}{r}}{r} \]
                  10. lower-fma.f64N/A

                    \[\leadsto \frac{\frac{\mathsf{fma}\left({r}^{2}, \frac{-3}{2}, 2\right)}{r}}{r} \]
                  11. pow2N/A

                    \[\leadsto \frac{\frac{\mathsf{fma}\left(r \cdot r, \frac{-3}{2}, 2\right)}{r}}{r} \]
                  12. lift-*.f6447.6

                    \[\leadsto \frac{\frac{\mathsf{fma}\left(r \cdot r, -1.5, 2\right)}{r}}{r} \]
                7. Applied rewrites47.6%

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

                if -1e161 < (-.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 87.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto {r}^{-2} \cdot 2 - \mathsf{fma}\left(\frac{1}{4}, \left(w \cdot r\right) \cdot \left(\color{blue}{w} \cdot r\right), \frac{3}{2}\right) \]
                  6. lift-*.f6496.3

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{2}{r \cdot r} - \frac{3}{2} \]
                11. Step-by-step derivation
                  1. Applied rewrites90.4%

                    \[\leadsto \frac{2}{r \cdot r} - 1.5 \]
                12. Recombined 2 regimes into one program.
                13. Add Preprocessing

                Alternative 9: 71.1% accurate, 0.7× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ \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\right) \cdot r\right)}{1 - v}\right) - 4.5 \leq -1 \cdot 10^{+129}:\\ \;\;\;\;\frac{\frac{\left(r \cdot r\right) \cdot -1.5}{r}}{r}\\ \mathbf{else}:\\ \;\;\;\;t\_0 - 1.5\\ \end{array} \end{array} \]
                (FPCore (v w r)
                 :precision binary64
                 (let* ((t_0 (/ 2.0 (* r r))))
                   (if (<=
                        (-
                         (-
                          (+ 3.0 t_0)
                          (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
                         4.5)
                        -1e+129)
                     (/ (/ (* (* r r) -1.5) r) r)
                     (- t_0 1.5))))
                double code(double v, double w, double r) {
                	double t_0 = 2.0 / (r * r);
                	double tmp;
                	if ((((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -1e+129) {
                		tmp = (((r * r) * -1.5) / r) / r;
                	} else {
                		tmp = t_0 - 1.5;
                	}
                	return tmp;
                }
                
                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
                    real(8) :: t_0
                    real(8) :: tmp
                    t_0 = 2.0d0 / (r * r)
                    if ((((3.0d0 + t_0) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0) <= (-1d+129)) then
                        tmp = (((r * r) * (-1.5d0)) / r) / r
                    else
                        tmp = t_0 - 1.5d0
                    end if
                    code = tmp
                end function
                
                public static double code(double v, double w, double r) {
                	double t_0 = 2.0 / (r * r);
                	double tmp;
                	if ((((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -1e+129) {
                		tmp = (((r * r) * -1.5) / r) / r;
                	} else {
                		tmp = t_0 - 1.5;
                	}
                	return tmp;
                }
                
                def code(v, w, r):
                	t_0 = 2.0 / (r * r)
                	tmp = 0
                	if (((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -1e+129:
                		tmp = (((r * r) * -1.5) / r) / r
                	else:
                		tmp = t_0 - 1.5
                	return tmp
                
                function code(v, w, r)
                	t_0 = Float64(2.0 / Float64(r * r))
                	tmp = 0.0
                	if (Float64(Float64(Float64(3.0 + t_0) - 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) <= -1e+129)
                		tmp = Float64(Float64(Float64(Float64(r * r) * -1.5) / r) / r);
                	else
                		tmp = Float64(t_0 - 1.5);
                	end
                	return tmp
                end
                
                function tmp_2 = code(v, w, r)
                	t_0 = 2.0 / (r * r);
                	tmp = 0.0;
                	if ((((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -1e+129)
                		tmp = (((r * r) * -1.5) / r) / r;
                	else
                		tmp = t_0 - 1.5;
                	end
                	tmp_2 = tmp;
                end
                
                code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(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), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], -1e+129], N[(N[(N[(N[(r * r), $MachinePrecision] * -1.5), $MachinePrecision] / r), $MachinePrecision] / r), $MachinePrecision], N[(t$95$0 - 1.5), $MachinePrecision]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := \frac{2}{r \cdot r}\\
                \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\right) \cdot r\right)}{1 - v}\right) - 4.5 \leq -1 \cdot 10^{+129}:\\
                \;\;\;\;\frac{\frac{\left(r \cdot r\right) \cdot -1.5}{r}}{r}\\
                
                \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)) < -1e129

                  1. Initial program 83.8%

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

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

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

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

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

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

                      \[\leadsto \frac{\mathsf{fma}\left(\frac{-3}{2}, r \cdot r, 2\right)}{{r}^{2}} \]
                    6. pow2N/A

                      \[\leadsto \frac{\mathsf{fma}\left(\frac{-3}{2}, r \cdot r, 2\right)}{r \cdot \color{blue}{r}} \]
                    7. lift-*.f645.5

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

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

                    \[\leadsto \frac{\frac{-3}{2} \cdot {r}^{2}}{\color{blue}{r} \cdot r} \]
                  7. Step-by-step derivation
                    1. *-commutativeN/A

                      \[\leadsto \frac{{r}^{2} \cdot \frac{-3}{2}}{r \cdot r} \]
                    2. lower-*.f64N/A

                      \[\leadsto \frac{{r}^{2} \cdot \frac{-3}{2}}{r \cdot r} \]
                    3. pow2N/A

                      \[\leadsto \frac{\left(r \cdot r\right) \cdot \frac{-3}{2}}{r \cdot r} \]
                    4. lift-*.f641.5

                      \[\leadsto \frac{\left(r \cdot r\right) \cdot -1.5}{r \cdot r} \]
                  8. Applied rewrites1.5%

                    \[\leadsto \frac{\left(r \cdot r\right) \cdot -1.5}{\color{blue}{r} \cdot r} \]
                  9. Step-by-step derivation
                    1. lift-*.f64N/A

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

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

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

                      \[\leadsto \frac{\frac{\left(r \cdot r\right) \cdot \frac{-3}{2}}{r}}{\color{blue}{r}} \]
                    5. lower-/.f6442.8

                      \[\leadsto \frac{\frac{\left(r \cdot r\right) \cdot -1.5}{r}}{r} \]
                  10. Applied rewrites42.8%

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

                  if -1e129 < (-.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 87.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto {r}^{-2} \cdot 2 - \mathsf{fma}\left(\frac{1}{4}, \left(w \cdot r\right) \cdot \left(\color{blue}{w} \cdot r\right), \frac{3}{2}\right) \]
                    6. lift-*.f6497.3

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \frac{2}{r \cdot r} - \frac{3}{2} \]
                  11. Step-by-step derivation
                    1. Applied rewrites91.6%

                      \[\leadsto \frac{2}{r \cdot r} - 1.5 \]
                  12. Recombined 2 regimes into one program.
                  13. Add Preprocessing

                  Alternative 10: 93.5% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  Alternative 11: 50.2% accurate, 3.2× speedup?

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

                    1. Initial program 84.5%

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

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

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

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

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

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

                        \[\leadsto \frac{\mathsf{fma}\left(\frac{-3}{2}, r \cdot r, 2\right)}{{r}^{2}} \]
                      6. pow2N/A

                        \[\leadsto \frac{\mathsf{fma}\left(\frac{-3}{2}, r \cdot r, 2\right)}{r \cdot \color{blue}{r}} \]
                      7. lift-*.f6464.5

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

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

                      \[\leadsto \frac{2}{\color{blue}{r} \cdot r} \]
                    7. Step-by-step derivation
                      1. Applied rewrites58.3%

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

                      if 1.1000000000000001 < r

                      1. Initial program 89.6%

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

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

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

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

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

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

                          \[\leadsto \frac{\mathsf{fma}\left(\frac{-3}{2}, r \cdot r, 2\right)}{{r}^{2}} \]
                        6. pow2N/A

                          \[\leadsto \frac{\mathsf{fma}\left(\frac{-3}{2}, r \cdot r, 2\right)}{r \cdot \color{blue}{r}} \]
                        7. lift-*.f6418.2

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

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

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

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

                      Alternative 12: 57.1% accurate, 3.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \frac{2}{r \cdot r} - \frac{3}{2} \]
                      11. Step-by-step derivation
                        1. Applied rewrites56.7%

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

                        Alternative 13: 13.8% accurate, 73.0× speedup?

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

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

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

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

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

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

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

                            \[\leadsto \frac{\mathsf{fma}\left(\frac{-3}{2}, r \cdot r, 2\right)}{{r}^{2}} \]
                          6. pow2N/A

                            \[\leadsto \frac{\mathsf{fma}\left(\frac{-3}{2}, r \cdot r, 2\right)}{r \cdot \color{blue}{r}} \]
                          7. lift-*.f6452.7

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

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

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

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

                          Reproduce

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