Rosa's TurbineBenchmark

Percentage Accurate: 85.4% → 99.8%
Time: 13.4s
Alternatives: 5
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 5 alternatives:

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

Initial Program: 85.4% 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} \\ {r}^{-2} \cdot 2 + \left(-1.5 + \frac{0.375 + v \cdot -0.25}{\frac{v + -1}{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}}\right) \end{array} \]
(FPCore (v w r)
 :precision binary64
 (+
  (* (pow r -2.0) 2.0)
  (+ -1.5 (/ (+ 0.375 (* v -0.25)) (/ (+ v -1.0) (* (* r w) (* r w)))))))
double code(double v, double w, double r) {
	return (pow(r, -2.0) * 2.0) + (-1.5 + ((0.375 + (v * -0.25)) / ((v + -1.0) / ((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 = ((r ** (-2.0d0)) * 2.0d0) + ((-1.5d0) + ((0.375d0 + (v * (-0.25d0))) / ((v + (-1.0d0)) / ((r * w) * (r * w)))))
end function
public static double code(double v, double w, double r) {
	return (Math.pow(r, -2.0) * 2.0) + (-1.5 + ((0.375 + (v * -0.25)) / ((v + -1.0) / ((r * w) * (r * w)))));
}
def code(v, w, r):
	return (math.pow(r, -2.0) * 2.0) + (-1.5 + ((0.375 + (v * -0.25)) / ((v + -1.0) / ((r * w) * (r * w)))))
function code(v, w, r)
	return Float64(Float64((r ^ -2.0) * 2.0) + Float64(-1.5 + Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(Float64(v + -1.0) / Float64(Float64(r * w) * Float64(r * w))))))
end
function tmp = code(v, w, r)
	tmp = ((r ^ -2.0) * 2.0) + (-1.5 + ((0.375 + (v * -0.25)) / ((v + -1.0) / ((r * w) * (r * w)))));
end
code[v_, w_, r_] := N[(N[(N[Power[r, -2.0], $MachinePrecision] * 2.0), $MachinePrecision] + N[(-1.5 + N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(N[(v + -1.0), $MachinePrecision] / N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{r}^{-2} \cdot 2 + \left(-1.5 + \frac{0.375 + v \cdot -0.25}{\frac{v + -1}{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}}\right)
\end{array}
Derivation
  1. Initial program 87.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. Simplified90.4%

    \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(-1.5 - \left(0.125 \cdot \mathsf{fma}\left(v, -2, 3\right)\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right)\right)\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. fma-undefine90.4%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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*83.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 r\right) \cdot \left(w \cdot w\right)}}}\right) \]
    15. pow283.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(3 + \frac{2}{r \cdot r}\right) + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \frac{w}{\frac{v + -1}{r}}\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 (/ (+ v -1.0) r)))) 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 / ((v + -1.0) / 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))) + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * (w / ((v + (-1.0d0)) / r)))) - 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 / ((v + -1.0) / r)))) - 4.5);
}
def code(v, w, r):
	return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w / ((v + -1.0) / r)))) - 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(Float64(v + -1.0) / r)))) - 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 / ((v + -1.0) / r)))) - 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[(N[(v + -1.0), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(3 + \frac{2}{r \cdot r}\right) + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \frac{w}{\frac{v + -1}{r}}\right) - 4.5\right)
\end{array}
Derivation
  1. Initial program 87.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. Step-by-step derivation
    1. associate--l-87.9%

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

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

      \[\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*87.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(\left(w \cdot w\right) \cdot \left(-r\right)\right) \cdot \left(-r\right)\right)}}{1 - v} + 4.5\right) \]
    5. associate-/l*90.5%

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

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

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

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

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

      \[\leadsto \left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(r \cdot \color{blue}{\left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right)}\right) + 4.5\right) \]
    4. associate-*l*98.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(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. *-commutative99.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 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. Step-by-step derivation
    1. clear-num99.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 r\right) \cdot \left(w \cdot \color{blue}{\frac{1}{\frac{1 - v}{r}}}\right)\right) + 4.5\right) \]
    2. un-div-inv99.8%

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

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

Alternative 3: 99.8% accurate, 1.2× speedup?

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

\\
\left(-1.5 + \frac{0.375 + v \cdot -0.25}{\frac{v + -1}{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}}\right) + \frac{2}{r \cdot r}
\end{array}
Derivation
  1. Initial program 87.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. Simplified90.4%

    \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(-1.5 - \left(0.125 \cdot \mathsf{fma}\left(v, -2, 3\right)\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right)\right)\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. fma-undefine90.4%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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*83.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 r\right) \cdot \left(w \cdot w\right)}}}\right) \]
    15. pow283.4%

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

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

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

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

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

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

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

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

Alternative 4: 96.7% accurate, 1.2× speedup?

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

\\
\frac{2}{r \cdot r} + \left(-1.5 + \frac{0.375 + v \cdot -0.25}{\frac{v + -1}{w \cdot \left(r \cdot \left(r \cdot w\right)\right)}}\right)
\end{array}
Derivation
  1. Initial program 87.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. Simplified90.4%

    \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(-1.5 - \left(0.125 \cdot \mathsf{fma}\left(v, -2, 3\right)\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right)\right)\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. fma-undefine90.4%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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*83.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 r\right) \cdot \left(w \cdot w\right)}}}\right) \]
    15. pow283.4%

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

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

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

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

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

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

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

      \[\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. *-un-lft-identity99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 80.4% accurate, 1.2× speedup?

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

\\
\frac{2}{r \cdot r} + \left(-1.5 + \frac{0.375 + v \cdot -0.25}{\frac{1}{r \cdot w} \cdot \frac{\frac{-1}{r}}{w}}\right)
\end{array}
Derivation
  1. Initial program 87.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. Simplified90.4%

    \[\leadsto \color{blue}{\frac{2}{r \cdot r} + \left(-1.5 - \left(0.125 \cdot \mathsf{fma}\left(v, -2, 3\right)\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right)\right)\right)} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. fma-undefine90.4%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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*83.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 r\right) \cdot \left(w \cdot w\right)}}}\right) \]
    15. pow283.4%

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

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

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

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

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

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

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

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

    \[\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. Taylor expanded in v around 0 81.1%

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

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

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

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

Reproduce

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