Rosa's TurbineBenchmark

Percentage Accurate: 84.6% → 98.9%
Time: 15.9s
Alternatives: 12
Speedup: 1.7×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 84.6% accurate, 1.0× speedup?

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

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

Alternative 1: 98.9% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;v \leq 5.2 \cdot 10^{+42}:\\
\;\;\;\;\left(\left(3 + t\_0\right) + \left(w \cdot \left(r \cdot \left(0.375 + v \cdot -0.25\right)\right)\right) \cdot \frac{w}{\frac{v + -1}{r}}\right) - 4.5\\

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


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

    1. Initial program 84.3%

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{0.25 \cdot \left({r}^{2} \cdot {w}^{2}\right)}\right) \]
    5. Step-by-step derivation
      1. *-commutative72.4%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({r}^{2} \cdot {w}^{2}\right) \cdot 0.25}\right) \]
      2. *-commutative72.4%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} \cdot 0.25\right) \]
      3. unpow272.4%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\color{blue}{\left(w \cdot w\right)} \cdot {r}^{2}\right) \cdot 0.25\right) \]
      4. unpow272.4%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\left(w \cdot w\right) \cdot \color{blue}{\left(r \cdot r\right)}\right) \cdot 0.25\right) \]
      5. swap-sqr99.7%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
      6. unpow299.7%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(w \cdot r\right)}^{2}} \cdot 0.25\right) \]
      7. *-commutative99.7%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(r \cdot w\right)}}^{2} \cdot 0.25\right) \]
    6. Simplified99.7%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(r \cdot w\right)}^{2} \cdot 0.25}\right) \]
    7. Step-by-step derivation
      1. *-commutative99.7%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(w \cdot r\right)}}^{2} \cdot 0.25\right) \]
      2. pow299.7%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
      3. remove-double-div99.7%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\color{blue}{\frac{1}{\frac{1}{w \cdot r}}} \cdot \left(w \cdot r\right)\right) \cdot 0.25\right) \]
      4. remove-double-div99.7%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\frac{1}{\frac{1}{w \cdot r}} \cdot \color{blue}{\frac{1}{\frac{1}{w \cdot r}}}\right) \cdot 0.25\right) \]
      5. frac-times99.6%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\frac{1 \cdot 1}{\frac{1}{w \cdot r} \cdot \frac{1}{w \cdot r}}} \cdot 0.25\right) \]
      6. metadata-eval99.6%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{\color{blue}{1}}{\frac{1}{w \cdot r} \cdot \frac{1}{w \cdot r}} \cdot 0.25\right) \]
    8. Applied egg-rr99.6%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\frac{1}{\frac{1}{w \cdot r} \cdot \frac{1}{w \cdot r}}} \cdot 0.25\right) \]
    9. Step-by-step derivation
      1. frac-times99.7%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{1}{\color{blue}{\frac{1 \cdot 1}{\left(w \cdot r\right) \cdot \left(w \cdot r\right)}}} \cdot 0.25\right) \]
      2. metadata-eval99.7%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{1}{\frac{\color{blue}{1}}{\left(w \cdot r\right) \cdot \left(w \cdot r\right)}} \cdot 0.25\right) \]
      3. pow299.7%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{1}{\frac{1}{\color{blue}{{\left(w \cdot r\right)}^{2}}}} \cdot 0.25\right) \]
      4. *-commutative99.7%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{1}{\frac{1}{{\color{blue}{\left(r \cdot w\right)}}^{2}}} \cdot 0.25\right) \]
      5. remove-double-div99.7%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(r \cdot w\right)}^{2}} \cdot 0.25\right) \]
      6. *-commutative99.7%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(w \cdot r\right)}}^{2} \cdot 0.25\right) \]
      7. pow299.7%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
      8. associate-*r*99.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(\left(w \cdot r\right) \cdot w\right) \cdot r\right)} \cdot 0.25\right) \]
    10. Applied egg-rr99.8%

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

    if -3e158 < v < 5.1999999999999998e42

    1. Initial program 88.5%

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

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \frac{\left(\left(w \cdot w\right) \cdot r\right) \cdot r}{1 - v}}\right) - 4.5 \]
      2. cancel-sign-sub-inv88.5%

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(0.125 \cdot \mathsf{fma}\left(v, -2, 3\right)\right) \cdot \left(r \cdot \frac{\color{blue}{\left(w \cdot w\right) \cdot r}}{1 - v}\right)\right) - 4.5 \]
      11. associate-*r/88.5%

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

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{\left(\left(0.125 \cdot \mathsf{fma}\left(v, -2, 3\right)\right) \cdot r\right) \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right)}\right) - 4.5 \]
      13. associate-*l*97.5%

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

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

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

    if 5.1999999999999998e42 < v

    1. Initial program 76.9%

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{0.25 \cdot \left({r}^{2} \cdot {w}^{2}\right)}\right) \]
    5. Step-by-step derivation
      1. *-commutative79.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({r}^{2} \cdot {w}^{2}\right) \cdot 0.25}\right) \]
      2. *-commutative79.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} \cdot 0.25\right) \]
      3. unpow279.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\color{blue}{\left(w \cdot w\right)} \cdot {r}^{2}\right) \cdot 0.25\right) \]
      4. unpow279.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\left(w \cdot w\right) \cdot \color{blue}{\left(r \cdot r\right)}\right) \cdot 0.25\right) \]
      5. swap-sqr99.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
      6. unpow299.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(w \cdot r\right)}^{2}} \cdot 0.25\right) \]
      7. *-commutative99.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(r \cdot w\right)}}^{2} \cdot 0.25\right) \]
    6. Simplified99.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(r \cdot w\right)}^{2} \cdot 0.25}\right) \]
    7. Step-by-step derivation
      1. *-commutative99.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(w \cdot r\right)}}^{2} \cdot 0.25\right) \]
      2. pow299.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
      3. remove-double-div99.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\left(w \cdot r\right) \cdot \color{blue}{\frac{1}{\frac{1}{w \cdot r}}}\right) \cdot 0.25\right) \]
      4. un-div-inv99.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\frac{w \cdot r}{\frac{1}{w \cdot r}}} \cdot 0.25\right) \]
    8. Applied egg-rr99.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;v \leq -3 \cdot 10^{+158}:\\ \;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 - \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right) \cdot 0.25\right)\\ \mathbf{elif}\;v \leq 5.2 \cdot 10^{+42}:\\ \;\;\;\;\left(\left(3 + \frac{2}{r \cdot r}\right) + \left(w \cdot \left(r \cdot \left(0.375 + v \cdot -0.25\right)\right)\right) \cdot \frac{w}{\frac{v + -1}{r}}\right) - 4.5\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + 0.25 \cdot \frac{r \cdot w}{\frac{-1}{r \cdot w}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 98.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -2200:\\
\;\;\;\;t\_0 + \left(-1.5 - \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right) \cdot 0.25\right)\\

\mathbf{elif}\;v \leq 3.65 \cdot 10^{-68}:\\
\;\;\;\;t\_0 + \left(-1.5 - 0.375 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\

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


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

    1. Initial program 89.9%

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{0.25 \cdot \left({r}^{2} \cdot {w}^{2}\right)}\right) \]
    5. Step-by-step derivation
      1. *-commutative79.5%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({r}^{2} \cdot {w}^{2}\right) \cdot 0.25}\right) \]
      2. *-commutative79.5%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} \cdot 0.25\right) \]
      3. unpow279.5%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\color{blue}{\left(w \cdot w\right)} \cdot {r}^{2}\right) \cdot 0.25\right) \]
      4. unpow279.5%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\left(w \cdot w\right) \cdot \color{blue}{\left(r \cdot r\right)}\right) \cdot 0.25\right) \]
      5. swap-sqr98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
      6. unpow298.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(w \cdot r\right)}^{2}} \cdot 0.25\right) \]
      7. *-commutative98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(r \cdot w\right)}}^{2} \cdot 0.25\right) \]
    6. Simplified98.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(r \cdot w\right)}^{2} \cdot 0.25}\right) \]
    7. Step-by-step derivation
      1. *-commutative98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(w \cdot r\right)}}^{2} \cdot 0.25\right) \]
      2. pow298.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
      3. remove-double-div98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\color{blue}{\frac{1}{\frac{1}{w \cdot r}}} \cdot \left(w \cdot r\right)\right) \cdot 0.25\right) \]
      4. remove-double-div98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\frac{1}{\frac{1}{w \cdot r}} \cdot \color{blue}{\frac{1}{\frac{1}{w \cdot r}}}\right) \cdot 0.25\right) \]
      5. frac-times98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\frac{1 \cdot 1}{\frac{1}{w \cdot r} \cdot \frac{1}{w \cdot r}}} \cdot 0.25\right) \]
      6. metadata-eval98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{\color{blue}{1}}{\frac{1}{w \cdot r} \cdot \frac{1}{w \cdot r}} \cdot 0.25\right) \]
    8. Applied egg-rr98.8%

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

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{1}{\color{blue}{\frac{1 \cdot 1}{\left(w \cdot r\right) \cdot \left(w \cdot r\right)}}} \cdot 0.25\right) \]
      2. metadata-eval98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{1}{\frac{\color{blue}{1}}{\left(w \cdot r\right) \cdot \left(w \cdot r\right)}} \cdot 0.25\right) \]
      3. pow298.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{1}{\frac{1}{\color{blue}{{\left(w \cdot r\right)}^{2}}}} \cdot 0.25\right) \]
      4. *-commutative98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{1}{\frac{1}{{\color{blue}{\left(r \cdot w\right)}}^{2}}} \cdot 0.25\right) \]
      5. remove-double-div98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(r \cdot w\right)}^{2}} \cdot 0.25\right) \]
      6. *-commutative98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(w \cdot r\right)}}^{2} \cdot 0.25\right) \]
      7. pow298.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
      8. associate-*r*98.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(\left(w \cdot r\right) \cdot w\right) \cdot r\right)} \cdot 0.25\right) \]
    10. Applied egg-rr98.9%

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

    if -2200 < v < 3.65000000000000005e-68

    1. Initial program 85.3%

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{0.375 \cdot \left({r}^{2} \cdot {w}^{2}\right)}\right) \]
    5. Step-by-step derivation
      1. *-commutative78.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({r}^{2} \cdot {w}^{2}\right) \cdot 0.375}\right) \]
      2. *-commutative78.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} \cdot 0.375\right) \]
      3. unpow278.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\color{blue}{\left(w \cdot w\right)} \cdot {r}^{2}\right) \cdot 0.375\right) \]
      4. unpow278.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\left(w \cdot w\right) \cdot \color{blue}{\left(r \cdot r\right)}\right) \cdot 0.375\right) \]
      5. swap-sqr99.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.375\right) \]
      6. unpow299.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(w \cdot r\right)}^{2}} \cdot 0.375\right) \]
      7. *-commutative99.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(r \cdot w\right)}}^{2} \cdot 0.375\right) \]
    6. Simplified99.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(r \cdot w\right)}^{2} \cdot 0.375}\right) \]
    7. Step-by-step derivation
      1. *-commutative85.3%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(w \cdot r\right)}}^{2} \cdot 0.25\right) \]
      2. pow285.3%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
    8. Applied egg-rr99.8%

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

    if 3.65000000000000005e-68 < v

    1. Initial program 82.4%

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{0.25 \cdot \left({r}^{2} \cdot {w}^{2}\right)}\right) \]
    5. Step-by-step derivation
      1. *-commutative84.6%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({r}^{2} \cdot {w}^{2}\right) \cdot 0.25}\right) \]
      2. *-commutative84.6%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} \cdot 0.25\right) \]
      3. unpow284.6%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\color{blue}{\left(w \cdot w\right)} \cdot {r}^{2}\right) \cdot 0.25\right) \]
      4. unpow284.6%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\left(w \cdot w\right) \cdot \color{blue}{\left(r \cdot r\right)}\right) \cdot 0.25\right) \]
      5. swap-sqr99.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
      6. unpow299.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(w \cdot r\right)}^{2}} \cdot 0.25\right) \]
      7. *-commutative99.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(r \cdot w\right)}}^{2} \cdot 0.25\right) \]
    6. Simplified99.9%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(r \cdot w\right)}^{2} \cdot 0.25}\right) \]
    7. Step-by-step derivation
      1. *-commutative99.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(w \cdot r\right)}}^{2} \cdot 0.25\right) \]
      2. pow299.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
      3. remove-double-div99.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\left(w \cdot r\right) \cdot \color{blue}{\frac{1}{\frac{1}{w \cdot r}}}\right) \cdot 0.25\right) \]
      4. un-div-inv99.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\frac{w \cdot r}{\frac{1}{w \cdot r}}} \cdot 0.25\right) \]
    8. Applied egg-rr99.9%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\frac{w \cdot r}{\frac{1}{w \cdot r}}} \cdot 0.25\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;v \leq -2200:\\ \;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 - \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right) \cdot 0.25\right)\\ \mathbf{elif}\;v \leq 3.65 \cdot 10^{-68}:\\ \;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 - 0.375 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + 0.25 \cdot \frac{r \cdot w}{\frac{-1}{r \cdot w}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 99.7% accurate, 1.0× speedup?

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

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

    \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
  2. Step-by-step derivation
    1. associate--l-85.8%

      \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\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} + 4.5\right)} \]
    2. associate-*l*78.9%

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

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \color{blue}{\left(\left(\left(w \cdot w\right) \cdot \left(-r\right)\right) \cdot \left(-r\right)\right)}}{1 - v} + 4.5\right) \]
    5. associate-/l*89.3%

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

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

    \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}{1 - v} + 4.5\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. *-un-lft-identity89.3%

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

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

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

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

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

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

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\frac{\left(\color{blue}{\left(\sqrt{w} \cdot \sqrt{w}\right)} \cdot \sqrt{r}\right) \cdot \sqrt{r}}{1} \cdot \frac{\sqrt{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}}{1 - v}\right) + 4.5\right) \]
    9. add-sqr-sqrt30.2%

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\frac{\left(\color{blue}{w} \cdot \sqrt{r}\right) \cdot \sqrt{r}}{1} \cdot \frac{\sqrt{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}}{1 - v}\right) + 4.5\right) \]
    10. associate-*r*30.2%

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\frac{\color{blue}{w \cdot \left(\sqrt{r} \cdot \sqrt{r}\right)}}{1} \cdot \frac{\sqrt{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}}{1 - v}\right) + 4.5\right) \]
    11. add-sqr-sqrt70.3%

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\frac{w \cdot \color{blue}{r}}{1} \cdot \frac{\sqrt{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}}{1 - v}\right) + 4.5\right) \]
  6. Applied egg-rr99.7%

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

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

Alternative 4: 97.4% accurate, 1.0× speedup?

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

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

    \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
  2. Step-by-step derivation
    1. associate--l-85.8%

      \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\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} + 4.5\right)} \]
    2. associate-*l*78.9%

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

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \color{blue}{\left(\left(\left(w \cdot w\right) \cdot \left(-r\right)\right) \cdot \left(-r\right)\right)}}{1 - v} + 4.5\right) \]
    5. associate-/l*89.3%

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

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

    \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}{1 - v} + 4.5\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. associate-/l*89.0%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(r \cdot \frac{\color{blue}{\left(w \cdot w\right) \cdot r}}{1 - v}\right) + 4.5\right) \]
    3. associate-*r/88.6%

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

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\color{blue}{\left(\left(w \cdot w\right) \cdot r\right)} \cdot \frac{r}{1 - v}\right) + 4.5\right) \]
    6. associate-*l*96.7%

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\color{blue}{\left(w \cdot \left(w \cdot r\right)\right)} \cdot \frac{r}{1 - v}\right) + 4.5\right) \]
    7. add-sqr-sqrt42.9%

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(w \cdot \left(w \cdot \color{blue}{\left(\sqrt{r} \cdot \sqrt{r}\right)}\right)\right) \cdot \frac{r}{1 - v}\right) + 4.5\right) \]
    8. associate-*r*42.9%

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(w \cdot \color{blue}{\left(\left(w \cdot \sqrt{r}\right) \cdot \sqrt{r}\right)}\right) \cdot \frac{r}{1 - v}\right) + 4.5\right) \]
    9. add-sqr-sqrt20.7%

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

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(w \cdot \left(\color{blue}{\sqrt{\left(w \cdot w\right) \cdot r}} \cdot \sqrt{r}\right)\right) \cdot \frac{r}{1 - v}\right) + 4.5\right) \]
    12. *-commutative30.2%

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(w \cdot \left(\sqrt{\color{blue}{r \cdot \left(w \cdot w\right)}} \cdot \sqrt{r}\right)\right) \cdot \frac{r}{1 - v}\right) + 4.5\right) \]
    13. sqrt-prod69.5%

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(w \cdot \color{blue}{\sqrt{\left(r \cdot \left(w \cdot w\right)\right) \cdot r}}\right) \cdot \frac{r}{1 - v}\right) + 4.5\right) \]
    14. *-commutative69.5%

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(w \cdot \sqrt{\color{blue}{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}}\right) \cdot \frac{r}{1 - v}\right) + 4.5\right) \]
    15. associate-*l*69.5%

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

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

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

Alternative 5: 97.3% accurate, 1.0× speedup?

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

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

    \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
  2. Step-by-step derivation
    1. associate--l-85.8%

      \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\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} + 4.5\right)} \]
    2. associate-*l*78.9%

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

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \color{blue}{\left(\left(\left(w \cdot w\right) \cdot \left(-r\right)\right) \cdot \left(-r\right)\right)}}{1 - v} + 4.5\right) \]
    5. associate-/l*89.3%

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

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

    \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}{1 - v} + 4.5\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. associate-/l*89.0%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(r \cdot \frac{\color{blue}{\left(w \cdot w\right) \cdot r}}{1 - v}\right) + 4.5\right) \]
    3. associate-*r/88.6%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \color{blue}{\left(\left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right) \cdot r\right)} + 4.5\right) \]
    5. associate-*l*96.2%

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\color{blue}{\left(w \cdot \left(w \cdot \frac{r}{1 - v}\right)\right)} \cdot r\right) + 4.5\right) \]
    6. associate-*l*97.9%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(w \cdot \left(\left(w \cdot \color{blue}{\frac{1}{\frac{1 - v}{r}}}\right) \cdot r\right)\right) + 4.5\right) \]
    8. un-div-inv97.9%

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

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

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

Alternative 6: 97.8% accurate, 1.0× speedup?

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

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

    \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
  2. Step-by-step derivation
    1. associate--l-85.8%

      \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\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} + 4.5\right)} \]
    2. associate-*l*78.9%

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

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \color{blue}{\left(\left(\left(w \cdot w\right) \cdot \left(-r\right)\right) \cdot \left(-r\right)\right)}}{1 - v} + 4.5\right) \]
    5. associate-/l*89.3%

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

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

    \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}{1 - v} + 4.5\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. associate-/l*89.0%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(r \cdot \frac{\color{blue}{\left(w \cdot w\right) \cdot r}}{1 - v}\right) + 4.5\right) \]
    3. associate-*r/88.6%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \color{blue}{\left(\left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right) \cdot r\right)} + 4.5\right) \]
    5. associate-*l*96.2%

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\color{blue}{\left(w \cdot \left(w \cdot \frac{r}{1 - v}\right)\right)} \cdot r\right) + 4.5\right) \]
    6. associate-*l*97.9%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(w \cdot \left(\left(w \cdot \color{blue}{\frac{1}{\frac{1 - v}{r}}}\right) \cdot r\right)\right) + 4.5\right) \]
    8. un-div-inv97.9%

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

    \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \color{blue}{\left(w \cdot \left(\frac{w}{\frac{1 - v}{r}} \cdot r\right)\right)} + 4.5\right) \]
  7. Step-by-step derivation
    1. div-inv97.9%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(w \cdot \left(\left(w \cdot \color{blue}{\frac{r}{1 - v}}\right) \cdot r\right)\right) + 4.5\right) \]
    3. associate-/l*98.7%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(w \cdot \color{blue}{\left(r \cdot \frac{w \cdot r}{1 - v}\right)}\right) + 4.5\right) \]
    5. clear-num98.7%

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(w \cdot \left(r \cdot \color{blue}{\frac{1}{\frac{1 - v}{w \cdot r}}}\right)\right) + 4.5\right) \]
    6. un-div-inv98.7%

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

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

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

Alternative 7: 99.3% accurate, 1.0× speedup?

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

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

    \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
  2. Step-by-step derivation
    1. associate--l-85.8%

      \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\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} + 4.5\right)} \]
    2. associate-*l*78.9%

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

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \color{blue}{\left(\left(\left(w \cdot w\right) \cdot \left(-r\right)\right) \cdot \left(-r\right)\right)}}{1 - v} + 4.5\right) \]
    5. associate-/l*89.3%

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

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

    \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}{1 - v} + 4.5\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. associate-/l*89.0%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(r \cdot \frac{\color{blue}{\left(w \cdot w\right) \cdot r}}{1 - v}\right) + 4.5\right) \]
    3. associate-*r/88.6%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(r \cdot \color{blue}{\left(w \cdot \left(w \cdot \frac{r}{1 - v}\right)\right)}\right) + 4.5\right) \]
    5. associate-*r*99.0%

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \color{blue}{\left(\left(r \cdot w\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right)} + 4.5\right) \]
    6. add-sqr-sqrt43.7%

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(\color{blue}{\left(\sqrt{r} \cdot \sqrt{r}\right)} \cdot w\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
    7. associate-*l*43.7%

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\color{blue}{\left(\sqrt{r} \cdot \left(\sqrt{r} \cdot w\right)\right)} \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
    8. add-sqr-sqrt21.1%

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

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(\sqrt{r} \cdot \color{blue}{\sqrt{r \cdot \left(w \cdot w\right)}}\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
    11. sqrt-prod69.5%

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\color{blue}{\sqrt{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}} \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
    12. *-commutative69.5%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\color{blue}{\left(\sqrt{r \cdot \left(w \cdot w\right)} \cdot \sqrt{r}\right)} \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
    14. *-commutative30.2%

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

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(\left(\color{blue}{\left(\sqrt{w} \cdot \sqrt{w}\right)} \cdot \sqrt{r}\right) \cdot \sqrt{r}\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
    17. add-sqr-sqrt43.7%

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(\left(\color{blue}{w} \cdot \sqrt{r}\right) \cdot \sqrt{r}\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
    18. associate-*r*43.7%

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\color{blue}{\left(w \cdot \left(\sqrt{r} \cdot \sqrt{r}\right)\right)} \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
    19. add-sqr-sqrt99.0%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(w \cdot r\right) \cdot \left(w \cdot \color{blue}{\frac{1}{\frac{1 - v}{r}}}\right)\right) + 4.5\right) \]
    21. un-div-inv99.0%

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

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

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

Alternative 8: 98.0% accurate, 1.0× speedup?

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

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

    \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
  2. Step-by-step derivation
    1. associate--l-85.8%

      \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\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} + 4.5\right)} \]
    2. associate-*l*78.9%

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

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \color{blue}{\left(\left(\left(w \cdot w\right) \cdot \left(-r\right)\right) \cdot \left(-r\right)\right)}}{1 - v} + 4.5\right) \]
    5. associate-/l*89.3%

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

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

    \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}{1 - v} + 4.5\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. associate-/l*89.0%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(r \cdot \frac{\color{blue}{\left(w \cdot w\right) \cdot r}}{1 - v}\right) + 4.5\right) \]
    3. associate-*r/88.6%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \color{blue}{\left(\left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right) \cdot r\right)} + 4.5\right) \]
    5. associate-*l*96.2%

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\color{blue}{\left(w \cdot \left(w \cdot \frac{r}{1 - v}\right)\right)} \cdot r\right) + 4.5\right) \]
    6. associate-*l*97.9%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(w \cdot \left(\left(w \cdot \color{blue}{\frac{1}{\frac{1 - v}{r}}}\right) \cdot r\right)\right) + 4.5\right) \]
    8. un-div-inv97.9%

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

    \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \color{blue}{\left(w \cdot \left(\frac{w}{\frac{1 - v}{r}} \cdot r\right)\right)} + 4.5\right) \]
  7. Step-by-step derivation
    1. div-inv97.9%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(w \cdot \left(\left(w \cdot \color{blue}{\frac{r}{1 - v}}\right) \cdot r\right)\right) + 4.5\right) \]
    3. associate-/l*98.7%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(w \cdot \color{blue}{\left(r \cdot \frac{w \cdot r}{1 - v}\right)}\right) + 4.5\right) \]
    5. clear-num98.7%

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(w \cdot \left(r \cdot \color{blue}{\frac{1}{\frac{1 - v}{w \cdot r}}}\right)\right) + 4.5\right) \]
    6. un-div-inv98.7%

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

    \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(w \cdot \color{blue}{\frac{r}{\frac{1 - v}{w \cdot r}}}\right) + 4.5\right) \]
  9. Step-by-step derivation
    1. clear-num98.7%

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

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

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

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

Alternative 9: 98.9% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(r \cdot w\right) \cdot \left(r \cdot w\right)\\ t_1 := \frac{2}{r \cdot r}\\ \mathbf{if}\;v \leq -200 \lor \neg \left(v \leq 3.65 \cdot 10^{-68}\right):\\ \;\;\;\;t\_1 + \left(-1.5 - 0.25 \cdot t\_0\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1 + \left(-1.5 - 0.375 \cdot t\_0\right)\\ \end{array} \end{array} \]
(FPCore (v w r)
 :precision binary64
 (let* ((t_0 (* (* r w) (* r w))) (t_1 (/ 2.0 (* r r))))
   (if (or (<= v -200.0) (not (<= v 3.65e-68)))
     (+ t_1 (- -1.5 (* 0.25 t_0)))
     (+ t_1 (- -1.5 (* 0.375 t_0))))))
double code(double v, double w, double r) {
	double t_0 = (r * w) * (r * w);
	double t_1 = 2.0 / (r * r);
	double tmp;
	if ((v <= -200.0) || !(v <= 3.65e-68)) {
		tmp = t_1 + (-1.5 - (0.25 * t_0));
	} else {
		tmp = t_1 + (-1.5 - (0.375 * t_0));
	}
	return tmp;
}
real(8) function code(v, w, r)
    real(8), intent (in) :: v
    real(8), intent (in) :: w
    real(8), intent (in) :: r
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (r * w) * (r * w)
    t_1 = 2.0d0 / (r * r)
    if ((v <= (-200.0d0)) .or. (.not. (v <= 3.65d-68))) then
        tmp = t_1 + ((-1.5d0) - (0.25d0 * t_0))
    else
        tmp = t_1 + ((-1.5d0) - (0.375d0 * t_0))
    end if
    code = tmp
end function
public static double code(double v, double w, double r) {
	double t_0 = (r * w) * (r * w);
	double t_1 = 2.0 / (r * r);
	double tmp;
	if ((v <= -200.0) || !(v <= 3.65e-68)) {
		tmp = t_1 + (-1.5 - (0.25 * t_0));
	} else {
		tmp = t_1 + (-1.5 - (0.375 * t_0));
	}
	return tmp;
}
def code(v, w, r):
	t_0 = (r * w) * (r * w)
	t_1 = 2.0 / (r * r)
	tmp = 0
	if (v <= -200.0) or not (v <= 3.65e-68):
		tmp = t_1 + (-1.5 - (0.25 * t_0))
	else:
		tmp = t_1 + (-1.5 - (0.375 * t_0))
	return tmp
function code(v, w, r)
	t_0 = Float64(Float64(r * w) * Float64(r * w))
	t_1 = Float64(2.0 / Float64(r * r))
	tmp = 0.0
	if ((v <= -200.0) || !(v <= 3.65e-68))
		tmp = Float64(t_1 + Float64(-1.5 - Float64(0.25 * t_0)));
	else
		tmp = Float64(t_1 + Float64(-1.5 - Float64(0.375 * t_0)));
	end
	return tmp
end
function tmp_2 = code(v, w, r)
	t_0 = (r * w) * (r * w);
	t_1 = 2.0 / (r * r);
	tmp = 0.0;
	if ((v <= -200.0) || ~((v <= 3.65e-68)))
		tmp = t_1 + (-1.5 - (0.25 * t_0));
	else
		tmp = t_1 + (-1.5 - (0.375 * t_0));
	end
	tmp_2 = tmp;
end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -200.0], N[Not[LessEqual[v, 3.65e-68]], $MachinePrecision]], N[(t$95$1 + N[(-1.5 - N[(0.25 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(-1.5 - N[(0.375 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(r \cdot w\right) \cdot \left(r \cdot w\right)\\
t_1 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -200 \lor \neg \left(v \leq 3.65 \cdot 10^{-68}\right):\\
\;\;\;\;t\_1 + \left(-1.5 - 0.25 \cdot t\_0\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1 + \left(-1.5 - 0.375 \cdot t\_0\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if v < -200 or 3.65000000000000005e-68 < v

    1. Initial program 86.2%

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{0.25 \cdot \left({r}^{2} \cdot {w}^{2}\right)}\right) \]
    5. Step-by-step derivation
      1. *-commutative82.0%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({r}^{2} \cdot {w}^{2}\right) \cdot 0.25}\right) \]
      2. *-commutative82.0%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} \cdot 0.25\right) \]
      3. unpow282.0%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\color{blue}{\left(w \cdot w\right)} \cdot {r}^{2}\right) \cdot 0.25\right) \]
      4. unpow282.0%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\left(w \cdot w\right) \cdot \color{blue}{\left(r \cdot r\right)}\right) \cdot 0.25\right) \]
      5. swap-sqr99.3%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
      6. unpow299.3%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(w \cdot r\right)}^{2}} \cdot 0.25\right) \]
      7. *-commutative99.3%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(r \cdot w\right)}}^{2} \cdot 0.25\right) \]
    6. Simplified99.3%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(r \cdot w\right)}^{2} \cdot 0.25}\right) \]
    7. Step-by-step derivation
      1. *-commutative99.3%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(w \cdot r\right)}}^{2} \cdot 0.25\right) \]
      2. pow299.3%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
    8. Applied egg-rr99.3%

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

    if -200 < v < 3.65000000000000005e-68

    1. Initial program 85.3%

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{0.375 \cdot \left({r}^{2} \cdot {w}^{2}\right)}\right) \]
    5. Step-by-step derivation
      1. *-commutative78.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({r}^{2} \cdot {w}^{2}\right) \cdot 0.375}\right) \]
      2. *-commutative78.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} \cdot 0.375\right) \]
      3. unpow278.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\color{blue}{\left(w \cdot w\right)} \cdot {r}^{2}\right) \cdot 0.375\right) \]
      4. unpow278.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\left(w \cdot w\right) \cdot \color{blue}{\left(r \cdot r\right)}\right) \cdot 0.375\right) \]
      5. swap-sqr99.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.375\right) \]
      6. unpow299.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(w \cdot r\right)}^{2}} \cdot 0.375\right) \]
      7. *-commutative99.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(r \cdot w\right)}}^{2} \cdot 0.375\right) \]
    6. Simplified99.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(r \cdot w\right)}^{2} \cdot 0.375}\right) \]
    7. Step-by-step derivation
      1. *-commutative85.3%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(w \cdot r\right)}}^{2} \cdot 0.25\right) \]
      2. pow285.3%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
    8. Applied egg-rr99.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.375\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;v \leq -200 \lor \neg \left(v \leq 3.65 \cdot 10^{-68}\right):\\ \;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 - 0.25 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 - 0.375 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 98.3% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ t_1 := \left(r \cdot w\right) \cdot \left(r \cdot w\right)\\ \mathbf{if}\;v \leq -1460:\\ \;\;\;\;t\_0 + \left(-1.5 - \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right) \cdot 0.25\right)\\ \mathbf{elif}\;v \leq 3.65 \cdot 10^{-68}:\\ \;\;\;\;t\_0 + \left(-1.5 - 0.375 \cdot t\_1\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0 + \left(-1.5 - 0.25 \cdot t\_1\right)\\ \end{array} \end{array} \]
(FPCore (v w r)
 :precision binary64
 (let* ((t_0 (/ 2.0 (* r r))) (t_1 (* (* r w) (* r w))))
   (if (<= v -1460.0)
     (+ t_0 (- -1.5 (* (* r (* w (* r w))) 0.25)))
     (if (<= v 3.65e-68)
       (+ t_0 (- -1.5 (* 0.375 t_1)))
       (+ t_0 (- -1.5 (* 0.25 t_1)))))))
double code(double v, double w, double r) {
	double t_0 = 2.0 / (r * r);
	double t_1 = (r * w) * (r * w);
	double tmp;
	if (v <= -1460.0) {
		tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25));
	} else if (v <= 3.65e-68) {
		tmp = t_0 + (-1.5 - (0.375 * t_1));
	} else {
		tmp = t_0 + (-1.5 - (0.25 * t_1));
	}
	return tmp;
}
real(8) function code(v, w, r)
    real(8), intent (in) :: v
    real(8), intent (in) :: w
    real(8), intent (in) :: r
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 2.0d0 / (r * r)
    t_1 = (r * w) * (r * w)
    if (v <= (-1460.0d0)) then
        tmp = t_0 + ((-1.5d0) - ((r * (w * (r * w))) * 0.25d0))
    else if (v <= 3.65d-68) then
        tmp = t_0 + ((-1.5d0) - (0.375d0 * t_1))
    else
        tmp = t_0 + ((-1.5d0) - (0.25d0 * t_1))
    end if
    code = tmp
end function
public static double code(double v, double w, double r) {
	double t_0 = 2.0 / (r * r);
	double t_1 = (r * w) * (r * w);
	double tmp;
	if (v <= -1460.0) {
		tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25));
	} else if (v <= 3.65e-68) {
		tmp = t_0 + (-1.5 - (0.375 * t_1));
	} else {
		tmp = t_0 + (-1.5 - (0.25 * t_1));
	}
	return tmp;
}
def code(v, w, r):
	t_0 = 2.0 / (r * r)
	t_1 = (r * w) * (r * w)
	tmp = 0
	if v <= -1460.0:
		tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25))
	elif v <= 3.65e-68:
		tmp = t_0 + (-1.5 - (0.375 * t_1))
	else:
		tmp = t_0 + (-1.5 - (0.25 * t_1))
	return tmp
function code(v, w, r)
	t_0 = Float64(2.0 / Float64(r * r))
	t_1 = Float64(Float64(r * w) * Float64(r * w))
	tmp = 0.0
	if (v <= -1460.0)
		tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(r * Float64(w * Float64(r * w))) * 0.25)));
	elseif (v <= 3.65e-68)
		tmp = Float64(t_0 + Float64(-1.5 - Float64(0.375 * t_1)));
	else
		tmp = Float64(t_0 + Float64(-1.5 - Float64(0.25 * t_1)));
	end
	return tmp
end
function tmp_2 = code(v, w, r)
	t_0 = 2.0 / (r * r);
	t_1 = (r * w) * (r * w);
	tmp = 0.0;
	if (v <= -1460.0)
		tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25));
	elseif (v <= 3.65e-68)
		tmp = t_0 + (-1.5 - (0.375 * t_1));
	else
		tmp = t_0 + (-1.5 - (0.25 * t_1));
	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[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, -1460.0], N[(t$95$0 + N[(-1.5 - N[(N[(r * N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[v, 3.65e-68], N[(t$95$0 + N[(-1.5 - N[(0.375 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 - N[(0.25 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \left(r \cdot w\right) \cdot \left(r \cdot w\right)\\
\mathbf{if}\;v \leq -1460:\\
\;\;\;\;t\_0 + \left(-1.5 - \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right) \cdot 0.25\right)\\

\mathbf{elif}\;v \leq 3.65 \cdot 10^{-68}:\\
\;\;\;\;t\_0 + \left(-1.5 - 0.375 \cdot t\_1\right)\\

\mathbf{else}:\\
\;\;\;\;t\_0 + \left(-1.5 - 0.25 \cdot t\_1\right)\\


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

    1. Initial program 89.9%

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{0.25 \cdot \left({r}^{2} \cdot {w}^{2}\right)}\right) \]
    5. Step-by-step derivation
      1. *-commutative79.5%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({r}^{2} \cdot {w}^{2}\right) \cdot 0.25}\right) \]
      2. *-commutative79.5%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} \cdot 0.25\right) \]
      3. unpow279.5%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\color{blue}{\left(w \cdot w\right)} \cdot {r}^{2}\right) \cdot 0.25\right) \]
      4. unpow279.5%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\left(w \cdot w\right) \cdot \color{blue}{\left(r \cdot r\right)}\right) \cdot 0.25\right) \]
      5. swap-sqr98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
      6. unpow298.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(w \cdot r\right)}^{2}} \cdot 0.25\right) \]
      7. *-commutative98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(r \cdot w\right)}}^{2} \cdot 0.25\right) \]
    6. Simplified98.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(r \cdot w\right)}^{2} \cdot 0.25}\right) \]
    7. Step-by-step derivation
      1. *-commutative98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(w \cdot r\right)}}^{2} \cdot 0.25\right) \]
      2. pow298.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
      3. remove-double-div98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\color{blue}{\frac{1}{\frac{1}{w \cdot r}}} \cdot \left(w \cdot r\right)\right) \cdot 0.25\right) \]
      4. remove-double-div98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\frac{1}{\frac{1}{w \cdot r}} \cdot \color{blue}{\frac{1}{\frac{1}{w \cdot r}}}\right) \cdot 0.25\right) \]
      5. frac-times98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\frac{1 \cdot 1}{\frac{1}{w \cdot r} \cdot \frac{1}{w \cdot r}}} \cdot 0.25\right) \]
      6. metadata-eval98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{\color{blue}{1}}{\frac{1}{w \cdot r} \cdot \frac{1}{w \cdot r}} \cdot 0.25\right) \]
    8. Applied egg-rr98.8%

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

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{1}{\color{blue}{\frac{1 \cdot 1}{\left(w \cdot r\right) \cdot \left(w \cdot r\right)}}} \cdot 0.25\right) \]
      2. metadata-eval98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{1}{\frac{\color{blue}{1}}{\left(w \cdot r\right) \cdot \left(w \cdot r\right)}} \cdot 0.25\right) \]
      3. pow298.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{1}{\frac{1}{\color{blue}{{\left(w \cdot r\right)}^{2}}}} \cdot 0.25\right) \]
      4. *-commutative98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{1}{\frac{1}{{\color{blue}{\left(r \cdot w\right)}}^{2}}} \cdot 0.25\right) \]
      5. remove-double-div98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(r \cdot w\right)}^{2}} \cdot 0.25\right) \]
      6. *-commutative98.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(w \cdot r\right)}}^{2} \cdot 0.25\right) \]
      7. pow298.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
      8. associate-*r*98.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(\left(w \cdot r\right) \cdot w\right) \cdot r\right)} \cdot 0.25\right) \]
    10. Applied egg-rr98.9%

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

    if -1460 < v < 3.65000000000000005e-68

    1. Initial program 85.3%

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{0.375 \cdot \left({r}^{2} \cdot {w}^{2}\right)}\right) \]
    5. Step-by-step derivation
      1. *-commutative78.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({r}^{2} \cdot {w}^{2}\right) \cdot 0.375}\right) \]
      2. *-commutative78.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} \cdot 0.375\right) \]
      3. unpow278.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\color{blue}{\left(w \cdot w\right)} \cdot {r}^{2}\right) \cdot 0.375\right) \]
      4. unpow278.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\left(w \cdot w\right) \cdot \color{blue}{\left(r \cdot r\right)}\right) \cdot 0.375\right) \]
      5. swap-sqr99.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.375\right) \]
      6. unpow299.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(w \cdot r\right)}^{2}} \cdot 0.375\right) \]
      7. *-commutative99.8%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(r \cdot w\right)}}^{2} \cdot 0.375\right) \]
    6. Simplified99.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(r \cdot w\right)}^{2} \cdot 0.375}\right) \]
    7. Step-by-step derivation
      1. *-commutative85.3%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(w \cdot r\right)}}^{2} \cdot 0.25\right) \]
      2. pow285.3%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
    8. Applied egg-rr99.8%

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

    if 3.65000000000000005e-68 < v

    1. Initial program 82.4%

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{0.25 \cdot \left({r}^{2} \cdot {w}^{2}\right)}\right) \]
    5. Step-by-step derivation
      1. *-commutative84.6%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({r}^{2} \cdot {w}^{2}\right) \cdot 0.25}\right) \]
      2. *-commutative84.6%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} \cdot 0.25\right) \]
      3. unpow284.6%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\color{blue}{\left(w \cdot w\right)} \cdot {r}^{2}\right) \cdot 0.25\right) \]
      4. unpow284.6%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\left(w \cdot w\right) \cdot \color{blue}{\left(r \cdot r\right)}\right) \cdot 0.25\right) \]
      5. swap-sqr99.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
      6. unpow299.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(w \cdot r\right)}^{2}} \cdot 0.25\right) \]
      7. *-commutative99.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(r \cdot w\right)}}^{2} \cdot 0.25\right) \]
    6. Simplified99.9%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(r \cdot w\right)}^{2} \cdot 0.25}\right) \]
    7. Step-by-step derivation
      1. *-commutative99.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(w \cdot r\right)}}^{2} \cdot 0.25\right) \]
      2. pow299.9%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
    8. Applied egg-rr99.9%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;v \leq -1460:\\ \;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 - \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right) \cdot 0.25\right)\\ \mathbf{elif}\;v \leq 3.65 \cdot 10^{-68}:\\ \;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 - 0.375 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 - 0.25 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 93.3% accurate, 1.7× speedup?

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

\\
\frac{2}{r \cdot r} + \left(-1.5 - 0.25 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)
\end{array}
Derivation
  1. Initial program 85.8%

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

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

    \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{0.25 \cdot \left({r}^{2} \cdot {w}^{2}\right)}\right) \]
  5. Step-by-step derivation
    1. *-commutative77.0%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({r}^{2} \cdot {w}^{2}\right) \cdot 0.25}\right) \]
    2. *-commutative77.0%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} \cdot 0.25\right) \]
    3. unpow277.0%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\color{blue}{\left(w \cdot w\right)} \cdot {r}^{2}\right) \cdot 0.25\right) \]
    4. unpow277.0%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\left(w \cdot w\right) \cdot \color{blue}{\left(r \cdot r\right)}\right) \cdot 0.25\right) \]
    5. swap-sqr92.3%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
    6. unpow292.3%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(w \cdot r\right)}^{2}} \cdot 0.25\right) \]
    7. *-commutative92.3%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(r \cdot w\right)}}^{2} \cdot 0.25\right) \]
  6. Simplified92.3%

    \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(r \cdot w\right)}^{2} \cdot 0.25}\right) \]
  7. Step-by-step derivation
    1. *-commutative92.3%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(w \cdot r\right)}}^{2} \cdot 0.25\right) \]
    2. pow292.3%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
  8. Applied egg-rr92.3%

    \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
  9. Final simplification92.3%

    \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - 0.25 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right) \]
  10. Add Preprocessing

Alternative 12: 57.3% accurate, 4.1× speedup?

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

\\
\frac{2}{r \cdot r} + -1.5
\end{array}
Derivation
  1. Initial program 85.8%

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

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

    \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{0.25 \cdot \left({r}^{2} \cdot {w}^{2}\right)}\right) \]
  5. Step-by-step derivation
    1. *-commutative77.0%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({r}^{2} \cdot {w}^{2}\right) \cdot 0.25}\right) \]
    2. *-commutative77.0%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left({w}^{2} \cdot {r}^{2}\right)} \cdot 0.25\right) \]
    3. unpow277.0%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\color{blue}{\left(w \cdot w\right)} \cdot {r}^{2}\right) \cdot 0.25\right) \]
    4. unpow277.0%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(\left(w \cdot w\right) \cdot \color{blue}{\left(r \cdot r\right)}\right) \cdot 0.25\right) \]
    5. swap-sqr92.3%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)} \cdot 0.25\right) \]
    6. unpow292.3%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(w \cdot r\right)}^{2}} \cdot 0.25\right) \]
    7. *-commutative92.3%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - {\color{blue}{\left(r \cdot w\right)}}^{2} \cdot 0.25\right) \]
  6. Simplified92.3%

    \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(r \cdot w\right)}^{2} \cdot 0.25}\right) \]
  7. Taylor expanded in r around 0 55.9%

    \[\leadsto \frac{2}{r \cdot r} + \color{blue}{-1.5} \]
  8. Final simplification55.9%

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

Reproduce

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