Rosa's TurbineBenchmark

Percentage Accurate: 84.9% → 99.3%
Time: 18.1s
Alternatives: 13
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 13 alternatives:

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

Initial Program: 84.9% 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.3% 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 86.6%

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

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

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

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

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

    \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}{1 - v} + 4.5\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. associate-/l*89.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. *-commutative89.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/89.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*96.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-sqrt50.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-prod78.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-sqrt35.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-prod67.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(\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-prod67.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}{\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-prod37.4%

      \[\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. *-commutative37.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{\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-prod37.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-prod24.9%

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

Alternative 2: 70.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ t_1 := \left(3 + r \cdot \left(\left(0.375 + v \cdot -0.25\right) \cdot \frac{w \cdot \left(r \cdot w\right)}{v}\right)\right) - 4.5\\ t_2 := t\_0 + \left(-1.5 + 0.375 \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{v + -1}\right)\right)\right)\\ \mathbf{if}\;r \leq 6.2 \cdot 10^{-77}:\\ \;\;\;\;t\_0 + -1.5\\ \mathbf{elif}\;r \leq 6.2 \cdot 10^{+80}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;r \leq 4.5 \cdot 10^{+125}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;r \leq 4.6 \cdot 10^{+230}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;r \leq 5 \cdot 10^{+259}:\\ \;\;\;\;t\_1\\ \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
 (let* ((t_0 (/ 2.0 (* r r)))
        (t_1
         (- (+ 3.0 (* r (* (+ 0.375 (* v -0.25)) (/ (* w (* r w)) v)))) 4.5))
        (t_2 (+ t_0 (+ -1.5 (* 0.375 (* r (* (* w w) (/ r (+ v -1.0)))))))))
   (if (<= r 6.2e-77)
     (+ t_0 -1.5)
     (if (<= r 6.2e+80)
       t_2
       (if (<= r 4.5e+125)
         t_1
         (if (<= r 4.6e+230)
           t_2
           (if (<= r 5e+259)
             t_1
             (-
              3.0
              (+
               4.5
               (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (* r w))))))))))))
double code(double v, double w, double r) {
	double t_0 = 2.0 / (r * r);
	double t_1 = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / v)))) - 4.5;
	double t_2 = t_0 + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0))))));
	double tmp;
	if (r <= 6.2e-77) {
		tmp = t_0 + -1.5;
	} else if (r <= 6.2e+80) {
		tmp = t_2;
	} else if (r <= 4.5e+125) {
		tmp = t_1;
	} else if (r <= 4.6e+230) {
		tmp = t_2;
	} else if (r <= 5e+259) {
		tmp = t_1;
	} 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) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = 2.0d0 / (r * r)
    t_1 = (3.0d0 + (r * ((0.375d0 + (v * (-0.25d0))) * ((w * (r * w)) / v)))) - 4.5d0
    t_2 = t_0 + ((-1.5d0) + (0.375d0 * (r * ((w * w) * (r / (v + (-1.0d0)))))))
    if (r <= 6.2d-77) then
        tmp = t_0 + (-1.5d0)
    else if (r <= 6.2d+80) then
        tmp = t_2
    else if (r <= 4.5d+125) then
        tmp = t_1
    else if (r <= 4.6d+230) then
        tmp = t_2
    else if (r <= 5d+259) then
        tmp = t_1
    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 t_0 = 2.0 / (r * r);
	double t_1 = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / v)))) - 4.5;
	double t_2 = t_0 + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0))))));
	double tmp;
	if (r <= 6.2e-77) {
		tmp = t_0 + -1.5;
	} else if (r <= 6.2e+80) {
		tmp = t_2;
	} else if (r <= 4.5e+125) {
		tmp = t_1;
	} else if (r <= 4.6e+230) {
		tmp = t_2;
	} else if (r <= 5e+259) {
		tmp = t_1;
	} else {
		tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (r * w))));
	}
	return tmp;
}
def code(v, w, r):
	t_0 = 2.0 / (r * r)
	t_1 = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / v)))) - 4.5
	t_2 = t_0 + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0))))))
	tmp = 0
	if r <= 6.2e-77:
		tmp = t_0 + -1.5
	elif r <= 6.2e+80:
		tmp = t_2
	elif r <= 4.5e+125:
		tmp = t_1
	elif r <= 4.6e+230:
		tmp = t_2
	elif r <= 5e+259:
		tmp = t_1
	else:
		tmp = 3.0 - (4.5 + ((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (r * w))))
	return tmp
function code(v, w, r)
	t_0 = Float64(2.0 / Float64(r * r))
	t_1 = Float64(Float64(3.0 + Float64(r * Float64(Float64(0.375 + Float64(v * -0.25)) * Float64(Float64(w * Float64(r * w)) / v)))) - 4.5)
	t_2 = Float64(t_0 + Float64(-1.5 + Float64(0.375 * Float64(r * Float64(Float64(w * w) * Float64(r / Float64(v + -1.0)))))))
	tmp = 0.0
	if (r <= 6.2e-77)
		tmp = Float64(t_0 + -1.5);
	elseif (r <= 6.2e+80)
		tmp = t_2;
	elseif (r <= 4.5e+125)
		tmp = t_1;
	elseif (r <= 4.6e+230)
		tmp = t_2;
	elseif (r <= 5e+259)
		tmp = t_1;
	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)
	t_0 = 2.0 / (r * r);
	t_1 = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / v)))) - 4.5;
	t_2 = t_0 + (-1.5 + (0.375 * (r * ((w * w) * (r / (v + -1.0))))));
	tmp = 0.0;
	if (r <= 6.2e-77)
		tmp = t_0 + -1.5;
	elseif (r <= 6.2e+80)
		tmp = t_2;
	elseif (r <= 4.5e+125)
		tmp = t_1;
	elseif (r <= 4.6e+230)
		tmp = t_2;
	elseif (r <= 5e+259)
		tmp = t_1;
	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_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(3.0 + N[(r * N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] * N[(N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 + 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]}, If[LessEqual[r, 6.2e-77], N[(t$95$0 + -1.5), $MachinePrecision], If[LessEqual[r, 6.2e+80], t$95$2, If[LessEqual[r, 4.5e+125], t$95$1, If[LessEqual[r, 4.6e+230], t$95$2, If[LessEqual[r, 5e+259], t$95$1, 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}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \left(3 + r \cdot \left(\left(0.375 + v \cdot -0.25\right) \cdot \frac{w \cdot \left(r \cdot w\right)}{v}\right)\right) - 4.5\\
t_2 := t\_0 + \left(-1.5 + 0.375 \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{v + -1}\right)\right)\right)\\
\mathbf{if}\;r \leq 6.2 \cdot 10^{-77}:\\
\;\;\;\;t\_0 + -1.5\\

\mathbf{elif}\;r \leq 6.2 \cdot 10^{+80}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;r \leq 4.5 \cdot 10^{+125}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;r \leq 4.6 \cdot 10^{+230}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;r \leq 5 \cdot 10^{+259}:\\
\;\;\;\;t\_1\\

\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 4 regimes
  2. if r < 6.20000000000000016e-77

    1. Initial program 83.7%

      \[\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. Simplified86.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. Applied egg-rr99.7%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(\sqrt[3]{\frac{{\left(w \cdot r\right)}^{2}}{1 - v} \cdot \left(0.375 + -0.25 \cdot v\right)}\right)}^{3}}\right) \]
    5. Taylor expanded in w around 0 73.8%

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

    if 6.20000000000000016e-77 < r < 6.19999999999999976e80 or 4.5e125 < r < 4.5999999999999996e230

    1. Initial program 97.9%

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

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

      \[\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) \]

    if 6.19999999999999976e80 < r < 4.5e125 or 4.5999999999999996e230 < r < 5.00000000000000033e259

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

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

        \[\leadsto \left(3 - \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. *-commutative99.1%

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

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

        \[\leadsto \left(3 - \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)}\right) - 4.5 \]
      5. *-commutative94.1%

        \[\leadsto \left(3 - \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)\right) - 4.5 \]
      6. associate-*r/94.0%

        \[\leadsto \left(3 - \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)\right) - 4.5 \]
      7. *-commutative94.0%

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

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

      \[\leadsto \left(3 - \color{blue}{\left(\left(0.375 + -0.25 \cdot v\right) \cdot \frac{{w}^{2} \cdot r}{1 - v}\right) \cdot r}\right) - 4.5 \]
    6. Step-by-step derivation
      1. pow294.0%

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

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

        \[\leadsto \left(3 - \left(\left(0.375 + -0.25 \cdot v\right) \cdot \frac{\color{blue}{\left(w \cdot r\right) \cdot w}}{1 - v}\right) \cdot r\right) - 4.5 \]
      4. *-un-lft-identity94.0%

        \[\leadsto \left(3 - \left(\left(0.375 + -0.25 \cdot v\right) \cdot \frac{\left(w \cdot r\right) \cdot w}{\color{blue}{1 \cdot \left(1 - v\right)}}\right) \cdot r\right) - 4.5 \]
      5. times-frac90.9%

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

      \[\leadsto \left(3 - \left(\left(0.375 + -0.25 \cdot v\right) \cdot \color{blue}{\left(\frac{w \cdot r}{1} \cdot \frac{w}{1 - v}\right)}\right) \cdot r\right) - 4.5 \]
    8. Step-by-step derivation
      1. /-rgt-identity90.9%

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

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

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

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

      \[\leadsto \left(3 - \left(\left(0.375 + -0.25 \cdot v\right) \cdot \frac{\left(r \cdot w\right) \cdot w}{\color{blue}{-1 \cdot v}}\right) \cdot r\right) - 4.5 \]
    11. Step-by-step derivation
      1. neg-mul-184.8%

        \[\leadsto \left(3 - \left(\left(0.375 + -0.25 \cdot v\right) \cdot \frac{\left(r \cdot w\right) \cdot w}{\color{blue}{-v}}\right) \cdot r\right) - 4.5 \]
    12. Simplified84.8%

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

    if 5.00000000000000033e259 < r

    1. Initial program 92.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-92.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*83.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(\sqrt{r \cdot 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-prod58.9%

        \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(\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-prod58.9%

        \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\color{blue}{\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*67.0%

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

        \[\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-prod67.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. *-commutative67.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-prod67.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(\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-prod74.7%

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

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

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

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

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

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

      \[\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(r \cdot w\right)\right) + 4.5\right) \]
  3. Recombined 4 regimes into one program.
  4. Final simplification78.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;r \leq 6.2 \cdot 10^{-77}:\\ \;\;\;\;\frac{2}{r \cdot r} + -1.5\\ \mathbf{elif}\;r \leq 6.2 \cdot 10^{+80}:\\ \;\;\;\;\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)\\ \mathbf{elif}\;r \leq 4.5 \cdot 10^{+125}:\\ \;\;\;\;\left(3 + r \cdot \left(\left(0.375 + v \cdot -0.25\right) \cdot \frac{w \cdot \left(r \cdot w\right)}{v}\right)\right) - 4.5\\ \mathbf{elif}\;r \leq 4.6 \cdot 10^{+230}:\\ \;\;\;\;\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)\\ \mathbf{elif}\;r \leq 5 \cdot 10^{+259}:\\ \;\;\;\;\left(3 + r \cdot \left(\left(0.375 + v \cdot -0.25\right) \cdot \frac{w \cdot \left(r \cdot w\right)}{v}\right)\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 3: 77.2% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;r \leq 2.2 \cdot 10^{-5}:\\
\;\;\;\;t\_1 + \left(-1.5 + \left(v \cdot -0.25\right) \cdot t\_0\right)\\

\mathbf{elif}\;r \leq 82000:\\
\;\;\;\;t\_1 + \left(-1.5 + 0.375 \cdot t\_0\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if r < 9.00000000000000017e-90

    1. Initial program 83.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. Simplified86.1%

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(\sqrt[3]{\frac{{\left(w \cdot r\right)}^{2}}{1 - v} \cdot \left(0.375 + -0.25 \cdot v\right)}\right)}^{3}}\right) \]
    5. Taylor expanded in w around 0 73.8%

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

    if 9.00000000000000017e-90 < r < 2.1999999999999999e-5

    1. Initial program 99.8%

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

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

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

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

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

    if 2.1999999999999999e-5 < r < 82000

    1. Initial program 86.6%

      \[\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \]
    2. Simplified89.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. Taylor expanded in v around 0 77.8%

      \[\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) \]

    if 82000 < r

    1. Initial program 92.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-92.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*86.5%

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

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

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

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

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

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

        \[\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 \color{blue}{{\left(\sqrt{r \cdot \left(w \cdot w\right)}\right)}^{2}}}{1 - v} + 4.5\right) \]
      3. *-commutative98.2%

        \[\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(\sqrt{\color{blue}{\left(w \cdot w\right) \cdot r}}\right)}^{2}}{1 - v} + 4.5\right) \]
      4. sqrt-prod98.2%

        \[\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 {\color{blue}{\left(\sqrt{w \cdot w} \cdot \sqrt{r}\right)}}^{2}}{1 - v} + 4.5\right) \]
      5. sqrt-prod52.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(\color{blue}{\left(\sqrt{w} \cdot \sqrt{w}\right)} \cdot \sqrt{r}\right)}^{2}}{1 - v} + 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 \frac{r \cdot {\left(\color{blue}{w} \cdot \sqrt{r}\right)}^{2}}{1 - v} + 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 \frac{r \cdot \color{blue}{{\left(w \cdot \sqrt{r}\right)}^{2}}}{1 - v} + 4.5\right) \]
    7. Step-by-step derivation
      1. unpow-prod-down98.3%

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

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

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

        \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{r \cdot \left(\left(w \cdot w\right) \cdot \color{blue}{r}\right)}{1 - v} + 4.5\right) \]
      5. 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 \frac{r \cdot \color{blue}{\left(w \cdot \left(w \cdot r\right)\right)}}{1 - v} + 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 \frac{r \cdot \color{blue}{\left(w \cdot \left(w \cdot r\right)\right)}}{1 - v} + 4.5\right) \]
    9. Taylor expanded in r around inf 99.8%

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

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

Alternative 4: 77.2% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \frac{r}{v + -1}\\
\mathbf{if}\;r \leq 6.4 \cdot 10^{-90}:\\
\;\;\;\;t\_0 + -1.5\\

\mathbf{elif}\;r \leq 24:\\
\;\;\;\;t\_0 + \left(-1.5 + \left(v \cdot -0.25\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot t\_1\right)\right)\right)\\

\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 t\_1\right)\right) - 4.5\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if r < 6.40000000000000014e-90

    1. Initial program 83.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. Simplified86.1%

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(\sqrt[3]{\frac{{\left(w \cdot r\right)}^{2}}{1 - v} \cdot \left(0.375 + -0.25 \cdot v\right)}\right)}^{3}}\right) \]
    5. Taylor expanded in w around 0 73.8%

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

    if 6.40000000000000014e-90 < r < 24

    1. Initial program 99.8%

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

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

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

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

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

    if 24 < r

    1. Initial program 92.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-92.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*86.5%

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

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

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

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

      \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}{1 - v} + 4.5\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/l*95.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. *-commutative95.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/95.6%

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

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

        \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \color{blue}{\left(\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-prod90.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(\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-sqrt47.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-prod56.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(\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-prod56.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}{\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*63.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. *-commutative63.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-prod63.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}{\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. *-commutative63.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{\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-prod63.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(\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-prod52.7%

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

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \color{blue}{\left(\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 99.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 3 regimes into one program.
  4. Final simplification82.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;r \leq 6.4 \cdot 10^{-90}:\\ \;\;\;\;\frac{2}{r \cdot r} + -1.5\\ \mathbf{elif}\;r \leq 24:\\ \;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + \left(v \cdot -0.25\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{v + -1}\right)\right)\right)\\ \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 5: 76.7% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 1.1 \cdot 10^{-89}:\\
\;\;\;\;t\_0 + -1.5\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if r < 1.10000000000000006e-89

    1. Initial program 83.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. Simplified86.1%

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(\sqrt[3]{\frac{{\left(w \cdot r\right)}^{2}}{1 - v} \cdot \left(0.375 + -0.25 \cdot v\right)}\right)}^{3}}\right) \]
    5. Taylor expanded in w around 0 73.8%

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

    if 1.10000000000000006e-89 < r < 23

    1. Initial program 99.8%

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

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

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

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

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

    if 23 < r

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

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

        \[\leadsto \left(3 - \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. *-commutative98.3%

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

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

        \[\leadsto \left(3 - \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)}\right) - 4.5 \]
      5. *-commutative95.7%

        \[\leadsto \left(3 - \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)\right) - 4.5 \]
      6. associate-*r/95.7%

        \[\leadsto \left(3 - \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)\right) - 4.5 \]
      7. *-commutative95.7%

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

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

      \[\leadsto \left(3 - \color{blue}{\left(\left(0.375 + -0.25 \cdot v\right) \cdot \frac{{w}^{2} \cdot r}{1 - v}\right) \cdot r}\right) - 4.5 \]
    6. Step-by-step derivation
      1. pow295.7%

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

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

        \[\leadsto \left(3 - \left(\left(0.375 + -0.25 \cdot v\right) \cdot \frac{\color{blue}{\left(w \cdot r\right) \cdot w}}{1 - v}\right) \cdot r\right) - 4.5 \]
      4. *-un-lft-identity97.0%

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

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

      \[\leadsto \left(3 - \left(\left(0.375 + -0.25 \cdot v\right) \cdot \color{blue}{\left(\frac{w \cdot r}{1} \cdot \frac{w}{1 - v}\right)}\right) \cdot r\right) - 4.5 \]
    8. Step-by-step derivation
      1. /-rgt-identity96.1%

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

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

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

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

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

Alternative 6: 95.8% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;r \leq 1120000:\\
\;\;\;\;\left(\left(3 + \frac{2}{r \cdot r}\right) + \left(w \cdot \left(r \cdot \left(0.375 + v \cdot -0.25\right)\right)\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\\

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


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

    1. Initial program 84.5%

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

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

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

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

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

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

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

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

        \[\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*87.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. *-commutative87.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/87.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 \color{blue}{\left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right)}\right)\right) - 4.5 \]
      12. associate-*r*83.8%

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

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

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

      \[\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 \]

    if 1.12e6 < r

    1. Initial program 92.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-92.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*86.5%

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

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

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

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

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

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

        \[\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 \color{blue}{{\left(\sqrt{r \cdot \left(w \cdot w\right)}\right)}^{2}}}{1 - v} + 4.5\right) \]
      3. *-commutative98.2%

        \[\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(\sqrt{\color{blue}{\left(w \cdot w\right) \cdot r}}\right)}^{2}}{1 - v} + 4.5\right) \]
      4. sqrt-prod98.2%

        \[\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 {\color{blue}{\left(\sqrt{w \cdot w} \cdot \sqrt{r}\right)}}^{2}}{1 - v} + 4.5\right) \]
      5. sqrt-prod52.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(\color{blue}{\left(\sqrt{w} \cdot \sqrt{w}\right)} \cdot \sqrt{r}\right)}^{2}}{1 - v} + 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 \frac{r \cdot {\left(\color{blue}{w} \cdot \sqrt{r}\right)}^{2}}{1 - v} + 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 \frac{r \cdot \color{blue}{{\left(w \cdot \sqrt{r}\right)}^{2}}}{1 - v} + 4.5\right) \]
    7. Step-by-step derivation
      1. unpow-prod-down98.3%

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

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

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

        \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{r \cdot \left(\left(w \cdot w\right) \cdot \color{blue}{r}\right)}{1 - v} + 4.5\right) \]
      5. 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 \frac{r \cdot \color{blue}{\left(w \cdot \left(w \cdot r\right)\right)}}{1 - v} + 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 \frac{r \cdot \color{blue}{\left(w \cdot \left(w \cdot r\right)\right)}}{1 - v} + 4.5\right) \]
    9. Taylor expanded in r around inf 99.8%

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

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

Alternative 7: 68.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;r \leq 7.2 \cdot 10^{-22}:\\ \;\;\;\;\frac{2}{r \cdot r} + -1.5\\ \mathbf{elif}\;r \leq 9 \cdot 10^{+261}:\\ \;\;\;\;\left(3 + r \cdot \left(\left(0.375 + v \cdot -0.25\right) \cdot \frac{w \cdot \left(r \cdot w\right)}{v}\right)\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 7.2e-22)
   (+ (/ 2.0 (* r r)) -1.5)
   (if (<= r 9e+261)
     (- (+ 3.0 (* r (* (+ 0.375 (* v -0.25)) (/ (* w (* r w)) v)))) 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 <= 7.2e-22) {
		tmp = (2.0 / (r * r)) + -1.5;
	} else if (r <= 9e+261) {
		tmp = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / v)))) - 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 <= 7.2d-22) then
        tmp = (2.0d0 / (r * r)) + (-1.5d0)
    else if (r <= 9d+261) then
        tmp = (3.0d0 + (r * ((0.375d0 + (v * (-0.25d0))) * ((w * (r * w)) / v)))) - 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 <= 7.2e-22) {
		tmp = (2.0 / (r * r)) + -1.5;
	} else if (r <= 9e+261) {
		tmp = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / v)))) - 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 <= 7.2e-22:
		tmp = (2.0 / (r * r)) + -1.5
	elif r <= 9e+261:
		tmp = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / v)))) - 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 <= 7.2e-22)
		tmp = Float64(Float64(2.0 / Float64(r * r)) + -1.5);
	elseif (r <= 9e+261)
		tmp = Float64(Float64(3.0 + Float64(r * Float64(Float64(0.375 + Float64(v * -0.25)) * Float64(Float64(w * Float64(r * w)) / v)))) - 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 <= 7.2e-22)
		tmp = (2.0 / (r * r)) + -1.5;
	elseif (r <= 9e+261)
		tmp = (3.0 + (r * ((0.375 + (v * -0.25)) * ((w * (r * w)) / v)))) - 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, 7.2e-22], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision], If[LessEqual[r, 9e+261], N[(N[(3.0 + N[(r * N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] * N[(N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $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 7.2 \cdot 10^{-22}:\\
\;\;\;\;\frac{2}{r \cdot r} + -1.5\\

\mathbf{elif}\;r \leq 9 \cdot 10^{+261}:\\
\;\;\;\;\left(3 + r \cdot \left(\left(0.375 + v \cdot -0.25\right) \cdot \frac{w \cdot \left(r \cdot w\right)}{v}\right)\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 3 regimes
  2. if r < 7.1999999999999996e-22

    1. Initial program 84.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. Simplified87.0%

      \[\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. Applied egg-rr99.7%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(\sqrt[3]{\frac{{\left(w \cdot r\right)}^{2}}{1 - v} \cdot \left(0.375 + -0.25 \cdot v\right)}\right)}^{3}}\right) \]
    5. Taylor expanded in w around 0 74.4%

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

    if 7.1999999999999996e-22 < r < 8.9999999999999998e261

    1. Initial program 92.2%

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

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

        \[\leadsto \left(3 - \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. *-commutative99.6%

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

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

        \[\leadsto \left(3 - \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)}\right) - 4.5 \]
      5. *-commutative96.5%

        \[\leadsto \left(3 - \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)\right) - 4.5 \]
      6. associate-*r/96.5%

        \[\leadsto \left(3 - \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)\right) - 4.5 \]
      7. *-commutative96.5%

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

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

      \[\leadsto \left(3 - \color{blue}{\left(\left(0.375 + -0.25 \cdot v\right) \cdot \frac{{w}^{2} \cdot r}{1 - v}\right) \cdot r}\right) - 4.5 \]
    6. Step-by-step derivation
      1. pow296.5%

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

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

        \[\leadsto \left(3 - \left(\left(0.375 + -0.25 \cdot v\right) \cdot \frac{\color{blue}{\left(w \cdot r\right) \cdot w}}{1 - v}\right) \cdot r\right) - 4.5 \]
      4. *-un-lft-identity96.5%

        \[\leadsto \left(3 - \left(\left(0.375 + -0.25 \cdot v\right) \cdot \frac{\left(w \cdot r\right) \cdot w}{\color{blue}{1 \cdot \left(1 - v\right)}}\right) \cdot r\right) - 4.5 \]
      5. times-frac95.4%

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

      \[\leadsto \left(3 - \left(\left(0.375 + -0.25 \cdot v\right) \cdot \color{blue}{\left(\frac{w \cdot r}{1} \cdot \frac{w}{1 - v}\right)}\right) \cdot r\right) - 4.5 \]
    8. Step-by-step derivation
      1. /-rgt-identity95.4%

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

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

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

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

      \[\leadsto \left(3 - \left(\left(0.375 + -0.25 \cdot v\right) \cdot \frac{\left(r \cdot w\right) \cdot w}{\color{blue}{-1 \cdot v}}\right) \cdot r\right) - 4.5 \]
    11. Step-by-step derivation
      1. neg-mul-172.6%

        \[\leadsto \left(3 - \left(\left(0.375 + -0.25 \cdot v\right) \cdot \frac{\left(r \cdot w\right) \cdot w}{\color{blue}{-v}}\right) \cdot r\right) - 4.5 \]
    12. Simplified72.6%

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

    if 8.9999999999999998e261 < r

    1. Initial program 92.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-92.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*83.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(\sqrt{r \cdot 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-prod58.9%

        \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(\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-prod58.9%

        \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\color{blue}{\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*67.0%

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

        \[\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-prod67.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. *-commutative67.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-prod67.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(\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-prod74.7%

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

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

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

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

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

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

      \[\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(r \cdot w\right)\right) + 4.5\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification74.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;r \leq 7.2 \cdot 10^{-22}:\\ \;\;\;\;\frac{2}{r \cdot r} + -1.5\\ \mathbf{elif}\;r \leq 9 \cdot 10^{+261}:\\ \;\;\;\;\left(3 + r \cdot \left(\left(0.375 + v \cdot -0.25\right) \cdot \frac{w \cdot \left(r \cdot w\right)}{v}\right)\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 8: 75.3% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;r \leq 9.5 \cdot 10^{-22}:\\
\;\;\;\;\frac{2}{r \cdot r} + -1.5\\

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


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

    1. Initial program 84.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. Simplified87.0%

      \[\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. Applied egg-rr99.7%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(\sqrt[3]{\frac{{\left(w \cdot r\right)}^{2}}{1 - v} \cdot \left(0.375 + -0.25 \cdot v\right)}\right)}^{3}}\right) \]
    5. Taylor expanded in w around 0 74.4%

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

    if 9.4999999999999994e-22 < r

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

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

        \[\leadsto \left(3 - \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. *-commutative98.3%

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

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

        \[\leadsto \left(3 - \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)}\right) - 4.5 \]
      5. *-commutative95.7%

        \[\leadsto \left(3 - \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)\right) - 4.5 \]
      6. associate-*r/95.7%

        \[\leadsto \left(3 - \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)\right) - 4.5 \]
      7. *-commutative95.7%

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

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

      \[\leadsto \left(3 - \color{blue}{\left(\left(0.375 + -0.25 \cdot v\right) \cdot \frac{{w}^{2} \cdot r}{1 - v}\right) \cdot r}\right) - 4.5 \]
    6. Step-by-step derivation
      1. pow295.7%

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

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

        \[\leadsto \left(3 - \left(\left(0.375 + -0.25 \cdot v\right) \cdot \frac{\color{blue}{\left(w \cdot r\right) \cdot w}}{1 - v}\right) \cdot r\right) - 4.5 \]
      4. *-un-lft-identity97.0%

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

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

      \[\leadsto \left(3 - \left(\left(0.375 + -0.25 \cdot v\right) \cdot \color{blue}{\left(\frac{w \cdot r}{1} \cdot \frac{w}{1 - v}\right)}\right) \cdot r\right) - 4.5 \]
    8. Step-by-step derivation
      1. /-rgt-identity96.1%

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

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

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

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

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

Alternative 9: 72.8% accurate, 1.1× speedup?

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

\mathbf{else}:\\
\;\;\;\;\left(3 + \left(w \cdot \left(r \cdot \left(0.375 + v \cdot -0.25\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 < 2.4999999999999999e-39

    1. Initial program 84.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. Simplified86.9%

      \[\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. Applied egg-rr99.7%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(\sqrt[3]{\frac{{\left(w \cdot r\right)}^{2}}{1 - v} \cdot \left(0.375 + -0.25 \cdot v\right)}\right)}^{3}}\right) \]
    5. Taylor expanded in w around 0 74.1%

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

    if 2.4999999999999999e-39 < r

    1. Initial program 92.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \mathsf{fma}\left(v, -2, 3\right)\right) \cdot r\right) \cdot \color{blue}{\left(w \cdot \left(w \cdot \frac{r}{1 - v}\right)\right)}\right) - 4.5 \]
      14. associate-*r*88.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 \]
    5. Applied egg-rr85.7%

      \[\leadsto \left(3 - \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 simplification77.5%

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

Alternative 10: 68.4% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;r \leq 15.8:\\ \;\;\;\;\frac{2}{r \cdot r} + -1.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 15.8)
   (+ (/ 2.0 (* r r)) -1.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 <= 15.8) {
		tmp = (2.0 / (r * r)) + -1.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 <= 15.8d0) then
        tmp = (2.0d0 / (r * r)) + (-1.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 <= 15.8) {
		tmp = (2.0 / (r * r)) + -1.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 <= 15.8:
		tmp = (2.0 / (r * r)) + -1.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 <= 15.8)
		tmp = Float64(Float64(2.0 / Float64(r * r)) + -1.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 <= 15.8)
		tmp = (2.0 / (r * r)) + -1.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, 15.8], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.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 15.8:\\
\;\;\;\;\frac{2}{r \cdot r} + -1.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 < 15.800000000000001

    1. Initial program 84.5%

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(\sqrt[3]{\frac{{\left(w \cdot r\right)}^{2}}{1 - v} \cdot \left(0.375 + -0.25 \cdot v\right)}\right)}^{3}}\right) \]
    5. Taylor expanded in w around 0 74.0%

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

    if 15.800000000000001 < r

    1. Initial program 92.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-92.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*86.5%

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

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

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

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

      \[\leadsto \color{blue}{\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \frac{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}{1 - v} + 4.5\right)} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-/l*95.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. *-commutative95.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/95.6%

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

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

        \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \color{blue}{\left(\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-prod90.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(\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-sqrt47.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-prod56.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(\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-prod56.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}{\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*63.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. *-commutative63.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-prod63.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}{\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. *-commutative63.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{\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-prod63.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(\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-prod52.7%

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

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \color{blue}{\left(\left(w \cdot r\right) \cdot \left(w \cdot \frac{r}{1 - v}\right)\right)} + 4.5\right) \]
    7. Taylor expanded in v around 0 71.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(w \cdot r\right) \cdot \color{blue}{\left(r \cdot w\right)}\right) + 4.5\right) \]
    8. Taylor expanded in r around inf 71.3%

      \[\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(r \cdot w\right)\right) + 4.5\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification73.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;r \leq 15.8:\\ \;\;\;\;\frac{2}{r \cdot r} + -1.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 11: 68.6% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;r \leq 0.065:\\
\;\;\;\;\frac{2}{r \cdot r} + -1.5\\

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


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

    1. Initial program 84.5%

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(\sqrt[3]{\frac{{\left(w \cdot r\right)}^{2}}{1 - v} \cdot \left(0.375 + -0.25 \cdot v\right)}\right)}^{3}}\right) \]
    5. Taylor expanded in w around 0 74.0%

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

    if 0.065000000000000002 < r

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

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

        \[\leadsto \left(3 - \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. *-commutative98.3%

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

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

        \[\leadsto \left(3 - \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)}\right) - 4.5 \]
      5. *-commutative95.7%

        \[\leadsto \left(3 - \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)\right) - 4.5 \]
      6. associate-*r/95.7%

        \[\leadsto \left(3 - \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)\right) - 4.5 \]
      7. *-commutative95.7%

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

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

      \[\leadsto \left(3 - \color{blue}{\left(\left(0.375 + -0.25 \cdot v\right) \cdot \frac{{w}^{2} \cdot r}{1 - v}\right) \cdot r}\right) - 4.5 \]
    6. Step-by-step derivation
      1. pow295.7%

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

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

        \[\leadsto \left(3 - \left(\left(0.375 + -0.25 \cdot v\right) \cdot \frac{\color{blue}{\left(w \cdot r\right) \cdot w}}{1 - v}\right) \cdot r\right) - 4.5 \]
      4. *-un-lft-identity97.0%

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

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

      \[\leadsto \left(3 - \left(\left(0.375 + -0.25 \cdot v\right) \cdot \color{blue}{\left(\frac{w \cdot r}{1} \cdot \frac{w}{1 - v}\right)}\right) \cdot r\right) - 4.5 \]
    8. Step-by-step derivation
      1. /-rgt-identity96.1%

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

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

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

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

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

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

Alternative 12: 58.2% accurate, 4.1× speedup?

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

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

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

    \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{{\left(\sqrt[3]{\frac{{\left(w \cdot r\right)}^{2}}{1 - v} \cdot \left(0.375 + -0.25 \cdot v\right)}\right)}^{3}}\right) \]
  5. Taylor expanded in w around 0 60.6%

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

Alternative 13: 13.9% 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 86.6%

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

    \[\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 60.6%

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

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

Reproduce

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