Rosa's TurbineBenchmark

Percentage Accurate: 84.1% → 99.7%
Time: 12.1s
Alternatives: 14
Speedup: 1.0×

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

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

Initial Program: 84.1% 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: 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 89.1%

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

      \[\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*85.2%

      \[\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-neg85.2%

      \[\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*89.1%

      \[\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*90.6%

      \[\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-define90.6%

      \[\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. Simplified90.6%

    \[\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-identity90.6%

      \[\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-sqrt90.5%

      \[\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-frac90.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(\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. *-commutative90.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{\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-prod49.6%

      \[\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. *-commutative49.6%

      \[\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-prod49.6%

      \[\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-prod22.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{\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-sqrt39.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}{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*39.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{\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-sqrt75.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{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.8%

    \[\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.8%

    \[\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 2: 95.4% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := v \cdot -0.25 + 0.375\\
t_1 := \frac{r}{v + -1}\\
t_2 := \frac{2}{r \cdot r}\\
\mathbf{if}\;w \cdot w \leq 2 \cdot 10^{+303}:\\
\;\;\;\;t\_2 + \left(-1.5 + t\_0 \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot t\_1\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\left(3 + t\_2\right) + \left(w \cdot \left(r \cdot t\_0\right)\right) \cdot \left(w \cdot t\_1\right)\right) - 4.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 w w) < 2e303

    1. Initial program 97.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. Simplified99.2%

      \[\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. Step-by-step derivation
      1. fma-undefine99.2%

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

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(0.125 \cdot \left(\color{blue}{-2 \cdot v} + 3\right)\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right)\right)\right) \]
      3. distribute-lft-in99.2%

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

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

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

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

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

    if 2e303 < (*.f64 w w)

    1. Initial program 64.1%

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

        \[\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-inv64.1%

        \[\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-eval64.1%

        \[\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. +-commutative64.1%

        \[\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. *-commutative64.1%

        \[\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-undefine64.1%

        \[\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. *-commutative64.1%

        \[\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. *-commutative64.1%

        \[\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*64.1%

        \[\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. *-commutative64.1%

        \[\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/63.9%

        \[\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*63.9%

        \[\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*93.9%

        \[\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*98.4%

        \[\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-rr98.4%

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

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

Alternative 3: 86.9% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if r < 6.00000000000000033e-55

    1. Initial program 86.0%

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

        \[\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*82.3%

        \[\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-neg82.3%

        \[\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*86.0%

        \[\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*87.5%

        \[\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-define87.5%

        \[\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. Simplified87.5%

      \[\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-identity87.5%

        \[\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-sqrt87.5%

        \[\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-frac87.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(\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. *-commutative87.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{\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-prod30.9%

        \[\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. *-commutative30.9%

        \[\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-prod30.9%

        \[\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-prod15.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}{\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-sqrt32.0%

        \[\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*32.0%

        \[\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-sqrt81.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{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.8%

      \[\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. Taylor expanded in v around 0 90.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{w \cdot r}{1} \cdot \color{blue}{\left(r \cdot w\right)}\right) + 4.5\right) \]
    8. Step-by-step derivation
      1. /-rgt-identity90.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}{\left(w \cdot r\right)} \cdot \left(r \cdot w\right)\right) + 4.5\right) \]
    9. Applied egg-rr90.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}{\left(w \cdot r\right)} \cdot \left(r \cdot w\right)\right) + 4.5\right) \]

    if 6.00000000000000033e-55 < r

    1. Initial program 97.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. Simplified98.5%

      \[\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. Step-by-step derivation
      1. fma-undefine98.5%

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

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(0.125 \cdot \left(\color{blue}{-2 \cdot v} + 3\right)\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right)\right)\right) \]
      3. distribute-lft-in98.5%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;r \leq 6 \cdot 10^{-55}:\\ \;\;\;\;\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 \left(r \cdot w\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + \left(v \cdot -0.25 + 0.375\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{v + -1}\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 75.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.3 \cdot 10^{-91}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if r < 1.30000000000000007e-91

    1. Initial program 86.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. Simplified83.5%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{4.5} \]
    5. Step-by-step derivation
      1. associate-/r*72.1%

        \[\leadsto \left(3 + \color{blue}{\frac{\frac{2}{r}}{r}}\right) - 4.5 \]
      2. div-inv72.0%

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

      \[\leadsto \left(3 + \color{blue}{\frac{2}{r} \cdot \frac{1}{r}}\right) - 4.5 \]
    7. Step-by-step derivation
      1. associate-*r/72.1%

        \[\leadsto \left(3 + \color{blue}{\frac{\frac{2}{r} \cdot 1}{r}}\right) - 4.5 \]
      2. *-rgt-identity72.1%

        \[\leadsto \left(3 + \frac{\color{blue}{\frac{2}{r}}}{r}\right) - 4.5 \]
    8. Simplified72.1%

      \[\leadsto \left(3 + \color{blue}{\frac{\frac{2}{r}}{r}}\right) - 4.5 \]

    if 1.30000000000000007e-91 < r

    1. Initial program 94.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. Simplified95.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. Step-by-step derivation
      1. fma-undefine95.4%

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

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(0.125 \cdot \left(\color{blue}{-2 \cdot v} + 3\right)\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right)\right)\right) \]
      3. distribute-lft-in95.4%

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

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

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

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(-0.25 \cdot v + \color{blue}{0.375}\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right)\right)\right) \]
    5. Applied egg-rr95.4%

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

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

Alternative 5: 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 \frac{r \cdot w}{\frac{v + -1}{r \cdot w}} - 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) (/ (+ 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))) * ((r * w) / ((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))) * ((r * w) / ((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))) * ((r * w) / ((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))) * ((r * w) / ((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(Float64(r * w) / 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))) * ((r * w) / ((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[(N[(r * w), $MachinePrecision] / N[(N[(v + -1.0), $MachinePrecision] / N[(r * w), $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 \frac{r \cdot w}{\frac{v + -1}{r \cdot w}} - 4.5\right)
\end{array}
Derivation
  1. Initial program 89.1%

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

      \[\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*85.2%

      \[\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-neg85.2%

      \[\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*89.1%

      \[\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*90.6%

      \[\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-define90.6%

      \[\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. Simplified90.6%

    \[\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-identity90.6%

      \[\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-sqrt90.5%

      \[\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-frac90.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(\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. *-commutative90.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{\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-prod49.6%

      \[\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. *-commutative49.6%

      \[\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-prod49.6%

      \[\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-prod22.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{\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-sqrt39.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}{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*39.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{\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-sqrt75.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{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.8%

    \[\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. Step-by-step derivation
    1. /-rgt-identity99.8%

      \[\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 r\right)} \cdot \frac{w \cdot r}{1 - v}\right) + 4.5\right) \]
    2. clear-num99.8%

      \[\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{1}{\frac{1 - v}{w \cdot r}}}\right) + 4.5\right) \]
    3. un-div-inv99.8%

      \[\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 \cdot r}{\frac{1 - v}{w \cdot r}}} + 4.5\right) \]
  8. Applied egg-rr99.8%

    \[\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 \cdot r}{\frac{1 - v}{w \cdot r}}} + 4.5\right) \]
  9. Final simplification99.8%

    \[\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 w}{\frac{v + -1}{r \cdot w}} - 4.5\right) \]
  10. Add Preprocessing

Alternative 6: 99.4% 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 \left(w \cdot \frac{r}{v + -1}\right)\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) (* w (/ r (+ 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) * (w * (r / (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) * (w * (r / (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) * (w * (r / (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) * (w * (r / (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(w * Float64(r / 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) * (w * (r / (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[(w * N[(r / N[(v + -1.0), $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(\left(r \cdot w\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\right)
\end{array}
Derivation
  1. Initial program 89.1%

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

      \[\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*85.2%

      \[\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-neg85.2%

      \[\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*89.1%

      \[\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*90.6%

      \[\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-define90.6%

      \[\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. Simplified90.6%

    \[\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*90.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(r \cdot \frac{r \cdot \left(w \cdot w\right)}{1 - v}\right)} + 4.5\right) \]
    2. *-commutative90.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 \frac{\color{blue}{\left(w \cdot w\right) \cdot r}}{1 - v}\right) + 4.5\right) \]
    3. associate-*r/90.5%

      \[\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*98.3%

      \[\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.4%

      \[\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-sqrt55.3%

      \[\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. sqrt-prod77.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}{\sqrt{r \cdot r}} \cdot w\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
    8. add-sqr-sqrt37.4%

      \[\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 r} \cdot \color{blue}{\left(\sqrt{w} \cdot \sqrt{w}\right)}\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
    9. sqrt-prod68.6%

      \[\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 r} \cdot \color{blue}{\sqrt{w \cdot w}}\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
    10. sqrt-prod68.6%

      \[\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{\left(r \cdot r\right) \cdot \left(w \cdot w\right)}} \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
    11. associate-*r*73.6%

      \[\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}{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. *-commutative73.6%

      \[\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-prod39.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}{\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. *-commutative39.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(\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-prod39.4%

      \[\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-prod26.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-sqrt55.3%

      \[\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*55.3%

      \[\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.4%

      \[\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) \]
  6. Applied egg-rr99.4%

    \[\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 \left(w \cdot \frac{r}{1 - v}\right)\right)} + 4.5\right) \]
  7. Final simplification99.4%

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

Alternative 7: 74.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;r \leq 4.6 \cdot 10^{-35}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\

\mathbf{else}:\\
\;\;\;\;3 + \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}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if r < 4.5999999999999998e-35

    1. Initial program 86.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. Simplified83.7%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{4.5} \]
    5. Step-by-step derivation
      1. associate-/r*72.9%

        \[\leadsto \left(3 + \color{blue}{\frac{\frac{2}{r}}{r}}\right) - 4.5 \]
      2. div-inv72.8%

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

      \[\leadsto \left(3 + \color{blue}{\frac{2}{r} \cdot \frac{1}{r}}\right) - 4.5 \]
    7. Step-by-step derivation
      1. associate-*r/72.9%

        \[\leadsto \left(3 + \color{blue}{\frac{\frac{2}{r} \cdot 1}{r}}\right) - 4.5 \]
      2. *-rgt-identity72.9%

        \[\leadsto \left(3 + \frac{\color{blue}{\frac{2}{r}}}{r}\right) - 4.5 \]
    8. Simplified72.9%

      \[\leadsto \left(3 + \color{blue}{\frac{\frac{2}{r}}{r}}\right) - 4.5 \]

    if 4.5999999999999998e-35 < r

    1. Initial program 97.0%

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

        \[\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*92.4%

        \[\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-neg92.4%

        \[\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*97.0%

        \[\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*98.5%

        \[\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-define98.5%

        \[\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. Simplified98.5%

      \[\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*98.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(r \cdot \frac{r \cdot \left(w \cdot w\right)}{1 - v}\right)} + 4.5\right) \]
      2. *-commutative98.5%

        \[\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/98.5%

        \[\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*99.8%

        \[\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.8%

        \[\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-sqrt99.8%

        \[\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. sqrt-prod94.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(\color{blue}{\sqrt{r \cdot r}} \cdot w\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
      8. add-sqr-sqrt38.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(\sqrt{r \cdot r} \cdot \color{blue}{\left(\sqrt{w} \cdot \sqrt{w}\right)}\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
      9. sqrt-prod51.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(\sqrt{r \cdot r} \cdot \color{blue}{\sqrt{w \cdot w}}\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
      10. sqrt-prod51.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{\left(r \cdot r\right) \cdot \left(w \cdot w\right)}} \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
      11. associate-*r*56.1%

        \[\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}{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. *-commutative56.1%

        \[\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-prod56.0%

        \[\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. *-commutative56.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(\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-prod56.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(\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-prod42.3%

        \[\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-sqrt99.8%

        \[\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*99.8%

        \[\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.8%

        \[\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) \]
    6. Applied egg-rr99.8%

      \[\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 \left(w \cdot \frac{r}{1 - v}\right)\right)} + 4.5\right) \]
    7. Taylor expanded in r around inf 96.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;r \leq 4.6 \cdot 10^{-35}:\\ \;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\ \mathbf{else}:\\ \;\;\;\;3 + \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} \]
  5. Add Preprocessing

Alternative 8: 74.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;r \leq 2.4 \cdot 10^{-35}:\\ \;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\ \mathbf{else}:\\ \;\;\;\;3 + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\right)\\ \end{array} \end{array} \]
(FPCore (v w r)
 :precision binary64
 (if (<= r 2.4e-35)
   (- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)
   (+
    3.0
    (-
     (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (* w (/ r (+ v -1.0)))))
     4.5))))
double code(double v, double w, double r) {
	double tmp;
	if (r <= 2.4e-35) {
		tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
	} else {
		tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (v + -1.0))))) - 4.5);
	}
	return tmp;
}
real(8) function code(v, w, r)
    real(8), intent (in) :: v
    real(8), intent (in) :: w
    real(8), intent (in) :: r
    real(8) :: tmp
    if (r <= 2.4d-35) then
        tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
    else
        tmp = 3.0d0 + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * (w * (r / (v + (-1.0d0)))))) - 4.5d0)
    end if
    code = tmp
end function
public static double code(double v, double w, double r) {
	double tmp;
	if (r <= 2.4e-35) {
		tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
	} else {
		tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (v + -1.0))))) - 4.5);
	}
	return tmp;
}
def code(v, w, r):
	tmp = 0
	if r <= 2.4e-35:
		tmp = (3.0 + ((2.0 / r) / r)) - 4.5
	else:
		tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (v + -1.0))))) - 4.5)
	return tmp
function code(v, w, r)
	tmp = 0.0
	if (r <= 2.4e-35)
		tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5);
	else
		tmp = Float64(3.0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(w * Float64(r / Float64(v + -1.0))))) - 4.5));
	end
	return tmp
end
function tmp_2 = code(v, w, r)
	tmp = 0.0;
	if (r <= 2.4e-35)
		tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
	else
		tmp = 3.0 + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w * (r / (v + -1.0))))) - 4.5);
	end
	tmp_2 = tmp;
end
code[v_, w_, r_] := If[LessEqual[r, 2.4e-35], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(3.0 + N[(N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(w * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;r \leq 2.4 \cdot 10^{-35}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\

\mathbf{else}:\\
\;\;\;\;3 + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if r < 2.4000000000000001e-35

    1. Initial program 86.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. Simplified83.7%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{4.5} \]
    5. Step-by-step derivation
      1. associate-/r*72.9%

        \[\leadsto \left(3 + \color{blue}{\frac{\frac{2}{r}}{r}}\right) - 4.5 \]
      2. div-inv72.8%

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

      \[\leadsto \left(3 + \color{blue}{\frac{2}{r} \cdot \frac{1}{r}}\right) - 4.5 \]
    7. Step-by-step derivation
      1. associate-*r/72.9%

        \[\leadsto \left(3 + \color{blue}{\frac{\frac{2}{r} \cdot 1}{r}}\right) - 4.5 \]
      2. *-rgt-identity72.9%

        \[\leadsto \left(3 + \frac{\color{blue}{\frac{2}{r}}}{r}\right) - 4.5 \]
    8. Simplified72.9%

      \[\leadsto \left(3 + \color{blue}{\frac{\frac{2}{r}}{r}}\right) - 4.5 \]

    if 2.4000000000000001e-35 < r

    1. Initial program 97.0%

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

        \[\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*92.4%

        \[\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-neg92.4%

        \[\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*97.0%

        \[\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*98.5%

        \[\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-define98.5%

        \[\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. Simplified98.5%

      \[\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*98.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(r \cdot \frac{r \cdot \left(w \cdot w\right)}{1 - v}\right)} + 4.5\right) \]
      2. *-commutative98.5%

        \[\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/98.5%

        \[\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*99.8%

        \[\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.8%

        \[\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-sqrt99.8%

        \[\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. sqrt-prod94.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(\color{blue}{\sqrt{r \cdot r}} \cdot w\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
      8. add-sqr-sqrt38.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(\sqrt{r \cdot r} \cdot \color{blue}{\left(\sqrt{w} \cdot \sqrt{w}\right)}\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
      9. sqrt-prod51.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(\sqrt{r \cdot r} \cdot \color{blue}{\sqrt{w \cdot w}}\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
      10. sqrt-prod51.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{\left(r \cdot r\right) \cdot \left(w \cdot w\right)}} \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
      11. associate-*r*56.1%

        \[\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}{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. *-commutative56.1%

        \[\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-prod56.0%

        \[\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. *-commutative56.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(\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-prod56.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(\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-prod42.3%

        \[\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-sqrt99.8%

        \[\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*99.8%

        \[\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.8%

        \[\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) \]
    6. Applied egg-rr99.8%

      \[\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 \left(w \cdot \frac{r}{1 - v}\right)\right)} + 4.5\right) \]
    7. Taylor expanded in r around inf 96.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;r \leq 2.4 \cdot 10^{-35}:\\ \;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\ \mathbf{else}:\\ \;\;\;\;3 + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 72.4% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;r \leq 4.4 \cdot 10^{-35}:\\ \;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\ \mathbf{else}:\\ \;\;\;\;\left(3 + \left(w \cdot \left(r \cdot \left(v \cdot -0.25 + 0.375\right)\right)\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\\ \end{array} \end{array} \]
(FPCore (v w r)
 :precision binary64
 (if (<= r 4.4e-35)
   (- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)
   (-
    (+ 3.0 (* (* w (* r (+ (* v -0.25) 0.375))) (* w (/ r (+ v -1.0)))))
    4.5)))
double code(double v, double w, double r) {
	double tmp;
	if (r <= 4.4e-35) {
		tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
	} else {
		tmp = (3.0 + ((w * (r * ((v * -0.25) + 0.375))) * (w * (r / (v + -1.0))))) - 4.5;
	}
	return tmp;
}
real(8) function code(v, w, r)
    real(8), intent (in) :: v
    real(8), intent (in) :: w
    real(8), intent (in) :: r
    real(8) :: tmp
    if (r <= 4.4d-35) then
        tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
    else
        tmp = (3.0d0 + ((w * (r * ((v * (-0.25d0)) + 0.375d0))) * (w * (r / (v + (-1.0d0)))))) - 4.5d0
    end if
    code = tmp
end function
public static double code(double v, double w, double r) {
	double tmp;
	if (r <= 4.4e-35) {
		tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
	} else {
		tmp = (3.0 + ((w * (r * ((v * -0.25) + 0.375))) * (w * (r / (v + -1.0))))) - 4.5;
	}
	return tmp;
}
def code(v, w, r):
	tmp = 0
	if r <= 4.4e-35:
		tmp = (3.0 + ((2.0 / r) / r)) - 4.5
	else:
		tmp = (3.0 + ((w * (r * ((v * -0.25) + 0.375))) * (w * (r / (v + -1.0))))) - 4.5
	return tmp
function code(v, w, r)
	tmp = 0.0
	if (r <= 4.4e-35)
		tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5);
	else
		tmp = Float64(Float64(3.0 + Float64(Float64(w * Float64(r * Float64(Float64(v * -0.25) + 0.375))) * Float64(w * Float64(r / Float64(v + -1.0))))) - 4.5);
	end
	return tmp
end
function tmp_2 = code(v, w, r)
	tmp = 0.0;
	if (r <= 4.4e-35)
		tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
	else
		tmp = (3.0 + ((w * (r * ((v * -0.25) + 0.375))) * (w * (r / (v + -1.0))))) - 4.5;
	end
	tmp_2 = tmp;
end
code[v_, w_, r_] := If[LessEqual[r, 4.4e-35], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(3.0 + N[(N[(w * N[(r * N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;r \leq 4.4 \cdot 10^{-35}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\

\mathbf{else}:\\
\;\;\;\;\left(3 + \left(w \cdot \left(r \cdot \left(v \cdot -0.25 + 0.375\right)\right)\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if r < 4.39999999999999987e-35

    1. Initial program 86.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. Simplified83.7%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{4.5} \]
    5. Step-by-step derivation
      1. associate-/r*72.9%

        \[\leadsto \left(3 + \color{blue}{\frac{\frac{2}{r}}{r}}\right) - 4.5 \]
      2. div-inv72.8%

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

      \[\leadsto \left(3 + \color{blue}{\frac{2}{r} \cdot \frac{1}{r}}\right) - 4.5 \]
    7. Step-by-step derivation
      1. associate-*r/72.9%

        \[\leadsto \left(3 + \color{blue}{\frac{\frac{2}{r} \cdot 1}{r}}\right) - 4.5 \]
      2. *-rgt-identity72.9%

        \[\leadsto \left(3 + \frac{\color{blue}{\frac{2}{r}}}{r}\right) - 4.5 \]
    8. Simplified72.9%

      \[\leadsto \left(3 + \color{blue}{\frac{\frac{2}{r}}{r}}\right) - 4.5 \]

    if 4.39999999999999987e-35 < r

    1. Initial program 97.0%

      \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/l*98.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-inv98.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-eval98.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. +-commutative98.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. *-commutative98.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-undefine98.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. *-commutative98.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. *-commutative98.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*98.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. *-commutative98.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/98.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*91.0%

        \[\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*92.3%

        \[\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*92.4%

        \[\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-rr92.4%

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

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

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

Alternative 10: 69.4% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;r \leq 7 \cdot 10^{-93}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\

\mathbf{else}:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + 0.375 \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{v + -1}\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if r < 7e-93

    1. Initial program 86.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. Simplified83.5%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{4.5} \]
    5. Step-by-step derivation
      1. associate-/r*72.1%

        \[\leadsto \left(3 + \color{blue}{\frac{\frac{2}{r}}{r}}\right) - 4.5 \]
      2. div-inv72.0%

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

      \[\leadsto \left(3 + \color{blue}{\frac{2}{r} \cdot \frac{1}{r}}\right) - 4.5 \]
    7. Step-by-step derivation
      1. associate-*r/72.1%

        \[\leadsto \left(3 + \color{blue}{\frac{\frac{2}{r} \cdot 1}{r}}\right) - 4.5 \]
      2. *-rgt-identity72.1%

        \[\leadsto \left(3 + \frac{\color{blue}{\frac{2}{r}}}{r}\right) - 4.5 \]
    8. Simplified72.1%

      \[\leadsto \left(3 + \color{blue}{\frac{\frac{2}{r}}{r}}\right) - 4.5 \]

    if 7e-93 < r

    1. Initial program 94.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. Simplified95.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 0 77.7%

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

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

Alternative 11: 67.4% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;r \leq 6.6 \cdot 10^{-34}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\

\mathbf{else}:\\
\;\;\;\;3 - \left(4.5 + \left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if r < 6.59999999999999965e-34

    1. Initial program 86.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. Simplified83.7%

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{4.5} \]
    5. Step-by-step derivation
      1. associate-/r*72.9%

        \[\leadsto \left(3 + \color{blue}{\frac{\frac{2}{r}}{r}}\right) - 4.5 \]
      2. div-inv72.8%

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

      \[\leadsto \left(3 + \color{blue}{\frac{2}{r} \cdot \frac{1}{r}}\right) - 4.5 \]
    7. Step-by-step derivation
      1. associate-*r/72.9%

        \[\leadsto \left(3 + \color{blue}{\frac{\frac{2}{r} \cdot 1}{r}}\right) - 4.5 \]
      2. *-rgt-identity72.9%

        \[\leadsto \left(3 + \frac{\color{blue}{\frac{2}{r}}}{r}\right) - 4.5 \]
    8. Simplified72.9%

      \[\leadsto \left(3 + \color{blue}{\frac{\frac{2}{r}}{r}}\right) - 4.5 \]

    if 6.59999999999999965e-34 < r

    1. Initial program 97.0%

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

        \[\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*92.4%

        \[\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-neg92.4%

        \[\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*97.0%

        \[\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*98.5%

        \[\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-define98.5%

        \[\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. Simplified98.5%

      \[\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*98.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(r \cdot \frac{r \cdot \left(w \cdot w\right)}{1 - v}\right)} + 4.5\right) \]
      2. *-commutative98.5%

        \[\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/98.5%

        \[\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*99.8%

        \[\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.8%

        \[\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-sqrt99.8%

        \[\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. sqrt-prod94.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(\color{blue}{\sqrt{r \cdot r}} \cdot w\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
      8. add-sqr-sqrt38.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(\sqrt{r \cdot r} \cdot \color{blue}{\left(\sqrt{w} \cdot \sqrt{w}\right)}\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
      9. sqrt-prod51.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(\sqrt{r \cdot r} \cdot \color{blue}{\sqrt{w \cdot w}}\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
      10. sqrt-prod51.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{\left(r \cdot r\right) \cdot \left(w \cdot w\right)}} \cdot \left(w \cdot \frac{r}{1 - v}\right)\right) + 4.5\right) \]
      11. associate-*r*56.1%

        \[\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}{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. *-commutative56.1%

        \[\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-prod56.0%

        \[\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. *-commutative56.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(\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-prod56.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(\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-prod42.3%

        \[\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-sqrt99.8%

        \[\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*99.8%

        \[\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.8%

        \[\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) \]
    6. Applied egg-rr99.8%

      \[\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 \left(w \cdot \frac{r}{1 - v}\right)\right)} + 4.5\right) \]
    7. Taylor expanded in r around inf 96.7%

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

      \[\leadsto 3 - \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}{r}\right)\right) + 4.5\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification72.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;r \leq 6.6 \cdot 10^{-34}:\\ \;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\ \mathbf{else}:\\ \;\;\;\;3 - \left(4.5 + \left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 57.4% accurate, 3.2× speedup?

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

\\
\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5
\end{array}
Derivation
  1. Initial program 89.1%

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

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

    \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{4.5} \]
  5. Step-by-step derivation
    1. associate-/r*62.5%

      \[\leadsto \left(3 + \color{blue}{\frac{\frac{2}{r}}{r}}\right) - 4.5 \]
    2. div-inv62.4%

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

    \[\leadsto \left(3 + \color{blue}{\frac{2}{r} \cdot \frac{1}{r}}\right) - 4.5 \]
  7. Step-by-step derivation
    1. associate-*r/62.5%

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

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

    \[\leadsto \left(3 + \color{blue}{\frac{\frac{2}{r}}{r}}\right) - 4.5 \]
  9. Add Preprocessing

Alternative 13: 57.4% accurate, 3.2× speedup?

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

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

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

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

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

Alternative 14: 13.7% accurate, 29.0× speedup?

\[\begin{array}{l} \\ -1.5 \end{array} \]
(FPCore (v w r) :precision binary64 -1.5)
double code(double v, double w, double r) {
	return -1.5;
}
real(8) function code(v, w, r)
    real(8), intent (in) :: v
    real(8), intent (in) :: w
    real(8), intent (in) :: r
    code = -1.5d0
end function
public static double code(double v, double w, double r) {
	return -1.5;
}
def code(v, w, r):
	return -1.5
function code(v, w, r)
	return -1.5
end
function tmp = code(v, w, r)
	tmp = -1.5;
end
code[v_, w_, r_] := -1.5
\begin{array}{l}

\\
-1.5
\end{array}
Derivation
  1. Initial program 89.1%

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

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

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

    \[\leadsto \color{blue}{-1.5} \]
  6. Add Preprocessing

Reproduce

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