Rosa's TurbineBenchmark

Percentage Accurate: 84.1% → 99.8%
Time: 13.0s
Alternatives: 9
Speedup: 1.2×

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

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

Initial Program: 84.1% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.2× speedup?

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

\\
\frac{2}{r \cdot r} + \left(-1.5 + \frac{-0.375 - v \cdot -0.25}{\frac{{w}^{-1} \cdot \frac{1}{r}}{r \cdot w} \cdot \left(1 - v\right)}\right)
\end{array}
Derivation
  1. Initial program 87.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. Simplified89.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. Step-by-step derivation
    1. fma-undefine89.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{0.375 + \color{blue}{\left(v \cdot -2\right)} \cdot 0.125}{\frac{1 - v}{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}}\right) \]
    12. associate-*l*89.1%

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

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

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{0.375 + v \cdot -0.25}{\frac{1 - v}{{r}^{2} \cdot \color{blue}{{w}^{2}}}}\right) \]
    17. pow-prod-down99.5%

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

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

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

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

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(-\color{blue}{\mathsf{fma}\left(v, -0.25, 0.375\right)}\right) \cdot \frac{1}{-\frac{1 - v}{{\left(w \cdot r\right)}^{2}}}\right) \]
    5. div-inv99.5%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(-\mathsf{fma}\left(v, -0.25, 0.375\right)\right) \cdot \frac{1}{-\color{blue}{\left(1 - v\right) \cdot \frac{1}{{\left(w \cdot r\right)}^{2}}}}\right) \]
    6. pow-flip99.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(-\mathsf{fma}\left(v, -0.25, 0.375\right)\right) \cdot \frac{1}{-\left(1 - v\right) \cdot \color{blue}{{\left(w \cdot r\right)}^{\left(-2\right)}}}\right) \]
    7. metadata-eval99.8%

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

    \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(-\mathsf{fma}\left(v, -0.25, 0.375\right)\right) \cdot \frac{1}{-\left(1 - v\right) \cdot {\left(w \cdot r\right)}^{-2}}}\right) \]
  8. Step-by-step derivation
    1. associate-*r/99.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\frac{\left(-\mathsf{fma}\left(v, -0.25, 0.375\right)\right) \cdot 1}{-\left(1 - v\right) \cdot {\left(w \cdot r\right)}^{-2}}}\right) \]
    2. *-rgt-identity99.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{\color{blue}{-\mathsf{fma}\left(v, -0.25, 0.375\right)}}{-\left(1 - v\right) \cdot {\left(w \cdot r\right)}^{-2}}\right) \]
    3. neg-sub099.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{\color{blue}{0 - \mathsf{fma}\left(v, -0.25, 0.375\right)}}{-\left(1 - v\right) \cdot {\left(w \cdot r\right)}^{-2}}\right) \]
    4. fma-undefine99.8%

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{0 - \color{blue}{\left(0.375 + -0.25 \cdot v\right)}}{-\left(1 - v\right) \cdot {\left(w \cdot r\right)}^{-2}}\right) \]
    7. associate--r+99.8%

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

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{-0.375 - v \cdot -0.25}{-\color{blue}{{\left(w \cdot r\right)}^{-2} \cdot \left(1 - v\right)}}\right) \]
    11. distribute-rgt-neg-in99.8%

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{-0.375 - v \cdot -0.25}{{\color{blue}{\left(r \cdot w\right)}}^{-2} \cdot \left(-\left(1 - v\right)\right)}\right) \]
    13. neg-sub099.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{-0.375 - v \cdot -0.25}{{\left(r \cdot w\right)}^{-2} \cdot \color{blue}{\left(0 - \left(1 - v\right)\right)}}\right) \]
    14. associate--r-99.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{-0.375 - v \cdot -0.25}{{\left(r \cdot w\right)}^{-2} \cdot \color{blue}{\left(\left(0 - 1\right) + v\right)}}\right) \]
    15. metadata-eval99.8%

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{-0.375 - v \cdot -0.25}{\color{blue}{\left(\frac{1}{r \cdot w} \cdot \frac{1}{r \cdot w}\right)} \cdot \left(-1 + v\right)}\right) \]
  12. Step-by-step derivation
    1. associate-*l/99.8%

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

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

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{-0.375 - v \cdot -0.25}{\frac{{\color{blue}{\left(w \cdot r\right)}}^{-1}}{r \cdot w} \cdot \left(-1 + v\right)}\right) \]
    3. unpow-prod-down99.8%

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

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

    \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{-0.375 - v \cdot -0.25}{\frac{\color{blue}{{w}^{-1} \cdot \frac{1}{r}}}{r \cdot w} \cdot \left(-1 + v\right)}\right) \]
  16. Final simplification99.8%

    \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 + \frac{-0.375 - v \cdot -0.25}{\frac{{w}^{-1} \cdot \frac{1}{r}}{r \cdot w} \cdot \left(1 - v\right)}\right) \]
  17. Add Preprocessing

Alternative 2: 99.8% accurate, 0.2× speedup?

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

\\
\frac{2}{r \cdot r} + \left(-1.5 + \frac{-0.375 - v \cdot -0.25}{{\left(r \cdot w\right)}^{-2} \cdot \left(1 - v\right)}\right)
\end{array}
Derivation
  1. Initial program 87.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. Simplified89.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. Step-by-step derivation
    1. fma-undefine89.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{0.375 + \color{blue}{\left(v \cdot -2\right)} \cdot 0.125}{\frac{1 - v}{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}}\right) \]
    12. associate-*l*89.1%

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

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

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{0.375 + v \cdot -0.25}{\frac{1 - v}{{r}^{2} \cdot \color{blue}{{w}^{2}}}}\right) \]
    17. pow-prod-down99.5%

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

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

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

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

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(-\color{blue}{\mathsf{fma}\left(v, -0.25, 0.375\right)}\right) \cdot \frac{1}{-\frac{1 - v}{{\left(w \cdot r\right)}^{2}}}\right) \]
    5. div-inv99.5%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(-\mathsf{fma}\left(v, -0.25, 0.375\right)\right) \cdot \frac{1}{-\color{blue}{\left(1 - v\right) \cdot \frac{1}{{\left(w \cdot r\right)}^{2}}}}\right) \]
    6. pow-flip99.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(-\mathsf{fma}\left(v, -0.25, 0.375\right)\right) \cdot \frac{1}{-\left(1 - v\right) \cdot \color{blue}{{\left(w \cdot r\right)}^{\left(-2\right)}}}\right) \]
    7. metadata-eval99.8%

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

    \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(-\mathsf{fma}\left(v, -0.25, 0.375\right)\right) \cdot \frac{1}{-\left(1 - v\right) \cdot {\left(w \cdot r\right)}^{-2}}}\right) \]
  8. Step-by-step derivation
    1. associate-*r/99.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\frac{\left(-\mathsf{fma}\left(v, -0.25, 0.375\right)\right) \cdot 1}{-\left(1 - v\right) \cdot {\left(w \cdot r\right)}^{-2}}}\right) \]
    2. *-rgt-identity99.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{\color{blue}{-\mathsf{fma}\left(v, -0.25, 0.375\right)}}{-\left(1 - v\right) \cdot {\left(w \cdot r\right)}^{-2}}\right) \]
    3. neg-sub099.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{\color{blue}{0 - \mathsf{fma}\left(v, -0.25, 0.375\right)}}{-\left(1 - v\right) \cdot {\left(w \cdot r\right)}^{-2}}\right) \]
    4. fma-undefine99.8%

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{0 - \color{blue}{\left(0.375 + -0.25 \cdot v\right)}}{-\left(1 - v\right) \cdot {\left(w \cdot r\right)}^{-2}}\right) \]
    7. associate--r+99.8%

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

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{-0.375 - v \cdot -0.25}{-\color{blue}{{\left(w \cdot r\right)}^{-2} \cdot \left(1 - v\right)}}\right) \]
    11. distribute-rgt-neg-in99.8%

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{-0.375 - v \cdot -0.25}{{\color{blue}{\left(r \cdot w\right)}}^{-2} \cdot \left(-\left(1 - v\right)\right)}\right) \]
    13. neg-sub099.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{-0.375 - v \cdot -0.25}{{\left(r \cdot w\right)}^{-2} \cdot \color{blue}{\left(0 - \left(1 - v\right)\right)}}\right) \]
    14. associate--r-99.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{-0.375 - v \cdot -0.25}{{\left(r \cdot w\right)}^{-2} \cdot \color{blue}{\left(\left(0 - 1\right) + v\right)}}\right) \]
    15. metadata-eval99.8%

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

    \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\frac{-0.375 - v \cdot -0.25}{{\left(r \cdot w\right)}^{-2} \cdot \left(-1 + v\right)}}\right) \]
  10. Final simplification99.8%

    \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 + \frac{-0.375 - v \cdot -0.25}{{\left(r \cdot w\right)}^{-2} \cdot \left(1 - v\right)}\right) \]
  11. Add Preprocessing

Alternative 3: 82.3% accurate, 1.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\


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

    1. Initial program 90.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. Simplified92.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. Step-by-step derivation
      1. fma-undefine92.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{0.375 + \color{blue}{\left(v \cdot -2\right)} \cdot 0.125}{\frac{1 - v}{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}}\right) \]
      12. associate-*l*91.7%

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{0.375 + \color{blue}{v \cdot \left(-2 \cdot 0.125\right)}}{\frac{1 - v}{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}}\right) \]
      13. metadata-eval91.7%

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

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

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

        \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{0.375 + v \cdot -0.25}{\frac{1 - v}{{r}^{2} \cdot \color{blue}{{w}^{2}}}}\right) \]
      17. pow-prod-down99.4%

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

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

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

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

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

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

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

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

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

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

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

    if 2e10 < v

    1. Initial program 79.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. Simplified75.3%

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

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

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

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

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

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

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

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

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

Alternative 4: 99.8% accurate, 1.1× speedup?

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

\\
\frac{2}{r \cdot r} + \left(-1.5 - \frac{v \cdot -0.25 - -0.375}{\frac{\frac{1}{r \cdot w}}{r \cdot w} \cdot \left(1 - v\right)}\right)
\end{array}
Derivation
  1. Initial program 87.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. Simplified89.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. Step-by-step derivation
    1. fma-undefine89.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{0.375 + \color{blue}{\left(v \cdot -2\right)} \cdot 0.125}{\frac{1 - v}{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}}\right) \]
    12. associate-*l*89.1%

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

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

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{0.375 + v \cdot -0.25}{\frac{1 - v}{{r}^{2} \cdot \color{blue}{{w}^{2}}}}\right) \]
    17. pow-prod-down99.5%

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

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

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

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

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(-\color{blue}{\mathsf{fma}\left(v, -0.25, 0.375\right)}\right) \cdot \frac{1}{-\frac{1 - v}{{\left(w \cdot r\right)}^{2}}}\right) \]
    5. div-inv99.5%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(-\mathsf{fma}\left(v, -0.25, 0.375\right)\right) \cdot \frac{1}{-\color{blue}{\left(1 - v\right) \cdot \frac{1}{{\left(w \cdot r\right)}^{2}}}}\right) \]
    6. pow-flip99.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \left(-\mathsf{fma}\left(v, -0.25, 0.375\right)\right) \cdot \frac{1}{-\left(1 - v\right) \cdot \color{blue}{{\left(w \cdot r\right)}^{\left(-2\right)}}}\right) \]
    7. metadata-eval99.8%

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

    \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\left(-\mathsf{fma}\left(v, -0.25, 0.375\right)\right) \cdot \frac{1}{-\left(1 - v\right) \cdot {\left(w \cdot r\right)}^{-2}}}\right) \]
  8. Step-by-step derivation
    1. associate-*r/99.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \color{blue}{\frac{\left(-\mathsf{fma}\left(v, -0.25, 0.375\right)\right) \cdot 1}{-\left(1 - v\right) \cdot {\left(w \cdot r\right)}^{-2}}}\right) \]
    2. *-rgt-identity99.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{\color{blue}{-\mathsf{fma}\left(v, -0.25, 0.375\right)}}{-\left(1 - v\right) \cdot {\left(w \cdot r\right)}^{-2}}\right) \]
    3. neg-sub099.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{\color{blue}{0 - \mathsf{fma}\left(v, -0.25, 0.375\right)}}{-\left(1 - v\right) \cdot {\left(w \cdot r\right)}^{-2}}\right) \]
    4. fma-undefine99.8%

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{0 - \color{blue}{\left(0.375 + -0.25 \cdot v\right)}}{-\left(1 - v\right) \cdot {\left(w \cdot r\right)}^{-2}}\right) \]
    7. associate--r+99.8%

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

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{-0.375 - v \cdot -0.25}{-\color{blue}{{\left(w \cdot r\right)}^{-2} \cdot \left(1 - v\right)}}\right) \]
    11. distribute-rgt-neg-in99.8%

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{-0.375 - v \cdot -0.25}{{\color{blue}{\left(r \cdot w\right)}}^{-2} \cdot \left(-\left(1 - v\right)\right)}\right) \]
    13. neg-sub099.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{-0.375 - v \cdot -0.25}{{\left(r \cdot w\right)}^{-2} \cdot \color{blue}{\left(0 - \left(1 - v\right)\right)}}\right) \]
    14. associate--r-99.8%

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{-0.375 - v \cdot -0.25}{{\left(r \cdot w\right)}^{-2} \cdot \color{blue}{\left(\left(0 - 1\right) + v\right)}}\right) \]
    15. metadata-eval99.8%

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{-0.375 - v \cdot -0.25}{\color{blue}{\left(\frac{1}{r \cdot w} \cdot \frac{1}{r \cdot w}\right)} \cdot \left(-1 + v\right)}\right) \]
  12. Step-by-step derivation
    1. associate-*l/99.8%

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

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

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

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

Alternative 5: 99.8% accurate, 1.1× speedup?

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

\\
\frac{2}{r \cdot r} + \left(-1.5 + \frac{v \cdot -0.25 + 0.375}{\frac{1}{r \cdot w} \cdot \frac{v + -1}{r \cdot w}}\right)
\end{array}
Derivation
  1. Initial program 87.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. Simplified89.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. Step-by-step derivation
    1. fma-undefine89.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{0.375 + \color{blue}{\left(v \cdot -2\right)} \cdot 0.125}{\frac{1 - v}{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}}\right) \]
    12. associate-*l*89.1%

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

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

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{0.375 + v \cdot -0.25}{\frac{1 - v}{{r}^{2} \cdot \color{blue}{{w}^{2}}}}\right) \]
    17. pow-prod-down99.5%

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

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

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

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

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

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

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

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

Alternative 6: 99.8% accurate, 1.2× speedup?

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

\\
\frac{2}{r \cdot r} + \left(-1.5 - \frac{v \cdot -0.25 + 0.375}{\frac{1 - v}{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}}\right)
\end{array}
Derivation
  1. Initial program 87.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. Simplified89.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. Step-by-step derivation
    1. fma-undefine89.0%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{0.375 + \color{blue}{\left(v \cdot -2\right)} \cdot 0.125}{\frac{1 - v}{r \cdot \left(r \cdot \left(w \cdot w\right)\right)}}\right) \]
    12. associate-*l*89.1%

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

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

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

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

      \[\leadsto \frac{2}{r \cdot r} + \left(-1.5 - \frac{0.375 + v \cdot -0.25}{\frac{1 - v}{{r}^{2} \cdot \color{blue}{{w}^{2}}}}\right) \]
    17. pow-prod-down99.5%

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

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

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

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

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

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

Alternative 7: 57.7% accurate, 3.2× speedup?

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

\\
\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5
\end{array}
Derivation
  1. Initial program 87.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. Simplified77.3%

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

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

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

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

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

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

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

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

Alternative 8: 57.7% accurate, 3.2× speedup?

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

\\
\left(\frac{2}{r \cdot r} + 3\right) - 4.5
\end{array}
Derivation
  1. Initial program 87.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. Simplified77.3%

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

    \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \color{blue}{4.5} \]
  5. Final simplification60.0%

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

Alternative 9: 14.3% 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 87.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. Simplified77.3%

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

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

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

Reproduce

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