Rosa's TurbineBenchmark

Percentage Accurate: 85.5% → 99.8%
Time: 4.5s
Alternatives: 14
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 14 alternatives:

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

Initial Program: 85.5% accurate, 1.0× speedup?

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

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

real(8) function code(v, w, r)
use fmin_fmax_functions
    real(8), intent (in) :: v
    real(8), intent (in) :: w
    real(8), intent (in) :: r
    code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
	return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
def code(v, w, r):
	return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
function code(v, w, r)
	return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5)
end
function tmp = code(v, w, r)
	tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 99.8% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 97.9% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;v \leq 9 \cdot 10^{-10}:\\
\;\;\;\;t\_1 - \mathsf{fma}\left(0.375, t\_2, 4.5\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1 - \mathsf{fma}\left(-0.25 \cdot v, t\_2, 4.5\right)\\


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

    1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.2499999999999999e58 < v < 8.9999999999999999e-10

    1. Initial program 85.5%

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

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

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

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

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

        \[\leadsto \left(\frac{2}{r \cdot r} + 3\right) - \mathsf{fma}\left(0.375, \frac{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}{1 - v}, 4.5\right) \]
      4. fp-cancel-sub-sign-inv85.1

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

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

    if 8.9999999999999999e-10 < v

    1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 97.3% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;v \leq 7.5 \cdot 10^{-47}:\\
\;\;\;\;\left(t\_0 + 3\right) - \mathsf{fma}\left(0.375, \frac{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}{1 - v}, 4.5\right)\\

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


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

    1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.2499999999999999e58 < v < 7.49999999999999969e-47

    1. Initial program 85.5%

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

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

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

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

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

        \[\leadsto \left(\frac{2}{r \cdot r} + 3\right) - \mathsf{fma}\left(0.375, \frac{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}{1 - v}, 4.5\right) \]
      4. fp-cancel-sub-sign-inv85.1

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

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

    if 7.49999999999999969e-47 < v

    1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 95.7% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if v < -1.05e50 or 6.99999999999999993e-50 < v

    1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.05e50 < v < 6.99999999999999993e-50

    1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{r \cdot r} - \mathsf{fma}\left(\left(w \cdot \left(r \cdot w\right)\right) \cdot r, \frac{3}{8}, \frac{3}{2}\right) \]
      18. lower-*.f6490.6

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

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

        \[\leadsto \frac{2}{r \cdot r} - \mathsf{fma}\left(\left(w \cdot \left(w \cdot r\right)\right) \cdot r, \frac{3}{8}, \frac{3}{2}\right) \]
      21. lower-*.f6490.6

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

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

Alternative 5: 95.6% accurate, 1.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\frac{2}{\color{blue}{{r}^{2}}} - \left(\mathsf{neg}\left(3\right)\right)\right) - \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{4}, v, \frac{3}{8}\right), \frac{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}{1 - v}, \frac{9}{2}\right) \]
    6. mult-flip-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 93.6% 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:\\ \;\;\;\;t\_0 - \left(\left(\left(w \cdot r\right) \cdot w\right) \cdot r\right) \cdot 0.25\\ \mathbf{elif}\;t\_1 \leq -1.5:\\ \;\;\;\;3 - \mathsf{fma}\left(0.375, \frac{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}{1 - v}, 4.5\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0 - 1.5\\ \end{array} \end{array} \]
(FPCore (v w r)
 :precision binary64
 (let* ((t_0 (/ 2.0 (* r r)))
        (t_1
         (-
          (-
           (+ 3.0 t_0)
           (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
          4.5)))
   (if (<= t_1 (- INFINITY))
     (- t_0 (* (* (* (* w r) w) r) 0.25))
     (if (<= t_1 -1.5)
       (- 3.0 (fma 0.375 (/ (* (* 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 = ((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 = t_0 - ((((w * r) * w) * r) * 0.25);
	} else if (t_1 <= -1.5) {
		tmp = 3.0 - fma(0.375, (((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(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(t_0 - Float64(Float64(Float64(Float64(w * r) * w) * r) * 0.25));
	elseif (t_1 <= -1.5)
		tmp = Float64(3.0 - fma(0.375, Float64(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[(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[(t$95$0 - N[(N[(N[(N[(w * r), $MachinePrecision] * w), $MachinePrecision] * r), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -1.5], N[(3.0 - N[(0.375 * N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] + 4.5), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - 1.5), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \left(\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:\\
\;\;\;\;t\_0 - \left(\left(\left(w \cdot r\right) \cdot w\right) \cdot r\right) \cdot 0.25\\

\mathbf{elif}\;t\_1 \leq -1.5:\\
\;\;\;\;3 - \mathsf{fma}\left(0.375, \frac{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}{1 - v}, 4.5\right)\\

\mathbf{else}:\\
\;\;\;\;t\_0 - 1.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) < -inf.0

    1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{r \cdot r} - \left(\left(w \cdot \left(w \cdot r\right)\right) \cdot r\right) \cdot \frac{1}{4} \]
      10. lift-*.f6478.0

        \[\leadsto \frac{2}{r \cdot r} - \left(\left(w \cdot \left(w \cdot r\right)\right) \cdot r\right) \cdot 0.25 \]
      11. lift-*.f64N/A

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

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

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

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

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

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

        \[\leadsto \frac{2}{r \cdot r} - \left(\left(\left(w \cdot r\right) \cdot w\right) \cdot r\right) \cdot 0.25 \]
    8. Applied rewrites78.0%

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

    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.5

    1. Initial program 85.5%

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

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

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

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

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

        \[\leadsto \left(\frac{2}{r \cdot r} + 3\right) - \mathsf{fma}\left(0.375, \frac{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}{1 - v}, 4.5\right) \]
      4. fp-cancel-sub-sign-inv85.1

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

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

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

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

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

      1. Initial program 85.5%

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

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

          \[\leadsto 2 \cdot \frac{1}{{r}^{2}} - \color{blue}{\frac{3}{2}} \]
        2. mult-flip-revN/A

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

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

          \[\leadsto \frac{2}{r \cdot r} - \frac{3}{2} \]
        5. lift-*.f6457.4

          \[\leadsto \frac{2}{r \cdot r} - 1.5 \]
      4. Applied rewrites57.4%

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

    Alternative 7: 92.7% accurate, 1.5× speedup?

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

      1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 1.14999999999999997e-52 < w

      1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{2}{r \cdot r} - \mathsf{fma}\left(\left(w \cdot \left(r \cdot w\right)\right) \cdot r, \frac{3}{8}, \frac{3}{2}\right) \]
        18. lower-*.f6490.6

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

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

          \[\leadsto \frac{2}{r \cdot r} - \mathsf{fma}\left(\left(w \cdot \left(w \cdot r\right)\right) \cdot r, \frac{3}{8}, \frac{3}{2}\right) \]
        21. lower-*.f6490.6

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{2}{r \cdot r} - \left(\left(\left(r \cdot r\right) \cdot \frac{3}{8}\right) \cdot w\right) \cdot w \]
        11. lift-*.f6477.1

          \[\leadsto \frac{2}{r \cdot r} - \left(\left(\left(r \cdot r\right) \cdot 0.375\right) \cdot w\right) \cdot w \]
      9. Applied rewrites77.1%

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

    Alternative 8: 91.9% 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:\\ \;\;\;\;t\_0 - \left(\left(\left(w \cdot r\right) \cdot w\right) \cdot r\right) \cdot 0.25\\ \mathbf{elif}\;t\_1 \leq -5000:\\ \;\;\;\;-0.375 \cdot \left(\left(w \cdot \left(w \cdot r\right)\right) \cdot r\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0 - 1.5\\ \end{array} \end{array} \]
    (FPCore (v w r)
     :precision binary64
     (let* ((t_0 (/ 2.0 (* r r)))
            (t_1
             (-
              (-
               (+ 3.0 t_0)
               (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
              4.5)))
       (if (<= t_1 (- INFINITY))
         (- t_0 (* (* (* (* w r) w) r) 0.25))
         (if (<= t_1 -5000.0) (* -0.375 (* (* w (* w r)) r)) (- 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 = t_0 - ((((w * r) * w) * r) * 0.25);
    	} else if (t_1 <= -5000.0) {
    		tmp = -0.375 * ((w * (w * r)) * r);
    	} else {
    		tmp = t_0 - 1.5;
    	}
    	return tmp;
    }
    
    public static double code(double v, double w, double r) {
    	double t_0 = 2.0 / (r * r);
    	double t_1 = ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
    	double tmp;
    	if (t_1 <= -Double.POSITIVE_INFINITY) {
    		tmp = t_0 - ((((w * r) * w) * r) * 0.25);
    	} else if (t_1 <= -5000.0) {
    		tmp = -0.375 * ((w * (w * r)) * r);
    	} else {
    		tmp = t_0 - 1.5;
    	}
    	return tmp;
    }
    
    def code(v, w, r):
    	t_0 = 2.0 / (r * r)
    	t_1 = ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
    	tmp = 0
    	if t_1 <= -math.inf:
    		tmp = t_0 - ((((w * r) * w) * r) * 0.25)
    	elif t_1 <= -5000.0:
    		tmp = -0.375 * ((w * (w * r)) * r)
    	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(t_0 - Float64(Float64(Float64(Float64(w * r) * w) * r) * 0.25));
    	elseif (t_1 <= -5000.0)
    		tmp = Float64(-0.375 * Float64(Float64(w * Float64(w * 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);
    	t_1 = ((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
    	tmp = 0.0;
    	if (t_1 <= -Inf)
    		tmp = t_0 - ((((w * r) * w) * r) * 0.25);
    	elseif (t_1 <= -5000.0)
    		tmp = -0.375 * ((w * (w * 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]}, 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[(t$95$0 - N[(N[(N[(N[(w * r), $MachinePrecision] * w), $MachinePrecision] * r), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -5000.0], N[(-0.375 * N[(N[(w * N[(w * r), $MachinePrecision]), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - 1.5), $MachinePrecision]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{2}{r \cdot r}\\
    t_1 := \left(\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:\\
    \;\;\;\;t\_0 - \left(\left(\left(w \cdot r\right) \cdot w\right) \cdot r\right) \cdot 0.25\\
    
    \mathbf{elif}\;t\_1 \leq -5000:\\
    \;\;\;\;-0.375 \cdot \left(\left(w \cdot \left(w \cdot r\right)\right) \cdot r\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0 - 1.5\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) < -inf.0

      1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{2}{r \cdot r} - \left(\left(w \cdot \left(w \cdot r\right)\right) \cdot r\right) \cdot \frac{1}{4} \]
        10. lift-*.f6478.0

          \[\leadsto \frac{2}{r \cdot r} - \left(\left(w \cdot \left(w \cdot r\right)\right) \cdot r\right) \cdot 0.25 \]
        11. lift-*.f64N/A

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

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

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

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

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

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

          \[\leadsto \frac{2}{r \cdot r} - \left(\left(\left(w \cdot r\right) \cdot w\right) \cdot r\right) \cdot 0.25 \]
      8. Applied rewrites78.0%

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

      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)) < -5e3

      1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{-3}{8} \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right) \]
        7. associate-*l*N/A

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

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

          \[\leadsto \frac{-3}{8} \cdot \left(\left(w \cdot \left(r \cdot w\right)\right) \cdot r\right) \]
        10. lower-*.f6437.7

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

          \[\leadsto \frac{-3}{8} \cdot \left(\left(w \cdot \left(r \cdot w\right)\right) \cdot r\right) \]
        12. *-commutativeN/A

          \[\leadsto \frac{-3}{8} \cdot \left(\left(w \cdot \left(w \cdot r\right)\right) \cdot r\right) \]
        13. lower-*.f6437.7

          \[\leadsto -0.375 \cdot \left(\left(w \cdot \left(w \cdot r\right)\right) \cdot r\right) \]
      7. Applied rewrites37.7%

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

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

      1. Initial program 85.5%

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

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

          \[\leadsto 2 \cdot \frac{1}{{r}^{2}} - \color{blue}{\frac{3}{2}} \]
        2. mult-flip-revN/A

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

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

          \[\leadsto \frac{2}{r \cdot r} - \frac{3}{2} \]
        5. lift-*.f6457.4

          \[\leadsto \frac{2}{r \cdot r} - 1.5 \]
      4. Applied rewrites57.4%

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

    Alternative 9: 91.7% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 10: 89.5% 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 -5000:\\ \;\;\;\;-0.375 \cdot \left(\left(w \cdot \left(w \cdot r\right)\right) \cdot r\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0 - 1.5\\ \end{array} \end{array} \]
    (FPCore (v w r)
     :precision binary64
     (let* ((t_0 (/ 2.0 (* r r))))
       (if (<=
            (-
             (-
              (+ 3.0 t_0)
              (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
             4.5)
            -5000.0)
         (* -0.375 (* (* w (* w 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) <= -5000.0) {
    		tmp = -0.375 * ((w * (w * 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) <= (-5000.0d0)) then
            tmp = (-0.375d0) * ((w * (w * 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) <= -5000.0) {
    		tmp = -0.375 * ((w * (w * 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) <= -5000.0:
    		tmp = -0.375 * ((w * (w * 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) <= -5000.0)
    		tmp = Float64(-0.375 * Float64(Float64(w * Float64(w * 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) <= -5000.0)
    		tmp = -0.375 * ((w * (w * 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], -5000.0], N[(-0.375 * N[(N[(w * N[(w * r), $MachinePrecision]), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - 1.5), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{2}{r \cdot r}\\
    \mathbf{if}\;\left(\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 -5000:\\
    \;\;\;\;-0.375 \cdot \left(\left(w \cdot \left(w \cdot r\right)\right) \cdot r\right)\\
    
    \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)) < -5e3

      1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{-3}{8} \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right) \]
        7. associate-*l*N/A

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

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

          \[\leadsto \frac{-3}{8} \cdot \left(\left(w \cdot \left(r \cdot w\right)\right) \cdot r\right) \]
        10. lower-*.f6437.7

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

          \[\leadsto \frac{-3}{8} \cdot \left(\left(w \cdot \left(r \cdot w\right)\right) \cdot r\right) \]
        12. *-commutativeN/A

          \[\leadsto \frac{-3}{8} \cdot \left(\left(w \cdot \left(w \cdot r\right)\right) \cdot r\right) \]
        13. lower-*.f6437.7

          \[\leadsto -0.375 \cdot \left(\left(w \cdot \left(w \cdot r\right)\right) \cdot r\right) \]
      7. Applied rewrites37.7%

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

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

      1. Initial program 85.5%

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

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

          \[\leadsto 2 \cdot \frac{1}{{r}^{2}} - \color{blue}{\frac{3}{2}} \]
        2. mult-flip-revN/A

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

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

          \[\leadsto \frac{2}{r \cdot r} - \frac{3}{2} \]
        5. lift-*.f6457.4

          \[\leadsto \frac{2}{r \cdot r} - 1.5 \]
      4. Applied rewrites57.4%

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

    Alternative 11: 89.5% 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 -5000:\\ \;\;\;\;\left(\left(\left(w \cdot r\right) \cdot w\right) \cdot r\right) \cdot -0.25\\ \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)
            -5000.0)
         (* (* (* (* w r) w) r) -0.25)
         (- 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) <= -5000.0) {
    		tmp = (((w * r) * w) * r) * -0.25;
    	} 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) <= (-5000.0d0)) then
            tmp = (((w * r) * w) * r) * (-0.25d0)
        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) <= -5000.0) {
    		tmp = (((w * r) * w) * r) * -0.25;
    	} 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) <= -5000.0:
    		tmp = (((w * r) * w) * r) * -0.25
    	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) <= -5000.0)
    		tmp = Float64(Float64(Float64(Float64(w * r) * w) * r) * -0.25);
    	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) <= -5000.0)
    		tmp = (((w * r) * w) * r) * -0.25;
    	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], -5000.0], N[(N[(N[(N[(w * r), $MachinePrecision] * w), $MachinePrecision] * r), $MachinePrecision] * -0.25), $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 -5000:\\
    \;\;\;\;\left(\left(\left(w \cdot r\right) \cdot w\right) \cdot r\right) \cdot -0.25\\
    
    \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)) < -5e3

      1. Initial program 85.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\left(w \cdot \left(w \cdot r\right)\right) \cdot r\right) \cdot \frac{-1}{4} \]
        10. lift-*.f6438.0

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

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

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

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

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

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

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

          \[\leadsto \left(\left(\left(w \cdot r\right) \cdot w\right) \cdot r\right) \cdot -0.25 \]
      8. Applied rewrites38.0%

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

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

      1. Initial program 85.5%

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

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

          \[\leadsto 2 \cdot \frac{1}{{r}^{2}} - \color{blue}{\frac{3}{2}} \]
        2. mult-flip-revN/A

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

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

          \[\leadsto \frac{2}{r \cdot r} - \frac{3}{2} \]
        5. lift-*.f6457.4

          \[\leadsto \frac{2}{r \cdot r} - 1.5 \]
      4. Applied rewrites57.4%

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

    Alternative 12: 57.4% accurate, 4.2× 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.5%

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

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

        \[\leadsto 2 \cdot \frac{1}{{r}^{2}} - \color{blue}{\frac{3}{2}} \]
      2. mult-flip-revN/A

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

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

        \[\leadsto \frac{2}{r \cdot r} - \frac{3}{2} \]
      5. lift-*.f6457.4

        \[\leadsto \frac{2}{r \cdot r} - 1.5 \]
    4. Applied rewrites57.4%

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

    Alternative 13: 43.7% accurate, 5.4× speedup?

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{r \cdot r}} \]
      3. lift-*.f6443.7

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

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

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

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

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

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

        \[\leadsto \frac{\frac{2}{r}}{r} \]
    6. Applied rewrites43.7%

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

    Alternative 14: 43.7% accurate, 5.7× speedup?

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

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

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

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

        \[\leadsto \frac{2}{\color{blue}{r \cdot r}} \]
      3. lift-*.f6443.7

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

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

    Reproduce

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