Rosa's TurbineBenchmark

Percentage Accurate: 84.5% → 99.8%
Time: 15.4s
Alternatives: 5
Speedup: 1.7×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 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: 84.5% 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.9× speedup?

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

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

    \[\leadsto \color{blue}{\left(3 + \left(\frac{2}{r \cdot r} - \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)\right) + -4.5} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. associate-*r*96.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 98.0% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;w \cdot w \leq 10^{+290}:\\
\;\;\;\;-1.5 + \left(t_0 + \frac{-0.375 + v \cdot 0.25}{1 - v} \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;-1.5 + \left(t_0 + w \cdot \left(r \cdot \left(w \cdot \left(r \cdot -0.375\right)\right)\right)\right)\\


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

    1. Initial program 85.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.0 < (*.f64 w w) < 1.00000000000000006e290

    1. Initial program 94.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. Simplified99.8%

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

    if 1.00000000000000006e290 < (*.f64 w w)

    1. Initial program 67.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{2}{r \cdot r} + \color{blue}{\left(\frac{-0.375 \cdot \left(r \cdot w\right)}{1} \cdot r\right)} \cdot w\right) + -1.5 \]
      2. /-rgt-identity97.7%

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

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

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

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

Alternative 3: 99.8% accurate, 1.1× speedup?

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

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

    \[\leadsto \color{blue}{\left(3 + \left(\frac{2}{r \cdot r} - \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)\right) + -4.5} \]
  3. Add Preprocessing
  4. Step-by-step derivation
    1. associate-*r*96.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 93.3% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 93.3% accurate, 1.7× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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