Rosa's TurbineBenchmark

?

Percentage Accurate: 85.0% → 98.4%
Time: 9.8s
Precision: binary64
Cost: 8580

?

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

\mathbf{else}:\\
\;\;\;\;-1.5 + 2 \cdot {r}^{-2}\\


\end{array}

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.

Herbie found 10 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

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.

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 2 regimes
  2. if (-.f64 (+.f64 3 (/.f64 2 (*.f64 r r))) (/.f64 (*.f64 (*.f64 1/8 (-.f64 3 (*.f64 2 v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 1 v))) < 3

    1. Initial program 84.2%

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

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

      [Start]84.2%

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

      associate--l- [=>]84.2%

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

      +-commutative [=>]84.2%

      \[ \color{blue}{\left(\frac{2}{r \cdot r} + 3\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) \]

      associate--l+ [=>]84.2%

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

      +-commutative [=>]84.2%

      \[ \frac{2}{r \cdot r} + \left(3 - \color{blue}{\left(4.5 + \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)}\right) \]

      associate--r+ [=>]84.2%

      \[ \frac{2}{r \cdot r} + \color{blue}{\left(\left(3 - 4.5\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)} \]

      metadata-eval [=>]84.2%

      \[ \frac{2}{r \cdot r} + \left(\color{blue}{-1.5} - \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) \]

      associate-*l/ [<=]91.1%

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

      *-commutative [=>]91.1%

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

      *-commutative [=>]91.1%

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

      *-commutative [=>]91.1%

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

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

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

      [Start]91.1%

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

      unpow2 [=>]91.1%

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

      associate-*l* [=>]99.8%

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

    if 3 < (-.f64 (+.f64 3 (/.f64 2 (*.f64 r r))) (/.f64 (*.f64 (*.f64 1/8 (-.f64 3 (*.f64 2 v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 1 v)))

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(v, 0.25, -0.375\right)}{1 - v}, \left(r \cdot r\right) \cdot \left(w \cdot w\right), \frac{2}{r \cdot r} + -1.5\right)} \]
      Step-by-step derivation

      [Start]87.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 \]

      sub-neg [=>]87.7%

      \[ \color{blue}{\left(\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}\right)\right)} - 4.5 \]

      +-commutative [=>]87.7%

      \[ \color{blue}{\left(\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}\right) + \left(3 + \frac{2}{r \cdot r}\right)\right)} - 4.5 \]

      associate--l+ [=>]87.7%

      \[ \color{blue}{\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}\right) + \left(\left(3 + \frac{2}{r \cdot r}\right) - 4.5\right)} \]

      associate-/l* [=>]87.7%

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

      distribute-neg-frac [=>]87.7%

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

      associate-/r/ [=>]87.7%

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

      fma-def [=>]87.7%

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

      sub-neg [=>]87.7%

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

      \[\leadsto \color{blue}{2 \cdot \frac{1}{{r}^{2}} - 1.5} \]
    4. Simplified99.9%

      \[\leadsto \color{blue}{\frac{2}{r \cdot r} + -1.5} \]
      Step-by-step derivation

      [Start]99.9%

      \[ 2 \cdot \frac{1}{{r}^{2}} - 1.5 \]

      sub-neg [=>]99.9%

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

      associate-*r/ [=>]99.9%

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

      metadata-eval [=>]99.9%

      \[ \frac{\color{blue}{2}}{{r}^{2}} + \left(-1.5\right) \]

      unpow2 [=>]99.9%

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

      metadata-eval [=>]99.9%

      \[ \frac{2}{r \cdot r} + \color{blue}{-1.5} \]
    5. Applied egg-rr99.6%

      \[\leadsto \color{blue}{\sqrt{\frac{2}{r \cdot r}} \cdot \sqrt{\frac{2}{r \cdot r}}} + -1.5 \]
      Step-by-step derivation

      [Start]99.9%

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

      add-sqr-sqrt [=>]99.6%

      \[ \color{blue}{\sqrt{\frac{2}{r \cdot r}} \cdot \sqrt{\frac{2}{r \cdot r}}} + -1.5 \]
    6. Applied egg-rr96.3%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(2 \cdot {r}^{-2}\right)} - 1\right)} + -1.5 \]
      Step-by-step derivation

      [Start]99.6%

      \[ \sqrt{\frac{2}{r \cdot r}} \cdot \sqrt{\frac{2}{r \cdot r}} + -1.5 \]

      expm1-log1p-u [=>]96.3%

      \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{\frac{2}{r \cdot r}} \cdot \sqrt{\frac{2}{r \cdot r}}\right)\right)} + -1.5 \]

      expm1-udef [=>]96.3%

      \[ \color{blue}{\left(e^{\mathsf{log1p}\left(\sqrt{\frac{2}{r \cdot r}} \cdot \sqrt{\frac{2}{r \cdot r}}\right)} - 1\right)} + -1.5 \]

      add-sqr-sqrt [<=]96.3%

      \[ \left(e^{\mathsf{log1p}\left(\color{blue}{\frac{2}{r \cdot r}}\right)} - 1\right) + -1.5 \]

      div-inv [=>]96.3%

      \[ \left(e^{\mathsf{log1p}\left(\color{blue}{2 \cdot \frac{1}{r \cdot r}}\right)} - 1\right) + -1.5 \]

      pow2 [=>]96.3%

      \[ \left(e^{\mathsf{log1p}\left(2 \cdot \frac{1}{\color{blue}{{r}^{2}}}\right)} - 1\right) + -1.5 \]

      pow-flip [=>]96.3%

      \[ \left(e^{\mathsf{log1p}\left(2 \cdot \color{blue}{{r}^{\left(-2\right)}}\right)} - 1\right) + -1.5 \]

      metadata-eval [=>]96.3%

      \[ \left(e^{\mathsf{log1p}\left(2 \cdot {r}^{\color{blue}{-2}}\right)} - 1\right) + -1.5 \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{2 \cdot {r}^{-2}} + -1.5 \]
      Step-by-step derivation

      [Start]96.3%

      \[ \left(e^{\mathsf{log1p}\left(2 \cdot {r}^{-2}\right)} - 1\right) + -1.5 \]

      expm1-def [=>]96.3%

      \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(2 \cdot {r}^{-2}\right)\right)} + -1.5 \]

      expm1-log1p [=>]100.0%

      \[ \color{blue}{2 \cdot {r}^{-2}} + -1.5 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.9%

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

Alternatives

Alternative 1
Accuracy98.4%
Cost8580
\[\begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ \mathbf{if}\;\left(3 + t_0\right) + \frac{\left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right) \cdot \left(0.125 \cdot \left(2 \cdot v - 3\right)\right)}{1 - v} \leq 3:\\ \;\;\;\;t_0 + \left(-1.5 - \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right) \cdot \frac{0.375 + v \cdot -0.25}{1 - v}\right)\\ \mathbf{else}:\\ \;\;\;\;-1.5 + 2 \cdot {r}^{-2}\\ \end{array} \]
Alternative 2
Accuracy99.7%
Cost20800
\[\left(\left(3 + \frac{2}{r \cdot r}\right) - {\left(\frac{\frac{1 - v}{{\left(r \cdot w\right)}^{2}}}{0.125 \cdot \mathsf{fma}\left(-2, v, 3\right)}\right)}^{-1}\right) + -4.5 \]
Alternative 3
Accuracy98.3%
Cost3396
\[\begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ \mathbf{if}\;\left(3 + t_0\right) + \frac{\left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right) \cdot \left(0.125 \cdot \left(2 \cdot v - 3\right)\right)}{1 - v} \leq 3:\\ \;\;\;\;t_0 + \left(-1.5 - \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right) \cdot \frac{0.375 + v \cdot -0.25}{1 - v}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 + -1.5\\ \end{array} \]
Alternative 4
Accuracy95.3%
Cost2121
\[\begin{array}{l} t_0 := \frac{2}{r \cdot r}\\ \mathbf{if}\;w \cdot w \leq 0 \lor \neg \left(w \cdot w \leq 2 \cdot 10^{+295}\right):\\ \;\;\;\;t_0 + \left(-1.5 - r \cdot \left(\left(w \cdot \left(r \cdot w\right)\right) \cdot 0.375\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0 + \left(-1.5 - \frac{0.375 + v \cdot -0.25}{1 - v} \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)\right)\\ \end{array} \]
Alternative 5
Accuracy72.4%
Cost1106
\[\begin{array}{l} \mathbf{if}\;r \leq -4.8 \cdot 10^{+94} \lor \neg \left(r \leq -125 \lor \neg \left(r \leq -1.05 \cdot 10^{-21}\right) \land r \leq 2.8 \cdot 10^{+51}\right):\\ \;\;\;\;\left(w \cdot w\right) \cdot \left(\left(r \cdot r\right) \cdot -0.375\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{r \cdot r} + -1.5\\ \end{array} \]
Alternative 6
Accuracy90.9%
Cost1088
\[\frac{2}{r \cdot r} + \left(-1.5 - r \cdot \left(\left(w \cdot \left(r \cdot w\right)\right) \cdot 0.375\right)\right) \]
Alternative 7
Accuracy90.9%
Cost1088
\[\frac{2}{r \cdot r} + \left(-1.5 - r \cdot \left(w \cdot \left(r \cdot \left(w \cdot 0.375\right)\right)\right)\right) \]
Alternative 8
Accuracy56.1%
Cost584
\[\begin{array}{l} \mathbf{if}\;r \leq -1.45 \cdot 10^{-8}:\\ \;\;\;\;-1.5\\ \mathbf{elif}\;r \leq 4.6 \cdot 10^{-8}:\\ \;\;\;\;\frac{2}{r \cdot r}\\ \mathbf{else}:\\ \;\;\;\;-1.5\\ \end{array} \]
Alternative 9
Accuracy57.0%
Cost448
\[\frac{2}{r \cdot r} + -1.5 \]
Alternative 10
Accuracy13.9%
Cost64
\[-1.5 \]

Reproduce?

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